mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
Update libsodium-wrappers peer dep and fix support for the newest version
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
"node-opus": "^0.2.0",
|
||||
"opusscript": "^0.0.3",
|
||||
"sodium": "^2.0.0",
|
||||
"libsodium-wrappers": "^0.5.0",
|
||||
"libsodium-wrappers": "^0.7.0",
|
||||
"uws": "^8.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -163,7 +163,7 @@ class StreamDispatcher extends VolumeInterface {
|
||||
packetBuffer.writeUIntBE(this.player.voiceConnection.authentication.ssrc, 8, 4);
|
||||
|
||||
packetBuffer.copy(nonce, 0, 0, 12);
|
||||
buffer = secretbox.close(buffer, nonce, this.player.voiceConnection.authentication.secretKey.key);
|
||||
buffer = secretbox.methods.close(buffer, nonce, this.player.voiceConnection.authentication.secretKey.key);
|
||||
for (let i = 0; i < buffer.length; i++) packetBuffer[i + 12] = buffer[i];
|
||||
|
||||
return packetBuffer;
|
||||
|
||||
@@ -148,7 +148,7 @@ class VoiceReceiver extends EventEmitter {
|
||||
|
||||
handlePacket(msg, user) {
|
||||
msg.copy(nonce, 0, 0, 12);
|
||||
let data = secretbox.open(msg.slice(12), nonce, this.voiceConnection.authentication.secretKey.key);
|
||||
let data = secretbox.methods.open(msg.slice(12), nonce, this.voiceConnection.authentication.secretKey.key);
|
||||
if (!data) {
|
||||
/**
|
||||
* Emitted whenever a voice packet experiences a problem.
|
||||
|
||||
@@ -13,10 +13,15 @@ const libs = {
|
||||
}),
|
||||
};
|
||||
|
||||
for (const libName of Object.keys(libs)) {
|
||||
try {
|
||||
const lib = require(libName);
|
||||
module.exports = libs[libName](lib);
|
||||
break;
|
||||
} catch (err) {} // eslint-disable-line no-empty
|
||||
}
|
||||
exports.methods = {};
|
||||
|
||||
(async() => {
|
||||
for (const libName of Object.keys(libs)) {
|
||||
try {
|
||||
const lib = require(libName);
|
||||
if (libName === 'libsodium-wrappers' && lib.ready) await lib.ready;
|
||||
exports.methods = libs[libName](lib);
|
||||
break;
|
||||
} catch (err) {} // eslint-disable-line no-empty
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user