Skip to content

basalt / auth/src / MfaStore

Interface: MfaStore ​

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

Methods ​

consumeRecoveryCode()? ​

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

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

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>


consumeTotpStep()? ​

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

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

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>


delete() ​

> delete(userId): Promise<void>

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

Parameters ​

userId ​

string

Returns ​

Promise<void>


get() ​

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

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

Parameters ​

userId ​

string

Returns ​

Promise<MfaRecord | null>


set() ​

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

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

Parameters ​

userId ​

string

record ​

MfaRecord

Returns ​

Promise<void>

Released under the MIT License.