venmo / VENTouchLock

A Touch ID and Passcode framework used in the Venmo app.
MIT License
964 stars 114 forks source link

Random False Positive #34

Closed zinthemoney closed 9 years ago

zinthemoney commented 9 years ago

isPasscodeSet sometimes return NO, even though passcode is set.

- (BOOL)isPasscodeSet
{
    return !![self currentPasscode];
}

This code is weird. Is there a better way to check whether or not SSKeychain sets password for the current account and service?

zinthemoney commented 9 years ago

When this happened and resetting a passcode, I was able to log this error description.

Failed to save access token: Error Domain=com.samsoffes.sskeychain Code=-34018 "errSecDefault" UserInfo=0x170678200 {NSLocalizedDescription=errSecDefault}
dasmer commented 9 years ago

We've never observed this issue in the Venmo app or any other projects using VENTouchLock. I think it makes sense to check SSKeychain if a passcode is set for the current account and service. Can you suggest an alternative solution that might be better?

Though I'm speculating, you may be running into this error if you are calling isPasscodeSet before calling

setKeychainService:keychainAccount:touchIDReason:passcodeAttemptLimit:splashViewControllerClass:
zinthemoney commented 9 years ago

Re-quoting one of the comments found in SSKeychain: https://github.com/soffes/sskeychain/issues/52

Working with the keychain is pretty sucky. You should really check for errors and failures. This library doesn't make it any more stable, it just wraps up all of the annoying C APIs.

The error I encountered was random and probably has nothing to do with VENTouchLock's usage of SSKeychain. Thanks @dasmer for looking into it.