Constructors

Methods

  • Attempts to connect to IMX silently without user interaction.

    Returns Promise<null | IMXProvider>

    A promise that resolves to an IMX provider if successful, or null if no cached session exists

    The method login with an argument of { useCachedSession: true } should be used in conjunction with connectImx instead

  • Connects to IMX, prompting user interaction if necessary.

    Returns Promise<IMXProvider>

    A promise that resolves to an IMX provider

  • Connects to EVM and optionally announces the provider.

    Parameters

    • Optionaloptions: {
          announceProvider: boolean;
      }

      Configuration options

      • announceProvider: boolean

        Whether to announce the provider via EIP-6963 for wallet discovery (defaults to true)

    Returns Promise<Provider>

    The EVM provider instance

  • Initiates the login process.

    Parameters

    • Optionaloptions: {
          useCachedSession?: boolean;
          anonymousId?: string;
          useSilentLogin?: boolean;
      }

      Login options

      • OptionaluseCachedSession?: boolean

        If true, and no active session exists, the user won't be prompted to log in

      • OptionalanonymousId?: string

        ID used to enrich Passport internal metrics

      • OptionaluseSilentLogin?: boolean

        If true, attempts silent authentication without user interaction. Note: This takes precedence over useCachedSession if both are true

    Returns Promise<null | UserProfile>

    A promise that resolves to the user profile if logged in, null otherwise

    If retrieving the cached user session fails (except for "Unknown or invalid refresh token" errors) and useCachedSession is true

  • Handles the login callback.

    Returns Promise<void>

    A promise that resolves when the callback is processed

  • Initiates a device flow login.

    Parameters

    • Optionaloptions: {
          anonymousId?: string;
      }

      Login options

      • OptionalanonymousId?: string

        ID used to enrich Passport internal metrics

    Returns Promise<DeviceConnectResponse>

    A promise that resolves to the device connection response

  • Handles the device flow login callback.

    Parameters

    • deviceCode: string

      The device code received from the initial request

    • interval: number

      Polling interval in seconds

    • OptionaltimeoutMs: number

      Optional timeout in milliseconds

    Returns Promise<UserProfile>

    A promise that resolves to the user profile

  • Initiates a PKCE flow login.

    Returns Promise<string>

    The authorization URL for the PKCE flow

  • Handles the PKCE flow login callback.

    Parameters

    • authorizationCode: string

      The authorization code received from the OAuth provider

    • state: string

      The state parameter for CSRF protection

    Returns Promise<UserProfile>

    A promise that resolves to the user profile

  • Logs out the current user.

    Returns Promise<void>

    A promise that resolves when the logout is complete

  • Logs the user out of Passport when using device flow authentication.

    Returns Promise<string>

    The device flow end session endpoint. Consumers are responsible for opening this URL in the same browser that was used to log the user in.

  • Handles the silent logout callback.

    Parameters

    • url: string

      The callback URL to process

    Returns Promise<void>

    A promise that resolves when the silent logout is complete

  • Retrieves the current user's information.

    Returns Promise<undefined | UserProfile>

    A promise that resolves to the user profile if logged in, undefined otherwise

  • Retrieves the current user's ID token.

    Returns Promise<undefined | string>

    A promise that resolves to the ID token if available, undefined otherwise

  • Retrieves the current user's access token.

    Returns Promise<undefined | string>

    A promise that resolves to the access token if available, undefined otherwise

  • Retrieves the addresses linked to the current user's account.

    Returns Promise<string[]>

    A promise that resolves to an array of linked addresses

  • Links an external wallet to the current user's account.

    Parameters

    Returns Promise<LinkedWallet>

    A promise that resolves to the linked wallet information

    When:

    • User is not logged in (NOT_LOGGED_IN_ERROR)
    • User is not registered (USER_NOT_REGISTERED_ERROR)
    • Wallet is already linked (LINK_WALLET_ALREADY_LINKED_ERROR)
    • Maximum number of wallets reached (LINK_WALLET_MAX_WALLETS_LINKED_ERROR)
    • Duplicate nonce used (LINK_WALLET_DUPLICATE_NONCE_ERROR)
    • Validation fails (LINK_WALLET_VALIDATION_ERROR)
    • Other generic errors (LINK_WALLET_GENERIC_ERROR)
""