openvibe-sdk/sso
Generated at from
openvibe-contracts v0.454.0 and
openvibe-sdk v0.193.0.
From types/sso.d.ts (server only). Declarations are shown verbatim.
interface SsoClientOptions
export interface SsoClientOptions {
/** Log prefix and the default extra audience openvibe.<site>. */
site: string;
/** This site's origin (post-sign-in targets, the redirect URI). */
baseUrl: string;
clientId: string;
clientSecret: string;
networkUrl?: string;
/** Token grants try this first, then networkUrl. */
networkInternalUrl?: string;
issuer?: string;
/** Default <baseUrl>/auth/callback. */
redirectUri?: string;
scope?: string;
/** Default ['openvibe.network', 'openvibe.<site>']. */
audience?: string | string[];
/** 0.187.0: accept delegated person tokens that name this site (true: the site's own name), e.g. a key's call through Connect's /mcp/all. */
delegated?: boolean | { service: string };
/** A pinned PEM instead of the JWKS. */
publicKey?: string;
secureCookies?: boolean;
accessMaxAgeMs?: number;
fetch?: FetchLike;
log?: Pick<Console, 'warn' | 'log'> & Partial<Pick<Console, 'error'>>;
/** The name the sign-in pages show (default OpenVibe.<Site>). */
siteName?: string;
/** Keep the access token httpOnly (no script can read it; the navbar asks /auth/me). Default false: the shared navbar reads ov_token. */
httpOnlyAccess?: boolean;
/** A site's own cookie names before it moved to the SDK: read as the session until the SDK writes its own. */
legacyCookies?: { access?: Array<string | { name: string; path?: string }>; refresh?: Array<string | { name: string; path?: string }> };
}type SsoUser
The verified session's claims without iat/exp/aud/iss/nbf/jti.
export type SsoUser = Omit<UserTokenClaims, 'iat' | 'exp' | 'aud' | 'iss' | 'nbf' | 'jti'> & Record<string, unknown>;interface SsoClient
export interface SsoClient {
/** GET /login /callback /logout /me /health, POST /fedcm /refresh /handoff; mount at /auth. */
router(express: any): any;
handlers: { login: Handler; callback: Handler; fedcm: Handler; logout: Handler; me: Handler; refresh: Handler; health: Handler; handoffMint: Handler };
/** Redeems a single-use cross-site ticket before the page renders; never replaces an existing session. */
handoff(): (req: Req, res: Res, next: Next) => void;
/** Sets req.user and req.token when a valid session is presented. */
optionalAuth(): (req: Req, res: Res, next: Next) => void;
/** 401 JSON without a valid session. */
requireAuth(): (req: Req, res: Res, next: Next) => void;
/** 0.187.0: the person themselves: 401 without a session, 403 for a delegated token. */
requireFullSession(): (req: Req, res: Res, next: Next) => void;
/** The verified claims, or null. */
verify(token: string | null | undefined): Promise<UserTokenClaims | null>;
/** A Bearer header, else the ov_token cookie. */
extractToken(req: Req): string | null;
authorizeUrl(opts?: { silent?: boolean }): { url: string; state: string; verifier: string };
tokenGrant(body: Record<string, unknown>): Promise<Record<string, any>>;
/** Does the Network accept this client? Cached 10 minutes; GET /auth/health answers with it (503 when 'invalid'). */
checkClient(opts?: { force?: boolean }): Promise<'ok' | 'invalid' | 'unknown'>;
redirectUri: string;
audience: string | string[];
}function createSsoClient
export declare function createSsoClient(opts: SsoClientOptions): SsoClient;function sanitizeNext
A same-site path, this site's https origin or the Network's; anything else (control characters, backslashes) is '/'.
export declare function sanitizeNext(next: unknown, opts?: { baseUrl?: string; networkUrl?: string }): string;function withParam
export declare function withParam(target: string, key: string, value: string): string;function stripHandoffParam
Remove the one-time handoff ticket from a path+query URL, preserving all other parameters and the fragment.
export declare function stripHandoffParam(target: string): string;function failurePage
The self-contained page a sign-in that cannot finish shows (text is escaped).
export declare function failurePage(o: { siteName: string; title: string; text: string; retryHref: string; backHref: string }): string;function decodeJwtPayload
The payload of a JWT, unverified; null when it does not parse.
export declare function decodeJwtPayload(token: string): Record<string, any> | null;function fedcmNonceMatches
export declare function fedcmNonceMatches(token: string, nonce: string): boolean;function claimsToUser
export declare function claimsToUser(claims: Record<string, any> | null): SsoUser | null;function parseCookies
export declare function parseCookies(req: { headers?: Record<string, any> }): Record<string, string>;const COOKIES
export declare const COOKIES: Readonly<{ access: string; refresh: string; hint: string }>;const HANDOFF_PARAM
export declare const HANDOFF_PARAM: 'ov_handoff';