TGFPasscodeAuthenticatorDelegate

Objective-C

@protocol TGFPasscodeAuthenticatorDelegate <NSObject>

Swift

protocol TGFPasscodeAuthenticatorDelegate : NSObjectProtocol

A delegate protocol that an application must implement to handle UI interactions for the Passcode Authenticator.

The FIDO2 SDK relies on the conforming delegate to display the secure keyboard and to inform the user about the status of passcode operations (enrollment, authentication, etc.).

Note

All callbacks are invoked on the Main thread.

@since 1.0.0

  • Called when the SDK requires the application to display the secure keyboard for user input.

    Declaration

    Objective-C

    - (void)passcodeAuthenticator:
                (TGFPasscodeAuthenticator *_Nullable)passcodeAuthenticator
            willStartWithKeyboard:(id<TGFKeyboard> _Nonnull)keyboard
                    operationInfo:(TGFFido2OperationInfo *_Nullable)operationInfo
                    cancelHandler:(void (^_Nonnull)(void))cancelHandler
                   failureHandler:
                       (void (^_Nonnull)(NSString *_Nullable))failureHandler;

    Swift

    optional func passcodeAuthenticator(_ passcodeAuthenticator: TGFPasscodeAuthenticator?, willStartWith keyboard: any TGFKeyboard, operationInfo: TGFFido2OperationInfo?, cancelHandler: @escaping () -> Void, failureHandler: @escaping (String?) -> Void)

    Parameters

    passcodeAuthenticator

    TGFPasscodeAuthenticator object.

    keyboard

    An object conforming to the TGFKeyboard protocol to present a secure keyboard for passcode entry.

    operationInfo

    An object containing information about the current FIDO2 operation.

    cancelHandler

    A block that your application must call if the user cancels the operation.

    failureHandler

    A block to be called if an unexpected error prevents the keyboard flow from starting.

  • Provides a passcode programmatically, bypassing the secure keyboard UI.

    This is an optional method for advanced use cases where the application collects the passcode through its own UI and provides it directly to the SDK.

    Note

    If this method is implemented, the passcodeAuthenticator:requestsKeyboard:forOperation:cancelHandler:failureHandler: method will not be called.

    @since 1.8.0

    Declaration

    Objective-C

    - (void)passcodeAuthenticator:
                (TGFPasscodeAuthenticator *_Nullable)passcodeAuthenticator
               setPasscodeForInfo:(TGFFido2OperationInfo *_Nullable)operationInfo
                 isChangePasscode:(BOOL)isChangePasscode
                  passcodeHandler:
                      (nonnull void (^)(NSData *_Nonnull,
                                        NSData *_Nullable))passcodeHandler
                    cancelHandler:(void (^_Nonnull)(void))cancelHandler
                   failureHandler:(void (^_Nonnull)(void))failureHandler;

    Swift

    optional func passcodeAuthenticator(_ passcodeAuthenticator: TGFPasscodeAuthenticator?, setPasscodeFor operationInfo: TGFFido2OperationInfo?, isChangePasscode: Bool, passcodeHandler: @escaping (Data, Data?) -> Void, cancelHandler: @escaping () -> Void, failureHandler: @escaping () -> Void)

    Parameters

    passcodeAuthenticator

    TGFPasscodeAuthenticator object.

    operationInfo

    An object containing information about the current FIDO2 operation.

    isChangePasscode

    YES if this is part of a change passcode flow, NO otherwise.

    passcodeHandler

    A block your application must call to provide the passcode(s).

    • For enrollment or authentication: provide the passcode in the passcode parameter and nil for updatedPasscode.
    • For changing a passcode: provide the old passcode in passcode and the new passcode in updatedPasscode.

    cancelHandler

    A block to be called if the user cancels the operation.

    failureHandler

    A block to be called if the SDK cannot proceed with the programmatic flow, indicating that the standard keyboard flow should be used instead.

  • Called when a passcode-related operation (enrollment, unenrollment, or change passcode) completes successfully.

    Note

    This callback is NOT invoked during FIDO2 Registration/Authentication operations.

    Declaration

    Objective-C

    - (void)passcodeAuthenticatorDidFinish:
        (TGFPasscodeAuthenticator *_Nonnull)passcodeAuthenticator;

    Swift

    optional func passcodeAuthenticatorDidFinish(_ passcodeAuthenticator: TGFPasscodeAuthenticator)

    Parameters

    passcodeAuthenticator

    TGFPasscodeAuthenticator object

  • Called when any passcode-related operation fails.

    Note

    This callback is NOT invoked during FIDO2 Registration/Authentication operations.

    Declaration

    Objective-C

    - (void)passcodeAuthenticator:
                (TGFPasscodeAuthenticator *_Nonnull)passcodeAuthenticator
                 didFailWithError:(nonnull NSError *)error;

    Swift

    optional func passcodeAuthenticator(_ passcodeAuthenticator: TGFPasscodeAuthenticator, didFailWithError error: any Error)

    Parameters

    passcodeAuthenticator

    TGFPasscodeAuthenticator object

    error

    An error object.