Skip to main content

Crate uor_addr_wasm

Crate uor_addr_wasm 

Source
Expand description

uor-addr-wasm — WASM Component Model bindings for uor-addr.

Generates a Component-Model component from the WIT interface at wit/uor-addr.wit via the wit-bindgen macro. Exports:

  • one *-address function per UOR-ADDR realization (κ-label only),
  • one *-address-with-witness function per realization (returning an opaque grounded resource that carries the ψ-pipeline derivation),
  • the grounded resource type with three methods: kappa-label, content-fingerprint, verify.

§Polyglot consumption

This crate is pure compute — it imports nothing from the host. Build it for wasm32-unknown-unknown and componentize the resulting core module (jco new, or wasm-tools component new) to obtain a zero-import Component Model component. Prefer this over wasm32-wasip2: the wasip2 target links std’s WASI runtime (cli/io/exit/environment) into the component even though it is never called, which forces every host to provision WASI 0.2 and — for the JS path — pins jco’s Node-only preview2-shim, breaking browser / Deno / Bun / Workers / bundler use.

The zero-import component is consumable from:

  • JS / TS via jco transpile → npm-publishable bindings that run in any JS environment (see bindings/npm/scripts/build.mjs).
  • Python via wasmtime-py (once it adds Component Model support; until then Python uses the C ABI path).
  • Go via wasmtime-go.
  • .NET via Wasmtime.NET.
  • Ruby / Java / C# via their respective wasmtime bindings.

All host paths produce the same 71-byte κ-label byte-for-byte as the Rust + C ABI paths.

§TC-05 replay across the wasm boundary

grounded.verify() re-certifies the witness’s owned replay Trace<256> through prism::replay::certify_from_trace (ADR-060, via uor_addr::AddressWitness::verify), returning the re-derived κ-label. The verifier path does not re-invoke the canonical SHA-256 hash axis (TC-05 / QS-05 — see CL-R* in CONFORMANCE.md). The resource carries the in-process owned witness; cross-process replay requires re-minting at the verifier side (a deliberate constraint of the Component Model resource lifecycle).

§Allocator

The WIT Component Model represents list<u8> and string as heap-allocated Rust types in the binding layer (Vec<u8> and String). Wasm runtimes ship an allocator; the binding turns on the alloc feature of uor-addr accordingly. The underlying ψ-pipeline remains no_alloc — only the host-input / host-output marshalling at the Component Model boundary allocates.