Skip to content

basalt / auth/src / RefreshTokenStore

Interface: RefreshTokenStore ​

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

Methods ​

create() ​

> create(record): Promise<void>

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

Parameters ​

record ​

RefreshRecord

Returns ​

Promise<void>


find() ​

> find(token): Promise<RefreshRecord | null>

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

Parameters ​

token ​

string

Returns ​

Promise<RefreshRecord | null>


markUsed() ​

> markUsed(token): Promise<boolean | void>

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

Consumes the refresh token. MUST be a compare-and-swap: mark it used only if it is still unused, and return whether THIS call did the consuming. Reuse detection depends on it — a plain UPDATE … WHERE token = ? lets two concurrent refreshes of a stolen+legitimate token both succeed. Returning void keeps the pre-CAS behaviour for stores written against the old contract.

Parameters ​

token ​

string

Returns ​

Promise<boolean | void>


revokeAllForUser()? ​

> optional revokeAllForUser(userId): Promise<void>

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

Revokes every token of a user — fired on password reset. Optional.

Parameters ​

userId ​

string

Returns ​

Promise<void>


revokeFamily() ​

> revokeFamily(familyId): Promise<void>

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

Revokes every token of a family — fired on reuse detection.

Parameters ​

familyId ​

string

Returns ​

Promise<void>

Released under the MIT License.