Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.57 KB

Class_RequestIdList.md

File metadata and controls

50 lines (33 loc) · 1.57 KB

RequestIdList Interface

Interface for Request ID Lists.

A Request ID List is a running append-only list of already-seen request IDs.

Re-adding an already-seen request ID results in a DuplicateRequestIDException, interrupting request verification.

It can be used to ensure that no two requests with the same request ID are processed, e.g. to prevent replay attacks.

NB: It's not recommended to use the interface methods directly. Use the RequestVerifier helper class instead, it has a withRequestIdList() setter.

See “Request IDs” for more information and a usage example.

Class Details

Implementations

Methods

  • contains (string $requestId): bool
    Returns true if the Request ID is already contained in the list (put() will fail), returns false if the Request ID is not yet known.

  • put (string $requestId): void
    Stores one Request ID in the list. This only works with Request IDs which are not yet contained within the list.
    Returns if the ID has been added to the list successfully.
    Throws a DuplicateRequestIDException if the Request ID has been seen previously.