ProblemsignPayload signs JSON.stringify({ event }); property order is deterministic for the same object, but any reserialization (logging, storing, resending) changes the body and invalidates the signature.
- Signing depends on serialization order.
- Re-delivery with re-serialized body fails signature.
- No canonicalization.
Solution
- Canonicalize the payload before signing and on verification.
- Sign and verify with the same canonical form.
- Test reserialization stability.
Acceptance Criteria
- Signature survives canonical re-serialization.
- Verification matches.
pnpm --filter @bettapay/webhook-delivery build passes.
Note for Contributors: Write a clear PR description. Show a canonicalization test.
Problem
signPayloadsignsJSON.stringify({ event }); property order is deterministic for the same object, but any reserialization (logging, storing, resending) changes the body and invalidates the signature.Solution
Acceptance Criteria
pnpm --filter @bettapay/webhook-delivery buildpasses.Note for Contributors: Write a clear PR description. Show a canonicalization test.