Skip to content

test(crypto): add dedicated signatures coverage (RFC 8032 + tombstone regression) - #219

Merged
h4yfans merged 1 commit into
mainfrom
debt/1.3-signatures-tests
Apr 15, 2026
Merged

test(crypto): add dedicated signatures coverage (RFC 8032 + tombstone regression)#219
h4yfans merged 1 commit into
mainfrom
debt/1.3-signatures-tests

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Closes Phase 1 §1.3 of .claude/plans/tech-debt-remediation.md.

Summary

Adds a dedicated test file for signatures.ts (previously only tangential coverage in foundation.test.ts). Includes RFC 8032 golden vector + load-bearing tombstone regression that prevents server-forged deletions.

New tests (8)

  1. RFC 8032 §7.1 TEST 1 golden vector — bit-exact pubkey + signature match
  2. signPayload determinism for fixed seed+payload
  3. Truncated signature → verifySignature returns false
  4. Forged signature (key A signs, key B's pubkey verifies) → false
  5. Wrong-pubkey verification → false
  6. Tombstone strip regression: signed payload with deletedAt → stripping the field breaks verification (prevents server-forged deletion per MEMORY.md)
  7. Mutating deletedAt to earlier timestamp → verify fails
  8. Signature covers exact CBOR-encoded bytes (uses CBOR_FIELD_ORDER.TOMBSTONE)

Test plan

  • pnpm --filter desktop test --project main src/main/crypto/signatures.test.ts — 0 failures
  • per-file coverage on signatures.ts ≥ 95% (file is 22L, 2 fns — should land at 100%)
  • pnpm typecheck:node && pnpm typecheck:web clean
  • pnpm lint clean

🤖 Generated with Claude Code

@h4yfans
h4yfans merged commit 8e7e5ba into main Apr 15, 2026
2 checks passed
h4yfans added a commit that referenced this pull request May 6, 2026
@h4yfans
h4yfans deleted the debt/1.3-signatures-tests branch May 6, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant