Protect and sign
Once a module passes conformance and the parity gate, it is protected (optionally encrypted, with its manifest attached), signed, and verified. All three verbs are implemented today in space-data-module.
Artifact layout
A protected, published artifact is a single file:
protected-payload-bytes || REC-flatbuffer-bytes || uint32le(REC length) || "$REC"The trailer is appended after the payload, so a consumer reads the last four bytes for the $REC magic, then the preceding little-endian uint32 length, then the record. The record types themselves (REC, MBL, PNM, ENC) are Space Data Standards messages; this SDK consumes the generated classes, it does not define them. See the module publication standard.
Protect
protect attaches the manifest to the artifact and, when a recipient key is supplied, encrypts the payload for that recipient.
space-data-module protect \
--manifest ./manifest.json \
--wasm ./dist/module.wasm \
--json# encrypted for a specific recipient
space-data-module protect \
--manifest ./manifest.json \
--wasm ./dist/module.wasm \
--recipient-public-key <hex> \
--out ./dist/module.wasm.enc# single-file bundle
space-data-module protect \
--manifest ./manifest.json \
--wasm ./dist/module.wasm \
--single-file-bundle \
--out ./dist/module.bundle.wasm| Flag | Required | Meaning |
|---|---|---|
--manifest <path> | yes | Module manifest JSON |
--wasm <path> | yes | The compiled artifact |
--recipient-public-key <hex> | no | Encrypt the payload for this recipient |
--mnemonic <words> | no | Key material for the protecting identity |
--single-file-bundle | no | Emit one self-contained bundle artifact |
--out <path> | no | Output path; otherwise reported on stdout |
--json | no | Machine-readable result |
Non-JSON output reports artifactId, signingPublicKeyHex, encrypted, wasmBase64Length, and protectedArtifactBytes.
Sign
space-data-module sign \
--wasm ./dist/module.wasm \
--key ./keys/module-signing-keypair.json \
--out ./dist/module.signed.wasm| Flag | Required | Meaning |
|---|---|---|
--wasm <path> | yes | Artifact to sign |
--key <path> | yes | Keypair JSON; must contain privateKeySeedHex |
--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 |
--out <path> | no | Output path; otherwise the input is signed in place |
The key file must carry privateKeySeedHex or the command refuses. Output reports signed, keyId, publicKeyHex, signatureScope, statementDomain, signedHashHex and canonicalModuleHashHex. Any previous signature entry is replaced, whatever its form. The form is defined in the publication standard.
Verify
space-data-module verify \
--wasm ./dist/module.wasm \
--trusted <pubKeyHex>[,<pubKeyHex>...] \
--require-signaturespace-data-module verify \
--wasm ./dist/module.wasm \
--key ./keys/module-signing-keypair.json--trusted takes a comma-separated list of trusted public keys; --key reads publicKeyHex out of a keypair JSON instead. Signature requirement defaults to true. Output reports verified, signed, signer (test or other, from the verified key), publicKeyHex, unsignedKeyId (a label the file carries about itself) and statementDomain, the form verified; check statementDomain, not a scope. The process exits non-zero unless verification succeeded. An artifact signed in the bare module digest form is refused with legacy_module_signature, one in the whole-bundle form with legacy_bundle_signature; sign it again.
Key custody
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.
Honest gaps
- There is no
licenseCLI verb. Asrc/licensing/module exists in the tree and is used programmatically, but it is not wired to aspace-data-modulesubcommand. protect,signandverifyare artifact-level primitives. There is no single end-to-end "release this module" command; see Publication and listing.