DVVelocityLimiter class

Failure limits per account and per source, distinct from the global rate limit.

Both are needed: a hundred failures spread across a hundred accounts from one source is the attack a per-account limit cannot see, and a per-source limit alone punishes an office behind one address. Counts are kept by the identifier that was submitted, never by whether an account behind it exists, so a limit trips identically either way.

Constructors

DVVelocityLimiter({DVVelocityBudget perAccount = const DVVelocityBudget(5, Duration(minutes: 15)), DVVelocityBudget perSource = const DVVelocityBudget(100, Duration(minutes: 15)), DVVelocityStore? store, DateTime clock()?})

Properties

hashCode → int
The hash code for this object.
no setterinherited
perAccount → DVVelocityBudget
final
perSource → DVVelocityBudget
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → DVVelocityStore
final

Methods

check({required String account, required String source}) → Future<DVVelocityRefusal?>
The refusal for an attempt now, or null when it may be tried.
checkSource({required String source}) → Future<DVVelocityRefusal?>
The per-source refusal alone, for attempts whose failure must not be counted against an account -- a sign-up that hit a taken address, where locking the address would announce that it is taken.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordFailure({required String account, required String source}) → Future<void>
recordSourceFailure({required String source}) → Future<void>
recordSuccess({required String account}) → Future<void>
Clears the account's failures. The source's stay: one success in a spray does not make the rest of it innocent.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited