FRWebAuthnManager
@available(iOS 16, *)
@MainActor
public class FRWebAuthnManager : NSObject, ASAuthorizationControllerPresentationContextProviding, ASAuthorizationControllerDelegate
FRWebAuthnManager is a class handling WebAuthn Registation and Authentication using Apple’s ASAuthorization libraries. Used by the SDK, it is called by the WebAuthnRegistration and WebAuthnAuthenticaton callbacks and sets the outcome in the HiddenValueCallback. This comes with the FRWebAuthnManagerDelegate that offers callbacks in the calling class for Success, Error and Cancel scenarios.
-
Declaration
Swift
@MainActor public weak var delegate: FRWebAuthnManagerDelegate? -
Declaration
Swift
@MainActor public init(domain: String, authenticationAnchor: ASPresentationAnchor?, node: Node) -
signInWith(preferImmediatelyAvailableCredentials:challenge: allowedCredentialsArray: userVerificationPreference: ) Sign In method, using AuthenticationServices. This will use the stored Passkeys to create the challenge and set it in tghe HiddenValue callback. Called by the WebAuthnAuthentication callback, by triggering the
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)delegate method.Declaration
Swift
@MainActor public func signInWith(preferImmediatelyAvailableCredentials: Bool, challenge: Data, allowedCredentialsArray: [[UInt8]], userVerificationPreference: ASAuthorizationPublicKeyCredentialUserVerificationPreference)Parameters
preferImmediatelyAvailableCredentialsset to
Trueto use only local keyschallengechallenge
Dataas received from the NodeallowedCredentialsArrayAllowed credentials
-
Sign un method, using AuthenticationServices. This create the Passkey and store it in the Keychain, by triggering the
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)delegate method.Declaration
Swift
@MainActor public func signUpWith(userName: String, challenge: Data, userID: String, deviceName: String?, userVerificationPreference: ASAuthorizationPublicKeyCredentialUserVerificationPreference, attestationPreference: ASAuthorizationPublicKeyCredentialAttestationKind)Parameters
userNameusername
challengechallenge
Dataas received from the NodeuserIDuserID
deviceNameOptional device name. This will be the device name, that appears in the list of user devices
-
Declaration
Swift
@MainActor public func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor
-
Declaration
Swift
@MainActor public func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) -
Declaration
Swift
@MainActor public func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error)
View on GitHub