Documentation
¶
Overview ¶
Package pin is the PIN of the section for adults (R04, R35): its form, its hash and the count of wrong PINs that closes its input. The PIN is a barrier of the interface, not of the server; the count is what keeps it from being tried by the server, one for every device of the account.
Index ¶
Constants ¶
const ( MaxFailures = 5 Window = 15 * time.Minute LockFor = 15 * time.Minute )
The count (R04, R35): no more than MaxFailures wrong PINs in any Window. The count is of the wrong PINs of the last Window, and the one that brings it to MaxFailures closes the input for LockFor from itself.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Check ¶
type Check struct {
// Matches says it is the PIN set.
Matches bool
// Left is how many wrong PINs are left before the input closes, beside a
// wrong one; 0 when this one closed it.
Left int
// LockedUntil is when the input opens, beside the wrong PIN that closed it.
LockedUntil time.Time
}
Check is how a PIN compared with the one set.
type State ¶
type State struct {
// Hash is the PIN's argon2id, or empty while none is set.
Hash string
// Failed is when each wrong PIN of the last Window was given, the oldest
// first; it may hold older ones, which no longer count.
Failed []time.Time
// LockedUntil is when the input opens once it closed; zero while it is open.
LockedUntil time.Time
}
State is what the account keeps of its PIN.