Interface RequestHasher

All Known Implementing Classes:
Sha256RequestHasher
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RequestHasher
Strategy interface for computing a deterministic hash of an HTTP request body.

Implementations must be deterministic and thread-safe. The returned string is stored alongside the idempotency record and compared on every subsequent request with the same key to detect accidental key reuse with a different payload.

The default implementation is Sha256RequestHasher.

  • Method Summary

    Modifier and Type
    Method
    Description
    hash(byte[] requestBody)
    Computes a hash of the given request body bytes.
  • Method Details

    • hash

      String hash(byte[] requestBody)
      Computes a hash of the given request body bytes.
      Parameters:
      requestBody - the raw bytes of the HTTP request body; must not be null.
      Returns:
      a non-null, non-empty hex (or otherwise encoded) string representing the hash.