Skip to content

Rust — xnet-core

Core · betaregenerates the golden vectors

xnet-core is a portable Rust implementation of the xNet interop kernel — the byte-exact core of the protocol: did:key identity, the canonical-JSON change hash, Ed25519 sign/verify, per-property LWW convergence, and the pure L2/L3 decision functions (version negotiation, authorization expression evaluation).

Unlike a full app SDK, xnet-core is the kernel + a binding surface. It’s Phase 2 of exploration 0210: one portable core that can back the Swift, Kotlin, and .NET SDKs via UniFFI / a C ABI, instead of each language re-implementing the kernel.

cargo test runs the shared golden-vector corpus (conformance/vectors/) — the same vectors the TypeScript reference and the Python/Swift kernels pass:

test l0_identity ... ok # did:key derivation + round-trip
test l1_change ... ok # canonical JSON, BLAKE3 hash, verify, AND re-sign
test l1_lww ... ok # per-property LWW convergence
test l2_replication ... ok # version-handshake negotiation + catch-up filter
test l3_authz ... ok # authorization expression-AST evaluation
Terminal window
cd rust/xnet-core
cargo test # 5 conformance suites + 1 FFI round-trip

src/ffi.rs exposes the kernel across a String / Vec<u8> / bool boundary — the shape a UniFFI or C-ABI consumer wants — so a native SDK (Swift, Kotlin, .NET) can call the verified kernel instead of porting it. The crate is dependency-light by design:

[dependencies]
curve25519-dalek = "4.1" # RFC-8032 Ed25519 (deterministic)
sha2 = "0.10"
blake3 = "1" # the change-hash digest
serde_json = "1"