TGFKeyboardDelegate
Objective-C
@protocol TGFKeyboardDelegate <NSObject>
Swift
protocol TGFKeyboardDelegate : NSObjectProtocol
A delegate protocol for responding to events from a secure keyboard view.
An object that adopts this protocol is responsible for providing the keyboard’s layout information and for handling user interactions, such as key presses and authentication results.
@since 1.0.0
-
Asks the delegate for the frame to use for the keyboard view.
The keyboard calls this method once during its initialization to determine its size and position within the superview. The returned frame is considered final and should not be modified at runtime.
Warning
An exception is thrown if the frame is invalid for the current orientation. Rotation is currently unsupported.
Declaration
Objective-C
- (CGRect)frameForKeyboard:(id<TGFKeyboard> _Nonnull)keyboard;Swift
func frame(for keyboard: any TGFKeyboard) -> CGRectParameters
keyboardAn object conforming to the TGFKeyboard protocol.
Return Value
The frame rectangle for the keyboard, specified in points.
-
Notifies the delegate that a key has been pressed on the keyboard.
The application should use this callback to update its UI, such as a secure input field that displays passcode characters. Key presses correspond to the following actions:
TGFKeyboardKeyInput: Add a new secure character (⬤) to the text field entry.TGFKeyboardKeyDelete: Remove a secure character from the text field entry.TGFKeyboardKeyDone: Submit the completed passcode entry to the FIDO2 SDK for processing. The application should then wait for a result callback.
See
TGFKeyboardKey
Declaration
Objective-C
- (void)keyboard:(id<TGFKeyboard> _Nonnull)keyboard didReceiveKey:(TGFKeyboardKey)key;Swift
func keyboard(_ keyboard: any TGFKeyboard, didReceive key: TGFKeyboardKey)Parameters
keyboardAn object conforming to the TGFKeyboard protocol.
keyAn enum of type TGFKeyboardKey indicating the type of key pressed.
-
Notifies the delegate that a passcode authentication attempt has failed.
This method provides the number of remaining retry attempts before the user is locked out (which triggers a
TGFFido2ErrorCodeUserLockouterror). The FIDO2 SDK allows a total of 5 attempts. Upon failure, the current passcode input is automatically cleared. The retry counter resets after a successful authentication.Declaration
Objective-C
- (void)keyboard:(id<TGFKeyboard> _Nonnull)keyboard didFailAuthenticationWithRetryCountRemaining: (NSUInteger)retryCountRemaining;Swift
func keyboard(_ keyboard: any TGFKeyboard, didFailAuthenticationWithRetryCountRemaining retryCountRemaining: UInt)Parameters
keyboardAn object conforming to the TGFKeyboard protocol.
retryCountRemainingThe number of attempts remaining. This will be 4 after the first failure and 1 on the last attempt before lockout.
-
Notifies the delegate that the keyboard’s purpose has changed.
This can occur, for example, when transitioning from initial passcode creation to passcode confirmation during a registration flow. The application can use this callback to update UI elements like titles or instruction labels.
Declaration
Objective-C
- (void)keyboard:(id<TGFKeyboard> _Nonnull)keyboard didChangeUsage:(TGFKeyboardUsage)usage;Swift
func keyboard(_ keyboard: any TGFKeyboard, didChange usage: TGFKeyboardUsage)Parameters
keyboardAn object conforming to the TGFKeyboard protocol.
usageAn enum of type
TGFKeyboardUsageindicating the keyboard’s new purpose. -
Notifies the delegate that the entered passcode has violated a predefined rule.
This is typically called during passcode creation if the input does not meet complexity requirements (e.g., minimum length, no sequential numbers). The associated
NSErrorobject contains details about the specific rule that failed.@since 1.3.0
Declaration
Objective-C
- (void)keyboard:(id<TGFKeyboard> _Nonnull)keyboard didFailPasscodeRuleWithError:(nonnull NSError *)error;Swift
func keyboard(_ keyboard: any TGFKeyboard, didFailPasscodeRuleWithError error: any Error)Parameters
keyboardAn object conforming to the TGFKeyboard protocol.
errorAn error representing the respective passcode rule violation.