Improve the support for PIN-less FIDO2 devices

- We now check if in the handling of two factor option, the option to be used is a SecurityKey. If so, check if a FIDO2 device is attached and if it needs a PIN.
- When a PIN is not required, we can just move straight onto assertation, the code for which will present the touch key UI.
- Otherwise we fallback to the original flow.
This commit is contained in:
Edgar Story 2024-11-12 09:20:38 +00:00
parent cc03660576
commit 259ad0789a
No known key found for this signature in database
GPG key ID: E808B9DE966FFDDA

View file

@ -305,11 +305,17 @@ class AppState: ObservableObject {
} }
func handleTwoFactorOption(_ option: TwoFactorOption, authOptions: AuthOptionsResponse, serviceKey: String, sessionID: String, scnt: String) { func handleTwoFactorOption(_ option: TwoFactorOption, authOptions: AuthOptionsResponse, serviceKey: String, sessionID: String, scnt: String) {
self.presentedSheet = .twoFactor(.init( let sessionData = AppleSessionData(serviceKey: serviceKey, sessionID: sessionID, scnt: scnt)
option: option,
authOptions: authOptions, if option == .securityKey, fido2DeviceIsPresent() && !fido2DeviceNeedsPin() {
sessionData: AppleSessionData(serviceKey: serviceKey, sessionID: sessionID, scnt: scnt) createAndSubmitSecurityKeyAssertationWithPinCode(nil, sessionData: sessionData, authOptions: authOptions)
)) } else {
self.presentedSheet = .twoFactor(.init(
option: option,
authOptions: authOptions,
sessionData: sessionData
))
}
} }
func requestSMS(to trustedPhoneNumber: AuthOptionsResponse.TrustedPhoneNumber, authOptions: AuthOptionsResponse, sessionData: AppleSessionData) { func requestSMS(to trustedPhoneNumber: AuthOptionsResponse.TrustedPhoneNumber, authOptions: AuthOptionsResponse, sessionData: AppleSessionData) {