Used to store account data.

interface AccountStore {
    create: (() => Promise<string>);
    getSetting: (<T>(id: string, setting: T) => Promise<AccountSettings[T]>);
    updateSetting: (<T>(id: string, setting: T, value: AccountSettings[T]) => Promise<void>);
}

Implemented by

Properties

create: (() => Promise<string>)

Creates a new and empty account. Since this account will not yet have a login method, implementations should restrict what is possible with this account, and should potentially have something in place to clean these accounts up if they are unused.

getSetting: (<T>(id: string, setting: T) => Promise<AccountSettings[T]>)

Finds the setting of the account with the given identifier.

Type declaration

    • <T>(id, setting): Promise<AccountSettings[T]>
    • Type Parameters

      • T extends "rememberLogin"

      Parameters

      • id: string

        The account identifier.

      • setting: T

        The setting to find the value of.

      Returns Promise<AccountSettings[T]>

updateSetting: (<T>(id: string, setting: T, value: AccountSettings[T]) => Promise<void>)

Updates the settings for the account with the given identifier to the new values.

Type declaration

    • <T>(id, setting, value): Promise<void>
    • Type Parameters

      • T extends "rememberLogin"

      Parameters

      • id: string

        The account identifier.

      • setting: T

        The setting to update.

      • value: AccountSettings[T]

        The new value for the setting.

      Returns Promise<void>