https://github.com/dione-software/x3dh-ke
Implantation of X3DH in Rust.
https://github.com/dione-software/x3dh-ke
hacktoberfest rust rust-lang signal signal-protocol x3dh
Last synced: about 1 month ago
JSON representation
Implantation of X3DH in Rust.
- Host: GitHub
- URL: https://github.com/dione-software/x3dh-ke
- Owner: Dione-Software
- License: mit
- Created: 2021-05-24T15:08:33.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-16T00:57:51.000Z (about 2 years ago)
- Last Synced: 2025-04-29T23:35:59.661Z (about 2 months ago)
- Topics: hacktoberfest, rust, rust-lang, signal, signal-protocol, x3dh
- Language: Rust
- Homepage:
- Size: 24.4 KB
- Stars: 7
- Watchers: 0
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://crates.io/crates/x3dh-ke)
[](https://github.com/Dione-Software/x3dh-ke/blob/main/LICENSE)
[](https://coveralls.io/github/Dione-Software/x3dh-ke?branch=master)
[](https://github.com/Dione-Software/x3dh-ke/actions/workflows/rust.yml)
# x3dh-ke
## Implementation of X3DH
Implementation of extended triple diffie hellman written in Rust, as described by [Signal][1].
WARNING! This crate hasn't been reviewed and may include serious faults. Use with care.## Example Usage:
### Standard:
```rust
use x3dh_ke::{IdentityKey, SignedPreKey, EphemeralKey, OneTimePreKey, Key, x3dh_a, x3dh_b};
let ika = IdentityKey::default();
let ikas = ika.strip();
let ikb = IdentityKey::default();
let ikbs = ikb.strip();
let spkb = SignedPreKey::default();
let spkbs = spkb.strip();
let eka = EphemeralKey::default();
let ekas = eka.strip();
let opkb = OneTimePreKey::default();
let opkbs = opkb.strip();
let signature = ikb.sign(&spkbs.pk_to_bytes());
let cka = x3dh_a(&signature, &ika, &spkbs, &eka, &ikbs, &opkbs).unwrap();
let ckb = x3dh_b(&ikas, &spkb, &ekas, &ikb, &opkb);
assert_eq!(cka, ckb)
```### Serialize and Deserialize
Every key described by this library can be turned into bytes and created from them too.
```rust
use x3dh_ke::{IdentityKey, Key};
let ika = IdentityKey::default();
let data = ika.to_bytes();
let ikr = IdentityKey::from_bytes(&data).unwrap();
assert_eq!(ika.to_bytes(), ikr.to_bytes())
```### Strip Private Key
To share a key, the private part has to be striped previously from that.
```rust
use x3dh_ke::{IdentityKey, Key};
let ika = IdentityKey::default();
let _iks = ika.strip(); // Without private key
```### WASM
This crate supports WASM. In order to do that, enable the `wasm` feature.[1]: https://signal.org/docs/specifications/x3dh/
Current version: 0.1.3
License: MIT