Skip to content

Conversation

Snazzah
Copy link
Contributor

@Snazzah Snazzah commented Sep 30, 2024

This is a modified version of a combination of PRs on dysnomia: projectdysnomia/dysnomia#156, projectdysnomia/dysnomia#160, projectdysnomia/dysnomia#168

  • @stablelib/xchacha20poly1305 replaces tweetnacl, it uses v1 since v2 is in ESM.
  • The UDP socket won't close when attempting to resume the WebSocket connection.
  • This is overriding the resuming function of feat(voice): support resuming voice connection #1448, but resuming is set while connecting instead of before.

@bsian03 bsian03 requested a review from abalabahaha October 12, 2024 23:13
@james58899
Copy link
Contributor

resume still doesn't work properly, because disconnect() also resets timestamp, and sequence.

@Snazzah Snazzah requested a review from james58899 June 11, 2025 16:40
Copy link
Contributor

@james58899 james58899 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After testing for about half a day, resuming worked and no other issues were observed.

@bsian03 bsian03 requested a review from Copilot September 27, 2025 16:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Updates the voice connection implementation to use Voice Gateway v8 and adds support for new encryption modes (aead_aes256_gcm_rtpsize and aead_xchacha20_poly1305_rtpsize) while replacing tweetnacl with @stablelib/xchacha20poly1305.

  • Replaces tweetnacl dependency with @stablelib/xchacha20poly1305 v1.0.1 for better encryption support
  • Adds support for Voice Gateway v8 with improved resuming logic and session management
  • Implements new AEAD encryption modes with preference-based selection

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.

File Description
package.json Replaces tweetnacl with @stablelib/xchacha20poly1305 and removes browser exclusion
lib/voice/VoiceConnection.js Major refactor implementing v8 gateway features, new encryption modes, and improved connection handling
lib/Constants.js Adds VOICE_VERSION constant set to 8


// RFC3550 5.1: Padding (may need testing)
if (hasPadding) {
const paddingAmount = data.subarray(0, data.length - 1);
Copy link
Preview

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect padding calculation. Should read the last byte of data to get padding amount: const paddingAmount = data[data.length - 1];

Suggested change
const paddingAmount = data.subarray(0, data.length - 1);
const paddingAmount = data[data.length - 1];

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abalabahaha please confirm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants