Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keychain synchronizable and TouchID #53

Closed
marbetschar opened this issue Feb 19, 2015 · 2 comments
Closed

Keychain synchronizable and TouchID #53

marbetschar opened this issue Feb 19, 2015 · 2 comments

Comments

@marbetschar
Copy link

I try to enable the keychain synchronization together with a Touch ID enabled login.
Unfortunately I receive the following error whenever I set .synchronizable(true):

OSStatus error:[-50] One or more parameters passed to a function were not valid.

error: Optional(Error Domain=com.kishikawakatsumi.KeychainAccess.error Code=-50 "One or more parameters passed to a function were not valid." UserInfo=0x7fb271d3e6b0 {NSLocalizedDescription=One or more parameters passed to a function were not valid.})

And thats the example code:

let keychain = Keychain(service: "my.service").synchronizable(true)
    keychain.remove("default.tenantid")

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
        let failable = keychain
            .authenticationPrompt("Please auth!")
            .getStringOrError("default.tenantid")

        if failable.succeeded {
            var tenantId: String? = failable.value

            if tenantId == nil{
                tenantId = NSUUID().UUIDString

                let error = keychain
                    .accessibility(.WhenPasscodeSetThisDeviceOnly, authenticationPolicy: .UserPresence)
                    .set(tenantId!, key: "default.tenantid")

                if error != nil {
                    println("error: \(error)")
                    // Error handling if needed...
                }
            }

            //logged in
            println(tenantId)

        } else {
            println("error: \(failable.error?.localizedDescription)")
            // Error handling if needed...
        }
    }

What's wrong?

@kishikawakatsumi
Copy link
Owner

synchronizable and Touch ID protection are incompatible, because ThisDeviceOnly means that cannot sync to another device.

@marbetschar
Copy link
Author

Ok, thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants