Dev environment setup
Last updated
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.
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 newerAdd the dependency to your Cargo.toml:
[dependencies]
derec-library = "0.0.1-alpha.7"Or via cargo:
cargo add derec-libraryPre-1.0 API. derec-library is still on the 0.0.1-alpha.* track. Breaking changes between alpha versions are expected — pin the exact version while we stabilise, and consult the changelog before bumping.
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.rs — InMemoryChannelStore, 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.
The Rust crate is the source of truth; the other SDKs are generated from it via FFI (.NET) or wasm-bindgen (TypeScript).
.NET — the DeRec.Library NuGet package. See the .Net SDK reference.
TypeScript (Node.js) — @derec-alliance/nodejs. See the TypeScript SDK reference.
TypeScript (Web) — @derec-alliance/web, a wasm-bindgen build targeting browsers. Same API surface as the Node.js package. See the TypeScript SDK reference.
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
git clone https://github.com/derecalliance/lib-derec.git
cd lib-derec
cargo build --release
cargo run --release --manifest-path bindings/rust/Cargo.toml── Primitives smoke tests ──────────────────────────────────
...
── Protocol smoke tests ────────────────────────────────────
=== Protocol pairing flow test ===
Protocol pairing flow test passed.
...
All smoke tests passed.