Skip to content

feat(dedup): add generateIdempotencyKey and key registry (#612) - #811

Open
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/generate-idempotency-key-612
Open

feat(dedup): add generateIdempotencyKey and key registry (#612)#811
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/generate-idempotency-key-612

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown

Closes #612

What

Adds a canonical idempotency key generator and an in-memory key registry for payment deduplication.

Changes

  • generateIdempotencyKey(params) — deterministic SHA-256 hex digest of {invoiceId}:{payer}:{amount} (with optional :{nonce} suffix)
  • isKnownKey(key) / registerKey(key) / clearKeys() — in-memory Set-backed registry
  • All exported from src/index.ts alongside existing Deduplicator
  • 8 unit tests covering determinism, input sensitivity, nonce variation, and registry lifecycle

Verification

  • Unit tests included in test/dedup.test.ts

…it#612)

- generateIdempotencyKey: deterministic SHA-256 hex key from invoiceId, payer, amount
- isKnownKey / registerKey / clearKeys: in-memory Set-backed registry
- Exported from index.ts alongside existing Deduplicator
- Unit tests: determinism, input sensitivity, nonce variation, registry lifecycle

Closes Stellar-split#612
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

1 participant