diff --git a/src/auth/loginVerify.js b/src/auth/loginVerify.js index e1c2743..0809269 100644 --- a/src/auth/loginVerify.js +++ b/src/auth/loginVerify.js @@ -1,5 +1,6 @@ const JWT = require('jsonwebtoken') const constants = require('./constants') +const debug = require('debug')('minecraft-protocol') module.exports = (client, server, options) => { // Refer to the docs: @@ -19,14 +20,14 @@ module.exports = (client, server, options) => { let finalKey = null // console.log(pubKey) for (const token of chain) { - const decoded = JWT.verify(token, pubKey, { algorithms: 'ES384' }) + const decoded = JWT.verify(token, pubKey, { algorithms: ['ES384'] }) // console.log('Decoded', decoded) // Check if signed by Mojang key const x5u = getX5U(token) if (x5u === constants.PUBLIC_KEY && !data.extraData?.XUID) { // didVerify = true - console.log('verified with mojang key!', x5u) + debug('Verified client with mojang key', x5u) } // TODO: Handle `didVerify` = false @@ -41,7 +42,7 @@ module.exports = (client, server, options) => { function verifySkin (publicKey, token) { const pubKey = mcPubKeyToPem(publicKey) - const decoded = JWT.verify(token, pubKey, { algorithms: 'ES384' }) + const decoded = JWT.verify(token, pubKey, { algorithms: ['ES384'] }) return decoded } diff --git a/src/client/tokens.js b/src/client/tokens.js index af82f45..6603df9 100644 --- a/src/client/tokens.js +++ b/src/client/tokens.js @@ -244,7 +244,7 @@ class MinecraftTokenManager { const token = this.cache.mca debug('[mc] token cache', this.cache) if (!token) return - console.log('TOKEN', token) + debug('Auth token', token) const jwt = token.chain[0] const [header, payload, signature] = jwt.split('.').map(k => Buffer.from(k, 'base64')) // eslint-disable-line diff --git a/src/datatypes/BatchPacket.js b/src/datatypes/BatchPacket.js index cdfb292..8c1094c 100644 --- a/src/datatypes/BatchPacket.js +++ b/src/datatypes/BatchPacket.js @@ -38,10 +38,8 @@ class BatchPacket { encode () { const buf = this.stream.getBuffer() - console.log('Encoding payload', buf) const def = Zlib.deflateRawSync(buf, { level: this.compressionLevel }) const ret = Buffer.concat([Buffer.from([0xfe]), def]) - console.log('Compressed', ret) return ret } diff --git a/src/serverPlayer.js b/src/serverPlayer.js index b11d8f4..d2a6d93 100644 --- a/src/serverPlayer.js +++ b/src/serverPlayer.js @@ -57,7 +57,7 @@ class Player extends Connection { // TODO: disconnect user throw new Error('Failed to verify user') } - console.log('Verified user', 'got pub key', key, userData) + debug('Verified user pub key', key, userData) this.emit('login', { user: userData.extraData }) // emit events for user this.emit('server.client_handshake', { key }) // internal so we start encryption