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.
Conformance
Section titled “Conformance”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-triptest l1_change ... ok # canonical JSON, BLAKE3 hash, verify, AND re-signtest l1_lww ... ok # per-property LWW convergencetest l2_replication ... ok # version-handshake negotiation + catch-up filtertest l3_authz ... ok # authorization expression-AST evaluationcd rust/xnet-corecargo test # 5 conformance suites + 1 FFI round-tripThe binding surface
Section titled “The binding surface”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 digestserde_json = "1"