Class: TransactionStore

TransactionStore(optsopt)

Grant transactions (the client nonce, the server nonce, the continuation) between the redirect to the AS and the callback. Keyed by the client nonce; take() removes the entry as it reads it, so each transaction — and therefore each authorization response — can be used exactly once.

Uses sessionStorage when present (per tab, cleared when the tab closes, survives the round trip to the AS) and memory otherwise.

Constructor

new TransactionStore(optsopt)

Parameters:
Name Type Attributes Description
opts Object <optional>

(TypeScript: { storage?: Storage|null, prefix?: string })

Source:

Classes

TransactionStore

Methods

ids() → {Array.<string>}

The ids of every transaction held, without removing any. A GNAP redirect finish carries no state: the client recognises its transaction by recomputing the interaction hash with each one's nonces.

Source:
Returns:
Type
Array.<string>

peek(id) → {Record.<string, any>|undefined}

Reads a transaction without removing it.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
Record.<string, any> | undefined

set(id)

Parameters:
Name Type Description
id string

@param {Record<string, any>} transaction

Source:

sweep(maxAgeMs)

Removes transactions older than maxAgeMs (abandoned sign-ins).

Parameters:
Name Type Description
maxAgeMs number
Source:

take(id) → {Record.<string, any>|undefined}

Reads and removes a transaction.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
Record.<string, any> | undefined