@mineygg/libdave-rs 0.0.0-stage → 0.1.2
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 +21 -0
- package/README.md +99 -2
- package/THIRD_PARTY_LICENSES +4668 -0
- package/binding.cjs +847 -0
- package/binding.d.cts +187 -0
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/package.json +107 -4
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,100 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mineygg/libdave-rs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Prebuilt Node.js bindings for Discord's official
|
|
4
|
+
[libdave](https://github.com/discord/libdave) (DAVE end-to-end encryption for
|
|
5
|
+
voice and video), written in Rust with [napi-rs](https://napi.rs).
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @mineygg/libdave-rs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
npm installs only the binary for your machine, through `optionalDependencies`.
|
|
12
|
+
No compiler is needed.
|
|
13
|
+
|
|
14
|
+
## Documentation
|
|
15
|
+
|
|
16
|
+
**[Read the full documentation](https://github.com/mineygg/libdave-rs/tree/main/docs)**
|
|
17
|
+
|
|
18
|
+
The documentation includes the getting-started guide, Node.js API reference,
|
|
19
|
+
class and type references, Rust crate overview, and integration notes.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import {
|
|
25
|
+
DaveSessionManager,
|
|
26
|
+
MediaType,
|
|
27
|
+
maxSupportedProtocolVersion,
|
|
28
|
+
} from '@mineygg/libdave-rs';
|
|
29
|
+
|
|
30
|
+
const dave = new DaveSessionManager(selfUserId, channelId);
|
|
31
|
+
dave.addUser(otherUserId);
|
|
32
|
+
dave.onSelectProtocolAck(maxSupportedProtocolVersion());
|
|
33
|
+
const keyPackage = dave.getMarshalledKeyPackage(); // send to the voice gateway
|
|
34
|
+
const encrypted = dave.encrypt(MediaType.Audio, ssrc, opusFrame); // Buffer | null
|
|
35
|
+
const plain = dave.decrypt(MediaType.Audio, otherUserId, received); // Buffer | null
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
CommonJS `require` works too. The lower-level `Session`, `Encryptor`,
|
|
39
|
+
`Decryptor` and `KeyRatchet` classes are also exported. MLS failures are read
|
|
40
|
+
with `takeFailures()`.
|
|
41
|
+
|
|
42
|
+
## Rust
|
|
43
|
+
|
|
44
|
+
The same library is on crates.io:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
cargo add libdave-rs
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Platforms
|
|
51
|
+
|
|
52
|
+
Each is published as `@mineygg-core/libdave-rs-<platform>`.
|
|
53
|
+
|
|
54
|
+
| OS | x64 | arm64 | armv7 |
|
|
55
|
+
| ------------- | ---------------- | ------------------ | ---------------------- |
|
|
56
|
+
| Linux (glibc) | `linux-x64-gnu` | `linux-arm64-gnu` | `linux-arm-gnueabihf` |
|
|
57
|
+
| Linux (musl) | `linux-x64-musl` | `linux-arm64-musl` | `linux-arm-musleabihf` |
|
|
58
|
+
| macOS | `darwin-x64` | `darwin-arm64` | |
|
|
59
|
+
| Windows | `win32-x64-msvc` | `win32-arm64-msvc` | |
|
|
60
|
+
|
|
61
|
+
## Layout
|
|
62
|
+
|
|
63
|
+
| Path | What it is |
|
|
64
|
+
| -------------------------------------- | ------------------------------------------------------- |
|
|
65
|
+
| `src/` | TypeScript entry point, bundled with tsup (ESM and CJS) |
|
|
66
|
+
| `npm/` | One small package per platform |
|
|
67
|
+
| `crates/libdave-node` | Node-API layer |
|
|
68
|
+
| `crates/libdave`, `crates/libdave-sys` | The `libdave-rs` and `libdave-rs-sys` Rust crates |
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
git submodule update --init
|
|
74
|
+
npm ci
|
|
75
|
+
npm run build # native addon (needs Rust, C++17, Perl, make) + TypeScript
|
|
76
|
+
npm test # vitest
|
|
77
|
+
npm run lint # biome
|
|
78
|
+
npm run typecheck
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
To work on TypeScript only, download the `bindings-<platform>` and `js-binding`
|
|
82
|
+
artifacts from a CI run into the repository root and skip the native build.
|
|
83
|
+
Git hooks are managed by lefthook.
|
|
84
|
+
|
|
85
|
+
## Releasing
|
|
86
|
+
|
|
87
|
+
Set the `NPM_TOKEN` and `CARGO_REGISTRY_TOKEN` repository secrets, then run the
|
|
88
|
+
commands below. This publishes the npm packages and the `libdave-rs-sys` and
|
|
89
|
+
`libdave-rs` crates.
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
npm version patch # also bumps the platform packages and crates
|
|
93
|
+
git push --follow-tags
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project is MIT licensed. The published binaries and `libdave-rs-sys` include
|
|
99
|
+
third-party code under its own terms, listed in `THIRD_PARTY_LICENSES`. After
|
|
100
|
+
changing dependencies or submodules, run `npm run licenses`.
|