diff --git a/README.md b/README.md index 1c4a3fe..54cd844 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ writer semantics independently in TypeScript. ## Version and Core release -The package asset binding is `0.0.6`, built against the published -`malt-core v0.0.11-rc.4` release at commit -`595f1e05aa86b0339addaa0f0e2ac6672faa8e00`. +The package asset binding is `0.0.7`, built against the published +`malt-core v0.0.12-rc.2` release at commit +`0c5dc0029bd89180f1ff9c8f87857c17aef6a094`. [`malt-core.lock.json`](./malt-core.lock.json) binds that tag, commit, Go module checksums. The `malt.ts-core-lock/v2` lock binds Core source only; Core WASM assets are not required. This repository exclusively owns WASM entrypoints, @@ -107,12 +107,11 @@ indices as eight unsigned big-endian bytes, and `encodeKeyLabel(Uint8Array)` serializes Direct 32-byte keys. `deriveCoordinate({profile, label})` executes Core derivation in the verifier Worker and returns a key or a bigint index. JavaScript performs no label hashing or application path normalization. -Map layout 4 authenticates exact original label bytes and targets; distinct -labels at the same full coordinate are errors. Layout 1 is rejected without a -compatibility reader. Rebuild old Map state and its dependent parent Roots; -List remains layout 3 and Root V=0 is unchanged. Core rc.4 includes rc.3's -empty-cell scalar-zero encoding; roots and proofs from rc.2 or earlier must -be regenerated from original inputs, including dependent parent Roots. +Map layout 1 authenticates original label bytes and targets. Distinct labels at +the same full coordinate are errors. List layout 2 authenticates contiguous +indices. Both use Root V=0. When upgrading from layouts 4/3, rebuild both +kinds of tree from the original inputs, then rebuild dependent parents and +regenerate proofs. Complete candidates use `malt.authentication/6`. `prepareAuthentication(backend, stateJSON)` builds a complete candidate. `updateAuthentication(backend, candidateJSON, stateJSON)` verifies a complete @@ -154,12 +153,12 @@ cancels pending operations; a subsequent request creates a new generation. ### Materialization batches and receipts `validateAuthenticationBatch(backend, batchJSON)` verifies all candidates and -returns Core's digest of the exact `malt.authentication-batch/2` batch. +returns Core's digest of the exact `malt.authentication-batch/3` batch. Candidates appear before parents and lineage successors. A bootstrap batch includes its newly constructed base. `validateAuthenticationReceipt(backend, batchJSON, receiptJSON)` checks the -`malt.authentication-receipt/2` transaction ID, base, final Root, digest and +`malt.authentication-receipt/3` transaction ID, base, final Root, digest and durable boundary. It returns the final Root without modifying retained state. Receipts acknowledge persistence; they neither prove a portable state transition nor publish a head or grant client trust. Applications own durable @@ -172,7 +171,7 @@ session snapshot compatibility APIs. Worker readiness requires the complete current ABI. There are no forwarding aliases or optional old-runtime exports. The `malt-core.lock.json` and packaged binary assets identify the published -Core `v0.0.11-rc.4` release. Its current host and batch APIs are bound to the +Core `v0.0.12-rc.2` release. Its current host and batch APIs are bound to the exact release tag, source commit, and module checksums. Source integration checks remain separate from this published release binding. @@ -192,7 +191,7 @@ current contracts to the exact release selected by the lock. ### WASM ownership and archives Core provides the Go SDK, cryptographic parameter metadata, and portable -`conformance/authentication-v3.json` corpus. All JavaScript/WASM runners live +`conformance/authentication-v4.json` corpus. All JavaScript/WASM runners live in this repository; tests never execute a Core-owned browser build or runner. `make test-wasm` tests the pinned published Core release. For a proposed Core source change, use the explicit non-release `scripts/test-core-source.sh`. @@ -211,4 +210,4 @@ The package uses root-only List metadata: `count` plus an optional opaque `payload_cid`. Range bounds are element indices, and non-root vectors have no reserved metadata slot. Application JSON decoding stays in consumers. The packaged verifier and writer assets are built from the exact audited Core -release above and pass its `authentication-v3.json` conformance corpus. +release above and pass its `authentication-v4.json` conformance corpus. diff --git a/assets/verifier/PROVENANCE.json b/assets/verifier/PROVENANCE.json index d1b9516..240e0cd 100644 --- a/assets/verifier/PROVENANCE.json +++ b/assets/verifier/PROVENANCE.json @@ -1,14 +1,14 @@ { "schema": "malt.ts-verifier.provenance/v1", "source_repository": "https://github.com/DeWebProtocol/malt-ts.git", - "build_inputs_sha256": "1df72aa516dc33125758c7491cbe493fb885a9bcc2effce57a302c52406ad861", + "build_inputs_sha256": "0c02f8be81cb7945052893c3e036a69f571be5b26b30478b1be9503df1be9734", "core": { "module_path": "github.com/dewebprotocol/malt-core", - "module_version": "v0.0.11-rc.4", + "module_version": "v0.0.12-rc.2", "source_repository": "https://github.com/DeWebProtocol/malt-core.git", - "source_commit": "595f1e05aa86b0339addaa0f0e2ac6672faa8e00", - "module_sum": "h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=", - "go_mod_sum": "h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA=" + "source_commit": "0c5dc0029bd89180f1ff9c8f87857c17aef6a094", + "module_sum": "h1:5KqS5FXrRkBHki+PO4dgDS2A5MlcgDQD9CBKHuuGAk0=", + "go_mod_sum": "h1:r3h6vMg1XN43S1N31hBrROPGP/w1+H5G4q3wiC3qL80=" }, "target": "js/wasm", "exports": [ diff --git a/assets/verifier/SHA256SUMS b/assets/verifier/SHA256SUMS index 37ef2f3..f64f0b6 100644 --- a/assets/verifier/SHA256SUMS +++ b/assets/verifier/SHA256SUMS @@ -1,3 +1,3 @@ -fdc3af9dce8de3b322de1cad208c750351fe068892363ab1f8937486c062bf77 malt-verifier.wasm +033ca9d13ca8e9f3a869906e81ede973f24a609ff5425522cbd27e3fd6a3dd8a malt-verifier.wasm 0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js -7be58669bd890583d02be4e621c828287b3aa72d18d06d912035e3ce73369622 PROVENANCE.json +5edabd01a0cbf30e6bd2e9001e120810e536a8c11a12f25e427a2c5124ff9131 PROVENANCE.json diff --git a/assets/verifier/malt-verifier.wasm b/assets/verifier/malt-verifier.wasm index 5792a8a..a32fe9f 100644 Binary files a/assets/verifier/malt-verifier.wasm and b/assets/verifier/malt-verifier.wasm differ diff --git a/assets/writer/PROVENANCE.json b/assets/writer/PROVENANCE.json index 7d0b158..006219e 100644 --- a/assets/writer/PROVENANCE.json +++ b/assets/writer/PROVENANCE.json @@ -1,14 +1,14 @@ { "schema": "malt.ts-writer.provenance/v1", "source_repository": "https://github.com/DeWebProtocol/malt-ts.git", - "build_inputs_sha256": "1df72aa516dc33125758c7491cbe493fb885a9bcc2effce57a302c52406ad861", + "build_inputs_sha256": "0c02f8be81cb7945052893c3e036a69f571be5b26b30478b1be9503df1be9734", "core": { "module_path": "github.com/dewebprotocol/malt-core", - "module_version": "v0.0.11-rc.4", + "module_version": "v0.0.12-rc.2", "source_repository": "https://github.com/DeWebProtocol/malt-core.git", - "source_commit": "595f1e05aa86b0339addaa0f0e2ac6672faa8e00", - "module_sum": "h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=", - "go_mod_sum": "h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA=" + "source_commit": "0c5dc0029bd89180f1ff9c8f87857c17aef6a094", + "module_sum": "h1:5KqS5FXrRkBHki+PO4dgDS2A5MlcgDQD9CBKHuuGAk0=", + "go_mod_sum": "h1:r3h6vMg1XN43S1N31hBrROPGP/w1+H5G4q3wiC3qL80=" }, "target": "js/wasm", "exports": [ diff --git a/assets/writer/SHA256SUMS b/assets/writer/SHA256SUMS index 19b63aa..4d2fb85 100644 --- a/assets/writer/SHA256SUMS +++ b/assets/writer/SHA256SUMS @@ -1,8 +1,8 @@ -b9a9de50f0dc945454f0e3f7e77b720d885747398cca3cf6b7ea4e80b4abfb86 malt-writer-kzg.wasm -e5432d306116fa54c21ebd78fcf320f2a6cef6f63259e2600573aa9dba0381b5 malt-writer-ipa-direct.wasm -e78d4fc1ac43c3e1b8bef261b7c8aa1b23442976e13fea28f33af1b9744702ab malt-writer-ipa-compact.wasm -8d57eada1383a1f65ab678434d721f9dd5f4f4cd43024231234f2c413cb7d14d malt-writer-ipa-fast.wasm +c58f5cbd99e10696d40eceab73d3b73ac611e803a91e9d380353d24fcabd30c2 malt-writer-kzg.wasm +0988b89dcd34b49467eb67bd4196e8bf35560f4e08faefeb416e4d9b904a9d58 malt-writer-ipa-direct.wasm +16e853f8fed1e56a732bacbf5d8d56be21948f73e1ea2127b9d12ec6070dc7bc malt-writer-ipa-compact.wasm +adc75674e1a6551e5a65782ebb90ff87968418b61906027e8da8cc5925f72fee malt-writer-ipa-fast.wasm 6311876a80f3c9333f20e6a8ae8b55b7235b1f7411d6ae2224bc90b55fe779a2 malt-writer-worker.mjs 968657d9a8818feb23b6463aca609478c81423a93a8b0dc453705ad009214db0 malt-writer-workers.mjs 0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js -4440c9b6048ed8b77eba3030c81c1fa669359e558f0938ce50dc90479e0e92d3 PROVENANCE.json +0af41b0801049ead574a91853763465bbedf19c0e049cc96b6db781253e70569 PROVENANCE.json diff --git a/assets/writer/malt-writer-ipa-compact.wasm b/assets/writer/malt-writer-ipa-compact.wasm index 5dde1a8..4857a62 100644 Binary files a/assets/writer/malt-writer-ipa-compact.wasm and b/assets/writer/malt-writer-ipa-compact.wasm differ diff --git a/assets/writer/malt-writer-ipa-direct.wasm b/assets/writer/malt-writer-ipa-direct.wasm index bb4dca4..0ec8a97 100644 Binary files a/assets/writer/malt-writer-ipa-direct.wasm and b/assets/writer/malt-writer-ipa-direct.wasm differ diff --git a/assets/writer/malt-writer-ipa-fast.wasm b/assets/writer/malt-writer-ipa-fast.wasm index 616da56..c0a1e68 100644 Binary files a/assets/writer/malt-writer-ipa-fast.wasm and b/assets/writer/malt-writer-ipa-fast.wasm differ diff --git a/assets/writer/malt-writer-kzg.wasm b/assets/writer/malt-writer-kzg.wasm index 5502841..a60e91a 100644 Binary files a/assets/writer/malt-writer-kzg.wasm and b/assets/writer/malt-writer-kzg.wasm differ diff --git a/go.mod b/go.mod index 297ba66..51dc75e 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/dewebprotocol/malt-ts go 1.26.8 -require github.com/dewebprotocol/malt-core v0.0.11-rc.4 +require github.com/dewebprotocol/malt-core v0.0.12-rc.2 require ( github.com/bits-and-blooms/bitset v1.25.0 // indirect @@ -19,7 +19,7 @@ require ( github.com/multiformats/go-varint v0.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect golang.org/x/crypto v0.57.0 // indirect - golang.org/x/sync v0.24.0 // indirect - golang.org/x/sys v0.49.0 // indirect + golang.org/x/sync v0.25.0 // indirect + golang.org/x/sys v0.50.0 // indirect lukechampine.com/blake3 v1.4.1 // indirect ) diff --git a/go.sum b/go.sum index 81fef46..17ea2f4 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/consensys/gnark-crypto v0.22.0 h1:RYH7FX1/zkmNrSiABo70HAqew41SRUsoluK github.com/consensys/gnark-crypto v0.22.0/go.mod h1:HL8XflRG4cvau1PEG3CWBTD2kkzUzdlqZF6BBgy57F8= github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= -github.com/dewebprotocol/malt-core v0.0.11-rc.4 h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM= -github.com/dewebprotocol/malt-core v0.0.11-rc.4/go.mod h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA= +github.com/dewebprotocol/malt-core v0.0.12-rc.2 h1:5KqS5FXrRkBHki+PO4dgDS2A5MlcgDQD9CBKHuuGAk0= +github.com/dewebprotocol/malt-core v0.0.12-rc.2/go.mod h1:r3h6vMg1XN43S1N31hBrROPGP/w1+H5G4q3wiC3qL80= github.com/ipfs/go-cid v0.6.2 h1:VuGwJd+KJTaMJ4S4d5EEf9SXc17YUblS5axCbocn9YE= github.com/ipfs/go-cid v0.6.2/go.mod h1:Xhwg8NzHeK9xPCEZkCw4idzPiuNMpX3fARuI5Iwj1Lo= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= @@ -34,10 +34,10 @@ go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= -golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= -golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= -golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= -golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= diff --git a/malt-core.lock.json b/malt-core.lock.json index a6b5b2d..9c22319 100644 --- a/malt-core.lock.json +++ b/malt-core.lock.json @@ -1,9 +1,9 @@ { "schema": "malt.ts-core-lock/v2", "module_path": "github.com/dewebprotocol/malt-core", - "module_version": "v0.0.11-rc.4", + "module_version": "v0.0.12-rc.2", "source_repository": "https://github.com/DeWebProtocol/malt-core.git", - "source_commit": "595f1e05aa86b0339addaa0f0e2ac6672faa8e00", - "module_sum": "h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=", - "go_mod_sum": "h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA=" + "source_commit": "0c5dc0029bd89180f1ff9c8f87857c17aef6a094", + "module_sum": "h1:5KqS5FXrRkBHki+PO4dgDS2A5MlcgDQD9CBKHuuGAk0=", + "go_mod_sum": "h1:r3h6vMg1XN43S1N31hBrROPGP/w1+H5G4q3wiC3qL80=" } diff --git a/node-tests/malt-writer-workers.mjs b/node-tests/malt-writer-workers.mjs index 7545dce..f729b73 100644 --- a/node-tests/malt-writer-workers.mjs +++ b/node-tests/malt-writer-workers.mjs @@ -139,8 +139,8 @@ test("request errors keep the selected Worker alive", async () => { const bootstrap = writer.createAuthentication("kzg", new Uint8Array([1])); const bootstrapRequest = await worker.nextRequest(); assert.equal(bootstrapRequest.method, "createAuthentication"); - worker.respond(bootstrapRequest, { result: '{"profile":"malt.authentication/4"}' }); - assert.equal(await bootstrap, '{"profile":"malt.authentication/4"}'); + worker.respond(bootstrapRequest, { result: '{"profile":"malt.authentication/6"}' }); + assert.equal(await bootstrap, '{"profile":"malt.authentication/6"}'); const invalidLoad = writer.importAuthentication("kzg", new Uint8Array([1])); const invalidRequest = await worker.nextRequest(); diff --git a/package-lock.json b/package-lock.json index b813efa..0daaa4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dewebprotocol/malt", - "version": "0.0.6", + "version": "0.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@dewebprotocol/malt", - "version": "0.0.6", + "version": "0.0.7", "license": "Apache-2.0", "devDependencies": { "happy-dom": "20.11.1", diff --git a/package.json b/package.json index c3fcbf6..34ff1a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dewebprotocol/malt", - "version": "0.0.6", + "version": "0.0.7", "description": "Stable TypeScript and browser WASM SDK for MALT", "type": "module", "license": "Apache-2.0", diff --git a/scripts/build-wasm-release.sh b/scripts/build-wasm-release.sh index 9fed625..e506c01 100755 --- a/scripts/build-wasm-release.sh +++ b/scripts/build-wasm-release.sh @@ -65,7 +65,7 @@ cp "${temporary}/assets/verifier/"* "${verifier_staging}/" cp "${temporary}/assets/writer/"* "${writer_staging}/" pin="$("${build_source}/scripts/resolve-core.sh")" IFS=$'\t' read -r _ _ core_module_dir _ _ <<<"${pin}" -authentication_corpus_sha256="$(sha256sum "${core_module_dir}/conformance/authentication-v3.json" | awk '{print $1}')" +authentication_corpus_sha256="$(sha256sum "${core_module_dir}/conformance/authentication-v4.json" | awk '{print $1}')" chmod 0644 "${verifier_staging}/"* "${writer_staging}/"* ( @@ -136,7 +136,7 @@ MANIFEST_PATH="${temporary}/WASM-RELEASE.json" node -e ' target: "js/wasm", archive_format: "ustar+gzip", conformance_corpora: { - authentication: {schema: "malt.conformance.authentication/3", sha256: process.env.AUTHENTICATION_CORPUS_SHA256}, + authentication: {schema: "malt.conformance.authentication/4", sha256: process.env.AUTHENTICATION_CORPUS_SHA256}, }, codegen_environment: {CGO_ENABLED: "0", GOEXPERIMENT: "none", GOWASM: "", GOFIPS140: "off"}, components: {verifier: component("VERIFIER"), writer: component("WRITER")} diff --git a/scripts/check-wasm-release.sh b/scripts/check-wasm-release.sh index 325384f..65e5a9f 100755 --- a/scripts/check-wasm-release.sh +++ b/scripts/check-wasm-release.sh @@ -27,7 +27,7 @@ fi expected_go_version="go${go_directive}" pin="$("${repo_root}/scripts/resolve-core.sh")" IFS=$'\t' read -r _ _ core_module_dir _ _ <<<"${pin}" -expected_authentication_corpus_sha256="$(sha256sum "${core_module_dir}/conformance/authentication-v3.json" | awk '{print $1}')" +expected_authentication_corpus_sha256="$(sha256sum "${core_module_dir}/conformance/authentication-v4.json" | awk '{print $1}')" expected_commit="$(git -C "${repo_root}" rev-parse HEAD)" expected_epoch="$(git -C "${repo_root}" show -s --format=%ct HEAD)" expected_build_inputs="$("${repo_root}/scripts/build-wasm.sh" --print-source-digest)" @@ -84,7 +84,7 @@ AUTHENTICATION_CORPUS_SHA256="${expected_authentication_corpus_sha256}" node -e const version = /^v[0-9]+\.[0-9]+\.[0-9]+(?:[.-][0-9A-Za-z.-]+)?$/ const expectedCodegen = {CGO_ENABLED: "0", GOEXPERIMENT: "none", GOWASM: "", GOFIPS140: "off"} const expectedCorpora = { - authentication: {schema: "malt.conformance.authentication/3", sha256: process.env.AUTHENTICATION_CORPUS_SHA256}, + authentication: {schema: "malt.conformance.authentication/4", sha256: process.env.AUTHENTICATION_CORPUS_SHA256}, } const toolchain = /^go version (go[0-9]+\.[0-9]+\.[0-9]+) ([a-z0-9]+)\/([a-z0-9]+)$/.exec(manifest.go_toolchain || "") if (manifest.schema !== "malt.ts-wasm-release/v1" || diff --git a/scripts/run-authentication-batch-wasm.mjs b/scripts/run-authentication-batch-wasm.mjs index 5d4fbc5..2985060 100644 --- a/scripts/run-authentication-batch-wasm.mjs +++ b/scripts/run-authentication-batch-wasm.mjs @@ -23,7 +23,7 @@ assert.equal(globalThis.maltWriterLoadedBackend, backend) assert.equal(globalThis.maltWriterLoadedProfile, profile) for (const name of ['maltComputeClientRootV1', 'maltWriterBootstrapSessionV1', 'maltWriterLoadSessionV1', 'maltWriterPrepareSessionV1', 'maltWriterValidateReceiptV1']) assert.equal(globalThis[name], undefined) const json = value => new TextEncoder().encode(JSON.stringify(value)) -const state = { descriptor: { layout: 4, derivation_profile: 4, vc_profile: backend === 'ipa' ? 2 : 1 }, entries: [] } +const state = { descriptor: { layout: 1, derivation_profile: 4, vc_profile: backend === 'ipa' ? 2 : 1 }, entries: [] } const base = JSON.parse(await globalThis.maltPrepareAuthentication(json(state))) state.entries.push({ label: 'ZmlsZQ==', target: { '/': 'bafkqaaa' } }) const next = JSON.parse(await globalThis.maltUpdateAuthentication(json(base), json(state))) @@ -35,15 +35,15 @@ const noOp = JSON.parse(await globalThis.maltExportAuthentication(new TextEncode for (const candidate of [unchanged, noOp]) { assert.equal(candidate.root, next.root) assert.equal(candidate.previous, next.previous) - const noOpBatch = { profile: 'malt.authentication-batch/2', transaction_id: 'no-op', base: next.root, root: next.root, candidates: [candidate] } + const noOpBatch = { profile: 'malt.authentication-batch/3', transaction_id: 'no-op', base: next.root, root: next.root, candidates: [candidate] } const noOpDigest = await globalThis.maltValidateAuthenticationBatch(json(noOpBatch)) - assert.equal(await globalThis.maltValidateAuthenticationReceipt(json(noOpBatch), json({ profile: 'malt.authentication-receipt/2', transaction_id: noOpBatch.transaction_id, base: next.root, root: next.root, digest: noOpDigest, durable_boundary: 'wasm-test/no-op' })), next.root) + assert.equal(await globalThis.maltValidateAuthenticationReceipt(json(noOpBatch), json({ profile: 'malt.authentication-receipt/3', transaction_id: noOpBatch.transaction_id, base: next.root, root: next.root, digest: noOpDigest, durable_boundary: 'wasm-test/no-op' })), next.root) } await globalThis.maltCloseAuthentication() -const batch = { profile: 'malt.authentication-batch/2', transaction_id: 'wasm-batch', base: base.root, root: next.root, candidates: [base, next] } +const batch = { profile: 'malt.authentication-batch/3', transaction_id: 'wasm-batch', base: base.root, root: next.root, candidates: [base, next] } const digest = await globalThis.maltValidateAuthenticationBatch(json(batch)) assert.match(digest, /^[a-f0-9]{64}$/) -const receipt = { profile: 'malt.authentication-receipt/2', transaction_id: batch.transaction_id, base: batch.base, root: batch.root, digest, durable_boundary: 'wasm-test/0' } +const receipt = { profile: 'malt.authentication-receipt/3', transaction_id: batch.transaction_id, base: batch.base, root: batch.root, digest, durable_boundary: 'wasm-test/0' } assert.equal(await globalThis.maltValidateAuthenticationReceipt(json(batch), json(receipt)), next.root) for (const field of ['transaction_id', 'base', 'root', 'digest', 'durable_boundary']) { await assert.rejects(() => globalThis.maltValidateAuthenticationReceipt(json(batch), json({ ...receipt, [field]: '' }))) diff --git a/scripts/run-authentication-router-smoke.mjs b/scripts/run-authentication-router-smoke.mjs index c18f1dd..006ce15 100644 --- a/scripts/run-authentication-router-smoke.mjs +++ b/scripts/run-authentication-router-smoke.mjs @@ -33,7 +33,7 @@ const writer = await createBrowserMaltWriter({ const bytes = value => new TextEncoder().encode(value) const json = value => bytes(JSON.stringify(value)) const state = { - descriptor: { layout: 3, derivation_profile: 3, vc_profile: 2 }, + descriptor: { layout: 2, derivation_profile: 3, vc_profile: 2 }, entries: [{ label: encodeIndexLabel('0'), target: { '/': 'bafkqaaa' } }] } try { diff --git a/scripts/run-authentication-wasm.mjs b/scripts/run-authentication-wasm.mjs index 3f5a3f3..a63403b 100644 --- a/scripts/run-authentication-wasm.mjs +++ b/scripts/run-authentication-wasm.mjs @@ -22,7 +22,7 @@ while (typeof globalThis[name] !== 'function') { await new Promise(resolve => setTimeout(resolve, 10)) } const corpus = JSON.parse(await readFile(corpusPath, 'utf8')) -assert.equal(corpus.schema, 'malt.conformance.authentication/3') +assert.equal(corpus.schema, 'malt.conformance.authentication/4') if (kind === 'verifier') { const derive = (profile, bytes) => JSON.parse(globalThis.maltDeriveCoordinate(profile, bytes)) for (const index of [0n, 42n, 9007199254740993n, 18446744073709551615n]) { @@ -48,7 +48,7 @@ if (kind === 'verifier') { console.log(`V0 WASM verifier ${backend} passed: ${corpus.vectors.length} vectors`) } else { const id = backend === 'ipa' ? 2 : 1 - const state = { descriptor: { layout: 4, derivation_profile: 4, vc_profile: id }, entries: [ + const state = { descriptor: { layout: 1, derivation_profile: 4, vc_profile: id }, entries: [ { label: 'YS9i', target: { '/': 'bafkqaaa' } }, { label: 'QHBheWxvYWQ=', target: { '/': 'bafkqaaa' } }, { label: '', target: { '/': 'bafkqaaa' } } @@ -56,12 +56,12 @@ if (kind === 'verifier') { const candidate = JSON.parse(await globalThis[name](new TextEncoder().encode(JSON.stringify(state)))) const expected = corpus.vectors.find(v => v.id === `profile-${id}.opaque-label`) assert.equal(candidate.root, expected.verification.request.root) - assert.equal(candidate.profile, 'malt.authentication/4') + assert.equal(candidate.profile, 'malt.authentication/6') assert(candidate.nodes.length > 0) await assert.rejects(() => globalThis[name]('{}')) - state.descriptor.layout = 1 + state.descriptor.layout = 255 await assert.rejects(() => globalThis[name](new TextEncoder().encode(JSON.stringify(state)))) - state.descriptor.layout = 4 + state.descriptor.layout = 1 state.descriptor.derivation_profile = 255 await assert.rejects(() => globalThis[name](new TextEncoder().encode(JSON.stringify(state)))) console.log(`V0 WASM writer ${backend}: exact native Root and rejection checks passed`) diff --git a/scripts/run-retained-writer-wasm.mjs b/scripts/run-retained-writer-wasm.mjs index 0d8987d..ea003ab 100644 --- a/scripts/run-retained-writer-wasm.mjs +++ b/scripts/run-retained-writer-wasm.mjs @@ -30,7 +30,7 @@ const json = value => text(JSON.stringify(value)) const first = 'bafkqaaa' const second = 'bafkreigh2akiscaildcw4535x7k5vfhq56bqddhziq3p4mwfmlz4vfu2ta' const state = { - descriptor: { layout: 3, derivation_profile: 3, vc_profile: backend === 'ipa' ? 2 : 1 }, + descriptor: { layout: 2, derivation_profile: 3, vc_profile: backend === 'ipa' ? 2 : 1 }, entries: Array.from({ length: 256 }, (_, i) => ({ label: encodeIndexLabel(String(i)), target: { '/': first } })) diff --git a/scripts/run-verifier-conformance.sh b/scripts/run-verifier-conformance.sh index 54ceda7..840e490 100755 --- a/scripts/run-verifier-conformance.sh +++ b/scripts/run-verifier-conformance.sh @@ -22,6 +22,6 @@ fi for backend in all kzg ipa; do node "${repo_root}/scripts/run-authentication-wasm.mjs" verifier \ "${verifier_root}/malt-verifier.wasm" "${verifier_root}/wasm_exec.js" \ - "${malt_module_dir}/conformance/authentication-v3.json" "${backend}" + "${malt_module_dir}/conformance/authentication-v4.json" "${backend}" done printf 'malt-ts verifier passes the MALT %s conformance corpus.\n' "${malt_version}" diff --git a/scripts/run-writer-conformance.sh b/scripts/run-writer-conformance.sh index 62b044e..02f4130 100755 --- a/scripts/run-writer-conformance.sh +++ b/scripts/run-writer-conformance.sh @@ -31,7 +31,7 @@ for profile in kzg direct compact fast; do wasm="${writer_root}/malt-writer-ipa-${profile}.wasm" profile_arg="${profile}" if [[ "${profile}" == kzg ]]; then backend=kzg; wasm="${writer_root}/malt-writer-kzg.wasm"; profile_arg=; fi - node "${repo_root}/scripts/run-authentication-wasm.mjs" writer "${wasm}" "${writer_root}/wasm_exec.js" "${malt_module_dir}/conformance/authentication-v3.json" "${backend}" + node "${repo_root}/scripts/run-authentication-wasm.mjs" writer "${wasm}" "${writer_root}/wasm_exec.js" "${malt_module_dir}/conformance/authentication-v4.json" "${backend}" node "${repo_root}/scripts/run-retained-writer-wasm.mjs" "${wasm}" "${writer_root}/wasm_exec.js" "${backend}" "${profile_arg}" node "${repo_root}/scripts/run-authentication-batch-wasm.mjs" "${wasm}" "${writer_root}/wasm_exec.js" "${backend}" "${profile_arg}" done diff --git a/scripts/run-writer-worker-smoke.mjs b/scripts/run-writer-worker-smoke.mjs index 5516d8a..9b0e9da 100644 --- a/scripts/run-writer-worker-smoke.mjs +++ b/scripts/run-writer-worker-smoke.mjs @@ -58,7 +58,7 @@ try { const bytes = value => new TextEncoder().encode(value); const json = value => bytes(JSON.stringify(value)); - const state = { descriptor: { layout: 4, derivation_profile: 4, vc_profile: backend === 'ipa' ? 2 : 1 }, entries: [] }; + const state = { descriptor: { layout: 1, derivation_profile: 4, vc_profile: backend === 'ipa' ? 2 : 1 }, entries: [] }; const base = JSON.parse(await writer.createAuthentication(backend, json(state))); const next = JSON.parse(await writer.applyAuthentication(backend, bytes(base.handle), json({ profile: 'malt.authentication-delta/2', changes: [{ label: 'ZmlsZQ==', after: 'bafkqaaa' }] @@ -67,9 +67,9 @@ try { const exported = JSON.parse(await writer.exportAuthentication(backend, bytes(next.handle))); const imported = JSON.parse(await writer.importAuthentication(backend, json(exported))); assert.equal(imported.root, next.root); - const batch = { profile: 'malt.authentication-batch/2', transaction_id: 'worker-smoke', base: base.root, root: next.root, candidates: [exported] }; + const batch = { profile: 'malt.authentication-batch/3', transaction_id: 'worker-smoke', base: base.root, root: next.root, candidates: [exported] }; const digest = await writer.validateAuthenticationBatch(backend, json(batch)); - const receipt = { profile: 'malt.authentication-receipt/2', transaction_id: batch.transaction_id, base: batch.base, root: batch.root, digest, durable_boundary: 'worker-smoke/0' }; + const receipt = { profile: 'malt.authentication-receipt/3', transaction_id: batch.transaction_id, base: batch.base, root: batch.root, digest, durable_boundary: 'worker-smoke/0' }; assert.equal(await writer.validateAuthenticationReceipt(backend, json(batch), json(receipt)), next.root); await assert.rejects(writer.validateAuthenticationReceipt(backend, json(batch), json({ ...receipt, root: base.root }))); // Queued export completes before close invalidates every retained handle. diff --git a/scripts/test-core-source.sh b/scripts/test-core-source.sh index df278de..b8a1a53 100755 --- a/scripts/test-core-source.sh +++ b/scripts/test-core-source.sh @@ -41,14 +41,14 @@ cp "${go_root}/lib/wasm/wasm_exec.js" "${output}/writer/wasm_exec.js" cp "${go_root}/lib/wasm/wasm_exec.js" "${output}/verifier/wasm_exec.js" cp "${repo_root}/assets/writer/malt-writer-worker.mjs" "${repo_root}/assets/writer/malt-writer-workers.mjs" "${output}/writer/" node "${repo_root}/scripts/run-authentication-wasm.mjs" verifier "${output}/verifier/malt-verifier.wasm" \ - "${output}/verifier/wasm_exec.js" "${core_root}/conformance/authentication-v3.json" all + "${output}/verifier/wasm_exec.js" "${core_root}/conformance/authentication-v4.json" all for profile in kzg direct compact fast; do backend=ipa wasm="${output}/writer/malt-writer-ipa-${profile}.wasm" profile_arg="${profile}" if [[ "${profile}" == kzg ]]; then backend=kzg; wasm="${output}/writer/malt-writer-kzg.wasm"; profile_arg=; fi node "${repo_root}/scripts/run-authentication-wasm.mjs" writer "${wasm}" "${output}/writer/wasm_exec.js" \ - "${core_root}/conformance/authentication-v3.json" "${backend}" + "${core_root}/conformance/authentication-v4.json" "${backend}" node "${repo_root}/scripts/run-retained-writer-wasm.mjs" "${wasm}" "${output}/writer/wasm_exec.js" "${backend}" "${profile_arg}" node "${repo_root}/scripts/run-authentication-batch-wasm.mjs" "${wasm}" "${output}/writer/wasm_exec.js" "${backend}" "${profile_arg}" done diff --git a/src/release.mjs b/src/release.mjs index 2fb99b7..1e32b3f 100644 --- a/src/release.mjs +++ b/src/release.mjs @@ -1,8 +1,8 @@ -export const maltTSVersion = '0.0.6' +export const maltTSVersion = '0.0.7' export const maltCoreRelease = Object.freeze({ - version: 'v0.0.11-rc.4', - commit: '595f1e05aa86b0339addaa0f0e2ac6672faa8e00', - moduleSum: 'h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=', - goModSum: 'h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA=' + version: 'v0.0.12-rc.2', + commit: '0c5dc0029bd89180f1ff9c8f87857c17aef6a094', + moduleSum: 'h1:5KqS5FXrRkBHki+PO4dgDS2A5MlcgDQD9CBKHuuGAk0=', + goModSum: 'h1:r3h6vMg1XN43S1N31hBrROPGP/w1+H5G4q3wiC3qL80=' }) diff --git a/test/verifier.test.mjs b/test/verifier.test.mjs index 71a00e4..7e75158 100644 --- a/test/verifier.test.mjs +++ b/test/verifier.test.mjs @@ -2,7 +2,8 @@ import { CID } from 'multiformats/cid' import * as Digest from 'multiformats/hashes/digest' import { afterEach, describe, expect, it, vi } from 'vitest' -function typedRoot(codec, size) { +function mapRoot(size) { + const codec = 0x300104 // V0, Map, SHA256 derivation return CID.createV1(codec, Digest.create(0, Uint8Array.from([size === 48 ? 1 : 2, size, ...new Uint8Array(size)]))).toString() } @@ -173,14 +174,14 @@ describe('browser verifier workers', () => { wasmURL: '/verifier/verifier-workers-b.wasm' }) const [portableWorker] = FakeVerifierWorker.instances - const kzgRoot = typedRoot(0x300404, 48) + const kzgRoot = mapRoot(48) const kzgResult = await verifyAuthenticationLocally({ ...JSON.parse(verification(kzgRoot)), provider }) expect(kzgResult.valid).toBe(true) - const ipaRoot = typedRoot(0x300404, 32) + const ipaRoot = mapRoot(32) const mixedInput = JSON.parse(verification(kzgRoot)) mixedInput.result.resolved = ipaRoot const mixed = JSON.stringify(mixedInput) @@ -295,7 +296,7 @@ describe('browser verifier workers', () => { releaseBrowserVerifier(secondOldLease) expect(replacementWorkers.every((worker) => !worker.terminated)).toBe(true) - await expect(replacement.authentication(verification(typedRoot(0x300404, 48)))) + await expect(replacement.authentication(verification(mapRoot(48)))) .resolves.toContain('"valid":true') releaseBrowserVerifier(replacementLease) @@ -304,7 +305,7 @@ describe('browser verifier workers', () => { it('passes an absent typed binding and the unchanged selected input to Core', async () => { const { verifyAuthenticationLocally } = await import('../src/verifier.mjs') - const q = { profile: 'malt.authentication/5', root: typedRoot(0x300404, 48), steps: [], operation: 'binding', label: 'bWlzc2luZw==' } + const q = { profile: 'malt.authentication/5', root: mapRoot(48), steps: [], operation: 'binding', label: 'bWlzc2luZw==' } const result = { profile: q.profile, resolved: q.root, binding: { present: false }, traversal: { results: [] } } const provider = { authentication: vi.fn(async (json) => { expect(JSON.parse(json)).toEqual({ request: q, result }) @@ -316,7 +317,7 @@ describe('browser verifier workers', () => { it('keeps function providers receiver-free', async () => { const { verifyAuthenticationLocally } = await import('../src/verifier.mjs') - const root = typedRoot(0x300404, 48) + const root = mapRoot(48) let receiver = 'not-called' function provider() { receiver = this @@ -410,12 +411,12 @@ describe('browser verifier workers', () => { firstPortable.emit({ type: 'runtime-error', error: 'simulated runtime failure' }) expect(firstPortable.terminated).toBe(true) - const kzgRoot = typedRoot(0x300404, 48) + const kzgRoot = mapRoot(48) await expect(provider.authentication(verification(kzgRoot))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances[1].backend).toBe('all') - const ipaRoot = typedRoot(0x300404, 32) + const ipaRoot = mapRoot(32) await expect(provider.authentication(verification(ipaRoot))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances).toHaveLength(2) @@ -434,11 +435,11 @@ describe('browser verifier workers', () => { .rejects.toThrow('simulated verification result error') const controller = new AbortController() controller.abort() - await expect(provider.authentication(verification(typedRoot(0x300404, 48)), controller.signal)) + await expect(provider.authentication(verification(mapRoot(48)), controller.signal)) .rejects.toMatchObject({ name: 'AbortError' }) await vi.waitFor(() => expect(FakeVerifierWorker.instances).toHaveLength(1)) - await expect(provider.authentication(verification(typedRoot(0x300404, 32)))) + await expect(provider.authentication(verification(mapRoot(32)))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances).toHaveLength(1) }) @@ -457,10 +458,10 @@ describe('browser verifier workers', () => { expect(FakeVerifierWorker.instances.every((worker) => worker.terminated)).toBe(true) const provider = await loadBrowserVerifier(options) - const kzgRoot = typedRoot(0x300404, 48) + const kzgRoot = mapRoot(48) await expect(provider.authentication(verification(kzgRoot))) .resolves.toContain('"valid":true') - const ipaRoot = typedRoot(0x300404, 32) + const ipaRoot = mapRoot(32) await expect(provider.authentication(verification(ipaRoot))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances).toHaveLength(3) @@ -487,7 +488,7 @@ describe('browser verifier workers', () => { error: 'simulated runtime failure' }) await vi.waitFor(() => expect(beforeWorkerStart).toHaveBeenCalledTimes(2)) - await expect(provider.authentication(verification(typedRoot(0x300404, 48)))) + await expect(provider.authentication(verification(mapRoot(48)))) .rejects.toBe(releaseChanged) await Promise.resolve() diff --git a/test/wasm-rebuild.test.mjs b/test/wasm-rebuild.test.mjs index 5f77b81..c0a168a 100644 --- a/test/wasm-rebuild.test.mjs +++ b/test/wasm-rebuild.test.mjs @@ -12,7 +12,7 @@ function writeSet(directory, host, changes = {}) { fs.mkdirSync(directory, { recursive: true }) const provenance = { go_version: 'go1.26.8', go_toolchain: `go version go1.26.8 ${host}`, - target: 'js/wasm', core: { module_version: 'v0.0.11-rc.4' }, ...changes + target: 'js/wasm', core: { module_version: 'v0.0.12-rc.2' }, ...changes } fs.writeFileSync(path.join(directory, 'PROVENANCE.json'), JSON.stringify(provenance)) fs.writeFileSync(path.join(directory, 'module.wasm'), 'wasm fixture') diff --git a/types/release.d.ts b/types/release.d.ts index 5c93bc4..747c721 100644 --- a/types/release.d.ts +++ b/types/release.d.ts @@ -1,8 +1,8 @@ -export declare const maltTSVersion: '0.0.6' +export declare const maltTSVersion: '0.0.7' export interface MaltCoreRelease { - readonly version: 'v0.0.11-rc.4' - readonly commit: '595f1e05aa86b0339addaa0f0e2ac6672faa8e00' + readonly version: 'v0.0.12-rc.2' + readonly commit: '0c5dc0029bd89180f1ff9c8f87857c17aef6a094' readonly moduleSum: string readonly goModSum: string }