diff --git a/src/networking/packet.js b/src/networking/packet.js index 2a34bd2..5c2a2cb 100644 --- a/src/networking/packet.js +++ b/src/networking/packet.js @@ -167,10 +167,13 @@ export default class packet { const customEncryption = getCustomEncryption(); if (customEncryption) { - this.buffer = await customEncryption.decrypt( - key, - nonce, - this.buffer.slice(12) + this.buffer = Buffer.from( + await customEncryption.decrypt( + key.toString('base64'), + nonce.toString('base64'), + this.buffer.slice(12).toString('base64') + ), + 'base64' ); } else { this.buffer = new JSChaCha20(key, nonce, 0).decrypt( @@ -290,7 +293,14 @@ export default class packet { const customEncryption = getCustomEncryption(); if (customEncryption) { - this.buffer = await customEncryption.encrypt(key, nonce, this.buffer); + this.buffer = Buffer.from( + await customEncryption.encrypt( + key.toString('base64'), + nonce.toString('base64'), + this.buffer.toString('base64') + ), + 'base64' + ); } else { this.buffer = new JSChaCha20(key, nonce, 0).encrypt(this.buffer); }