Interface TokenLog

All Known Implementing Classes:
BloomTokenLog
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 TokenLog
Limits the reuse of NEW_TOKEN tokens, which attackers could replay to use the server as an amplifier (RFC 9000 section 8.1.4). Retry tokens are not logged: they expire within seconds.

False positives (refusing a fresh token) are safe: the client is just not validated yet. False negatives must be rare enough that replays cannot amplify much.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TokenLog
    A log that refuses every token, so NEW_TOKEN tokens never validate an address.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkAndInsert(byte[] nonce, Instant issued, Duration lifetime)
    Records that a token was used.
  • Field Details

    • NONE

      static final TokenLog NONE
      A log that refuses every token, so NEW_TOKEN tokens never validate an address.
  • Method Details

    • checkAndInsert

      boolean checkAndInsert(byte[] nonce, Instant issued, Duration lifetime)
      Records that a token was used.
      Parameters:
      nonce - the token's unique nonce
      issued - when the token was issued
      lifetime - how long such tokens are valid
      Returns:
      true if the token is accepted, false if it may have been used before