@eyeoverthink/wasm-deflate-vault 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,26 +1,43 @@
1
- # WASM Deflate Vault (`v1.0.0`)
2
-
3
- [![CI](https://github.com/eyeoverthink/wasm-deflate-vault/actions/workflows/ci.yml/badge.svg)](https://github.com/eyeoverthink/wasm-deflate-vault/actions/workflows/ci.yml)
4
- [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
5
-
6
- Zero-dependency, **100% offline** unification of `java__java-rosetta-stone-perfect-v2.html` + `transmutation__Transmutation-Bridge-Key-Encoded.html`:
7
-
8
- - **Live Vault Studio:** https://eyeoverthink.github.io/wasm-deflate-vault/
9
- - **Repository:** https://github.com/eyeoverthink/wasm-deflate-vault (`v1.0.0`, Apache-2.0)
10
-
11
- ## Primitives
12
-
13
- 1. **Self-Extracting Deflate-in-WASM (`packDeflateWasmContainer` / `unpackAndVerifyWasmContainer`):** Compresses multi-file bundles via `CompressionStream('deflate')` (`78 9c` zlib header), embeds the payload into a `.wasm` linear-memory Data segment alongside `"wdv.manifest"`, instantiates via native `WebAssembly.instantiate()`, and verifies magic `0x57445631`, SHA-256, Ed25519 signature, and RFC 6962 Merkle root.
14
- 2. **Per-File RFC 6962 Merkle Inclusion Proofs:** Proves any single file (`getFileMerkleProof` / `verifyFileMerkleProof`) against the signed root.
15
- 3. **Standard PKZIP (`0x04034b50` + CRC-32) Builder & Inspector** + **Variation-Selector Signed Carrier Bridge**.
16
-
17
- ## Quick Start
18
-
19
- ```bash
20
- npm install @eyeoverthink/wasm-deflate-vault
21
- npm test
22
- ```
23
-
24
- ## License
25
-
26
- Apache-2.0 — see [LICENSE](LICENSE).
1
+ # WASM Deflate Vault (`v2.0.0`)
2
+
3
+ [![CI](https://github.com/eyeoverthink/wasm-deflate-vault/actions/workflows/ci.yml/badge.svg)](https://github.com/eyeoverthink/wasm-deflate-vault/actions/workflows/ci.yml)
4
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
5
+
6
+ Zero-dependency, **100% offline** unification of `java__java-rosetta-stone-perfect-v2.html` + `transmutation__Transmutation-Bridge-Key-Encoded.html`:
7
+
8
+ - **Live Vault Studio:** https://eyeoverthink.github.io/wasm-deflate-vault/
9
+ - **Repository:** https://github.com/eyeoverthink/wasm-deflate-vault (`v2.0.0`, Apache-2.0)
10
+
11
+ ## Primitives
12
+
13
+ 1. **Deflate-in-WASM container (`packDeflateWasmContainer` / `unpackAndVerifyWasmContainer`):** Compresses multi-file bundles via `CompressionStream('deflate')` (`78 9c` zlib header) and embeds the payload in a `.wasm` linear-memory Data segment alongside `"wdv.manifest"` (manifest, Ed25519 signature, signer key). The module holds data and four constant-returning functions; inflating happens in JavaScript. File contents may be strings or `Uint8Array` (binary files come back as `Uint8Array`).
14
+ The verifier **never compiles or runs the module**: it parses the bytes, requires exactly the layout this package writes, then checks SHA-256, the Ed25519 signature, and the per-file Merkle root. Inflated size is capped (`maxInflatedBytes`, default 64 MiB).
15
+ 2. **Per-File RFC 6962 Merkle Inclusion Proofs:** Proves any single file (`getFileMerkleProof` / `verifyFileMerkleProof`) against the signed root.
16
+ 3. **Standard PKZIP (`0x04034b50` + CRC-32) Builder & Inspector** + **Variation-Selector Signed Carrier Bridge**.
17
+
18
+ ## Trust model (2.0.0)
19
+
20
+ A signature only means something if you know whose key made it. The verifier therefore **never trusts the key embedded in a vault**: pass the signer's raw Ed25519 public key (64 hex characters) as `expectedPublicKeys`. Without it, or with any other key, the result is `ok: false` and no files are returned. Small-order Ed25519 keys, which verify any message without a private key, are always refused.
21
+
22
+ ```js
23
+ const packed = await packDeflateWasmContainer(files, { keyPair }); // packed.publicKeyHex
24
+ const res = await unpackAndVerifyWasmContainer(wasmBytes, { expectedPublicKeys: [trustedSignerHex] });
25
+ if (res.ok) use(res.files);
26
+ ```
27
+
28
+ `decodeBridgeCarrier(text, { expectedPublicKeys })` follows the same rule.
29
+
30
+ Breaking changes from 1.x: `unpackAndVerifyWasmContainer` and `decodeBridgeCarrier` return `ok: false` without pinned keys; `checks` gains `keyTrusted`.
31
+
32
+ Known limits: the per-file Merkle tree duplicates an odd node and joins name and content with `0x1f`, so it is **not** RFC 6962 and two different file maps can share a root; use it as a change detector only. The zip writer writes names as given (sanitise `..` and absolute paths yourself).
33
+
34
+ ## Quick Start
35
+
36
+ ```bash
37
+ npm install @eyeoverthink/wasm-deflate-vault
38
+ npm test
39
+ ```
40
+
41
+ ## License
42
+
43
+ Apache-2.0 — see [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,47 +1,48 @@
1
- {
2
- "name": "@eyeoverthink/wasm-deflate-vault",
3
- "version": "1.0.0",
4
- "type": "module",
5
- "description": "Zero-dependency Self-Extracting Deflate-in-WASM container, IEEE 802.3 CRC-32 PKZIP builder/inspector, RFC 6962 per-file Merkle inclusion prover, WebCrypto Ed25519 signing, and Unicode Variation-Selector bridge.",
6
- "license": "Apache-2.0",
7
- "main": "./src/wasm-deflate-vault.js",
8
- "types": "./src/wasm-deflate-vault.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./src/wasm-deflate-vault.d.ts",
12
- "import": "./src/wasm-deflate-vault.js"
13
- }
14
- },
15
- "files": [
16
- "src/",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "keywords": [
21
- "wasm",
22
- "deflate",
23
- "pkzip",
24
- "merkle-tree",
25
- "rfc6962",
26
- "ed25519",
27
- "steganography",
28
- "zero-dependency"
29
- ],
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/eyeoverthink/wasm-deflate-vault.git"
33
- },
34
- "homepage": "https://eyeoverthink.github.io/wasm-deflate-vault/",
35
- "bugs": {
36
- "url": "https://github.com/eyeoverthink/wasm-deflate-vault/issues"
37
- },
38
- "publishConfig": {
39
- "access": "public"
40
- },
41
- "scripts": {
42
- "test": "node --test test/vault.test.js"
43
- },
44
- "engines": {
45
- "node": ">=20.0.0"
46
- }
47
- }
1
+ {
2
+ "name": "@eyeoverthink/wasm-deflate-vault",
3
+ "version": "2.0.0",
4
+ "type": "module",
5
+ "description": "Zero-dependency Self-Extracting Deflate-in-WASM container, IEEE 802.3 CRC-32 PKZIP builder/inspector, RFC 6962 per-file Merkle inclusion prover, WebCrypto Ed25519 signing, and Unicode Variation-Selector bridge.",
6
+ "license": "Apache-2.0",
7
+ "main": "./src/wasm-deflate-vault.js",
8
+ "types": "./src/wasm-deflate-vault.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./src/wasm-deflate-vault.d.ts",
12
+ "import": "./src/wasm-deflate-vault.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "src/",
17
+ "test/",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "keywords": [
22
+ "wasm",
23
+ "deflate",
24
+ "pkzip",
25
+ "merkle-tree",
26
+ "rfc6962",
27
+ "ed25519",
28
+ "steganography",
29
+ "zero-dependency"
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/eyeoverthink/wasm-deflate-vault.git"
34
+ },
35
+ "homepage": "https://eyeoverthink.github.io/wasm-deflate-vault/",
36
+ "bugs": {
37
+ "url": "https://github.com/eyeoverthink/wasm-deflate-vault/issues"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "test": "node --test test/vault.test.js"
44
+ },
45
+ "engines": {
46
+ "node": ">=20.0.0"
47
+ }
48
+ }
@@ -1,17 +1,28 @@
1
- export const VERSION: string;
2
- export const VAULT_MAGIC: number;
3
-
4
- export function crc32(bytes: Uint8Array): number;
5
- export function buildZipArchive(filesMap: Record<string, string | Uint8Array>): Uint8Array;
6
- export function inspectZipArchive(zipBytes: Uint8Array): { ok: boolean; magicHex?: string; entryCount?: number; totalBytes?: number; cdMatch?: boolean; entries?: unknown[]; error?: string };
7
-
8
- export function buildFileMerkleTree(filesMap: Record<string, string | Uint8Array>): Promise<{ filenames: string[]; leafCount: number; layers: string[][]; rootHex: string }>;
9
- export function getFileMerkleProof(tree: { filenames: string[]; layers: string[][]; rootHex: string }, filename: string): { filename: string; leafHash: string; proof: Array<{ position: "left" | "right"; hash: string }>; rootHex: string };
10
- export function verifyFileMerkleProof(opts: { filename: string; content: string | Uint8Array; proof: Array<{ position: "left" | "right"; hash: string }>; rootHex: string }): Promise<{ ok: boolean; computedRoot: string; expectedRoot: string }>;
11
-
12
- export function packDeflateWasmContainer(filesMap: Record<string, string | Uint8Array>, options?: { issuedAt?: string; keyPair?: CryptoKeyPair }): Promise<{ wasmBytes: Uint8Array; wasmByteLength: number; manifest: Record<string, unknown>; envelope: Record<string, unknown>; merkleTree: Awaited<ReturnType<typeof buildFileMerkleTree>> }>;
13
- export function unpackAndVerifyWasmContainer(wasmBytes: Uint8Array): Promise<{ ok: boolean; checks: { magicOk: boolean; sha256Ok: boolean; signatureOk: boolean; merkleOk: boolean }; manifest?: Record<string, unknown>; edFxTag?: string; files?: Record<string, string>; merkleTree?: Awaited<ReturnType<typeof buildFileMerkleTree>>; error?: string }>;
14
- export function findWasmDataSegmentByteOffset(wasmBytes: Uint8Array): number;
15
-
16
- export function encodeBridgeCarrier(envelope: Record<string, unknown>, carrierGlyph?: string): { carrier: string; encodedBytes: number };
17
- export function decodeBridgeCarrier(carrierText: string): Promise<{ ok: boolean; signatureValid?: boolean; manifest?: Record<string, unknown>; edFxTag?: string; error?: string }>;
1
+ export const VERSION: string;
2
+ export const VAULT_MAGIC: number;
3
+
4
+ export function crc32(bytes: Uint8Array): number;
5
+ export function buildZipArchive(filesMap: Record<string, string | Uint8Array>): Uint8Array;
6
+ export function inspectZipArchive(zipBytes: Uint8Array): { ok: boolean; magicHex?: string; entryCount?: number; totalBytes?: number; cdMatch?: boolean; entries?: unknown[]; error?: string };
7
+
8
+ export function buildFileMerkleTree(filesMap: Record<string, string | Uint8Array>): Promise<{ filenames: string[]; leafCount: number; layers: string[][]; rootHex: string }>;
9
+ export function getFileMerkleProof(tree: { filenames: string[]; layers: string[][]; rootHex: string }, filename: string): { filename: string; leafHash: string; proof: Array<{ position: "left" | "right"; hash: string }>; rootHex: string };
10
+ export function verifyFileMerkleProof(opts: { filename: string; content: string | Uint8Array; proof: Array<{ position: "left" | "right"; hash: string }>; rootHex: string }): Promise<{ ok: boolean; computedRoot: string; expectedRoot: string }>;
11
+
12
+ export const DEFAULT_MAX_INFLATED_BYTES: number;
13
+
14
+ /** Raw Ed25519 public keys as 64 hex characters; one or a list. */
15
+ export type ExpectedPublicKeys = string | string[];
16
+
17
+ /** True for a malformed key or one of the small-order Ed25519 points (which verify any message). */
18
+ export function isSmallOrderKey(publicKeyHex: string): boolean;
19
+ /** Raw Ed25519 public key of a CryptoKey as 64 hex characters. */
20
+ export function publicKeyToHex(publicKey: CryptoKey): Promise<string>;
21
+
22
+ export function packDeflateWasmContainer(filesMap: Record<string, string | Uint8Array>, options?: { issuedAt?: string; keyPair?: CryptoKeyPair }): Promise<{ wasmBytes: Uint8Array; wasmByteLength: number; manifest: Record<string, unknown>; envelope: Record<string, unknown>; publicKeyHex: string; merkleTree: Awaited<ReturnType<typeof buildFileMerkleTree>> }>;
23
+ /** Never compiles or runs the module. ok is true only when the signer is one of `expectedPublicKeys`. */
24
+ export function unpackAndVerifyWasmContainer(wasmBytes: Uint8Array, options?: { expectedPublicKeys?: ExpectedPublicKeys; maxInflatedBytes?: number }): Promise<{ ok: boolean; checks: { magicOk: boolean; sha256Ok: boolean; keyTrusted: boolean; signatureOk: boolean; merkleOk: boolean }; manifest?: Record<string, unknown>; signerPublicKeyHex?: string | null; edFxTag?: string; files?: Record<string, string | Uint8Array>; merkleTree?: Awaited<ReturnType<typeof buildFileMerkleTree>>; error?: string }>;
25
+ export function findWasmDataSegmentByteOffset(wasmBytes: Uint8Array): number;
26
+
27
+ export function encodeBridgeCarrier(envelope: Record<string, unknown>, carrierGlyph?: string): { carrier: string; encodedBytes: number };
28
+ export function decodeBridgeCarrier(carrierText: string, options?: { expectedPublicKeys?: ExpectedPublicKeys }): Promise<{ ok: boolean; signatureValid?: boolean; keyTrusted?: boolean; signerPublicKeyHex?: string | null; manifest?: Record<string, unknown>; edFxTag?: string; error?: string }>;