diff --git a/README.md b/README.md index 57508d7..d2b1bfd 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.3`, built against the published -`malt-core v0.0.10` release at commit -`aaa78737c35f82fe91bb3f749cfddbcb7953ed2b`. +The package asset binding is `0.0.4`, built against the published +`malt-core v0.0.11-rc.1` release at commit +`704ee38cdafaa628b713b2965b6d407ab0e4205b`. [`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,6 +107,10 @@ 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. +Prefix 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 Prefix state and its dependent parent Roots; +Positional layout 3 and Root V=0 are unchanged. `prepareAuthentication(backend, stateJSON)` builds a complete candidate. `updateAuthentication(backend, candidateJSON, stateJSON)` verifies a complete @@ -120,18 +124,20 @@ Handles are opaque identities bound to this router, backend and Worker. `importAuthentication` transfers a candidate's complete ArrayBuffer when possible; pass a copy if the caller needs those bytes afterwards. -`applyAuthentication` takes a handle and a `malt.authentication-delta/0` +`applyAuthentication` takes a handle and a `malt.authentication-delta/2` change set. It returns a new independent handle and leaves its base usable. `exportAuthentication` explicitly exports a complete candidate. Retained updates do not resend or export the complete base. ```ts +import { encodeIndexLabel } from '@dewebprotocol/malt' + const encode = (value: unknown) => new TextEncoder().encode(JSON.stringify(value)) const handleBytes = (handle: string) => new TextEncoder().encode(handle) const base = JSON.parse(await writer.createAuthentication('kzg', encode(state))) const next = JSON.parse(await writer.applyAuthentication('kzg', handleBytes(base.handle), encode({ - profile: 'malt.authentication-delta/0', - changes: [{ input: { kind: 'index', number: '0' }, before: oldCID, after: newCID }] + profile: 'malt.authentication-delta/2', + changes: [{ label: encodeIndexLabel(0n), before: oldCID, after: newCID }] }))) const candidate = JSON.parse(await writer.exportAuthentication('kzg', handleBytes(next.handle))) await writer.discardAuthentication('kzg', handleBytes(base.handle)) @@ -146,12 +152,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/0` batch. +returns Core's digest of the exact `malt.authentication-batch/2` 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/0` transaction ID, base, final Root, digest and +`malt.authentication-receipt/2` 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 @@ -164,7 +170,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.10` release. Its current host and batch APIs are bound to the +Core `v0.0.11-rc.1` 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. diff --git a/assets/verifier/PROVENANCE.json b/assets/verifier/PROVENANCE.json index 0ada1f6..da11082 100644 --- a/assets/verifier/PROVENANCE.json +++ b/assets/verifier/PROVENANCE.json @@ -1,22 +1,22 @@ { "schema": "malt.ts-verifier.provenance/v1", "source_repository": "https://github.com/DeWebProtocol/malt-ts.git", - "build_inputs_sha256": "610e2e0b50304b981e485d3e5f92db4b4552783a90671d1a26716d78d6d47396", + "build_inputs_sha256": "2cc10cc94abe9bcb435b418b298c1866c5b904f85f3e22bb0e70b7f6e6fb62e0", "core": { "module_path": "github.com/dewebprotocol/malt-core", - "module_version": "v0.0.10", + "module_version": "v0.0.11-rc.1", "source_repository": "https://github.com/DeWebProtocol/malt-core.git", - "source_commit": "aaa78737c35f82fe91bb3f749cfddbcb7953ed2b", - "module_sum": "h1:HgzuUot+AAKiLz20KdeUlnVDCVFHxfjQc7unsQOqm7Q=", - "go_mod_sum": "h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs=" + "source_commit": "704ee38cdafaa628b713b2965b6d407ab0e4205b", + "module_sum": "h1:V1PC7myStsHDeAjy6DkNwkOGyWlJF4vXYFQSwgAbb4A=", + "go_mod_sum": "h1:Ewf3s5XYFlgsX2PhcOKY2BLqv9jcYXYEFaYhDHjO/Y0=" }, "target": "js/wasm", "exports": [ "maltVerifyAuthentication", "maltDeriveCoordinate" ], - "go_version": "go1.26.0", - "go_toolchain": "go version go1.26.0 linux/amd64", + "go_version": "go1.26.8", + "go_toolchain": "go version go1.26.8 linux/amd64", "build_flags": [ "-p=6", "-mod=readonly", diff --git a/assets/verifier/SHA256SUMS b/assets/verifier/SHA256SUMS index a4ee8eb..ee185fe 100644 --- a/assets/verifier/SHA256SUMS +++ b/assets/verifier/SHA256SUMS @@ -1,3 +1,3 @@ -adfb131464ba9c9f19292569c1e5ea3c34a29f5c7f5eef5bf288f994d917c037 malt-verifier.wasm +29a747bfe8cec408be9b5f6ba4fd31b5412136d96adecd0466b03859b3be9562 malt-verifier.wasm 0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js -d5bc936fbbcf740fc41d6936be8b9ee9dc64e7a6d8ccf1c90d6726cd1b70ba32 PROVENANCE.json +6d901a5e837c4dd1e893985af43d998121a1c76443b21bdf9594b87145c2e663 PROVENANCE.json diff --git a/assets/verifier/malt-verifier.wasm b/assets/verifier/malt-verifier.wasm index 2278ab1..b2a4d83 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 7e22d73..914facb 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": "610e2e0b50304b981e485d3e5f92db4b4552783a90671d1a26716d78d6d47396", + "build_inputs_sha256": "2cc10cc94abe9bcb435b418b298c1866c5b904f85f3e22bb0e70b7f6e6fb62e0", "core": { "module_path": "github.com/dewebprotocol/malt-core", - "module_version": "v0.0.10", + "module_version": "v0.0.11-rc.1", "source_repository": "https://github.com/DeWebProtocol/malt-core.git", - "source_commit": "aaa78737c35f82fe91bb3f749cfddbcb7953ed2b", - "module_sum": "h1:HgzuUot+AAKiLz20KdeUlnVDCVFHxfjQc7unsQOqm7Q=", - "go_mod_sum": "h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs=" + "source_commit": "704ee38cdafaa628b713b2965b6d407ab0e4205b", + "module_sum": "h1:V1PC7myStsHDeAjy6DkNwkOGyWlJF4vXYFQSwgAbb4A=", + "go_mod_sum": "h1:Ewf3s5XYFlgsX2PhcOKY2BLqv9jcYXYEFaYhDHjO/Y0=" }, "target": "js/wasm", "exports": [ @@ -27,8 +27,8 @@ "id": "malt.ipa-parameters/v1", "sha256": "3799df0a77d1843b13a3a08744165180a12e1cd2dca529bee64ad691ac63adaf" }, - "go_version": "go1.26.0", - "go_toolchain": "go version go1.26.0 linux/amd64", + "go_version": "go1.26.8", + "go_toolchain": "go version go1.26.8 linux/amd64", "build_flags": [ "-p=6", "-mod=readonly", diff --git a/assets/writer/SHA256SUMS b/assets/writer/SHA256SUMS index 8ba09bf..332f41d 100644 --- a/assets/writer/SHA256SUMS +++ b/assets/writer/SHA256SUMS @@ -1,8 +1,8 @@ -d8509c24c079323c784d7f5632073abfed194763201e5477fd92868d4fdf5083 malt-writer-kzg.wasm -cf21fbf61aedc64dfd671a0660c3f5afa442411a0d08731c9dfdf1703eb8228f malt-writer-ipa-direct.wasm -e02dcde26245b1f8df0825f38b0c426f6ea355179f66e3191456fe6007d58f7c malt-writer-ipa-compact.wasm -4461eeeb9699321fe8de944772c588ad101db8feb1645ad84d231a804e004fe6 malt-writer-ipa-fast.wasm +f69d829ca7b29da9f661c72165fa059c54a9584ad7eaa31ee78d00aa256f8ac6 malt-writer-kzg.wasm +608b90874060d1d292c9d83224f77b6ce7b24426437e1cf538d6ae85c1da7652 malt-writer-ipa-direct.wasm +1311c0cec11f101073b8f136e70618f996af20876c138c6a7bbd252996983c90 malt-writer-ipa-compact.wasm +1dadddaf52506abfdfb475a56889191565958275757b845371c0af4cd112d01e malt-writer-ipa-fast.wasm 6311876a80f3c9333f20e6a8ae8b55b7235b1f7411d6ae2224bc90b55fe779a2 malt-writer-worker.mjs 968657d9a8818feb23b6463aca609478c81423a93a8b0dc453705ad009214db0 malt-writer-workers.mjs 0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js -82500f2f8585b10defd691727f6a925bd3535893acb4ad643315e44d86b1bf0b PROVENANCE.json +63d0e40470760bc20f394cee9dd642f232dcf3ab3cb087e7c2012608d006b372 PROVENANCE.json diff --git a/assets/writer/malt-writer-ipa-compact.wasm b/assets/writer/malt-writer-ipa-compact.wasm index 269b122..a58996b 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 015f0c2..6425d50 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 558d1f1..b258df3 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 8b1c476..d61f995 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 1ec049b..cc375e7 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/dewebprotocol/malt-ts -go 1.26.0 +go 1.26.8 -require github.com/dewebprotocol/malt-core v0.0.10 +require github.com/dewebprotocol/malt-core v0.0.11-rc.1 require ( - github.com/bits-and-blooms/bitset v1.24.6 // indirect - github.com/consensys/gnark-crypto v0.21.0 // indirect + github.com/bits-and-blooms/bitset v1.25.0 // indirect + github.com/consensys/gnark-crypto v0.22.0 // indirect github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect github.com/ipfs/go-cid v0.6.2 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect @@ -18,7 +18,7 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-varint v0.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - golang.org/x/crypto v0.54.0 // indirect + golang.org/x/crypto v0.57.0 // indirect golang.org/x/sync v0.23.0 // indirect golang.org/x/sys v0.48.0 // indirect lukechampine.com/blake3 v1.4.1 // indirect diff --git a/go.sum b/go.sum index 1913354..88d0075 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,11 @@ -github.com/bits-and-blooms/bitset v1.24.6 h1:qcrftZUVBIwfs+m+nhoCBAPT+ZPZZjti8SbHbDQQkZ4= -github.com/bits-and-blooms/bitset v1.24.6/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/consensys/gnark-crypto v0.21.0 h1:FDHibVIk4T5LkOKAkiN38g8gEvOxNcM10mLHOqvFTD0= -github.com/consensys/gnark-crypto v0.21.0/go.mod h1:hdTjDNjdkYJ1oVuc8emh9XEhfM1SbyZhJigFqItiOLk= +github.com/bits-and-blooms/bitset v1.25.0 h1:0Ro0qF4abCkM6SqWPVj29sFhAbMPAZpaDD7xhJ10beM= +github.com/bits-and-blooms/bitset v1.25.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/consensys/gnark-crypto v0.22.0 h1:RYH7FX1/zkmNrSiABo70HAqew41SRUsoluKundObo3o= +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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dewebprotocol/malt-core v0.0.10 h1:HgzuUot+AAKiLz20KdeUlnVDCVFHxfjQc7unsQOqm7Q= -github.com/dewebprotocol/malt-core v0.0.10/go.mod h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs= +github.com/dewebprotocol/malt-core v0.0.11-rc.1 h1:V1PC7myStsHDeAjy6DkNwkOGyWlJF4vXYFQSwgAbb4A= +github.com/dewebprotocol/malt-core v0.0.11-rc.1/go.mod h1:Ewf3s5XYFlgsX2PhcOKY2BLqv9jcYXYEFaYhDHjO/Y0= 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= @@ -28,21 +26,19 @@ github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7B github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= github.com/multiformats/go-varint v0.1.0 h1:i2wqFp4sdl3IcIxfAonHQV9qU5OsZ4Ts9IOoETFs5dI= github.com/multiformats/go-varint v0.1.0/go.mod h1:5KVAVXegtfmNQQm/lCY+ATvDzvJJhSkUlGQV9wgObdI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +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.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.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= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo= diff --git a/malt-core.lock.json b/malt-core.lock.json index c0f166f..95e43b7 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.10", + "module_version": "v0.0.11-rc.1", "source_repository": "https://github.com/DeWebProtocol/malt-core.git", - "source_commit": "aaa78737c35f82fe91bb3f749cfddbcb7953ed2b", - "module_sum": "h1:HgzuUot+AAKiLz20KdeUlnVDCVFHxfjQc7unsQOqm7Q=", - "go_mod_sum": "h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs=" + "source_commit": "704ee38cdafaa628b713b2965b6d407ab0e4205b", + "module_sum": "h1:V1PC7myStsHDeAjy6DkNwkOGyWlJF4vXYFQSwgAbb4A=", + "go_mod_sum": "h1:Ewf3s5XYFlgsX2PhcOKY2BLqv9jcYXYEFaYhDHjO/Y0=" } diff --git a/package-lock.json b/package-lock.json index 1ebc145..c974f4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dewebprotocol/malt", - "version": "0.0.3", + "version": "0.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@dewebprotocol/malt", - "version": "0.0.3", + "version": "0.0.4", "license": "Apache-2.0", "devDependencies": { "happy-dom": "20.11.1", diff --git a/package.json b/package.json index 62ae662..0e16fc1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dewebprotocol/malt", - "version": "0.0.3", + "version": "0.0.4", "description": "Stable TypeScript and browser WASM SDK for MALT", "type": "module", "license": "Apache-2.0", diff --git a/scripts/run-authentication-batch-wasm.mjs b/scripts/run-authentication-batch-wasm.mjs index 0ed2438..5d4fbc5 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: 1, derivation_profile: 4, vc_profile: backend === 'ipa' ? 2 : 1 }, entries: [] } +const state = { descriptor: { layout: 4, 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))) diff --git a/scripts/run-authentication-wasm.mjs b/scripts/run-authentication-wasm.mjs index fdb2fc7..3f5a3f3 100644 --- a/scripts/run-authentication-wasm.mjs +++ b/scripts/run-authentication-wasm.mjs @@ -48,9 +48,10 @@ 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: 1, derivation_profile: 4, vc_profile: id }, entries: [ + const state = { descriptor: { layout: 4, derivation_profile: 4, vc_profile: id }, entries: [ { label: 'YS9i', target: { '/': 'bafkqaaa' } }, - { label: 'QHBheWxvYWQ=', target: { '/': 'bafkqaaa' } } + { label: 'QHBheWxvYWQ=', target: { '/': 'bafkqaaa' } }, + { label: '', target: { '/': 'bafkqaaa' } } ] } 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`) @@ -58,6 +59,9 @@ if (kind === 'verifier') { assert.equal(candidate.profile, 'malt.authentication/4') assert(candidate.nodes.length > 0) await assert.rejects(() => globalThis[name]('{}')) + state.descriptor.layout = 1 + await assert.rejects(() => globalThis[name](new TextEncoder().encode(JSON.stringify(state)))) + state.descriptor.layout = 4 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-writer-worker-smoke.mjs b/scripts/run-writer-worker-smoke.mjs index c8a0895..5516d8a 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: 1, derivation_profile: 4, vc_profile: backend === 'ipa' ? 2 : 1 }, entries: [] }; + const state = { descriptor: { layout: 4, 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' }] diff --git a/src/release.mjs b/src/release.mjs index a1e3655..70a2e0c 100644 --- a/src/release.mjs +++ b/src/release.mjs @@ -1,8 +1,8 @@ -export const maltTSVersion = '0.0.3' +export const maltTSVersion = '0.0.4' export const maltCoreRelease = Object.freeze({ - version: 'v0.0.10', - commit: 'aaa78737c35f82fe91bb3f749cfddbcb7953ed2b', - moduleSum: 'h1:HgzuUot+AAKiLz20KdeUlnVDCVFHxfjQc7unsQOqm7Q=', - goModSum: 'h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs=' + version: 'v0.0.11-rc.1', + commit: '704ee38cdafaa628b713b2965b6d407ab0e4205b', + moduleSum: 'h1:V1PC7myStsHDeAjy6DkNwkOGyWlJF4vXYFQSwgAbb4A=', + goModSum: 'h1:Ewf3s5XYFlgsX2PhcOKY2BLqv9jcYXYEFaYhDHjO/Y0=' }) diff --git a/test/verifier.test.mjs b/test/verifier.test.mjs index 7770025..71a00e4 100644 --- a/test/verifier.test.mjs +++ b/test/verifier.test.mjs @@ -173,14 +173,14 @@ describe('browser verifier workers', () => { wasmURL: '/verifier/verifier-workers-b.wasm' }) const [portableWorker] = FakeVerifierWorker.instances - const kzgRoot = typedRoot(0x300104, 48) + const kzgRoot = typedRoot(0x300404, 48) const kzgResult = await verifyAuthenticationLocally({ ...JSON.parse(verification(kzgRoot)), provider }) expect(kzgResult.valid).toBe(true) - const ipaRoot = typedRoot(0x300104, 32) + const ipaRoot = typedRoot(0x300404, 32) const mixedInput = JSON.parse(verification(kzgRoot)) mixedInput.result.resolved = ipaRoot const mixed = JSON.stringify(mixedInput) @@ -295,7 +295,7 @@ describe('browser verifier workers', () => { releaseBrowserVerifier(secondOldLease) expect(replacementWorkers.every((worker) => !worker.terminated)).toBe(true) - await expect(replacement.authentication(verification(typedRoot(0x300104, 48)))) + await expect(replacement.authentication(verification(typedRoot(0x300404, 48)))) .resolves.toContain('"valid":true') releaseBrowserVerifier(replacementLease) @@ -304,7 +304,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(0x300104, 48), steps: [], operation: 'binding', label: 'bWlzc2luZw==' } + const q = { profile: 'malt.authentication/5', root: typedRoot(0x300404, 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 +316,7 @@ describe('browser verifier workers', () => { it('keeps function providers receiver-free', async () => { const { verifyAuthenticationLocally } = await import('../src/verifier.mjs') - const root = typedRoot(0x300104, 48) + const root = typedRoot(0x300404, 48) let receiver = 'not-called' function provider() { receiver = this @@ -410,12 +410,12 @@ describe('browser verifier workers', () => { firstPortable.emit({ type: 'runtime-error', error: 'simulated runtime failure' }) expect(firstPortable.terminated).toBe(true) - const kzgRoot = typedRoot(0x300104, 48) + const kzgRoot = typedRoot(0x300404, 48) await expect(provider.authentication(verification(kzgRoot))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances[1].backend).toBe('all') - const ipaRoot = typedRoot(0x300104, 32) + const ipaRoot = typedRoot(0x300404, 32) await expect(provider.authentication(verification(ipaRoot))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances).toHaveLength(2) @@ -434,11 +434,11 @@ describe('browser verifier workers', () => { .rejects.toThrow('simulated verification result error') const controller = new AbortController() controller.abort() - await expect(provider.authentication(verification(typedRoot(0x300104, 48)), controller.signal)) + await expect(provider.authentication(verification(typedRoot(0x300404, 48)), controller.signal)) .rejects.toMatchObject({ name: 'AbortError' }) await vi.waitFor(() => expect(FakeVerifierWorker.instances).toHaveLength(1)) - await expect(provider.authentication(verification(typedRoot(0x300104, 32)))) + await expect(provider.authentication(verification(typedRoot(0x300404, 32)))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances).toHaveLength(1) }) @@ -457,10 +457,10 @@ describe('browser verifier workers', () => { expect(FakeVerifierWorker.instances.every((worker) => worker.terminated)).toBe(true) const provider = await loadBrowserVerifier(options) - const kzgRoot = typedRoot(0x300104, 48) + const kzgRoot = typedRoot(0x300404, 48) await expect(provider.authentication(verification(kzgRoot))) .resolves.toContain('"valid":true') - const ipaRoot = typedRoot(0x300104, 32) + const ipaRoot = typedRoot(0x300404, 32) await expect(provider.authentication(verification(ipaRoot))) .resolves.toContain('"valid":true') expect(FakeVerifierWorker.instances).toHaveLength(3) @@ -487,7 +487,7 @@ describe('browser verifier workers', () => { error: 'simulated runtime failure' }) await vi.waitFor(() => expect(beforeWorkerStart).toHaveBeenCalledTimes(2)) - await expect(provider.authentication(verification(typedRoot(0x300104, 48)))) + await expect(provider.authentication(verification(typedRoot(0x300404, 48)))) .rejects.toBe(releaseChanged) await Promise.resolve() diff --git a/types/release.d.ts b/types/release.d.ts index a318d77..4c16dd6 100644 --- a/types/release.d.ts +++ b/types/release.d.ts @@ -1,8 +1,8 @@ -export declare const maltTSVersion: '0.0.3' +export declare const maltTSVersion: '0.0.4' export interface MaltCoreRelease { - readonly version: 'v0.0.10' - readonly commit: 'aaa78737c35f82fe91bb3f749cfddbcb7953ed2b' + readonly version: 'v0.0.11-rc.1' + readonly commit: '704ee38cdafaa628b713b2965b6d407ab0e4205b' readonly moduleSum: string readonly goModSum: string }