export RemainingAttempts

This commit is contained in:
Andrea Franz 2021-10-07 10:20:58 +02:00
parent f53d31ab34
commit 557c4c58b3
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
1 changed files with 3 additions and 3 deletions

View File

@ -16,11 +16,11 @@ import (
var ErrNoAvailablePairingSlots = errors.New("no available pairing slots") var ErrNoAvailablePairingSlots = errors.New("no available pairing slots")
type WrongPINError struct { type WrongPINError struct {
remainingAttempts int RemainingAttempts int
} }
func (e *WrongPINError) Error() string { func (e *WrongPINError) Error() string {
return fmt.Sprintf("wrong pin. remaining attempts: %d", e.remainingAttempts) return fmt.Sprintf("wrong pin. remaining attempts: %d", e.RemainingAttempts)
} }
type CommandSet struct { type CommandSet struct {
@ -190,7 +190,7 @@ func (cs *CommandSet) VerifyPIN(pin string) error {
if resp.Sw&0x63C0 == 0x63C0 { if resp.Sw&0x63C0 == 0x63C0 {
remainingAttempts := resp.Sw & 0x000F remainingAttempts := resp.Sw & 0x000F
return &WrongPINError{ return &WrongPINError{
remainingAttempts: int(remainingAttempts), RemainingAttempts: int(remainingAttempts),
} }
} }
return err return err