Package io.github.mahmoudimus.quic.token
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.
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAndInsert(byte[] nonce, Instant issued, Duration lifetime) Records that a token was used.
-
Field Details
-
NONE
A log that refuses every token, so NEW_TOKEN tokens never validate an address.
-
-
Method Details
-
checkAndInsert
Records that a token was used.- Parameters:
nonce- the token's unique nonceissued- when the token was issuedlifetime- how long such tokens are valid- Returns:
- true if the token is accepted, false if it may have been used before
-