MCPcopy Create free account
hub / github.com/PrismarineJS/node-minecraft-protocol / setEncryption

Method setEncryption

src/client.js:212–222  ·  view source on GitHub ↗
(sharedSecret)

Source from the content-addressed store, hash-verified

210 }
211
212 setEncryption (sharedSecret) {
213 if (this.cipher != null) { this.emit('error', new Error('Set encryption twice!')) }
214 this.cipher = createCipher(sharedSecret)
215 this.cipher.on('error', (err) => this.emit('error', err))
216 this.framer.unpipe(this.socket)
217 this.framer.pipe(this.cipher).pipe(this.socket)
218 this.decipher = createDecipher(sharedSecret)
219 this.decipher.on('error', (err) => this.emit('error', err))
220 this.socket.unpipe(this.splitter)
221 this.socket.pipe(this.decipher).pipe(this.splitter)
222 }
223
224 setCompressionThreshold (threshold) {
225 if (this.compressor == null) {

Callers 2

onEncryptionKeyResponseFunction · 0.80

Calls 2

createCipherFunction · 0.85
createDecipherFunction · 0.85

Tested by

no test coverage detected