Skip to content

Commit

Permalink
add types to serverKey in server
Browse files Browse the repository at this point in the history
  • Loading branch information
u9g committed Nov 12, 2024
1 parent 590dc33 commit bcaabeb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@
"minecraft-wrap": "^1.2.3",
"mocha": "^10.0.0",
"power-assert": "^1.0.0",
"standard": "^17.0.0",
"prismarine-registry": "^1.8.0"
"prismarine-registry": "^1.8.0",
"standard": "^17.0.0"
},
"dependencies": {
"@types/node-rsa": "^1.1.4",
"@types/readable-stream": "^4.0.0",
"aes-js": "^3.1.2",
"buffer-equal": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Agent } from 'http'
import { Transform } from "readable-stream";
import { BinaryLike, KeyObject } from 'crypto';
import { Realm } from "prismarine-realms"
import NodeRSA from 'node-rsa';

type PromiseLike = Promise<void> | void

Expand Down Expand Up @@ -166,6 +167,7 @@ declare module 'minecraft-protocol' {
motd: string
motdMsg?: Object
favicon: string
serverKey: NodeRSA
close(): void
on(event: 'connection', handler: (client: ServerClient) => PromiseLike): this
on(event: 'error', listener: (error: Error) => PromiseLike): this
Expand Down
5 changes: 5 additions & 0 deletions src/server/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ const { concat } = require('../transforms/binaryStream')
const { mojangPublicKeyPem } = require('./constants')
const debug = require('debug')('minecraft-protocol')

/**
* @param {import('../index').Client} client
* @param {import('../index').Server} server
* @param {Object} options
*/
module.exports = function (client, server, options) {
const mojangPubKey = crypto.createPublicKey(mojangPublicKeyPem)
const raise = (translatableError) => client.end(translatableError, JSON.stringify({ translate: translatableError }))
Expand Down

0 comments on commit bcaabeb

Please sign in to comment.