@auth0/auth0-acul-js - v0.1.0-beta.5
    Preparing search index...

    Interface MfaWebAuthnPlatformEnrollmentMembers

    MfaWebAuthnPlatformEnrollmentMembers

    interface MfaWebAuthnPlatformEnrollmentMembers {
        branding: Classes.BrandingMembers;
        client: Classes.ClientMembers;
        organization: Classes.OrganizationMembers;
        prompt: Classes.PromptMembers;
        screen: Classes.ScreenMembers;
        tenant: Classes.TenantMembers;
        transaction: Classes.TransactionMembers;
        untrustedData: Classes.UntrustedDataMembers;
        user: Classes.UserMembers;
        refuseEnrollmentOnThisDevice(
            payload?: Classes.CustomOptions,
        ): Promise<void>;
        reportBrowserError(
            payload: Classes.ReportBrowserErrorOptions,
        ): Promise<void>;
        snoozeEnrollment(payload?: Classes.CustomOptions): Promise<void>;
        submitPasskeyCredential(
            payload?: Classes.SubmitPasskeyCredentialOptions,
        ): Promise<void>;
    }

    Hierarchy

    • BaseMembers
      • MfaWebAuthnPlatformEnrollmentMembers

    Implemented by

    Index

    Properties

    Methods

    • Allows the user to refuse WebAuthn platform enrollment on the current device. This action indicates the user does not want to use a platform authenticator on this specific device.

      Parameters

      Returns Promise<void>

      A promise that resolves when the refusal action is successfully submitted.

      Throws an error if the submission fails.

      // Assuming 'sdk' is an instance of MfaWebAuthnPlatformEnrollment
      await sdk.refuseEnrollmentOnThisDevice();
    • Reports a browser-side error encountered during the WebAuthn navigator.credentials.create() operation. This method sends the error details to the server.

      Parameters

      Returns Promise<void>

      A promise that resolves when the error report is successfully submitted.

      Throws an error if the submission fails.

      // Assuming 'sdk' is an instance of MfaWebAuthnPlatformEnrollment
      // In the catch block of an attempted passkey creation (e.g. from submitPasskeyCredential):
      } catch (webAuthnError) {
      if (webAuthnError.name) { // Check if it's likely a WebAuthn API error
      await sdk.reportBrowserError({ error: { name: webAuthnError.name, message: webAuthnError.message } });
      }
      // Update UI to show error message to the user
      }
    • Allows the user to snooze or postpone the WebAuthn platform enrollment. This action typically means the user will be reminded to enroll at a later time.

      Parameters

      Returns Promise<void>

      A promise that resolves when the snooze action is successfully submitted.

      Throws an error if the submission fails.

      // Assuming 'sdk' is an instance of MfaWebAuthnPlatformEnrollment
      await sdk.snoozeEnrollment();
    • Initiates the WebAuthn platform credential creation process using the public key options available on this.screen.publicKey and submits the resulting credential to the server. This method internally calls createPasskeyCredentials (which wraps navigator.credentials.create()).

      Parameters

      Returns Promise<void>

      A promise that resolves when the credential is successfully created and submitted.

      Throws an error if this.screen.publicKey is not available, if createPasskeyCredentials fails (e.g., user cancellation, hardware issues), or if the submission to the server fails.

      // Assuming 'sdk' is an instance of MfaWebAuthnPlatformEnrollment
      try {
      if (!sdk.screen.publicKey) { // Check if options are available
      throw new Error("Public key creation options are not available on the screen context.");
      }
      await sdk.submitPasskeyCredential(); // No need to pass publicKey explicitly
      // On success, Auth0 handles redirection.
      } catch (error) {
      console.error('Passkey enrollment failed:', error);
      // Handle error, potentially by calling reportBrowserError if it's a WebAuthn API error
      if (error.name && error.message) { // Check if it looks like a WebAuthn error
      await sdk.reportBrowserError({ error: { name: error.name, message: error.message } });
      }
      }