Space Data Module SDK

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.

sh
space-data-module protect \
  --manifest ./manifest.json \
  --wasm ./dist/module.wasm \
  --json
sh
# 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
sh
# single-file bundle
space-data-module protect \
  --manifest ./manifest.json \
  --wasm ./dist/module.wasm \
  --single-file-bundle \
  --out ./dist/module.bundle.wasm
FlagRequiredMeaning
--manifest <path>yesModule manifest JSON
--wasm <path>yesThe compiled artifact
--recipient-public-key <hex>noEncrypt the payload for this recipient
--mnemonic <words>noKey material for the protecting identity
--single-file-bundlenoEmit one self-contained bundle artifact
--out <path>noOutput path; otherwise reported on stdout
--jsonnoMachine-readable result

Non-JSON output reports artifactId, signingPublicKeyHex, encrypted, wasmBase64Length, and protectedArtifactBytes.

Sign

sh
space-data-module sign \
  --wasm ./dist/module.wasm \
  --key ./keys/module-signing-keypair.json \
  --out ./dist/module.signed.wasm
FlagRequiredMeaning
--wasm <path>yesArtifact to sign
--key <path>yesKeypair JSON; must contain privateKeySeedHex
--scope <form>nopublication, 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>noOutput 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

sh
space-data-module verify \
  --wasm ./dist/module.wasm \
  --trusted <pubKeyHex>[,<pubKeyHex>...] \
  --require-signature
sh
space-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