SimplePassphraseFailureEnforcer
A simple non-distributed and non-persistent PassphraseFailureEnforcer.
The policy implemented is that the client is locked out if N failed passphrase attempts has been recorded in the last M seconds.
Assuming the passphrase is a 7-digit numeric PIN, this means that no more than N PIN guesses can be done in M seconds. For N=3 and M=60 seconds, this translates into a maximum of three guesses per minute meaning the probability to guess the PIN in one minute is 3 in 10 million. The time to try all 10 million combinations is just over 6 years and 4 months.
The data is kept in memory only and not persisted so this is not appropriate to use in a production environment.
Parameters
the number of failed passphrase attempts before a client is locked out.
the duration of the period to consider.
a function to give the current time (used only for unit tests).