Skip to content

Add helper for generating a unique idempotency key from request body hash #517

Description

@Chucks1093

Summary

Mutation endpoints like alert registration and webhook registration should be idempotent when the same request is submitted twice. A shared helper that hashes the request body and returns a stable idempotency key allows duplicate detection without requiring clients to send an explicit key.

Scope

  • Add hashRequestBody(body: unknown): string helper using a stable hash function (e.g. SHA-256)
  • Returns a hex string of fixed length
  • Same input always produces the same output
  • Add unit tests for: identical objects produce identical hashes, different objects produce different hashes, empty object has a stable hash

Acceptance Criteria

  • Identical input always produces the same hash
  • Different inputs produce different hashes
  • Output is a fixed-length hex string
  • Empty object produces a valid hash without throwing

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions