Skip to content

TypeScript API / laikacms/auth / ResolveBearerDeps

Interface: ResolveBearerDeps ​

Properties ​

lookupPatByHash ​

ts
lookupPatByHash: (hash) => Promise<PatRecord | null | undefined>;

Looks up a PAT record by its sha256 hash. Never receives the plaintext token.

Parameters ​

ParameterType
hashstring

Returns ​

Promise<PatRecord | null | undefined>


now? ​

ts
optional now?: () => Date;

Returns ​

Date


onPatUsed? ​

ts
optional onPatUsed?: (record) => void | Promise<void>;

Optional side effect (e.g. bump lastUsedAt); failures never fail verification.

Parameters ​

ParameterType
recordPatRecord

Returns ​

void | Promise<void>


verifySessionToken ​

ts
verifySessionToken: (bearer) => Promise<
  | SessionVerificationResult
  | null
| undefined>;

Validates a non-PAT bearer against the existing OAuth session-token seam (unchanged). Return null/undefined for an invalid/expired token. Omitting scopes on the result means "full admin", matching today's behaviour where any authenticated session is full-admin.

Parameters ​

ParameterType
bearerstring

Returns ​

Promise< | SessionVerificationResult | null | undefined>

Released under the MIT License.