@snazzah/davey
DAVE protocol implementation
Last updated a month ago by snazzah .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @snazzah/davey 
SYNC missed versions from official npm registry.

Davey!

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.encryptOpus(packet);
  // Decrypt a packet from a user, use this after transport decryption
  session.decrypt(userId, MediaType.AUDIO, incomingPacket);
}

References

Current Tags

  • 0.1.10                                ...           latest (a month ago)

11 Versions

  • 0.1.10                                ...           a month ago
  • 0.1.9                                ...           4 months ago
  • 0.1.8                                ...           5 months ago
  • 0.1.7                                ...           7 months ago
  • 0.1.6                                ...           10 months ago
  • 0.1.5                                ...           10 months ago
  • 0.1.4                                ...           10 months ago
  • 0.1.3                                ...           10 months ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (17)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |