1# `@nzip/shared`23**The runtime-agnostic contract between the [nzip](https://github.com/FelineStateMachine/nzip) CLI4and Worker.**56Manifest canonicalization, content hashing, address/target parsing, and the wire types exchanged7over the API. Canonical JSON serialization lives in exactly one place8([`manifest.ts`](./manifest.ts)) so the CLI and Worker can never disagree about a manifest hash.910This package uses only Web-standard APIs (`crypto.subtle`, `TextEncoder`/`TextDecoder`, `JSON`), so11the same code runs under Deno, Cloudflare Workers, Node.js, Bun, and browsers.1213## Install1415```sh16deno add jsr:@nzip/shared17```1819## Use2021```ts22import { canonicalManifestBytes, manifestHash, parseTarget, type Manifest } from "@nzip/shared";2324const manifest: Manifest = {25 v: 1,26 files: {27 "index.html": { h: "…64-hex-sha256…", s: 128, ct: "text/html; charset=utf-8" },28 },29};3031// Byte-identical on every runtime, which is what makes hashes agree across CLI and Worker.32const hash = await manifestHash(manifest);33const bytes = canonicalManifestBytes(manifest);3435parseTarget("2a3f"); // { kind: "address", address: 10815 }36parseTarget("work:demo"); // { kind: "vaultAlias", vault: "work", alias: "demo" }37parseTarget("demo"); // { kind: "alias", alias: "demo" }38```3940MIT licensed.