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)
  • 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

    preferImmediatelyAvailableCredentials

    set to True to use only local keys

    challenge

    challenge Data as received from the Node

    allowedCredentialsArray

    Allowed 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

    userName

    username

    challenge

    challenge Data as received from the Node

    userID

    userID

    deviceName

    Optional device name. This will be the device name, that appears in the list of user devices

ASAuthorizationControllerPresentationContextProviding

  • Declaration

    Swift

    @MainActor
    public func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor

ASAuthorizationControllerDelegate