@onchaininvoice
Build in public note from working on OnchainInvoice.
I fixed a subtle integrity bug that came from modeling receipts as “signed PDFs” instead of signed receipt records.
We were signing the canonical payload (semantic integrity) but not the rendered artifact bytes (representational integrity). That’s valid crypto, but it allows the record to drift while still “verifying.”
Now each receipt record binds:
canonical payload bytes → SHA-256 → Ed25519 signature
final PDF bytes → SHA-256 (raw 32-byte digest) → Ed25519 signature
explicit proof file describing signing semantics (no implicit assumptions)
Verification recomputes everything and reports per-domain validity.
Lesson: integrity failures often come from modeling shortcuts, not bad cryptography.
Curious what other record/representation traps people here have hit.