mirror of
https://github.com/status-im/status-keycard-go.git
synced 2025-01-18 18:31:56 +00:00
add puk retries check
This commit is contained in:
parent
ed51858caf
commit
660760d156
@ -158,6 +158,10 @@ func (f *KeycardFlow) openSC(kc *keycardContext, giveup bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *KeycardFlow) unblockPIN(kc *keycardContext) error {
|
func (f *KeycardFlow) unblockPIN(kc *keycardContext) error {
|
||||||
|
if f.cardInfo.pukRetries == 0 {
|
||||||
|
return f.pauseAndRestart(SwapCard, PUKRetries)
|
||||||
|
}
|
||||||
|
|
||||||
pukError := ""
|
pukError := ""
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -185,6 +189,10 @@ func (f *KeycardFlow) unblockPIN(kc *keycardContext) error {
|
|||||||
pukError = PUK
|
pukError = PUK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f.cardInfo.pukRetries == 0 {
|
||||||
|
return f.pauseAndRestart(SwapCard, PUKRetries)
|
||||||
|
}
|
||||||
|
|
||||||
if !pukOK {
|
if !pukOK {
|
||||||
err = f.pauseAndWait(EnterPUK, pukError)
|
err = f.pauseAndWait(EnterPUK, pukError)
|
||||||
} else if !pinOK {
|
} else if !pinOK {
|
||||||
@ -199,9 +207,7 @@ func (f *KeycardFlow) unblockPIN(kc *keycardContext) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *KeycardFlow) authenticate(kc *keycardContext) error {
|
func (f *KeycardFlow) authenticate(kc *keycardContext) error {
|
||||||
if f.cardInfo.pukRetries == 0 {
|
if f.cardInfo.pinRetries == 0 {
|
||||||
return f.pauseAndRestart(SwapCard, PUKRetries)
|
|
||||||
} else if f.cardInfo.pinRetries == 0 {
|
|
||||||
// succesful unblock leaves the card authenticated
|
// succesful unblock leaves the card authenticated
|
||||||
return f.unblockPIN(kc)
|
return f.unblockPIN(kc)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user