This class represents an 'Multi User API With Credentials' authentication workflow.

Hierarchy (view full)

Constructors

Properties

onLogin: OEvent<((instanceName: string, secret: string, email: string) => void)> = ...

This event will be triggered right AFTER the instance was initialised

onLogout: OEvent<(() => void)> = ...

This event will be triggered right BEFORE the instance was closed

Methods

  • Erases the instance. This function will:

    • deletes the instance

    Parameters

    • instanceName: string
    • email: string

    Returns Promise<void>

  • Checks if the user exists or not.

    Parameters

    • email: string
    • instanceName: string

    Returns Promise<boolean>

  • Logins the user. This function will:

    • trigger the 'login' event
    • will check if the instance exists
      • if yes, it will initialize the instance, import modules, register recipes, trigger onLogin and wait for all the listeners to finish and trigger 'login_success' event
      • if no, it will trigger 'login_failure' event

    Parameters

    • email: string
    • secret: string
    • instanceName: string

    Returns Promise<void>

  • This function will login or register based on the instance existence.

    Parameters

    • email: string
    • secret: string
    • instanceName: string

    Returns Promise<void>

  • Logouts the user. This function will:

    • trigger the 'logout' event
    • trigger onLogout and wait for all the listeners to finish
    • close the instance
    • trigger the 'logout_done' event if it is successfully

    Returns Promise<void>

  • Registers the user. Register acts as a login if the instance does not exist yet.

    Parameters

    • email: string
    • secret: string
    • instanceName: string
    • OptionalsecretEncryptionKey: string | Uint8Array
    • OptionalsecretSignKey: string | Uint8Array

    Returns Promise<void>