From afa6dff0b9c8142488b71e0c4abe738bdac0c16f Mon Sep 17 00:00:00 2001 From: Edgar Story Date: Sun, 10 Nov 2024 12:16:17 +0000 Subject: [PATCH] =?UTF-8?q?Support=20FIDO=20authentication=20with=20device?= =?UTF-8?q?s=20that=20don=E2=80=99t=20have=20a=20PIN=20code=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Xcodes/Backend/AppState.swift | 2 +- .../Frontend/SignIn/SignInSecurityKeyPinView.swift | 7 +++++++ Xcodes/Resources/Localizable.xcstrings | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Xcodes/Backend/AppState.swift b/Xcodes/Backend/AppState.swift index 475602f..c216435 100644 --- a/Xcodes/Backend/AppState.swift +++ b/Xcodes/Backend/AppState.swift @@ -357,7 +357,7 @@ class AppState: ObservableObject { var fido2: FIDO2? - func createAndSubmitSecurityKeyAssertationWithPinCode(_ pinCode: String, sessionData: AppleSessionData, authOptions: AuthOptionsResponse) { + func createAndSubmitSecurityKeyAssertationWithPinCode(_ pinCode: String?, sessionData: AppleSessionData, authOptions: AuthOptionsResponse) { self.presentedSheet = .securityKeyTouchToConfirm guard let fsaChallenge = authOptions.fsaChallenge else { diff --git a/Xcodes/Frontend/SignIn/SignInSecurityKeyPinView.swift b/Xcodes/Frontend/SignIn/SignInSecurityKeyPinView.swift index 32b6028..d2b1646 100644 --- a/Xcodes/Frontend/SignIn/SignInSecurityKeyPinView.swift +++ b/Xcodes/Frontend/SignIn/SignInSecurityKeyPinView.swift @@ -32,6 +32,9 @@ struct SignInSecurityKeyPinView: View { Button("Cancel", action: { isPresented = false }) .keyboardShortcut(.cancelAction) Spacer() + + Button("PIN not set", action: submitWithoutPinCode) + ProgressButton(isInProgress: appState.isProcessingAuthRequest, action: submitPinCode) { Text("Continue") @@ -50,6 +53,10 @@ struct SignInSecurityKeyPinView: View { func submitPinCode() { appState.createAndSubmitSecurityKeyAssertationWithPinCode(pin, sessionData: sessionData, authOptions: authOptions) } + + func submitWithoutPinCode() { + appState.createAndSubmitSecurityKeyAssertationWithPinCode(nil, sessionData: sessionData, authOptions: authOptions) + } } #Preview { diff --git a/Xcodes/Resources/Localizable.xcstrings b/Xcodes/Resources/Localizable.xcstrings index 24fc217..e80c58b 100644 --- a/Xcodes/Resources/Localizable.xcstrings +++ b/Xcodes/Resources/Localizable.xcstrings @@ -237,6 +237,16 @@ } } }, + "%@ (%@)" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "%1$@ (%2$@)" + } + } + } + }, "%@ %@ %@" : { "localizations" : { "ar" : { @@ -17907,6 +17917,9 @@ } } } + }, + "PIN not set" : { + }, "Platforms" : { "localizations" : {