Skip to content

feat: add SHA-256 contentAddress to identity document#9

Merged
litzki-systems merged 2 commits into
mainfrom
claude/eloquent-lovelace-windo4
Jun 23, 2026
Merged

feat: add SHA-256 contentAddress to identity document#9
litzki-systems merged 2 commits into
mainfrom
claude/eloquent-lovelace-windo4

Conversation

@litzki-systems

Copy link
Copy Markdown
Owner

Summary

  • Computes SHA-256 over the JCS-canonicalized payload bytes (same bytes used for Ed25519 signature) in generate_identity_document()
  • Appends contentAddress: {alg: "sha256", digest: "<hex>"} to the returned document
  • Adds contentAddress to _OUT_OF_SCOPE_KEYS so verify_identity() strips it before canonicalization — keeps verification deterministic when a full document is passed

Output example

"contentAddress": {
  "alg": "sha256",
  "digest": "db4f1d7d23c181f5b64ecb4e3cd0ce0b7803806417caea386279055fe15cc25d"
}

No new canonicalization step — reuses canonical_data already computed for signing.

Test plan

  • generate_identity_document() returns contentAddress with alg and digest
  • digest matches hashlib.sha256(jcs.canonicalize(non_proof)).hexdigest()
  • verify_identity(doc, sig, pub) still returns True when full document (including contentAddress) is passed

Generated by Claude Code

claude added 2 commits June 23, 2026 18:37
Computes SHA-256 over the same JCS-canonicalized bytes used for the
Ed25519 signature and appends contentAddress {alg, digest} to the
document. contentAddress is added to _OUT_OF_SCOPE_KEYS so verify_identity
strips it before canonicalization, keeping verification deterministic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GRuyRG2kcHdKwtrqdwMZAK
generate_identity_document() now delegates to sign_identity() instead of
repeating the private-key load and Ed25519 sign call. _OUT_OF_SCOPE_KEYS
now has exactly one enforcement point.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GRuyRG2kcHdKwtrqdwMZAK
@litzki-systems litzki-systems marked this pull request as ready for review June 23, 2026 18:41
@litzki-systems litzki-systems merged commit 2be281a into main Jun 23, 2026
3 checks passed
@litzki-systems litzki-systems deleted the claude/eloquent-lovelace-windo4 branch June 23, 2026 18:41
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.

2 participants