Skip to content

feat(attestation): implement Stellar-based snippet content attestation and verification (#218) - #232

Closed
jeffrey-graham wants to merge 1 commit into
SudiptaPaul-31:mainfrom
jeffrey-graham:feat/stellar-snippet-attestation-218
Closed

jeffrey-graham wants to merge 1 commit into
SudiptaPaul-31:mainfrom
jeffrey-graham:feat/stellar-snippet-attestation-218

Conversation

@jeffrey-graham

Copy link
Copy Markdown

Summary

Implements Stellar-backed snippet content attestation, deterministic SHA-256 hash calculation, multi-revision attestation history, and independent on-chain integrity verification.

Key Changes

  • lib/snippet-attestation-service.ts:
    • Computes deterministic sha256:<hex> content hashes with normalized line endings (\r\n -> \n) and rejects spoofed client-provided hashes.
    • Links immutable (Object.freeze) attestation records to Stellar transaction metadata (stellarTransactionHash, network, ledger, attestedBy).
    • Verifies current snippet content against attested hashes and authoritative Stellar transaction records across all 5 states (verified, modified, pending, failed, unverifiable) with contentIntegrity: "match" | "mismatch" | "unknown".
    • Supports multiple revision attestations per snippet and full history retrieval.
    • Rejects wrong-network transactions, handles concurrent/duplicate requests idempotently, enforces owner/collaborator authorization, supports network retry recovery, and logs audit events.
  • API Endpoints:
    • POST /api/snippets/[id]/attest
    • GET /api/snippets/[id]/attestation
    • GET /api/snippets/[id]/verify
    • GET /api/attestations/[attestationId]
  • Tests (lib/__tests__/snippet-attestation-service.test.ts):
    • Comprehensive unit and route tests covering SHA-256 hashing, unchanged vs modified snippet detection, wrong-network/invalid/missing transactions, historical revisions, concurrency, authorization, and audit logs.

Closes #218

@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown

@jeffrey-graham is attempting to deploy a commit to the Sudipta 's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Implement Stellar-Based Snippet Attestation

1 participant