FidoAuthenticationCollector

public class FidoAuthenticationCollector : AbstractFidoCollector, Closeable, @unchecked Sendable

A collector for FIDO authentication within a DaVinci flow.

  • Resets the collector’s state by clearing the assertion value.

    Declaration

    Swift

    public func close()
  • The public key credential request options provided by the server.

    Declaration

    Swift

    public var publicKeyCredentialRequestOptions: [String : Any]
  • The assertion value constructed after a successful authentication. This value is sent to the server.

    Declaration

    Swift

    public var assertionValue: [String : Any]?
  • Initializes a new Fido authentication collector.

    Throws

    An error if the required publicKeyCredentialRequestOptions parameter is missing from the JSON.

    Declaration

    Swift

    required public init(with json: [String : Any])

    Parameters

    json

    The JSON payload from the server that includes the Fido authentication options.

  • The payload to be sent to the DaVinci server.

    Declaration

    Swift

    override public func payload() -> [String : Any]?

    Return Value

    A dictionary containing the assertion value, or nil if authentication has not been completed.

  • authenticate(window:) Asynchronous

    Initiates the FIDO authentication process using async/await.

    This method uses the fido.authenticate method to perform the authentication ceremony. On success, it constructs and stores the assertionValue, then returns it.

    Throws

    An error if the authentication process fails or the response is invalid.

    Declaration

    Swift

    @MainActor
    public func authenticate(window: ASPresentationAnchor) async -> Result<[String : Any], Error>

    Parameters

    window

    The ASPresentationAnchor to present the FIDO UI.

    Return Value

    A dictionary representing the assertionValue.