UNPKG

@capgo/cli

Version:
31 lines (30 loc) 986 B
export interface BrokerSession { pubId: string; pollSecret: string; signInUrl: string; /** Epoch ms when the sign-in window closes (the broker's 15-min session TTL). */ expiresAt: number; } export type BrokerPollResult = { status: 'pending'; } | { status: 'awaiting_code'; error?: string; } | { status: 'done'; accessToken: string; expiresAt: number | null; } | { status: 'error'; error: string; }; /** Create a broker sign-in session for `appId`. Throws on a transport/HTTP failure. */ export declare function createBrokerSession(appId: string): Promise<BrokerSession>; /** * Poll a broker session. Pass `confirmCode` (the code the user read off the success page) to release the * token — the broker withholds it (status 'awaiting_code') until the matching code is presented. */ export declare function pollBrokerSession(session: { pubId: string; pollSecret: string; }, confirmCode?: string): Promise<BrokerPollResult>;