fix(keycard): unable to import account from keycard

Handling for recovering Status profile for Linux updated since we don't use biometrics for Linux
and that requires slightly different flow.

Closes: #14673
This commit is contained in:
Sale Djenic 2024-05-12 14:12:22 +02:00 committed by saledjenic
parent 753825a40e
commit 6e1fe678bd
4 changed files with 12 additions and 11 deletions

View File

@ -13,7 +13,7 @@ proc delete*(self: BiometricsState) =
method getNextPrimaryState*(self: BiometricsState, controller: Controller): State =
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
self.flowType == FlowType.FirstRunOldUserKeycardImport:
return createState(StateType.ProfileFetching, self.flowType, self)
return createState(StateType.ProfileFetching, self.flowType, nil)
return nil
method getNextSecondaryState*(self: BiometricsState, controller: Controller): State =

View File

@ -56,7 +56,7 @@ method resolveKeycardNextState*(self: KeycardEnterPinState, keycardFlowType: str
if keycardFlowType == ResponseTypeValueKeycardFlowResult:
controller.setKeycardEvent(keycardEvent)
if not main_constants.IS_MACOS:
controller.setupKeycardAccount(storeToKeychain = false)
return nil
controller.setupKeycardAccount(storeToKeychain = false, recoverAccount = true)
return createState(StateType.ProfileFetching, self.flowType, nil)
let backState = findBackStateWithTargetedStateType(self, StateType.RecoverOldUser)
return createState(StateType.Biometrics, self.flowType, backState)

View File

@ -20,7 +20,7 @@ method getNextPrimaryState*(self: KeycardPinSetState, controller: Controller): S
if self.flowType == FlowType.FirstRunOldUserKeycardImport:
if controller.getValidPuk():
if not main_constants.IS_MACOS:
return nil
return createState(StateType.ProfileFetching, self.flowType, nil)
return createState(StateType.Biometrics, self.flowType, self.getBackState)
return createState(StateType.KeycardWrongPuk, self.flowType, self.getBackState)
if self.flowType == FlowType.AppLogin:
@ -38,7 +38,7 @@ method executePrimaryCommand*(self: KeycardPinSetState, controller: Controller)
if main_constants.IS_MACOS:
return
if controller.getValidPuk():
controller.setupKeycardAccount(storeToKeychain = false)
controller.setupKeycardAccount(storeToKeychain = false, recoverAccount = true)
if self.flowType == FlowType.AppLogin:
if controller.getRecoverKeycardUsingSeedPhraseWhileLoggingIn():
controller.startLoginFlowAutomatically(controller.getPin())
@ -47,20 +47,21 @@ method executePrimaryCommand*(self: KeycardPinSetState, controller: Controller)
let storeToKeychainValue = singletonInstance.localAccountSettings.getStoreToKeychainValue()
controller.loginAccountKeycard(storeToKeychainValue)
if self.flowType == FlowType.LostKeycardReplacement:
if main_constants.IS_MACOS:
return
controller.startLoginFlowAutomatically(controller.getPin())
method resolveKeycardNextState*(self: KeycardPinSetState, keycardFlowType: string, keycardEvent: KeycardEvent,
controller: Controller): State =
var storeToKeychainValue = LS_VALUE_NEVER
if self.flowType == FlowType.LostKeycardReplacement:
if keycardFlowType == ResponseTypeValueKeycardFlowResult and
keycardEvent.error.len == 0:
if main_constants.IS_MACOS:
storeToKeychainValue = LS_VALUE_NOT_NOW
controller.setKeycardEvent(keycardEvent)
controller.loginAccountKeycard(storeToKeychainValue = LS_VALUE_NOT_NOW, keycardReplacement = true)
controller.loginAccountKeycard(storeToKeychainValue, keycardReplacement = true)
if self.flowType == FlowType.AppLogin:
if keycardFlowType == ResponseTypeValueKeycardFlowResult and
keycardEvent.error.len == 0:
# we are here in case of recover account from the login flow using seed phrase
controller.setKeycardEvent(keycardEvent)
controller.loginAccountKeycard(storeToKeychainValue = LS_VALUE_NEVER, keycardReplacement = false)
controller.loginAccountKeycard(storeToKeychainValue, keycardReplacement = false)

View File

@ -39,8 +39,8 @@ method resolveKeycardNextState*(self: KeycardWrongPukState, keycardFlowType: str
controller.setKeycardEvent(keycardEvent)
controller.setPukValid(true)
if not main_constants.IS_MACOS:
controller.setupKeycardAccount(storeToKeychain = false)
return nil
controller.setupKeycardAccount(storeToKeychain = false, recoverAccount = true)
return createState(StateType.ProfileFetching, self.flowType, nil)
let backState = findBackStateWithTargetedStateType(self, StateType.RecoverOldUser)
return createState(StateType.Biometrics, self.flowType, backState)
if self.flowType == FlowType.AppLogin: