Skip to content

Commit 259ad07

Browse files
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.
1 parent cc03660 commit 259ad07

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

Xcodes/Backend/AppState.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,17 @@ class AppState: ObservableObject {
305305
}
306306

307307
func handleTwoFactorOption(_ option: TwoFactorOption, authOptions: AuthOptionsResponse, serviceKey: String, sessionID: String, scnt: String) {
308-
self.presentedSheet = .twoFactor(.init(
309-
option: option,
310-
authOptions: authOptions,
311-
sessionData: AppleSessionData(serviceKey: serviceKey, sessionID: sessionID, scnt: scnt)
312-
))
308+
let sessionData = AppleSessionData(serviceKey: serviceKey, sessionID: sessionID, scnt: scnt)
309+
310+
if option == .securityKey, fido2DeviceIsPresent() && !fido2DeviceNeedsPin() {
311+
createAndSubmitSecurityKeyAssertationWithPinCode(nil, sessionData: sessionData, authOptions: authOptions)
312+
} else {
313+
self.presentedSheet = .twoFactor(.init(
314+
option: option,
315+
authOptions: authOptions,
316+
sessionData: sessionData
317+
))
318+
}
313319
}
314320

315321
func requestSMS(to trustedPhoneNumber: AuthOptionsResponse.TrustedPhoneNumber, authOptions: AuthOptionsResponse, sessionData: AppleSessionData) {

0 commit comments

Comments
 (0)