@mineygg/libdave-rs 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mineygg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ # @mineygg/libdave-rs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![builds](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmineygg%2Flibdave-rs%2Fbadges%2Fbuilds.json)](https://github.com/mineygg/libdave-rs/actions/workflows/ci.yml?query=branch%3Amain)
4
+ [![tests](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmineygg%2Flibdave-rs%2Fbadges%2Fsuite.json)](https://github.com/mineygg/libdave-rs/actions/workflows/ci.yml?query=branch%3Amain)
5
+ [![libdave tests](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmineygg%2Flibdave-rs%2Fbadges%2Ftests.json)](https://github.com/mineygg/libdave-rs/actions/workflows/ci.yml?query=branch%3Amain)
6
+
7
+ Prebuilt Node.js bindings for Discord's official
8
+ [libdave](https://github.com/discord/libdave) (DAVE end-to-end encryption for
9
+ voice and video), written in Rust with [napi-rs](https://napi.rs).
10
+
11
+ ```sh
12
+ npm install @mineygg/libdave-rs
13
+ ```
14
+
15
+ npm installs only the binary for your machine, through `optionalDependencies`.
16
+ No compiler is needed.
17
+
18
+ ## Documentation
19
+
20
+ **[Read the full documentation](https://github.com/mineygg/libdave-rs/tree/main/docs)**
21
+
22
+ The documentation includes the getting-started guide, Node.js API reference,
23
+ class and type references, Rust crate overview, and integration notes.
24
+
25
+ ## Usage
26
+
27
+ ```ts
28
+ import {
29
+ DaveSessionManager,
30
+ MediaType,
31
+ maxSupportedProtocolVersion,
32
+ } from '@mineygg/libdave-rs';
33
+
34
+ const dave = new DaveSessionManager(selfUserId, channelId);
35
+ dave.addUser(otherUserId);
36
+ dave.onSelectProtocolAck(maxSupportedProtocolVersion());
37
+ const keyPackage = dave.getMarshalledKeyPackage(); // send to the voice gateway
38
+ const encrypted = dave.encrypt(MediaType.Audio, ssrc, opusFrame); // Buffer | null
39
+ const plain = dave.decrypt(MediaType.Audio, otherUserId, received); // Buffer | null
40
+ ```
41
+
42
+ CommonJS `require` works too. The lower-level `Session`, `Encryptor`,
43
+ `Decryptor` and `KeyRatchet` classes are also exported. MLS failures are read
44
+ with `takeFailures()`.
45
+
46
+ ## Rust
47
+
48
+ The same library is on crates.io:
49
+
50
+ ```sh
51
+ cargo add libdave-rs
52
+ ```
53
+
54
+ ## Platforms
55
+
56
+ Each is published as `@mineygg-core/libdave-rs-<platform>`.
57
+
58
+ | OS | x64 | arm64 | armv7 |
59
+ | ------------- | ---------------- | ------------------ | ---------------------- |
60
+ | Linux (glibc) | `linux-x64-gnu` | `linux-arm64-gnu` | `linux-arm-gnueabihf` |
61
+ | Linux (musl) | `linux-x64-musl` | `linux-arm64-musl` | `linux-arm-musleabihf` |
62
+ | macOS | `darwin-x64` | `darwin-arm64` | |
63
+ | Windows | `win32-x64-msvc` | `win32-arm64-msvc` | |
64
+
65
+ ## Layout
66
+
67
+ | Path | What it is |
68
+ | -------------------------------------- | ------------------------------------------------------- |
69
+ | `src/` | TypeScript entry point, bundled with tsup (ESM and CJS) |
70
+ | `npm/` | One small package per platform |
71
+ | `crates/libdave-node` | Node-API layer |
72
+ | `crates/libdave`, `crates/libdave-sys` | The `libdave-rs` and `libdave-rs-sys` Rust crates |
73
+
74
+ ## Development
75
+
76
+ ```sh
77
+ git submodule update --init
78
+ npm ci
79
+ npm run build # native addon (needs Rust, C++17, Perl, make) + TypeScript
80
+ npm test # vitest
81
+ npm run lint # biome
82
+ npm run typecheck
83
+ npm run test:upstream # Discord's libdave tests, see tests/upstream
84
+ ```
85
+
86
+ To work on TypeScript only, download the `bindings-<platform>` and `js-binding`
87
+ artifacts from a CI run into the repository root and skip the native build.
88
+ Git hooks are managed by lefthook.
89
+
90
+ ## Releasing
91
+
92
+ Set the `NPM_TOKEN` and `CARGO_REGISTRY_TOKEN` repository secrets, then run the
93
+ commands below. This publishes the npm packages and the `libdave-rs-sys` and
94
+ `libdave-rs` crates.
95
+
96
+ ```sh
97
+ npm version patch # also bumps the platform packages and crates
98
+ git push --follow-tags
99
+ ```
100
+
101
+ ## License
102
+
103
+ This project is MIT licensed. The published binaries and `libdave-rs-sys` include
104
+ third-party code under its own terms, listed in `THIRD_PARTY_LICENSES`. After
105
+ changing dependencies or submodules, run `npm run licenses`.