libchat/core/double-ratchets
dependabot[bot] c0e07c765e
Build(deps): bump rand from 0.8.5 to 0.9.3 (#86)
Bumps [rand](https://github.com/rust-random/rand) from 0.8.5 to 0.9.3.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/0.9.3/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.5...0.9.3)

---
updated-dependencies:
- dependency-name: rand
  dependency-version: 0.9.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-16 07:50:16 -07:00
..
2026-03-24 18:21:00 -07:00
2026-03-24 18:21:00 -07:00

Double Ratchet

This library provides an implementation of the Double Ratchet algorithm.

Usage

let shared_secret = [42u8; 32];
let bob_dh = DhKeyPair::generate();

let mut alice = RatchetState::init_sender(shared_secret, bob_dh.public);
let mut bob = RatchetState::init_receiver(shared_secret, bob_dh);

let (ciphertext, header) = alice.encrypt_message(b"Hello Bob!");
let plaintext = bob.decrypt_message(&ciphertext, header);

Run examples,

cargo run --example double_ratchet_basic

cargo run --example storage_demo --features storage
cargo run --example storage_demo --features sqlcipher

Run Nim FFI example,

# In the root folder (libchat)
cargo build --release
# In ffi-nim-example folder
nimble run