Skip to content

feat(dedup): implement generateIdempotencyKey with canonical SHA-256 and key registry (#612) - #724

Closed
s6pa1rta3n-lab wants to merge 1 commit into
Stellar-split:mainfrom
s6pa1rta3n-lab:feat/issue-612-generate-idempotency-key
Closed

feat(dedup): implement generateIdempotencyKey with canonical SHA-256 and key registry (#612)#724
s6pa1rta3n-lab wants to merge 1 commit into
Stellar-split:mainfrom
s6pa1rta3n-lab:feat/issue-612-generate-idempotency-key

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary of Changes

  • Implements generateIdempotencyKey(params: IdempotencyParams): string in src/dedup.ts using Node.js built-in crypto.createHash('sha256').
  • Canonicalizes parameters into "{invoiceId}:{payer}:{amount}" or "{invoiceId}:{payer}:{amount}:{nonce}" to produce deterministic 64-character hex digests.
  • Implements in-memory key registration and checking via isKnownKey(key) and registerKey(key) backed by an internal module Set.
  • Provides clearKeys() for clean test teardown and resets.
  • Exports all deduplication utilities and IdempotencyParams from src/index.ts.
  • Adds unit tests in test/dedup.test.ts verifying key determinism, differentiation on varying amounts/invoices/payers/nonces, key registration, teardown reset, and preservation of existing Deduplicator class behavior.

Closes #612
/claim #612

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

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.

Add generateIdempotencyKey for canonical payment deduplication

2 participants