Handles authentication messaging between the parent window and an embedded iframe. Sends user credentials to the iframe and listens for an authentication response.

Constructors

Properties

Methods

Constructors

  • Creates an instance of AuthManager.

    Parameters

    • iframe: HTMLIFrameElement

      The target iframe element to manage.

    • OptionaluserId: string

      The user ID to authenticate with.

    • OptionalapiKey: string

      The API key to authenticate with.

    Returns AuthManager

Properties

tier: string

Methods

  • Cleans up all registered message event listeners previously added by _listenForMessage. Call this method when the instance is being destroyed or no longer needs to listen to messages.

    Returns void

  • Initializes the AuthManager by:

    • Sending an authentication message to the iframe with the API key and user ID.
    • Listening for a response message of type "auth" to retrieve and store the access tier.

    Parameters

    • opt: { maxTries: number; try: number } = ...

    Returns Promise<"timeout" | "initialized">

    A promise that resolves when the authentication response is received.