Détail du package

@snazzah/davey

Snazzah392MIT0.1.6

DAVE protocol implementation

discord, e2ee, mls, napi-rs

readme

Davey! How ya doin?

NPM version install size NPM downloads discord chat

A Discord Audio & Video End-to-End Encryption (DAVE) Protocol implementation using OpenMLS built with NAPI-RS.

Proper documentation does not exist yet, but you can read the usage document and review the type definitions for available methods.

import { DAVESession, ProposalsOperationType, MediaType, Codec } from '@snazzah/davey';

const session = new DAVESession(
  1, // dave version
  '158049329150427136', // user id
  '927310423890473011', // channel id
);

// Set the external sender of the session from opcode 25
session.setExternalSender(externalSenderBuffer);

// Get the key package buffer to send to Discord
session.getSerializedKeyPackage();

// Process a proposals
session.processProposals(
  ProposalsOperationType.APPEND, // the type of proposals operation
  proposalsBuffer, // proposals or proposal refs buffer
  recognizedUserIds, // an array of user IDs in the session, optional but recommended
);

// Process a commit
session.processCommit(commitBuffer);

// Process a welcome
session.processWelcome(welcomeBuffer);

// The current voice privacy code of the session, updated after a commit/welcome
session.voicePrivacyCode; // a 30 digit string or an empty string for not started sessions

// Encrypt/decrypt voice packets
if (session.ready) {
  // Encrypt packets with a specified media type and codec, use this before transport encryption
  session.encrypt(MediaType.AUDIO, Codec.OPUS, packet);
  // Really only opus is supported right now so just use the shorthand method
  session.encrypt_opus(packet);
  // Decrypt a packet from a user, use this after transport decryption
  session.decrypt(userId, MediaType.AUDIO, incomingPacket);
}

References

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

0.1.6 - 2025-06-10

Fixed:

  • Forced resulting commits to only include proposal references. This problem resulted in voice servers not accepting our commits that have add proposals in them.

0.1.5 - 2025-06-05

Fixed:

  • DAVESession will no longer create a decryptor for itself.
  • Fixed an issue where on cleaning up expiring ciphers, it actually cleaned up valid ones.

0.1.4 - 2025-06-01

Fixed:

  • Using DAVESession.canPassthrough on a user ID that doesn't have a decryptor now just returns false instead of throwing an error.
  • Fixed return type for DAVESession.getVerificationCode.
  • Decryptors of users that have left the group will now be removed rather than retained.

0.1.3 - 2025-05-27

Added

  • DAVESession.epoch
  • DAVESession.ownLeafIndex

Changed

  • Bumped Node-API version to 6

0.1.2 - 2025-04-04

Added

  • Functions for decryptor passthrough: DAVESession.canPassthrough, DAVESession.setPassthroughMode

Fixed:

  • Fixed setting an external sender possibly not re-creating the group.

0.1.1 - 2025-03-21

Fixed:

  • Fixed an issue where encryption did not properly set the codec and led to encryption failures.

0.1.0 - 2025-03-21

Added

  • Initial version of package.