johnandersen777.bsky.social/atlibs-identlink
ident.link agent-of walk with grants over CAR-verified sync.getRecord: Rust crate identlink, wasm, JS
atlibs-identlink
ident.link agent-of walk with grants, Rust + wasm/JS.
An edge A -> P holds when A's DID doc has https://ident.link/agent-of/P,
P/link.ident.endorsement/A has agent == A, and
P/com.publicdomainrelay.temp.market.association/A is live. Records come from
com.atproto.sync.getRecord, CAR verified (commit signature, MST proof).
Rust
git clone knotless://johnandersen777.bsky.social/atlibs-identlink
cd atlibs-identlink
cargo test --features native
cargo run --example walk --features native -- did:plc:4vcig7s43z3nyqrnepmcfzqt
test result: ok…
"roots": [
"did:plc:ocnuqjlzgohypj3zoznermms"
],
Contract liveness: HttpIo::contract_held (None by default) runs
market_contract_held: the accept at contract.uri is in an authority's
repo and has contract.cid, the bidder's receipt answers it, no vm.delete,
no vm.terminated. A custom Io calls identlink::market_contract_held(self, contract, authorities)
from its contract_held.
The core (no features) builds for any wasm32-unknown-unknown host with no
getrandom:
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown
JS
cargo install wasm-pack --version 0.15.0 --locked
wasm-pack build --target web --out-dir js/pkg --out-name identlink --no-pack -- --features wasm
node js/test.mjs
import { readFileSync } from "node:fs";
import { load, walk } from "./js/index.js";
await load(readFileSync("js/pkg/identlink_bg.wasm"));
const w = await walk({}, "did:plc:4vcig7s43z3nyqrnepmcfzqt");
console.log(JSON.stringify(w.roots));
["did:plc:ocnuqjlzgohypj3zoznermms"]
A browser needs no load. io callbacks resolveDid, getRecord, contractHeld, now are optional:
without resolveDid/getRecord the walk fetches and verifies in wasm;
without contractHeld it is marketContractHeld. Also agentOf,
verifyRecord, recordCid, marketContractHeld(io, contract, authorities).
Vectors
vectors.json runs through an in-memory IO in tests/vectors.rs and
js/test.mjs:
dids[did]: DID doc;nullor missing = nonerecords["at://repo/collection/rkey"]: value; none when the repo DID is noneheld[uri]:contractHeldis true whentrueand the uri's repo is in authorities"error"anywhere above: the IO call failswant.errors: number of errors, default 0market[]:{name, contract, authorities, want}formarket_contract_heldover the samedids/records;wantistrue,falseor"error"