fix(biometrics): Change keychain keys from DisplayName to KeyUid
Fixes: #10424
This commit is contained in:
parent
43bd5631de
commit
184745cf1b
|
@ -360,21 +360,19 @@ proc checkForStoringPasswordToKeychain(self: AppController) =
|
||||||
## This proc is used to store pass/pin depends on user's selection during onboarding flow.
|
## This proc is used to store pass/pin depends on user's selection during onboarding flow.
|
||||||
let account = self.accountsService.getLoggedInAccount()
|
let account = self.accountsService.getLoggedInAccount()
|
||||||
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
|
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
|
||||||
if not main_constants.IS_MACOS or # This is MacOS only feature
|
if not main_constants.SUPPORTS_FINGERPRINT or # This is MacOS only feature
|
||||||
value == LS_VALUE_STORE or # means pass is already stored, no need to store it again
|
value == LS_VALUE_STORE or # means pass is already stored, no need to store it again
|
||||||
value == LS_VALUE_NEVER or # means pass doesn't need to be stored at all
|
value == LS_VALUE_NEVER or # means pass doesn't need to be stored at all
|
||||||
account.name.len == 0:
|
account.name.len == 0:
|
||||||
return
|
return
|
||||||
# We are here if stored "storeToKeychain" property for the logged in user is either empty or set to "NotNow".
|
# We are here if stored "storeToKeychain" property for the logged in user is either empty or set to "NotNow".
|
||||||
|
|
||||||
#TODO: we should store PubKey of this account instead of display name (display name is not unique)
|
|
||||||
# and we may run into a problem if 2 accounts with the same display name are generated.
|
|
||||||
self.connectKeychain()
|
self.connectKeychain()
|
||||||
let pass = self.startupModule.getPassword()
|
let pass = self.startupModule.getPassword()
|
||||||
if pass.len > 0:
|
if pass.len > 0:
|
||||||
self.keychainService.storeData(account.name, pass)
|
self.keychainService.storeData(account.keyUid, pass)
|
||||||
else:
|
else:
|
||||||
self.keychainService.storeData(account.name, self.startupModule.getPin())
|
self.keychainService.storeData(account.keyUid, self.startupModule.getPin())
|
||||||
|
|
||||||
proc startupDidLoad*(self: AppController) =
|
proc startupDidLoad*(self: AppController) =
|
||||||
singletonInstance.engine.setRootContextProperty("localAppSettings", self.localAppSettingsVariant)
|
singletonInstance.engine.setRootContextProperty("localAppSettings", self.localAppSettingsVariant)
|
||||||
|
|
|
@ -101,16 +101,16 @@ method getPasswordStrengthScore*(self: Controller, password, userName: string):
|
||||||
return self.generalService.getPasswordStrengthScore(password, userName)
|
return self.generalService.getPasswordStrengthScore(password, userName)
|
||||||
|
|
||||||
proc storeToKeychain*(self: Controller, data: string) =
|
proc storeToKeychain*(self: Controller, data: string) =
|
||||||
let myName = singletonInstance.userProfile.getName()
|
let myKeyUid = singletonInstance.userProfile.getKeyUid()
|
||||||
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
|
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
|
||||||
if not main_constants.IS_MACOS or # Dealing with Keychain is the MacOS only feature
|
if not main_constants.SUPPORTS_FINGERPRINT or # Dealing with Keychain is the MacOS only feature
|
||||||
data.len == 0 or
|
data.len == 0 or
|
||||||
value == LS_VALUE_STORE or
|
value == LS_VALUE_STORE or
|
||||||
myName.len == 0:
|
myKeyUid.len == 0:
|
||||||
self.delegate.onStoreToKeychainError("", "")
|
self.delegate.onStoreToKeychainError("", "")
|
||||||
return
|
return
|
||||||
self.connectKeychain()
|
self.connectKeychain()
|
||||||
self.keychainService.storeData(myName, data)
|
self.keychainService.storeData(myKeyUid, data)
|
||||||
|
|
||||||
proc removeFromKeychain*(self: Controller, key: string) =
|
proc removeFromKeychain*(self: Controller, key: string) =
|
||||||
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
|
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
|
||||||
|
|
|
@ -109,8 +109,8 @@ method tryStoreToKeyChain*(self: Module) =
|
||||||
|
|
||||||
method tryRemoveFromKeyChain*(self: Module) =
|
method tryRemoveFromKeyChain*(self: Module) =
|
||||||
self.keychainActivityReason = KeychainActivityReason.RemoveFrom
|
self.keychainActivityReason = KeychainActivityReason.RemoveFrom
|
||||||
let myName = singletonInstance.userProfile.getName()
|
let myKeyUid = singletonInstance.userProfile.getKeyUid()
|
||||||
self.controller.removeFromKeychain(myName)
|
self.controller.removeFromKeychain(myKeyUid)
|
||||||
|
|
||||||
method onUserAuthenticated*(self: Module, pin: string, password: string, keyUid: string) =
|
method onUserAuthenticated*(self: Module, pin: string, password: string, keyUid: string) =
|
||||||
self.keychainActivityReason = KeychainActivityReason.StoreTo
|
self.keychainActivityReason = KeychainActivityReason.StoreTo
|
||||||
|
|
|
@ -767,10 +767,10 @@ proc tryToObtainDataFromKeychain*(self: Controller) =
|
||||||
if(not singletonInstance.userProfile.getUsingBiometricLogin()):
|
if(not singletonInstance.userProfile.getUsingBiometricLogin()):
|
||||||
return
|
return
|
||||||
let loggedInAccount = self.getLoggedInAccount()
|
let loggedInAccount = self.getLoggedInAccount()
|
||||||
self.keychainService.tryToObtainData(loggedInAccount.name)
|
self.keychainService.tryToObtainData(loggedInAccount.keyUid)
|
||||||
|
|
||||||
proc tryToStoreDataToKeychain*(self: Controller, password: string) =
|
proc tryToStoreDataToKeychain*(self: Controller, password: string) =
|
||||||
if not serviceApplicable(self.keychainService):
|
if not serviceApplicable(self.keychainService):
|
||||||
return
|
return
|
||||||
let loggedInAccount = self.getLoggedInAccount()
|
let loggedInAccount = self.getLoggedInAccount()
|
||||||
self.keychainService.storeData(loggedInAccount.name, password)
|
self.keychainService.storeData(loggedInAccount.keyUid, password)
|
|
@ -334,7 +334,7 @@ proc tryToObtainDataFromKeychain*(self: Controller) =
|
||||||
self.connectKeychain() # handling the results is done in slots connected in `connectKeychain` proc
|
self.connectKeychain() # handling the results is done in slots connected in `connectKeychain` proc
|
||||||
self.tmpKeychainErrorOccurred = false
|
self.tmpKeychainErrorOccurred = false
|
||||||
let selectedAccount = self.getSelectedLoginAccount()
|
let selectedAccount = self.getSelectedLoginAccount()
|
||||||
self.keychainService.tryToObtainData(selectedAccount.name)
|
self.keychainService.tryToObtainData(selectedAccount.keyUid)
|
||||||
|
|
||||||
proc storeIdentityImage*(self: Controller): seq[Image] =
|
proc storeIdentityImage*(self: Controller): seq[Image] =
|
||||||
if self.tmpProfileImageDetails.url.len == 0:
|
if self.tmpProfileImageDetails.url.len == 0:
|
||||||
|
|
|
@ -13,6 +13,9 @@ let WALLET_ENABLED* = if (existsEnv("ENABLE_WALLET")):
|
||||||
## on other platform if we just change the value here
|
## on other platform if we just change the value here
|
||||||
const IS_MACOS* = defined(macosx)
|
const IS_MACOS* = defined(macosx)
|
||||||
|
|
||||||
|
# For future supporting fingerprints on other platforms
|
||||||
|
const SUPPORTS_FINGERPRINT* = IS_MACOS
|
||||||
|
|
||||||
const sep* = when defined(windows): "\\" else: "/"
|
const sep* = when defined(windows): "\\" else: "/"
|
||||||
|
|
||||||
proc defaultDataDir*(): string =
|
proc defaultDataDir*(): string =
|
||||||
|
|
Loading…
Reference in New Issue