space-data-module-sdk 0.10.4 → 0.11.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.
@@ -139,6 +139,9 @@ function parseArgs(argv) {
139
139
  case "--require-signature":
140
140
  options.requireSignature = true;
141
141
  break;
142
+ case "--scope":
143
+ options.signatureScope = requireValue(argv, ++index, value);
144
+ break;
142
145
  case "--fixture":
143
146
  options.fixturePath = path.resolve(requireValue(argv, ++index, value));
144
147
  break;
@@ -167,6 +170,9 @@ function parseArgs(argv) {
167
170
  case "--allow-single-lane":
168
171
  options.allowSingleLane = true;
169
172
  break;
173
+ case "--allow-test-signer":
174
+ options.allowTestSigner = true;
175
+ break;
170
176
  case "--gate-manifest":
171
177
  options.gateManifestPath = path.resolve(
172
178
  requireValue(argv, ++index, value),
@@ -257,7 +263,7 @@ function printUsage() {
257
263
  space-data-module conformance estimation --evidence ./conformance/estimation-evidence.json --json
258
264
  space-data-module conformance estimation --self-test (proves EKF/UKF alias, runtime divergence, and placeholder OCM are caught)
259
265
  space-data-module flow check ./flows/my.flow.json --deps ./modules-root
260
- space-data-module flow compile ./flows/my.flow.json --deps ./modules-root [--out ./flows/my/dist]
266
+ space-data-module flow compile ./flows/my.flow.json --deps ./modules-root [--out ./flows/my/dist] [--allow-test-signer]
261
267
  space-data-module protect --manifest ./manifest.json --wasm ./dist/module.wasm --json
262
268
  space-data-module protect --manifest ./manifest.json --wasm ./dist/module.wasm --recipient-public-key <hex> --out ./dist/module.wasm.enc
263
269
  space-data-module protect --manifest ./manifest.json --wasm ./dist/module.wasm --single-file-bundle --out ./dist/module.bundle.wasm
@@ -343,6 +349,7 @@ async function runFlow(argv) {
343
349
  dependencies,
344
350
  outDir,
345
351
  flowSourcePath: flowPath,
352
+ allowTestSigner: options.allowTestSigner === true,
346
353
  });
347
354
  if (options.json) {
348
355
  console.log(
@@ -760,6 +767,7 @@ async function runSign(argv) {
760
767
  const result = await signModuleArtifact(wasmBytes, {
761
768
  privateKeySeedHex: keypair.privateKeySeedHex,
762
769
  keyId: keypair.keyId ?? null,
770
+ ...(options.signatureScope ? { signatureScope: options.signatureScope } : {}),
763
771
  });
764
772
  const outputPath = options.outputPath ?? options.wasmPath;
765
773
  await writeFile(outputPath, result.wasmBytes);
@@ -770,6 +778,9 @@ async function runSign(argv) {
770
778
  outputPath,
771
779
  keyId: result.signature.keyId,
772
780
  publicKeyHex: result.signature.publicKeyHex,
781
+ signatureScope: result.signatureScope,
782
+ statementDomain: result.signature.statementDomain ?? null,
783
+ signedHashHex: result.signedHashHex,
773
784
  canonicalModuleHashHex: result.canonicalModuleHashHex,
774
785
  },
775
786
  null,
@@ -780,6 +791,9 @@ async function runSign(argv) {
780
791
  console.log(`signed=${outputPath}`);
781
792
  console.log(`keyId=${result.signature.keyId}`);
782
793
  console.log(`publicKeyHex=${result.signature.publicKeyHex}`);
794
+ console.log(`signatureScope=${result.signatureScope}`);
795
+ if (result.signature.statementDomain) console.log(`statementDomain=${result.signature.statementDomain}`);
796
+ console.log(`signedHashHex=${result.signedHashHex}`);
783
797
  console.log(`canonicalModuleHashHex=${result.canonicalModuleHashHex}`);
784
798
  }
785
799
  return 0;
@@ -800,13 +814,21 @@ async function runVerify(argv) {
800
814
  trustedPublicKeys,
801
815
  requireSignature: options.requireSignature ?? true,
802
816
  });
817
+ // The form verified is named by its statement domain. The result's
818
+ // signatureScope ("module", the node's status label, kept for the shared
819
+ // vectors) is not printed: it reads like the removed bare-digest form.
820
+ const { signatureScope: _nodeStatusLabel, ...printed } = result;
803
821
  if (options.json) {
804
- console.log(JSON.stringify(result, null, 2));
822
+ console.log(JSON.stringify(printed, null, 2));
805
823
  } else {
806
- console.log(`verified=${result.verified}`);
807
- console.log(`signed=${result.signed}`);
808
- if (result.keyId) console.log(`keyId=${result.keyId}`);
809
- if (result.publicKeyHex) console.log(`publicKeyHex=${result.publicKeyHex}`);
824
+ console.log(`verified=${printed.verified}`);
825
+ console.log(`signed=${printed.signed}`);
826
+ // The signer's role comes from the verified KEY. The entry's keyId is an
827
+ // unsigned label the file carries about itself, printed as such.
828
+ if (printed.verified) console.log(`signer=${printed.testSigner ? "test" : "other"}`);
829
+ if (printed.publicKeyHex) console.log(`publicKeyHex=${printed.publicKeyHex}`);
830
+ if (printed.keyId) console.log(`unsignedKeyId=${printed.keyId}`);
831
+ if (printed.statementDomain) console.log(`statementDomain=${printed.statementDomain}`);
810
832
  }
811
833
  return result.verified ? 0 : 1;
812
834
  }
@@ -120,7 +120,7 @@ space-data-module conformance estimation --self-test # planted failures</code
120
120
  <div class="table-wrap"><table><thead><tr><th>Planted defect</th><th>Real-world citation</th><th>Must be caught by</th></tr></thead><tbody><tr><td><code>units-km</code> (1000× error)</td><td>the <code>orbpro_propagator.h</code> km/meters contradiction (finding §4.1)</td><td><code>tierB/anchors</code></td></tr><tr><td><code>leaky-destroy</code></td><td><code>destroySource(){}</code> in both shipped propagators (§4.5)</td><td><code>tier4/lifecycle-leak</code></td></tr><tr><td><code>confident-nonsense</code> (accepts e ≥ 1)</td><td>the underground phasing orbit (§5)</td><td><code>tierC/typed-refusals</code></td></tr><tr><td><code>count-fallback</code> (returns success, not the handle)</td><td>three families deriving count−1 (§4.4)</td><td><code>tierC/create-returns-handle</code></td></tr><tr><td><code>frame-lies</code> (declares TEME, writes ECEF)</td><td>the Δv frame never pinned (§4.3)</td><td><code>tierC/frame-flags-reserved-declared</code></td></tr><tr><td><code>batch-divergence</code></td><td>batch path not the same physics</td><td><code>tierC/batch-single-agreement</code></td></tr><tr><td><code>nondeterministic</code></td><td>byte-determinism is the parity envelope's floor</td><td><code>tierC/determinism-byte-identity</code></td></tr><tr><td><code>missing-exports</code></td><td>destroy was optional once; it is not now</td><td><code>tier0/instantiation-and-exports</code></td></tr></tbody></table></div>
121
121
  <p>The self-test exits 0 only when the conformant baseline mock is clean AND every planted defect is caught by the check that owns it. It needs no toolchain, no artifact and no network — <code>npm run conformance:self-test</code>.</p>
122
122
  <h2 id="receipt-trust-wave-4-not-yet-wired"><a class="anchor" href="#receipt-trust-wave-4-not-yet-wired" aria-hidden="true">#</a>Receipt &amp; trust (Wave 4, not yet wired)</h2>
123
- <p>The conformance receipt travels as a bundle <code>ATTESTATION</code> entry (publisher-signed under bundle scope); the graduated listing requirement (receipt REQUIRED for <code>CORE</code>+<code>ANONYMOUS</code>, badge for <code>RECOMMENDED</code>) and the <code>SDN-CONFORMANCE-RECEIPT-V1</code> third-party attestor domain are W4.1/W4.2 of the program — see the finding §5 &quot;Receipt &amp; trust&quot;.</p>
123
+ <p>The conformance receipt travels as a bundle <code>ATTESTATION</code> entry in the trailer. The module's publication signature does not cover it (that signature covers only the bytes before the trailer), so the entry needs its own attestor signature under the attestor domain named below. The graduated listing requirement (receipt REQUIRED for <code>CORE</code>+<code>ANONYMOUS</code>, badge for <code>RECOMMENDED</code>) and the <code>SDN-CONFORMANCE-RECEIPT-V1</code> third-party attestor domain are W4.1/W4.2 of the program — see the finding §5 &quot;Receipt &amp; trust&quot;.</p>
124
124
  <p>The estimation self-test plants runtime-byte divergence, the historical EKF/UKF covariance alias, and a placeholder <code>$OCM</code>. All three must be caught.</p>
125
125
  <h2 id="reference-implementation"><a class="anchor" href="#reference-implementation" aria-hidden="true">#</a>Reference implementation</h2>
126
126
  <p><code>space-data-network-modules propagator/keplerian-reference</code> is the exemplar the kit was generalized from: its <code>tests/</code> are the original expression of these checks, its <code>vectors/</code> suite is the corpus format, and <code>tests/sdk-conformance-runner.test.mjs</code> proves the runner reaches the same verdict on the same artifact — including the corrupted-corpus negative control.</p>
@@ -84,8 +84,10 @@ toolchain, no artifact and no network — `npm run conformance:self-test`.
84
84
 
85
85
  ## Receipt & trust (Wave 4, not yet wired)
86
86
 
87
- The conformance receipt travels as a bundle `ATTESTATION` entry
88
- (publisher-signed under bundle scope); the graduated listing requirement
87
+ The conformance receipt travels as a bundle `ATTESTATION` entry in the trailer.
88
+ The module's publication signature does not cover it (that signature covers only
89
+ the bytes before the trailer), so the entry needs its own attestor signature
90
+ under the attestor domain named below. The graduated listing requirement
89
91
  (receipt REQUIRED for `CORE`+`ANONYMOUS`, badge for `RECOMMENDED`) and the
90
92
  `SDN-CONFORMANCE-RECEIPT-V1` third-party attestor domain are W4.1/W4.2 of the
91
93
  program — see the finding §5 "Receipt & trust".
@@ -170,13 +170,15 @@
170
170
  </ul>
171
171
  <p>In practice this is the record a host inspects to determine what artifact was published and which signer attested to it.</p>
172
172
  <h3 id="mbl-signature-entry-domain-separation-statementdomain"><a class="anchor" href="#mbl-signature-entry-domain-separation-statementdomain" aria-hidden="true">#</a>MBL <code>signature</code> entry — domain separation (<code>statementDomain</code>)</h3>
173
- <p>The detached Ed25519 signature carried as the MBL bundle's <code>signature</code>-role entry has two forms, and the ARTIFACT chooses which one applies — never the verifier, never a policy:</p>
174
- <div class="table-wrap"><table><thead><tr><th><code>statementDomain</code></th><th>signature covers</th></tr></thead><tbody><tr><td><code>SDN-MODULE-PUBLICATION-V1</code></td><td>`&quot;SDN-MODULE-PUBLICATION-V1&quot; \</td><td>\</td><td>0x00 \</td><td>\</td><td>sha256(portable)`</td></tr><tr><td>absent</td><td>the bare canonical module (or bundle) digest — legacy</td></tr></tbody></table></div>
175
- <p><code>portable</code> is the trailer-stripped payload: the exact bytes the runtime instantiates and the node's capability policy identifies by content hash.</p>
173
+ <p>The detached Ed25519 signature carried as the MBL bundle's <code>signature</code>-role entry has ONE form:</p>
174
+ <div class="table-wrap"><table><thead><tr><th><code>statementDomain</code></th><th>signature covers</th></tr></thead><tbody><tr><td><code>SDN-MODULE-PUBLICATION-V1</code></td><td>`&quot;SDN-MODULE-PUBLICATION-V1&quot; \</td><td>\</td><td>0x00 \</td><td>\</td><td>sha256(portable)`</td></tr></tbody></table></div>
175
+ <p><code>portable</code> is the trailer-stripped payload: the exact bytes the runtime instantiates and the node's capability policy identifies by content hash. The signature covers every byte of it (the code, every data segment, every custom section left in it) and none of the trailer: the MBL entries beside the signature, the manifest copy among them, are not signed. A host takes the manifest from the signed code, never from the trailer, and refuses an artifact whose trailer copy differs from the code's copy.</p>
176
+ <p><code>signModuleArtifact</code> writes it (<code>signatureScope: &quot;publication&quot;</code>, the default and the only value), the same entry, field for field, as the node's signing endpoint; so does the CLI's <code>sign</code>. The entry's <code>signedHashHex</code> is REQUIRED and equal to sha256(portable) (<code>missing_signed_hash</code>, <code>hash_mismatch</code>), and its <code>signedHashAlgorithm</code> is REQUIRED and is the fixed label <code>sha256-canonical-module-hash</code>, the string the node writes; it is a label, not a description of the hash (<code>unsupported_hash_algorithm</code>).</p>
177
+ <p>A signature with no <code>statementDomain</code> is one of the two forms removed in 0.11.0, and every verifier in this SDK refuses it by name, before the signer is asked about: <code>legacy_module_signature</code> for the bare canonical module digest (<code>signedHashAlgorithm</code> <code>sha256-canonical-module-hash</code> or absent) and <code>legacy_bundle_signature</code> for the whole-bundle digest (<code>signedHashAlgorithm</code> <code>sha256-sdn-module-bundle-v1</code>). No writer produces either, and <code>signatureScope: &quot;module&quot;</code> or <code>&quot;bundle&quot;</code> is refused. A module signed in either must be signed again.</p>
176
178
  <p>The domain prefix exists because the node's publisher key is the NODE key, and that one bonded key signs several unrelated kinds of statement (dataset publications, module artifacts, update SIGNALS — the advisory pub/sub nudge a publisher pushes so every install upgrades itself in place, which has a live producer — and, still reserved, update manifests). If every statement were a bare SHA-256 digest, a caller who could reach the node's signing endpoint could submit the bytes of one kind of document and staple the returned signature onto another. An ASCII domain label, a <code>NUL</code> that cannot occur inside the label, and a fixed-width 32-byte tail put each statement kind in a disjoint message space with no length ambiguity anywhere in the preimage.</p>
177
179
  <p>The domain registry is <strong>closed</strong>: a verifier refuses any label that is not registered, and a module verifier additionally refuses any registered label other than <code>SDN-MODULE-PUBLICATION-V1</code> — so a signature minted for an update manifest or an update signal can never be replayed into a module trailer, which the shared vectors pin as <code>foreign-registered-domain</code> and <code>update-signal-domain-is-refused-for-a-module</code>. Adding a domain is a reviewed change in every implementation at once (<code>src/bundle/sigdomain.js</code> here; <code>internal/sigdomain</code> and its kubo twin in the node), never a request parameter.</p>
178
180
  <p><code>statementDomain</code> and <code>algorithm</code> are compared after trimming <strong>Go's</strong> whitespace set (<code>unicode.IsSpace</code> / Unicode <code>White_Space</code>), which is not JavaScript's: Go trims U+0085 NEL and JS does not, JS trims U+FEFF BOM and Go does not. Either mismatch is a &quot;loads on the node, dies in the browser&quot; split, so both are pinned by vectors rather than left to each language's default.</p>
179
- <p>Legacy artifacts that predate the field keep verifying unchanged. The forms, the preimage bytes and every refusal reason are pinned as shared cross-language vectors in <code>test/support/statement-domain-vectors.json</code>, byte-identical to the node's copies, and asserted by the JS suite and both Go suites.</p>
181
+ <p>The forms, the preimage bytes and every refusal reason are pinned as shared cross-language vectors in <code>test/support/statement-domain-vectors.json</code>, byte-identical to the node's copies, and asserted by the JS suite and both Go suites. Four vectors, <code>legacy-bare-digest-no-domain</code> and the three <code>bundle-scope-*</code>, are refused by this SDK where the file records the node's verdict; the JS suite states those differences by name.</p>
180
182
  <h3 id="enc-encrypted-delivery-extension"><a class="anchor" href="#enc-encrypted-delivery-extension" aria-hidden="true">#</a><code>ENC</code> encrypted-delivery extension</h3>
181
183
  <p><code>ENC</code> carries the decryption parameters for a transport-protected module:</p>
182
184
  <ul>
@@ -115,16 +115,36 @@ published and which signer attested to it.
115
115
  ### MBL `signature` entry — domain separation (`statementDomain`)
116
116
 
117
117
  The detached Ed25519 signature carried as the MBL bundle's `signature`-role
118
- entry has two forms, and the ARTIFACT chooses which one applies — never the
119
- verifier, never a policy:
118
+ entry has ONE form:
120
119
 
121
120
  | `statementDomain` | signature covers |
122
121
  | ---------------------------- | --------------------------------------------------- |
123
122
  | `SDN-MODULE-PUBLICATION-V1` | `"SDN-MODULE-PUBLICATION-V1" \|\| 0x00 \|\| sha256(portable)` |
124
- | absent | the bare canonical module (or bundle) digest — legacy |
125
123
 
126
124
  `portable` is the trailer-stripped payload: the exact bytes the runtime
127
- instantiates and the node's capability policy identifies by content hash.
125
+ instantiates and the node's capability policy identifies by content hash. The
126
+ signature covers every byte of it (the code, every data segment, every custom
127
+ section left in it) and none of the trailer: the MBL entries beside the
128
+ signature, the manifest copy among them, are not signed. A host takes the
129
+ manifest from the signed code, never from the trailer, and refuses an artifact
130
+ whose trailer copy differs from the code's copy.
131
+
132
+ `signModuleArtifact` writes it (`signatureScope: "publication"`, the default and
133
+ the only value), the same entry, field for field, as the node's signing
134
+ endpoint; so does the CLI's `sign`. The entry's `signedHashHex` is REQUIRED and
135
+ equal to sha256(portable) (`missing_signed_hash`, `hash_mismatch`), and its
136
+ `signedHashAlgorithm` is REQUIRED and is the fixed label
137
+ `sha256-canonical-module-hash`, the string the node writes; it is a label, not
138
+ a description of the hash (`unsupported_hash_algorithm`).
139
+
140
+ A signature with no `statementDomain` is one of the two forms removed in
141
+ 0.11.0, and every verifier in this SDK refuses it by name, before the signer is
142
+ asked about: `legacy_module_signature` for the bare canonical module digest
143
+ (`signedHashAlgorithm` `sha256-canonical-module-hash` or absent) and
144
+ `legacy_bundle_signature` for the whole-bundle digest (`signedHashAlgorithm`
145
+ `sha256-sdn-module-bundle-v1`). No writer produces either, and
146
+ `signatureScope: "module"` or `"bundle"` is refused. A module signed in either
147
+ must be signed again.
128
148
 
129
149
  The domain prefix exists because the node's publisher key is the NODE key, and
130
150
  that one bonded key signs several unrelated kinds of statement (dataset
@@ -153,10 +173,12 @@ JavaScript's: Go trims U+0085 NEL and JS does not, JS trims U+FEFF BOM and Go
153
173
  does not. Either mismatch is a "loads on the node, dies in the browser" split,
154
174
  so both are pinned by vectors rather than left to each language's default.
155
175
 
156
- Legacy artifacts that predate the field keep verifying unchanged. The forms,
157
- the preimage bytes and every refusal reason are pinned as shared cross-language
158
- vectors in `test/support/statement-domain-vectors.json`, byte-identical to the
159
- node's copies, and asserted by the JS suite and both Go suites.
176
+ The forms, the preimage bytes and every refusal reason are pinned as shared
177
+ cross-language vectors in `test/support/statement-domain-vectors.json`,
178
+ byte-identical to the node's copies, and asserted by the JS suite and both Go
179
+ suites. Four vectors, `legacy-bare-digest-no-domain` and the three
180
+ `bundle-scope-*`, are refused by this SDK where the file records the node's
181
+ verdict; the JS suite states those differences by name.
160
182
 
161
183
  ### `ENC` encrypted-delivery extension
162
184
 
@@ -125,8 +125,8 @@ space-data-module protect \
125
125
  --wasm ./dist/module.wasm \
126
126
  --key ./keys/module-signing-keypair.json \
127
127
  --out ./dist/module.signed.wasm</code></pre></div>
128
- <div class="table-wrap"><table><thead><tr><th>Flag</th><th>Required</th><th>Meaning</th></tr></thead><tbody><tr><td><code>--wasm &lt;path&gt;</code></td><td>yes</td><td>Artifact to sign</td></tr><tr><td><code>--key &lt;path&gt;</code></td><td>yes</td><td>Keypair JSON; must contain <code>privateKeySeedHex</code></td></tr><tr><td><code>--out &lt;path&gt;</code></td><td>no</td><td>Output path; otherwise the input is signed in place</td></tr></tbody></table></div>
129
- <p>The key file must carry <code>privateKeySeedHex</code> or the command refuses. Output reports <code>signed</code>, <code>keyId</code>, <code>publicKeyHex</code>, and <code>canonicalModuleHashHex</code> — the canonical hash is what a verifier recomputes, so it is stable across the appended trailer.</p>
128
+ <div class="table-wrap"><table><thead><tr><th>Flag</th><th>Required</th><th>Meaning</th></tr></thead><tbody><tr><td><code>--wasm &lt;path&gt;</code></td><td>yes</td><td>Artifact to sign</td></tr><tr><td><code>--key &lt;path&gt;</code></td><td>yes</td><td>Keypair JSON; must contain <code>privateKeySeedHex</code></td></tr><tr><td><code>--scope &lt;form&gt;</code></td><td>no</td><td><code>publication</code>, the one form (the <code>SDN-MODULE-PUBLICATION-V1</code> statement over the bytes before the trailer) and the default. <code>module</code> and <code>bundle</code> are refused: those forms were removed in 0.11.0</td></tr><tr><td><code>--out &lt;path&gt;</code></td><td>no</td><td>Output path; otherwise the input is signed in place</td></tr></tbody></table></div>
129
+ <p>The key file must carry <code>privateKeySeedHex</code> or the command refuses. Output reports <code>signed</code>, <code>keyId</code>, <code>publicKeyHex</code>, <code>signatureScope</code>, <code>statementDomain</code>, <code>signedHashHex</code> and <code>canonicalModuleHashHex</code>. Any previous signature entry is replaced, whatever its form. The form is defined in <a href="./module-publication-standard.html">the publication standard</a>.</p>
130
130
  <h2 id="verify"><a class="anchor" href="#verify" aria-hidden="true">#</a>Verify</h2>
131
131
  <div class="codeblock"><div class="codeblock-head">sh</div><pre><code>space-data-module verify \
132
132
  --wasm ./dist/module.wasm \
@@ -135,7 +135,7 @@ space-data-module protect \
135
135
  <div class="codeblock"><div class="codeblock-head">sh</div><pre><code>space-data-module verify \
136
136
  --wasm ./dist/module.wasm \
137
137
  --key ./keys/module-signing-keypair.json</code></pre></div>
138
- <p><code>--trusted</code> takes a comma-separated list of trusted public keys; <code>--key</code> reads <code>publicKeyHex</code> out of a keypair JSON instead. Signature requirement defaults to true. Output reports <code>verified</code>, <code>signed</code>, <code>keyId</code>, <code>publicKeyHex</code>, and the process exits non-zero unless verification succeeded.</p>
138
+ <p><code>--trusted</code> takes a comma-separated list of trusted public keys; <code>--key</code> reads <code>publicKeyHex</code> out of a keypair JSON instead. Signature requirement defaults to true. Output reports <code>verified</code>, <code>signed</code>, <code>signer</code> (<code>test</code> or <code>other</code>, from the verified key), <code>publicKeyHex</code>, <code>unsignedKeyId</code> (a label the file carries about itself) and <code>statementDomain</code>, the form verified; check <code>statementDomain</code>, not a scope. The process exits non-zero unless verification succeeded. An artifact signed in the bare module digest form is refused with <code>legacy_module_signature</code>, one in the whole-bundle form with <code>legacy_bundle_signature</code>; sign it again.</p>
139
139
  <h2 id="key-custody"><a class="anchor" href="#key-custody" aria-hidden="true">#</a>Key custody</h2>
140
140
  <p>Signing keys are HD-derived from a node's root identity by default; supplying an external key is an explicit opt-in. Never commit a private key or a mnemonic to a repository, and never paste one into a build log. The dev keypairs that appear in the SDK's own test fixtures are test material and are not valid for a published module.</p>
141
141
  <h2 id="honest-gaps"><a class="anchor" href="#honest-gaps" aria-hidden="true">#</a>Honest gaps</h2>
@@ -75,12 +75,14 @@ space-data-module sign \
75
75
  | --- | --- | --- |
76
76
  | `--wasm <path>` | yes | Artifact to sign |
77
77
  | `--key <path>` | yes | Keypair JSON; must contain `privateKeySeedHex` |
78
+ | `--scope <form>` | no | `publication`, the one form (the `SDN-MODULE-PUBLICATION-V1` statement over the bytes before the trailer) and the default. `module` and `bundle` are refused: those forms were removed in 0.11.0 |
78
79
  | `--out <path>` | no | Output path; otherwise the input is signed in place |
79
80
 
80
81
  The key file must carry `privateKeySeedHex` or the command refuses. Output
81
- reports `signed`, `keyId`, `publicKeyHex`, and `canonicalModuleHashHex` — the
82
- canonical hash is what a verifier recomputes, so it is stable across the
83
- appended trailer.
82
+ reports `signed`, `keyId`, `publicKeyHex`, `signatureScope`, `statementDomain`,
83
+ `signedHashHex` and `canonicalModuleHashHex`. Any previous
84
+ signature entry is replaced, whatever its form. The form is defined in
85
+ [the publication standard](./module-publication-standard.md).
84
86
 
85
87
  ## Verify
86
88
 
@@ -99,8 +101,13 @@ space-data-module verify \
99
101
 
100
102
  `--trusted` takes a comma-separated list of trusted public keys; `--key` reads
101
103
  `publicKeyHex` out of a keypair JSON instead. Signature requirement defaults to
102
- true. Output reports `verified`, `signed`, `keyId`, `publicKeyHex`, and the
103
- process exits non-zero unless verification succeeded.
104
+ true. Output reports `verified`, `signed`, `signer` (`test` or `other`, from the
105
+ verified key), `publicKeyHex`, `unsignedKeyId` (a label the file carries about
106
+ itself) and `statementDomain`, the form verified; check `statementDomain`, not a
107
+ scope. The process exits non-zero unless
108
+ verification succeeded. An artifact signed in the bare module digest form is
109
+ refused with `legacy_module_signature`, one in the whole-bundle form with
110
+ `legacy_bundle_signature`; sign it again.
104
111
 
105
112
  ## Key custody
106
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "space-data-module-sdk",
3
- "version": "0.10.4",
3
+ "version": "0.11.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Module SDK for building, validating, signing, and deploying WebAssembly modules on the Space Data Network.",
6
6
  "type": "module",
@@ -93,7 +93,8 @@
93
93
  "templates/"
94
94
  ],
95
95
  "scripts": {
96
- "test": "node scripts/flatsql-release-e2e.mjs",
96
+ "test": "node scripts/flatsql-release-e2e.mjs && npm run test:signatures",
97
+ "test:signatures": "node --test test/module-signature-forms.test.js test/module-signature-writer.test.js test/module-signing.test.js test/signature-policy-keys.test.js test/signature-entry-parsing.test.js test/signed-code-manifest.test.js test/code-manifest-not-run.test.js test/statement-domain-parity.test.js test/loader-verified-bytes.test.js test/flow-compiler.test.js test/isomorphic-flow-host.test.js",
97
98
  "test:host-surfaces": "node --test test/node-host.test.js test/host-abi.test.js test/browser-host.test.js test/browser-module-harness.test.js test/testing-harness.test.js test/browser-owner-tls.test.js",
98
99
  "test:runtime-matrix": "SPACE_DATA_MODULE_SDK_ENABLE_RUNTIME_MATRIX=1 node --test test/runtime-matrix.test.js",
99
100
  "test:parity": "node --test test/parity-harness.test.js",