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.1213The wire contract also defines lifecycle-aware vault metadata (`defaultVaults`, per-vault14`defaultTtl`/`effectiveDefaultTtl`/`defaultFor`), resolved push retention (`ttl` and `ttlSource`),15and permanent app-origin reservations. These fields let agents inspect policy before mutating16hosting state instead of inferring defaults from names.1718## Install1920```sh21deno add jsr:@nzip/shared22```2324## Use2526```ts27import { canonicalManifestBytes, type Manifest, manifestHash, parseTarget } from "@nzip/shared";2829const manifest: Manifest = {30 v: 1,31 files: {32 "index.html": {33 h: "…64-hex-sha256…",34 s: 128,35 ct: "text/html; charset=utf-8",36 },37 },38};3940// Byte-identical on every runtime, which is what makes hashes agree across CLI and Worker.41const hash = await manifestHash(manifest);42const bytes = canonicalManifestBytes(manifest);4344parseTarget("2a3f"); // { kind: "address", address: 10815 }45parseTarget("work:demo"); // { kind: "vaultAlias", vault: "work", alias: "demo" }46parseTarget("demo"); // { kind: "alias", alias: "demo" }47```4849MIT licensed.