Used to generate and store cookies.

interface CookieStore {
    delete: ((cookie: string) => Promise<boolean>);
    generate: ((accountId: string) => Promise<string>);
    get: ((cookie: string) => Promise<undefined | string>);
    refresh: ((cookie: string) => Promise<undefined | Date>);
}

Implemented by

Properties

delete: ((cookie: string) => Promise<boolean>)

Deletes the given cookie.

Type declaration

    • (cookie): Promise<boolean>
    • Parameters

      • cookie: string

        Cookie to delete.

      Returns Promise<boolean>

generate: ((accountId: string) => Promise<string>)

Generates and stores a new cookie for the given accountId. This does not replace previously generated cookies.

Type declaration

    • (accountId): Promise<string>
    • Parameters

      • accountId: string

        Account to create a cookie for.

      Returns Promise<string>

      The generated cookie.

get: ((cookie: string) => Promise<undefined | string>)

Return the accountID associated with the given cookie.

Type declaration

    • (cookie): Promise<undefined | string>
    • Parameters

      • cookie: string

        Cookie to find the account for.

      Returns Promise<undefined | string>

refresh: ((cookie: string) => Promise<undefined | Date>)

Refreshes the cookie expiration and returns when it will expire if the cookie exists.

Type declaration

    • (cookie): Promise<undefined | Date>
    • Parameters

      • cookie: string

        Cookie to refresh.

      Returns Promise<undefined | Date>