Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict'
const crypto = require('crypto')
const yggserver = require('yggdrasil').server({})
const debug = require('debug')('minecraft-protocol')
module.exports = function (client, options) {
client.once('encryption_begin', onEncryptionKeyRequest)
function onEncryptionKeyRequest (packet) {
crypto.randomBytes(16, gotSharedSecret)
function gotSharedSecret (err, sharedSecret) {
if (err) {
debug(err)
client.emit('error', err)
client.end()
return
}
if (options.haveCredentials) {
const yggserver = require('yggdrasil').server({})
const UUID = require('uuid-1345')
const bufferEqual = require('buffer-equal')
const crypto = require('crypto')
const pluginChannels = require('../client/pluginChannels')
const states = require('../states')
module.exports = function (client, server, options) {
const {
'online-mode': onlineMode = true,
kickTimeout = 30 * 1000,
errorHandler: clientErrorHandler = (client, err) => client.end(err)
} = options
let serverId
client.on('error', function (err) {