fix: adjust types for typescript upgrade (#11132)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida
2025-10-05 13:43:49 +01:00
committed by GitHub
parent ffbb7b6936
commit 612c49b546
4 changed files with 14 additions and 14 deletions

View File

@@ -87,7 +87,7 @@
"prettier": "^3.6.2",
"tsup": "^8.5.0",
"turbo": "^2.5.6",
"typescript": "~5.5.4",
"typescript": "~5.9.2",
"vitest": "^3.2.4",
"vitest-websocket-mock": "^0.5.0"
},

View File

@@ -134,7 +134,7 @@ export class VoiceReceiver {
* @returns The parsed Opus packet
*/
private parsePacket(buffer: Buffer, mode: string, nonce: Buffer, secretKey: Uint8Array, userId: string) {
let packet = this.decrypt(buffer, mode, nonce, secretKey);
let packet: Buffer = this.decrypt(buffer, mode, nonce, secretKey);
if (!packet) throw new Error('Failed to parse packet');
// Strip decrypted RTP Header Extension if present

View File

@@ -5,13 +5,13 @@ interface Methods {
cipherText: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
): Buffer;
crypto_aead_xchacha20poly1305_ietf_encrypt(
plaintext: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
): Buffer;
}
@@ -21,7 +21,7 @@ const libs = {
cipherText: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
) => {
const message = Buffer.alloc(cipherText.length - sodium.crypto_aead_xchacha20poly1305_ietf_ABYTES);
sodium.crypto_aead_xchacha20poly1305_ietf_decrypt(message, null, cipherText, additionalData, nonce, key);
@@ -31,7 +31,7 @@ const libs = {
plaintext: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
) => {
const cipherText = Buffer.alloc(plaintext.length + sodium.crypto_aead_xchacha20poly1305_ietf_ABYTES);
sodium.crypto_aead_xchacha20poly1305_ietf_encrypt(cipherText, plaintext, additionalData, null, nonce, key);
@@ -43,13 +43,13 @@ const libs = {
cipherText: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
) => sodium.api.crypto_aead_xchacha20poly1305_ietf_decrypt(cipherText, additionalData, null, nonce, key),
crypto_aead_xchacha20poly1305_ietf_encrypt: (
plaintext: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
) => sodium.api.crypto_aead_xchacha20poly1305_ietf_encrypt(plaintext, additionalData, null, nonce, key),
}),
'libsodium-wrappers': (sodium: any): Methods => ({
@@ -57,13 +57,13 @@ const libs = {
cipherText: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
) => sodium.crypto_aead_xchacha20poly1305_ietf_decrypt(null, cipherText, additionalData, nonce, key),
crypto_aead_xchacha20poly1305_ietf_encrypt: (
plaintext: Buffer,
additionalData: Buffer,
nonce: Buffer,
key: ArrayBufferLike,
key: Uint8Array,
) => sodium.crypto_aead_xchacha20poly1305_ietf_encrypt(plaintext, additionalData, null, nonce, key),
}),
'@stablelib/xchacha20poly1305': (stablelib: any): Methods => ({