feat(REQ-26): sign_digest — keyless-sign an arbitrary 32-byte digest (#256) - #263
Merged
Conversation
…256) varve (#256) can VERIFY a bare digest with wsc (AirGappedVerifier::verify_signature already takes &[u8;32]) but could only SIGN a WASM Module. It signs layer manifests, whose sha256 is a 32-byte digest. Adds KeylessSigner::sign_digest(&self, digest: &[u8;32]) -> KeylessSignature as the single keyless signing primitive. sign_module is now sign_digest(sha256(module)) + the module-embedding step, collapsing two signing paths into one. The digest is signed as an ECDSA P-256 prehash — the exact inverse of the verifier's verify_prehash(module_hash) — so the output verifies offline against the same digest. Behaviour-preserving for sign_module: the old DigestSigner-over-hasher and the new PrehashSigner-over-finalized-digest sign the identical 32-byte SHA-256 with the same key. Oracle: - Non-gated (CI-runnable) test_sign_digest_prehash_is_verifier_symmetric proves the core primitive round-trips for an arbitrary digest AND rejects a different one (built-in negative control). - Gated e2e test_sign_digest_arbitrary_roundtrip signs sha256("test") (a non-module digest) and asserts the signature binds to exactly that digest. - The offline "verifier accepts an arbitrary digest" half is already covered by the airgapped verifier fixture tests, which verify over a synthetic digest. Tests: wsc lib 610 pass/3 ignored (was 609; +1 symmetry test); keyless_integration 5 pass/4 ignored (+1 gated). No change to sign_module behaviour. Refs: #256 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012aR3Md1h46K9wAUWMQiESH
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the asymmetry varve reported in #256: wsc could verify a bare digest (
AirGappedVerifier::verify_signaturealready takes&[u8; 32]) but could only sign a WASMModule. varve signs layer manifests, whose sha256 is a 32-byte digest.Change
Adds
KeylessSigner::sign_digest(&self, digest: &[u8; 32]) -> Result<KeylessSignature, WSError>as the single keyless signing primitive.sign_modulebecomessign_digest(sha256(module))+ the module-embedding step — one signing path, not two.The digest is signed as an ECDSA P-256 prehash — the exact inverse of the verifier's
verify_prehash(module_hash)— so the output verifies offline against the same digest. Behaviour-preserving forsign_module: the oldDigestSigner-over-hasher and the newPrehashSigner-over-finalized-digest sign the identical 32-byte SHA-256 with the same key.Oracle
test_sign_digest_prehash_is_verifier_symmetric— the core primitive round-trips for an arbitrary digest and rejects a different one (built-in negative control, so it can't be vacuous).test_sign_digest_arbitrary_roundtripsignssha256("test")(a non-module digest) and asserts the signature binds to exactly that digest + carries a Fulcio chain + Rekor entry.airgapped::verifierfixture tests (they verify over a synthetic, non-module digest — which is why wsc: keyless signing over an arbitrary digest, not only a WASM Module #256 notes "verification is already general").Evidence
wsclib 610 pass/3 ignored (+1 symmetry test);keyless_integration5 pass/4 ignored (+1 gated).sign_modulebehaviour unchanged.Part of the v0.12.0 varve-interop line (plan #261). Refs #256.
🤖 Generated with Claude Code