Is there a way to check for this?
LAPolicy is unavailable on the Watch and I cannot check deviceOwnerAuthenticationWithWatch from a paired phone only from a Mac.
Code Block swift let flag = SecAccessControlCreateFlags.userPresence let sacResult = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, flag, &error)
Code Block swift kSecUseAuthenticationUI as String: kSecUseAuthenticationUIFail
Hey @pawpoise,
I am trying to achieve the same thing I am trying the following
var query: [String: Any] { return [kSecUseAuthenticationUI as String: kSecUseAuthenticationUIFail] } let flag = SecAccessControlCreateFlags.userPresence
var accessControlError: UnsafeMutablePointer<Unmanaged?>? = nil
var result: AnyObject? = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, flag, accessControlError)
let status = SecItemCopyMatching(query as CFDictionary, &result) switch status { case errSecSuccess: print("keychainItem") case errSecItemNotFound: print("errSecItemNotFound") default: print("error") }
this is always hitting the default case with -50
im guessing one of my params are not valid
Hey @pawpoise,
I am trying to achieve the same thing I am trying the following
` var query: [String: Any] { return [kSecUseAuthenticationUI as String: kSecUseAuthenticationUIFail] } let flag = SecAccessControlCreateFlags.userPresence
var accessControlError: UnsafeMutablePointer<Unmanaged?>? = nil
var result: AnyObject? = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, flag, accessControlError)
let status = SecItemCopyMatching(query as CFDictionary, &result)
switch status {
case errSecSuccess:
print("keychainItem")
case errSecItemNotFound:
print("errSecItemNotFound")
default:
print("error")
}
this is always hitting the default case with
-50` im guessing one of my params are not valid
If you gate access to your view via a keychain item that’s protected with kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, does that do what you want? Ideally the sensitive data should be encrypted with the content of that keychain item but for a quick test you can just see whether the item is available.I need to know if an Apple Watch user has a passcode set before we can
show sensitive data in a View.
Code Block swift let flag = SecAccessControlCreateFlags.userPresence let sacResult = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, flag, &error)
Code Block swift kSecUseAuthenticationUI as String: kSecUseAuthenticationUIFail
Hey @pawpoise,
I am trying to achieve the same thing I am trying the following
var query: [String: Any] { return [kSecUseAuthenticationUI as String: kSecUseAuthenticationUIFail] } let flag = SecAccessControlCreateFlags.userPresence
var accessControlError: UnsafeMutablePointer<Unmanaged?>? = nil
var result: AnyObject? = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, flag, accessControlError)
let status = SecItemCopyMatching(query as CFDictionary, &result) switch status { case errSecSuccess: print("keychainItem") case errSecItemNotFound: print("errSecItemNotFound") default: print("error") }
this is always hitting the default case with -50
im guessing one of my params are not valid
Hey @pawpoise,
I am trying to achieve the same thing I am trying the following
` var query: [String: Any] { return [kSecUseAuthenticationUI as String: kSecUseAuthenticationUIFail] } let flag = SecAccessControlCreateFlags.userPresence
var accessControlError: UnsafeMutablePointer<Unmanaged?>? = nil
var result: AnyObject? = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, flag, accessControlError)
let status = SecItemCopyMatching(query as CFDictionary, &result)
switch status {
case errSecSuccess:
print("keychainItem")
case errSecItemNotFound:
print("errSecItemNotFound")
default:
print("error")
}
this is always hitting the default case with
-50` im guessing one of my params are not valid