This class represents an 'Single 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:

    • delete the instance
    • remove (if present) only workflow related store

    Returns Promise<void>

  • Logins the user. This function will:

    • trigger the 'login' event
    • will check if there are any stored credentials
      • if no, it will throw an error and trigger 'login_failure' event
      • if yes, it will check if the instance exist
        • 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 throw an error and trigger 'login_failure' event

    Parameters

    • secret: string

    Returns Promise<void>

  • This function will login or register based on the credentials existence in store.

    Parameters

    • secret: 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>

  • Erases the current instance. This function will:

    • trigger the 'logout' & onLogout events
    • remove (if present) only workflow related store
    • delete the instance
    • trigger 'logout_done' event

    Returns Promise<void>

  • Registers the user with secret and generated instance name & email. This function will:

    • will check if there are any stored credentials
      • if no, it will persist the generated instance name & email
      • if yes, continue
    • will trigger the 'login' event
    • will init the instance
    • if successful
      • if yes, it will trigger the 'login_success' event
      • if no, it will throw error and trigger 'login_failure' event

    Parameters

    • secret: string

    Returns Promise<void>