FIDO U2F Enroll Operation - iOS Example

Below is the code related to processing a FIDO U2F enroll operation.



SurePassIdU2F *u2f; U2FClientSettings *settings = [[U2FClientSettings alloc] initWithNavigationController:self.navigationController fidoEndpointURL:serverUrl]; u2f = [[SurePassIdU2F alloc] initWithSettings:settings]; [u2f signUsername:usernameOrSessionToken fidoSignResultHandler:^(enum U2FResult result, NSString * _Nullable token) { switch (result) { case SUCCESS: { // FIDO Authentication succeeded. break; } case FALLBACK_AUTHENTICATION: { // The user wants to use fallback authentication instead of FIDO. // This will only happen if U2FClientSettings.allowFallbackAuthentication // is set to YES. break; } case CANCELED: { // The user canceled FIDO Authentication. break; } } } fidoClientErrorHandler:^(NSString * _Nullable errorMessage) { // Handle FIDO Client errors. } fidoServerErrorHandler:^(NSString * _Nullable errorMessage, int errorCode) { // Handle FIDO Server errors. }];