libdave-rs for Python
Python bindings for libdave, Discord's DAVE end-to-end encryption (MLS) for voice and video, built on libdave-rs.
libdave, mlspp and OpenSSL are compiled in and linked statically, so the wheels have
no runtime dependencies. One abi3 wheel per platform covers every CPython 3.9+.
pip install libdave-rs
import libdave_rs as dave
from libdave_rs import MediaType
print(dave.max_supported_protocol_version())
with dave.SessionManager(self_user_id=42, group_id=1234567890) as manager:
manager.add_user(43)
manager.on_select_protocol_ack(dave.max_supported_protocol_version())
key_package = manager.get_marshalled_key_package() # -> DAVE_MLS_KEY_PACKAGE
# ...feed the voice-gateway opcodes into the on_* methods...
frame = manager.encrypt(MediaType.AUDIO, ssrc, opus_frame) # bytes, or None
plain = manager.decrypt(MediaType.AUDIO, 43, wire_frame) # bytes, or None
Everything the Node package exports exists here under the same name in snake_case, with the
same parameters in the same order (DaveSessionManager is the Node name for SessionManager;
both work). scripts/check-parity.py enforces this in CI. Python adds context managers
(with ...:), bytearray inputs and int ids on top.
SessionManager implements the gateway bookkeeping (transitions, epochs, per-user
ratchets). Session, Encryptor, Decryptor and KeyRatchet are the lower-level
building blocks it is made of.
Notes
- Ids (users and groups) are Discord snowflakes: pass an
intor its decimalstr. User ids in results (roster,roster_signatures) arestr. - Binary inputs may be
bytesorbytearray; outputs arebytes. - Threads and the GIL. Every native call releases the GIL, so encrypting audio on one thread never stalls the rest of your program. Objects are thread-safe: calls on the same object are serialised, calls on different objects run in parallel.
- asyncio. Every call is fast and non-blocking except the fingerprint, which libdave
derives on a worker thread. Like the Promise in the Node bindings,
await session.get_pairwise_fingerprint(version, user_id)is awaitable and needs a running event loop;get_pairwise_fingerprint_syncblocks (with the GIL released) for use elsewhere. - Errors. Bad arguments raise
ValueError/TypeError. libdave failures raiseDaveError. Using an object afterdestroy()(or after leaving itswithblock) raisesDestroyedError, aDaveErrorsubclass.SessionManager.encrypt/decryptreturnNoneinstead of raising when a frame cannot be processed, so a lost key never kills a voice loop. - Callbacks (
Encryptor.set_protocol_version_changed_callback) run on the calling thread right after the call that triggered them, so they may safely use the encryptor. - Logging. libdave prints to stdout by default. Call
libdave_rs.enable_logging()to route it to the standardloggingmodule (loggerlibdave_rs), orlibdave_rs.set_log_sink(callback)for full control. Either replaces the stdout output. - Types. The package ships type stubs (
py.typed).
Building from source
Needs a Rust toolchain (1.88+), a C++20 compiler, CMake, and the git submodules
(git submodule update --init). Nothing else: OpenSSL is vendored.
pip install maturin
maturin develop --release -m crates/libdave-py/Cargo.toml # into the active venv
pytest crates/libdave-py/tests
License
MIT. Third-party notices (libdave, mlspp, OpenSSL, ...) are in THIRD_PARTY_LICENSES.
Metadata
Release files for libdave-rs 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| libdave_rs-0.3.1.tar.gz | 409.0 kB | Without provenance | Details for libdave_rs-0.3.1.tar.gz |
Built distributions (wheels)
Total release size: 31.1 MB
Release files / libdave_rs-0.3.1.tar.gz
| Download URL | libdave_rs-0.3.1.tar.gz |
|---|---|
| Size | 409.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18491e7571ba64e27205bfc3606009bcd0b81b3ae0233c3a948a3cce2ec8eb8d
|
|
BLAKE2b-256 checksum How to use checksums |
9934acacd70c668135c46cef83ccdb6a506e3773887cdf293edf5c92f52a4712
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-win_arm64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-win_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.9 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
490bf8ec9895fdc8fabf55d878c22aee7031e1df939ab2b18dc5170ff5521a80
|
|
BLAKE2b-256 checksum How to use checksums |
31e2203f874ef2daefb9d96fc2b7e953444124441d0961526f78b7e62606bba1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-win_amd64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ff271e84d51f9d36d4c687fe619eb523c68db2385be15cc73762cbdc4e547285
|
|
BLAKE2b-256 checksum How to use checksums |
c9d59f211a51a445ba541b156002cfcaeb647ff545eaebdf1f94a0bc3ffcda9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a9c5618a6ba879bd930f416de732a10368b4ada59347bf9f3e9173efed46e318
|
|
BLAKE2b-256 checksum How to use checksums |
1eb5be4ebd3c5db88a3cd3e7b776420bba10e7af04535e9a8061b4430aa8ee64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-musllinux_1_2_armv7l.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-musllinux_1_2_armv7l.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.9 Linux musl 1.2+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
082dd8aeff4d3010fdc661bce5ba53a90b094bbd89a73818cbbad7b4c9943d05
|
|
BLAKE2b-256 checksum How to use checksums |
16e882459c6f1d0e677908bef72ca9e21260fe0852a62914b16b94b82c1d82d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.9 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5bbdd91a9ca65ec53c52fc08e618de095357accedcaf8493c97f51c5d0f6146c
|
|
BLAKE2b-256 checksum How to use checksums |
b942e4088baa46db5fbea9ddc568dd13e5ea8766038feeabccc5acfb16b69bce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-manylinux_2_27_riscv64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-manylinux_2_27_riscv64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.9 Linux glibc 2.27+ RISC-V 64 abi3 |
|
SHA-256 checksum How to use checksums |
d803fd4996fea4f77ab1242dbd713b1d1c3699e409bae4b0ff995b9dbd81ab78
|
|
BLAKE2b-256 checksum How to use checksums |
52216c96995a8df20a4acabb4229860093f88fec580ef8b1b3c83c19a2dde8e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-manylinux_2_19_ppc64le.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-manylinux_2_19_ppc64le.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.9 Linux glibc 2.19+ PowerPC 64-le abi3 |
|
SHA-256 checksum How to use checksums |
9c2edad2a56aa9f94be3d33a32e35ed6dd472848a98e4730019aee34c1ef673e
|
|
BLAKE2b-256 checksum How to use checksums |
cede320a65c5f4f559b011c3807727c671bd81e516c1cb5984644b54094b66dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d5853cb6618b4d484c25d72a3d242dfc80c3881ebc1985a2d4710f3f555b748a
|
|
BLAKE2b-256 checksum How to use checksums |
e346469699c3160f5b71caacafecb4772df15aef6055b1eda7076dcd94c8d1aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-manylinux2014_s390x.manylinux_2_17_s390x.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-manylinux2014_s390x.manylinux_2_17_s390x.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ IBM System/390x abi3 |
|
SHA-256 checksum How to use checksums |
3ed8a574d92504bebe9176eae5cb2a00fdf9aeb6b23f5d80393f52c4892e5635
|
|
BLAKE2b-256 checksum How to use checksums |
7aeec265a4b87110c40013d7ca8111b9ac2bd5c5bc1edd64d48543f00d12f34f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
adb57ad6d5bfad8b93dd25c8db11b077722138a3f27d46a1f19c3600f0ce50b7
|
|
BLAKE2b-256 checksum How to use checksums |
100412860afdc142ee0f5a57e2bde1d5c9bcc601b130e687ed06bd3b776aa7af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
aa2c14a8b220a4497745dbbf0d81349f0ec9f3115c5f339a9bfd8a809df49b32
|
|
BLAKE2b-256 checksum How to use checksums |
e546208408ff54f4ca4c170211c50a45bad7912cef9f676df7522f714f4d7c95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ee80c3268b8bf16f9e7dbf19d1efade83344661fa7735d80801927ce97657268
|
|
BLAKE2b-256 checksum How to use checksums |
9d243a1d094be89dcb44a0ca53c0b347e03613fccbf872d1da5a62698752bb3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / libdave_rs-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | libdave_rs-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c5816343ac5038ab608072e3778ff86f37329033446051781bfbea4b84fea7be
|
|
BLAKE2b-256 checksum How to use checksums |
cd4c8c66eac2184f3b86474888c26aefac0811b20b4c90b06c6bce290e0a6250
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for libdave-rs 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.