tomSecretsAuthDelay function

Duration tomSecretsAuthDelay(
  1. int failures
)

The delay before the next authentication after failures failed ones: 0, then 1 s, 2 s, 4 s … up to 60 s (protocol.md 6.1).

Implementation

Duration tomSecretsAuthDelay(int failures) {
  if (failures <= 0) return Duration.zero;
  final seconds = 1 << (failures - 1).clamp(0, 6);
  return Duration(seconds: seconds > 60 ? 60 : seconds);
}