Utilities for validating, parsing, and serializing compact OAuth token blobs.
// Source: https://github.com/mnfst/llm-gateway | License: MIT | Copyright 2026 MNFST, Inc
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Compact JSON shape used to persist OAuth credentials in
* `tenant_providers.api_key`. Field names are single letters to keep the
* encrypted payload small.
*/
export interface OAuthTokenBlob {
/** Access token. */
t: string;
/** Refresh token. */
r: string;
/** Access-token expiry (epoch ms). */
e: number;
/** Provider-specific resource URL (e.g. MiniMax region base URL). */
u?: string;
}
export function isOAuthTokenBlob(value: unknown): value is OAuthTokenBlob {
if (!value || typeof value !== 'object') return false;
const v = value as Partial<OAuthTokenBlob>;
return (
typeof v.t === 'string' &&
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key