Skip to content

basalt / auth/src / MemoryMfaStore

Class: MemoryMfaStore ​

Defined in: auth/src/stores.ts:342

Implements ​

Constructors ​

Constructor ​

> new MemoryMfaStore(): MemoryMfaStore

Returns ​

MemoryMfaStore

Methods ​

consumeRecoveryCode() ​

> consumeRecoveryCode(userId, hash): Promise<boolean>

Defined in: auth/src/stores.ts:362

Atomically removes the recovery-code hash, returning whether THIS call removed it (a compare-and-swap). Optional, with the same fallback caveat.

Parameters ​

userId ​

string

hash ​

string

Returns ​

Promise<boolean>

Implementation of ​

MfaStore.consumeRecoveryCode


consumeTotpStep() ​

> consumeTotpStep(userId, step): Promise<boolean>

Defined in: auth/src/stores.ts:355

Atomically records step as the last accepted TOTP step, only if MFA is enabled and no step ≥ step was accepted before (a conditional UPDATE). Returns whether THIS call consumed it. Optional: without it, Auth falls back to get → set, which lets two parallel requests replay the same code.

Parameters ​

userId ​

string

step ​

number

Returns ​

Promise<boolean>

Implementation of ​

MfaStore.consumeTotpStep


delete() ​

> delete(userId): Promise<void>

Defined in: auth/src/stores.ts:351

Parameters ​

userId ​

string

Returns ​

Promise<void>

Implementation of ​

MfaStore.delete


get() ​

> get(userId): Promise<MfaRecord | null>

Defined in: auth/src/stores.ts:345

Parameters ​

userId ​

string

Returns ​

Promise<MfaRecord | null>

Implementation of ​

MfaStore.get


set() ​

> set(userId, record): Promise<void>

Defined in: auth/src/stores.ts:348

Parameters ​

userId ​

string

record ​

MfaRecord

Returns ​

Promise<void>

Implementation of ​

MfaStore.set

Released under the MIT License.