Expand description
§vcp-wasm
WebAssembly bindings for the VCP SDK, exposing core parsing
and encoding functions to JavaScript/TypeScript via wasm-bindgen.
§Usage from JS
import init, { parse_csm1, encode_csm1, parse_context_wire, validate_token } from 'vcp-wasm';
await init();
const code = parse_csm1("N5+F+E");
console.log(code.persona); // "Nanny"
const wire = parse_context_wire("⏰🌅|📍🏡‖🧠focused:4|💭calm:3");
console.log(wire.personal.cognitive.value); // "focused"Functions§
- encode_
context_ wire - Encode a full context object to wire format.
- encode_
csm1 - Encode a CSM-1 compact code from a JS object back to a string.
- encode_
csm1_ token - Encode a CSM-1 8-line token from a JS object back to a string.
- hash_
content - Compute the SHA-256 content hash of constitution text.
- parse_
context_ wire - Parse the full context wire format (situational + personal, separated by
‖). - parse_
csm1 - Parse a CSM-1 compact code (e.g.
"N5+F+E") and return it as a JS object. - parse_
csm1_ token - Parse a CSM-1 8-line token string and return it as a JS object.
- validate_
token - Validate a VCP/I identity token (e.g.
"family.safe.guide@1.2.0"). - verify_
bundle - Verify a bundle (manifest JSON + content).
- verify_
hash - Verify that content matches an expected hash.