Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ writer semantics independently in TypeScript.

## Version and Core release

The package asset binding is `0.0.2`, built against the published
`malt-core v0.0.9` release at commit
`e389418cf6715ae58a97255196833b410b0962d1`.
The package asset binding is `0.0.3-rc.1`, built against the published
`malt-core v0.0.10-rc.1` release at commit
`933ef9824d5d852f819bdc91b244ce7b7e800706`.
[`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,
Expand Down Expand Up @@ -100,10 +100,13 @@ from committing source.
## Authentication API

`verifyAuthenticationLocally({request, result, ...options})` verifies the
caller-selected Root, typed steps and binding/range operation through Core.
`malt.authentication/1` also authenticates early path absence. Typed inputs
preserve base64 bytes and decimal uint64 strings; JavaScript performs no
input hashing or application path normalization.
caller-selected Root, label steps and binding/range operation through Core.
`malt.authentication/3` also authenticates early path absence. Labels are
base64-encoded opaque bytes. `encodeIndexLabel(bigint)` serializes Direct
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.

`prepareAuthentication(backend, stateJSON)` builds a complete candidate.
`updateAuthentication(backend, candidateJSON, stateJSON)` verifies a complete
Expand Down Expand Up @@ -161,7 +164,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.9` release. Its current host and batch APIs are bound to the
Core `v0.0.10-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.

Expand Down
11 changes: 6 additions & 5 deletions assets/verifier/PROVENANCE.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"schema": "malt.ts-verifier.provenance/v1",
"source_repository": "https://github.com/DeWebProtocol/malt-ts.git",
"build_inputs_sha256": "f6d894fa39215a1c87a1a35ee6afa1af59d79191dcb2aadd9c1eeb4331044fc0",
"build_inputs_sha256": "a09908180f8fb79c4e6136c24f46deabc93a54dca0bfe106ecf82e8384f4af8f",
"core": {
"module_path": "github.com/dewebprotocol/malt-core",
"module_version": "v0.0.9",
"module_version": "v0.0.10-rc.1",
"source_repository": "https://github.com/DeWebProtocol/malt-core.git",
"source_commit": "e389418cf6715ae58a97255196833b410b0962d1",
"module_sum": "h1:e4jNMhZ0dkaiFFLfg/8xxUFAP7JK//8KLxqp78s2nso=",
"source_commit": "933ef9824d5d852f819bdc91b244ce7b7e800706",
"module_sum": "h1:bZl8z4y0Uug6H79KAUBjwJ28RjOQouONTlF9Ede57sc=",
"go_mod_sum": "h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs="
},
"target": "js/wasm",
"exports": [
"maltVerifyAuthentication"
"maltVerifyAuthentication",
"maltDeriveCoordinate"
],
"go_version": "go1.26.0",
"go_toolchain": "go version go1.26.0 linux/amd64",
Expand Down
4 changes: 2 additions & 2 deletions assets/verifier/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
9f284de8b16efe4d2b941c966840199a325b4587cb9cee295fbcfa9c36ab9a5d malt-verifier.wasm
f920f17dfd846afb90e30c04919a97d9a936a1cd21ba78deba9c468a9bcd372d malt-verifier.wasm
0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js
37428609c8e71a9986a3df0181359f076cd3c1f54293e2529369bc8a6db72e89 PROVENANCE.json
96666561a87b1ecd5a099d4de3f2f7a79f7b0432e80066a9248f36bd4d1fd8b9 PROVENANCE.json
Binary file modified assets/verifier/malt-verifier.wasm
Binary file not shown.
8 changes: 4 additions & 4 deletions assets/writer/PROVENANCE.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"schema": "malt.ts-writer.provenance/v1",
"source_repository": "https://github.com/DeWebProtocol/malt-ts.git",
"build_inputs_sha256": "f6d894fa39215a1c87a1a35ee6afa1af59d79191dcb2aadd9c1eeb4331044fc0",
"build_inputs_sha256": "a09908180f8fb79c4e6136c24f46deabc93a54dca0bfe106ecf82e8384f4af8f",
"core": {
"module_path": "github.com/dewebprotocol/malt-core",
"module_version": "v0.0.9",
"module_version": "v0.0.10-rc.1",
"source_repository": "https://github.com/DeWebProtocol/malt-core.git",
"source_commit": "e389418cf6715ae58a97255196833b410b0962d1",
"module_sum": "h1:e4jNMhZ0dkaiFFLfg/8xxUFAP7JK//8KLxqp78s2nso=",
"source_commit": "933ef9824d5d852f819bdc91b244ce7b7e800706",
"module_sum": "h1:bZl8z4y0Uug6H79KAUBjwJ28RjOQouONTlF9Ede57sc=",
"go_mod_sum": "h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs="
},
"target": "js/wasm",
Expand Down
10 changes: 5 additions & 5 deletions assets/writer/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
82a734f8cf71608a21fcf5d8cd1ed213096373dd479a833e66eac53f62bad09d malt-writer-kzg.wasm
222a66d912f6498474353297c5ef21eb72103dbdaa9cf9e58062218dd6fdc66a malt-writer-ipa-direct.wasm
3a9bda0d5f5c889ae9be2ef9e179c9848e5d48ab4d194360f5c84f85fec49f7f malt-writer-ipa-compact.wasm
cd23cceeb13c8765a6ff8e318dca4d37cf596a851af1641fd082f8e49222f3c5 malt-writer-ipa-fast.wasm
32f533363304bd92e9198d1f5642a55a1c809a75e19bfbde18259d99b4fc5ce0 malt-writer-kzg.wasm
49d24f768c0b7361bb42c2629408ed55a05faf20301fa075f9e8db9c170c2719 malt-writer-ipa-direct.wasm
fb0326b4a47a80b9d79a40068a34a8f96e01507d004473ccfc80c696d2c432cc malt-writer-ipa-compact.wasm
190c5d081a7ac10b4bee48771b103096d9096d49e14caf8a418f844161d31a7f malt-writer-ipa-fast.wasm
6311876a80f3c9333f20e6a8ae8b55b7235b1f7411d6ae2224bc90b55fe779a2 malt-writer-worker.mjs
968657d9a8818feb23b6463aca609478c81423a93a8b0dc453705ad009214db0 malt-writer-workers.mjs
0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js
4f2a89091cc594deb2f6e5a432b115081dcd0ee00af18d56a26974524ae9909d PROVENANCE.json
35ce4aad116eedbfacc44f8c49632c6f969a27ff94187f9cf3939943fc2276fe PROVENANCE.json
Binary file modified assets/writer/malt-writer-ipa-compact.wasm
Binary file not shown.
Binary file modified assets/writer/malt-writer-ipa-direct.wasm
Binary file not shown.
Binary file modified assets/writer/malt-writer-ipa-fast.wasm
Binary file not shown.
Binary file modified assets/writer/malt-writer-kzg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion cmd/malt-verifier-wasm/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func registerAuthenticationVerifier(backend string) error {
default:
return fmt.Errorf("unsupported verifier backend %q", backend)
}
verifier, initErr := authbuiltin.NewVerifier(nil, profiles...)
verifier, initErr := authbuiltin.NewVerifier(profiles...)
if initErr != nil {
return initErr
}
Expand Down
49 changes: 49 additions & 0 deletions cmd/malt-verifier-wasm/coordinate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//go:build js && wasm

package main

import (
"encoding/json"
"strconv"
"syscall/js"

"github.com/dewebprotocol/malt-core/auth/coordinate"
"github.com/dewebprotocol/malt-core/derivation"
)

func registerCoordinateDerivation() {
js.Global().Set("maltDeriveCoordinate", js.FuncOf(func(_ js.Value, args []js.Value) any {
fail := func(message string) string {
raw, _ := json.Marshal(map[string]string{"error": message})
return string(raw)
}
if len(args) != 2 || args[0].Type() != js.TypeNumber || args[1].Type() != js.TypeObject || !args[1].InstanceOf(js.Global().Get("Uint8Array")) {
return fail("derive expects a profile ID and Uint8Array label")
}
number := args[0].Float()
if number < 0 || number > 255 || number != float64(uint8(number)) {
return fail("invalid derivation profile ID")
}
length := args[1].Get("byteLength").Int()
if length > 96<<20 {
return fail("label exceeds size limit")
}
label := make([]byte, length)
js.CopyBytesToGo(label, args[1])
value, err := derivation.Derive(derivation.ProfileID(uint8(number)), label)
if err != nil {
return fail(err.Error())
}
result := map[string]any{"kind": string(value.Kind)}
if value.Kind == coordinate.Index {
result["index"] = strconv.FormatUint(value.Index, 10)
} else {
result["key"] = coordinate.EncodeKey(value.Key)
}
raw, err := json.Marshal(result)
if err != nil {
return fail(err.Error())
}
return string(raw)
}))
}
1 change: 1 addition & 0 deletions cmd/malt-verifier-wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

func main() {
registerCoordinateDerivation()
backend := requestedBackend()
if err := registerAuthenticationVerifier(backend); err != nil {
js.Global().Set("maltVerifierInitError", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/dewebprotocol/malt-ts

go 1.26.0

require github.com/dewebprotocol/malt-core v0.0.9
require github.com/dewebprotocol/malt-core v0.0.10-rc.1

require (
github.com/bits-and-blooms/bitset v1.24.6 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHH
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.9 h1:e4jNMhZ0dkaiFFLfg/8xxUFAP7JK//8KLxqp78s2nso=
github.com/dewebprotocol/malt-core v0.0.9/go.mod h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs=
github.com/dewebprotocol/malt-core v0.0.10-rc.1 h1:bZl8z4y0Uug6H79KAUBjwJ28RjOQouONTlF9Ede57sc=
github.com/dewebprotocol/malt-core v0.0.10-rc.1/go.mod h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs=
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=
Expand Down
6 changes: 3 additions & 3 deletions malt-core.lock.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"schema": "malt.ts-core-lock/v2",
"module_path": "github.com/dewebprotocol/malt-core",
"module_version": "v0.0.9",
"module_version": "v0.0.10-rc.1",
"source_repository": "https://github.com/DeWebProtocol/malt-core.git",
"source_commit": "e389418cf6715ae58a97255196833b410b0962d1",
"module_sum": "h1:e4jNMhZ0dkaiFFLfg/8xxUFAP7JK//8KLxqp78s2nso=",
"source_commit": "933ef9824d5d852f819bdc91b244ce7b7e800706",
"module_sum": "h1:bZl8z4y0Uug6H79KAUBjwJ28RjOQouONTlF9Ede57sc=",
"go_mod_sum": "h1:o6L8K9vJp5hyrVo3fUtSsj0rvNpcboOcOb3nQwnR/gs="
}
4 changes: 2 additions & 2 deletions node-tests/malt-writer-workers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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/0"}' });
assert.equal(await bootstrap, '{"profile":"malt.authentication/0"}');
worker.respond(bootstrapRequest, { result: '{"profile":"malt.authentication/2"}' });
assert.equal(await bootstrap, '{"profile":"malt.authentication/2"}');

const invalidLoad = writer.importAuthentication("kzg", new Uint8Array([1]));
const invalidRequest = await worker.nextRequest();
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dewebprotocol/malt",
"version": "0.0.2",
"version": "0.0.3-rc.1",
"description": "Stable TypeScript and browser WASM SDK for MALT",
"type": "module",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-wasm-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-v1.json" | awk '{print $1}')"
authentication_corpus_sha256="$(sha256sum "${core_module_dir}/conformance/authentication-v2.json" | awk '{print $1}')"

chmod 0644 "${verifier_staging}/"* "${writer_staging}/"*
(
Expand Down Expand Up @@ -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/1", sha256: process.env.AUTHENTICATION_CORPUS_SHA256},
authentication: {schema: "malt.conformance.authentication/2", sha256: process.env.AUTHENTICATION_CORPUS_SHA256},
},
codegen_environment: {CGO_ENABLED: "0", GOEXPERIMENT: "none", GOWASM: "", GOFIPS140: "off"},
components: {verifier: component("VERIFIER"), writer: component("WRITER")}
Expand Down
3 changes: 2 additions & 1 deletion scripts/build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ PROVENANCE_PATH="${verifier_staging}/PROVENANCE.json" node -e '
},
target: "js/wasm",
exports: [
"maltVerifyAuthentication"
"maltVerifyAuthentication",
"maltDeriveCoordinate"
],
go_version: process.env.GO_VERSION,
go_toolchain: process.env.GO_TOOLCHAIN,
Expand Down
3 changes: 2 additions & 1 deletion scripts/check-verifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ MALT_SUM="${malt_module_sum}" MALT_GO_MOD_SUM="${malt_go_mod_sum}" \
CGO_ENABLED: "0", GOEXPERIMENT: "none", GOWASM: "", GOFIPS140: "off"
}
const expectedExports = [
"maltVerifyAuthentication"
"maltVerifyAuthentication",
"maltDeriveCoordinate"
]
if (
provenance.schema !== "malt.ts-verifier.provenance/v1" ||
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-wasm-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-v1.json" | awk '{print $1}')"
expected_authentication_corpus_sha256="$(sha256sum "${core_module_dir}/conformance/authentication-v2.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)"
Expand Down Expand Up @@ -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/1", sha256: process.env.AUTHENTICATION_CORPUS_SHA256},
authentication: {schema: "malt.conformance.authentication/2", 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" ||
Expand Down
14 changes: 7 additions & 7 deletions scripts/run-authentication-batch-wasm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ 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, input_rule: 1, 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({ input: { kind: 'label', data: 'ZmlsZQ==' }, target: { '/': 'bafkqaaa' } })
state.entries.push({ label: 'ZmlsZQ==', target: { '/': 'bafkqaaa' } })
const next = JSON.parse(await globalThis.maltUpdateAuthentication(json(base), json(state)))
// Both complete and retained no-op updates must stay materializable.
const unchanged = JSON.parse(await globalThis.maltUpdateAuthentication(json(next), json(state)))
const retained = JSON.parse(await globalThis.maltImportAuthentication(json(next)))
const noOpHandle = JSON.parse(await globalThis.maltApplyAuthentication(new TextEncoder().encode(retained.handle), json({ profile: 'malt.authentication-delta/0', changes: [] })))
const noOpHandle = JSON.parse(await globalThis.maltApplyAuthentication(new TextEncoder().encode(retained.handle), json({ profile: 'malt.authentication-delta/1', changes: [] })))
const noOp = JSON.parse(await globalThis.maltExportAuthentication(new TextEncoder().encode(noOpHandle.handle)))
for (const candidate of [unchanged, noOp]) {
assert.equal(candidate.root, next.root)
assert.equal(candidate.previous, next.previous)
const noOpBatch = { profile: 'malt.authentication-batch/0', transaction_id: 'no-op', base: next.root, root: next.root, candidates: [candidate] }
const noOpBatch = { profile: 'malt.authentication-batch/1', 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/0', 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/1', 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/0', transaction_id: 'wasm-batch', base: base.root, root: next.root, candidates: [base, next] }
const batch = { profile: 'malt.authentication-batch/1', 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/0', transaction_id: batch.transaction_id, base: batch.base, root: batch.root, digest, durable_boundary: 'wasm-test/0' }
const receipt = { profile: 'malt.authentication-receipt/1', 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]: '' })))
Expand Down
9 changes: 5 additions & 4 deletions scripts/run-authentication-router-smoke.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { encodeIndexLabel } from '../src/coordinate.mjs'
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { Worker as NodeWorker } from 'node:worker_threads'
Expand Down Expand Up @@ -32,14 +33,14 @@ const writer = await createBrowserMaltWriter({
const bytes = value => new TextEncoder().encode(value)
const json = value => bytes(JSON.stringify(value))
const state = {
descriptor: { layout: 2, input_rule: 0, vc_profile: 2 },
entries: [{ input: { kind: 'index', number: '0' }, target: { '/': 'bafkqaaa' } }]
descriptor: { layout: 2, derivation_profile: 3, vc_profile: 2 },
entries: [{ label: encodeIndexLabel('0'), target: { '/': 'bafkqaaa' } }]
}
try {
const base = JSON.parse(await writer.createAuthentication('ipa', json(state)))
const next = JSON.parse(await writer.applyAuthentication('ipa', bytes(base.handle), json({
profile: 'malt.authentication-delta/0',
changes: [{ input: { kind: 'index', number: '0' }, before: 'bafkqaaa', after: 'bafkreigh2akiscaildcw4535x7k5vfhq56bqddhziq3p4mwfmlz4vfu2ta' }]
profile: 'malt.authentication-delta/1',
changes: [{ label: encodeIndexLabel('0'), before: 'bafkqaaa', after: 'bafkreigh2akiscaildcw4535x7k5vfhq56bqddhziq3p4mwfmlz4vfu2ta' }]
})))
assert.notEqual(next.root, base.root)
const exported = JSON.parse(await writer.exportAuthentication('ipa', bytes(next.handle)))
Expand Down
Loading
Loading