Type Alias: OneTimeTokenStore
OneTimeTokenStore =
object
Defined in: auth-core/src/emailAuthTypes.ts:104
App-provided one-time token persistence.
Every method takes or returns a tokenHash, never a redeemable token, which
makes storing a usable secret impossible rather than merely discouraged.
Properties
delete
delete: (
args) =>Promise<void> |void
Defined in: auth-core/src/emailAuthTypes.ts:125
Delete a token, enforcing single use.
Parameters
| Parameter | Type |
|---|---|
args | { purpose: OneTimeTokenPurpose; tokenHash: string; } |
args.purpose | OneTimeTokenPurpose |
args.tokenHash | string |
Returns
Promise<void> | void
deleteFor
deleteFor: (
args) =>Promise<void> |void
Defined in: auth-core/src/emailAuthTypes.ts:133
Delete every outstanding token of this purpose for this address, so issuing a new one invalidates whatever preceded it.
Parameters
| Parameter | Type |
|---|---|
args | { email: string; purpose: OneTimeTokenPurpose; } |
args.email | string |
args.purpose | OneTimeTokenPurpose |
Returns
Promise<void> | void
find
find: (
args) =>Promise<StoredOneTimeToken|null> |StoredOneTimeToken|null
Defined in: auth-core/src/emailAuthTypes.ts:111
Look up by hash and purpose, so a token minted for one flow cannot be redeemed by another. This is the lookup for the link flows, where the token itself is the only thing the request carries.
Parameters
| Parameter | Type |
|---|---|
args | { purpose: OneTimeTokenPurpose; tokenHash: string; } |
args.purpose | OneTimeTokenPurpose |
args.tokenHash | string |
Returns
Promise<StoredOneTimeToken | null> | StoredOneTimeToken | null
findByEmail?
optionalfindByEmail?: (args) =>Promise<StoredOneTimeToken|null> |StoredOneTimeToken|null
Defined in: auth-core/src/emailAuthTypes.ts:120
Look up the outstanding token for an address. Required when emailCode is
enabled: a wrong code hashes to nothing on record, so the engine has to
find the record by address before it can compare and count the attempt.
Parameters
| Parameter | Type |
|---|---|
args | { email: string; purpose: OneTimeTokenPurpose; } |
args.email | string |
args.purpose | OneTimeTokenPurpose |
Returns
Promise<StoredOneTimeToken | null> | StoredOneTimeToken | null
incrementAttempts?
optionalincrementAttempts?: (args) =>Promise<void> |void
Defined in: auth-core/src/emailAuthTypes.ts:142
Record a failed attempt. Required when emailCode is enabled; the engine
calls it on every wrong guess and destroys the token once maxAttempts is
reached.
Parameters
| Parameter | Type |
|---|---|
args | { purpose: OneTimeTokenPurpose; tokenHash: string; } |
args.purpose | OneTimeTokenPurpose |
args.tokenHash | string |
Returns
Promise<void> | void
save
save: (
token) =>Promise<void> |void
Defined in: auth-core/src/emailAuthTypes.ts:105
Parameters
| Parameter | Type |
|---|---|
token | StoredOneTimeToken |
Returns
Promise<void> | void