For the complete documentation index, see llms.txt. This page is also available as Markdown.

Dev environment setup

This page covers the practical bits of getting derec-library building locally and running its end-to-end smoke test. If you've already done this once, the Quickstart and Minimal integration example are probably more useful.

Rust toolchain

derec-library builds on stable Rust. The minimum supported Rust version (MSRV) is 1.85 — it is pinned in the crate's Cargo.toml via rust-version = "1.85".

rustup toolchain install stable
rustup default stable
rustc --version   # should print 1.85 or newer

Adding the crate

Add the dependency to your Cargo.toml:

[dependencies]
derec-library = "0.0.1-alpha.7"

Or via cargo:

cargo add derec-library

The four store traits are required

DeRecProtocolBuilder::build() is only callable once every required slot is filled. That includes implementations of:

  • DeRecChannelStore — paired channel records and the channel-link graph.

  • DeRecShareStore — secret shares keyed by (channel_id, secret_id, version, replica_id).

  • DeRecSecretStore — per-channel key material (SharedKey, PairingSecret, PairingContact).

  • DeRecUserSecretStore — user-facing Secret snapshot keyed by secret_id.

There are working in-memory implementations of all four in the repository — copy them as a starting point:

  • bindings/rust/src/protocol.rsInMemoryChannelStore, InMemoryShareStore, InMemorySecretStore, InMemoryUserSecretStore.

  • bindings/sqlite/ and bindings/postgres/ — reference persistent implementations.

Trait methods return type-erased Futures (ChannelStoreFuture, ShareStoreFuture, SecretStoreFuture). Sync backends just return Box::pin(std::future::ready(...)) — that's a zero-cost wrapper. No executor is imposed.

Other languages

The Rust crate is the source of truth; the other SDKs are generated from it via FFI (.NET) or wasm-bindgen (TypeScript).

Clone and run the smoke test

The fastest way to verify "the whole thing works end-to-end" is to clone the monorepo and run the Rust binding's smoke test. It drives every flow — pairing, sharing, verification, discovery, recovery, unpairing, update-channel-info, and replica Secret sync — through multiple in-process DeRecProtocol instances (an Owner, its Helpers, and a paired Replica).

Expected tail output:

If you see All smoke tests passed., your local toolchain is wired up correctly. From here, jump into Choose your integration path or the Minimal integration example.

Last updated