I noticed that the Keychain Access utility uses exactly what I am looking for …
That UI is being presented by Authorization Services. Here’s how you can replicate it with your code:
let rightName = "com.apple.trust-settings.user"
let err = rightName.withCString { namePtr in
var item = AuthorizationItem(name: namePtr, valueLength: 0, value: nil, flags: 0)
return withUnsafeMutablePointer(to: &item) { itemPtr in
var rights = AuthorizationRights(count: 1, items: itemPtr)
return AuthorizationCopyRights(ref, &rights, nil, [.extendRights, .interactionAllowed], nil)
}
}
I was hoping that the new Local Authentication right mechanism might help with this situation. For example, with code like this:
let requirement = LAAuthenticationRequirement.biometry(fallback: .devicePasscode)
let right = LARight(requirement: requirement)
do {
print("will authorise")
try await right.authorize(localizedReason: "Testing only.")
print("did authorise")
} catch {
print("did not authorise, error: \(error)")
}
However, in this case the button is Use Password rather than Use PIN )-:
I’ve got one more thing I want to try. I’m off to do that now and I’ll post an update when I’m done.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"