kishikawakatsumi / KeychainAccess

Simple Swift wrapper for Keychain that works on iOS, watchOS, tvOS and macOS.
MIT License
7.98k stars 788 forks source link

TouchID not showed after .removeAll() #312

Open carmelogallo opened 7 years ago

carmelogallo commented 7 years ago

Hi guys, I got this weird issue. Seems that if I call

do {
    try Keychain(service: "XXX").removeAll()
} catch let error {
    Manager.log.error("Failed to remove all keychains with error: \(error)")
}

and after

let keychain = Keychain(service: "XXX")
DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async {
    do {
        // Should be the secret invalidated when passcode is removed? If not then use '.WhenUnlocked'
        try keychain
            .accessibility(.whenPasscodeSetThisDeviceOnly, authenticationPolicy: .userPresence)
            .authenticationPrompt("Authenticate to update your access token")
            .set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")
    } catch let error {
        // Error handling if needed...
    }
}

the touch id pop up is not showed but, if you call it again the pop up is showed. Seems that the first time you try to access to touch id after .removeAll() is broken. Any clue why?

[UPDATED] Seems that calling any Keychain feature in application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool fail the touch id. I was calling the .removeAll() there but even if I set a key there the touch id fails. The problem is always there if I use .removeAll() in any place. Also if you set a key in application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool the touch id fails as well.

txaiwieser commented 7 years ago

Same thing here, couldn't figure out why

carmelogallo commented 7 years ago

@kishikawakatsumi may you help out here?

Claes34 commented 4 years ago

Hi, I'm having the same issue with the "remove" method also. Next time I'm adding an item, the TouchId popup won't show.

vg-identance commented 4 years ago

Any updates on this?