Class FRWebAuthnAbstract

Utility for integrating a web browser's WebAuthn API.

Example:

// Determine if a step is a WebAuthn step
const stepType = FRWebAuthn.getWebAuthnStepType(step);
if (stepType === WebAuthnStepType.Registration) {
// Register a new device
await FRWebAuthn.register(step);
} else if (stepType === WebAuthnStepType.Authentication) {
// Authenticate with a registered device
await FRWebAuthn.authenticate(step);
}

Conditional mediation (Autofill) Support:

// Check if browser supports conditional mediation
const supportsConditionalUI = await FRWebAuthn.isConditionalUISupported();

if (supportsConditionalUI) {
// The authenticate() method automatically handles conditional mediation
// when the server indicates support via conditionalWebAuthn: true
// in the metadata. No additional code changes needed.
await FRWebAuthn.authenticate(step);

// For conditional mediation to work in the browser, add autocomplete="webauthn"
// to your username input field:
// <input type="text" name="username" autocomplete="webauthn" />
}

Constructors

Methods

  • Checks if the browser supports WebAuthn.

    Returns boolean

    boolean indicating if WebAuthn is available

  • Checks if the browser supports conditional mediation (autofill) for WebAuthn.

    Returns Promise<boolean>

    Promise indicating if conditional mediation is available

  • Populates the step with the necessary authentication outcome. Automatically handles conditional mediation if indicated by the server metadata.

    Parameters

    • step: FRStep

      The step that contains WebAuthn authentication data

    • optionsTransformer: (options: CredentialRequestOptions) => CredentialRequestOptions = ...

      Augments the derived options with custom behaviour

    Returns Promise<FRStep>

    The populated step

  • Can make this generic const in Typescript 5.0 > and the name itself will be inferred from the type so typeof deviceName will not just return string but the actual name of the deviceName passed in as a generic.

    Type Parameters

    • T extends string = ""

    Parameters

    Returns Promise<FRStep>

  • Retrieves the credential from the browser Web Authentication API.

    Parameters

    • options: CredentialRequestOptions

      The options associated with the request

    Returns Promise<null | PublicKeyCredential>

    The credential

  • Converts an authentication credential into the outcome expected by OpenAM.

    Parameters

    • credential: null | PublicKeyCredential

      The credential to convert

    Returns
        | `${string}::direct::${string}`
        | `${string}::indirect::${string}`
        | `${string}::none::${string}`
        | `${string}::direct::${string}::${string}`
        | `${string}::indirect::${string}::${string}`
        | `${string}::none::${string}::${string}`

    The outcome string

  • Retrieves the credential from the browser Web Authentication API.

    Parameters

    • options: PublicKeyCredentialCreationOptions

      The public key options associated with the request

    Returns Promise<null | PublicKeyCredential>

    The credential

  • Converts a registration credential into the outcome expected by OpenAM.

    Parameters

    • credential: null | PublicKeyCredential

      The credential to convert

    Returns
        | `${string}::direct::${string}`
        | `${string}::indirect::${string}`
        | `${string}::none::${string}`

    The outcome string

  • Converts authentication tree metadata into options required by the browser Web Authentication API.

    Parameters

    Returns PublicKeyCredentialRequestOptions

    The Web Authentication API request options

  • Converts authentication tree metadata into options required by the browser Web Authentication API.

    Parameters

    Returns PublicKeyCredentialCreationOptions

    The Web Authentication API request options

  • Parameters

    • message: string

    Returns null | object