LimiterPolicy class final

Throttling parameters for an AttemptLimiter (RFC 4226 §7.3).

Three independent rules apply; the longest wait wins:

  • window: at most maxAttempts failures per window;
  • back-off: after the n-th consecutive failure the next attempt waits min(backoffBase × 2^(n−1), backoffMax);
  • lockout: after lockoutAfter consecutive failures the subject is locked until a success or an administrative reset.
Annotations

Constructors

LimiterPolicy({int maxAttempts = 5, Duration window = const Duration(minutes: 5), Duration backoffBase = const Duration(seconds: 1), Duration backoffMax = const Duration(minutes: 15), int lockoutAfter = 20})
Creates a policy; defaults suit 6-digit codes on a server.
const

Properties

backoffBase → Duration
Back-off after the first consecutive failure; zero disables back-off.
final
backoffMax → Duration
Upper bound of the back-off.
final
hashCode → int
The hash code for this object.
no setteroverride
lockoutAfter → int
Consecutive failures that trigger the hard lockout; at least maxAttempts.
final
maxAttempts → int
Failures allowed within one window.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
window → Duration
Length of the counting window, starting at its first failure.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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