Skip to main content

persistRefreshToken

API Docs


Function: persistRefreshToken()

persistRefreshToken(db, params): Promise<void>

Defined in: src/services/auth/refreshStore.ts:46

Persists a refresh token in the database. Stores only userId, tokenHash (SHA-256 of token), and expiresAt. Throws if params.ttlSec is not a finite positive number (avoids NaN, Infinity, and immediately-expired tokens).

Parameters

db

DrizzleClient

Drizzle client.

params

PersistRefreshTokenParams

Token, userId, ttlSec; ip/userAgent accepted but not persisted.

Returns

Promise<void>

Promise that resolves when the insert completes.

Throws

TalawaRestError with code INVALID_ARGUMENTS if params.ttlSec is not positive.