@makechain/mkit-wasm
v0.2.1
Published
WebAssembly bindings for mkit — content-addressed VCS primitives (BLAKE3 hashing, Ed25519 commit signing, in-toto attestations, FastCDC chunking, delta encoding, and Bao verified streaming) for use from JavaScript bundlers, browsers, and edge runtimes.
Readme
mkit-wasm
WebAssembly bindings for mkit — a content-addressed VCS for creative work. The package exposes the pure byte-format and crypto paths from mkit-core and mkit-attest so they can run anywhere a modern JS runtime can: browsers, Cloudflare Workers, Bun, Deno, Node.
No filesystem or network access is performed inside the wasm module. It is a stateless library of object encoders, hashers, signers, verifiers, FastCDC chunkers, delta encoders, and Bao streaming primitives.
Install
bun add @makechain/mkit-wasm
# or
npm i @makechain/mkit-wasm
# or
pnpm add @makechain/mkit-wasmThe published package is built with wasm-pack --target bundler. It works out of the box with esbuild, Wrangler, Vite, webpack, and Rollup. For direct <script type="module"> usage without a bundler, build the crate yourself with --target web.
Usage (Cloudflare Workers / bundler)
import init, {
blake3_hex,
commit_verify,
attest_build,
attest_verify,
} from "@makechain/mkit-wasm";
await init();
const id = blake3_hex(new TextEncoder().encode("hello"));
console.log(id); // 64-char lowercase hexExported functions
Content-addressing and objects:
blake3_hex(bytes) -> string— BLAKE3 of arbitrary bytes as 64-char hex.blob_encode(bytes) -> { bytes, hash_hex }— canonical blob object.tree_encode(entries_json) -> { bytes, hash_hex }— canonical tree object.commit_encode_and_sign(...)— encode + sign a commit object.commit_verify(commit_bytes) -> bool— verify a signed commit.
Signing primitives:
keypair_from_seed(seed_hex)/keypair_generate()— Ed25519 keys.sign_bytes_commit_domain(seed_hex, bytes) -> sig_hex.verify_bytes_commit_domain(pubkey_hex, bytes, sig_hex) -> bool.
Attestations (in-toto / DSSE-style envelopes):
attest_keypair(seed_hex, algo)— ed25519, secp256k1, or p256.attest_build(...)— build and sign an envelope.attest_verify(envelope_json, pubkey_hex, algo) -> bool.
Chunking, delta, and streaming:
chunk_boundaries(bytes)— FastCDC chunk boundary report.chunked_blob_encode(bytes)— chunked-blob object construction.delta_encode(base, target)— produce a delta summary.bao_encode(bytes)— produce a BLAKE3 Bao outboard tree.bao_slice(...)/bao_verify_slice(...)— verified streaming.
The exact JS surface is generated by wasm-bindgen; refer to the
TypeScript declarations shipped in the package for full signatures.
Versioning
This package is generated from the mkit-wasm crate inside the
mkit Rust workspace.
Each npm release is built from a tagged commit of the upstream repo;
the npm version matches the upstream vX.Y.Z tag, so @makechain/[email protected]
on npm corresponds to v0.1.0 on GitHub.
The wasm bundle wraps the same Rust crates the native mkit CLI uses,
so on-disk objects produced here are byte-identical to those produced
by the CLI.
Provenance
Releases are published from GitHub Actions with
npm publish --provenance,
producing a Sigstore-backed attestation tied to the workflow run.
Verify on the npm package page or with npm audit signatures.
Repository
github.com/officialunofficial/mkit
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
