/** * The result of handling the state in the URL. * - "completed" means the authentication process has finished successfully; * - "nothing" means that there was no state in the URL to handle; * - "invalid" means that there was a mismatch between the stored state and URL params; * - "error" means there was an error. */ export interface HandleStateResult { status: "completed" | "nothing" | "invalid" | "error"; msg: string; } /** * A typical JWT payload. Probably not really correct. */ interface JWTPayload { exp: number; iat: number; auth_time: number; jti: string; iss: string; sub: string; typ: string; azp: string; nonce: string; session_state: string; scope: string; sid: string; email: string; } /** * The well known configuration for an OpenID Connect provider */ export interface WellKnownConfig { authorization_endpoint: string; token_endpoint: string; userinfo_endpoint: string; logout_endpoint?: string; } /** * The options for the CodeOICClient */ export interface CodeOICClientOptions { clientId: string; clientSecret?: string; scopes?: string[]; accessType?: string; redirectUri: string; pkce?: boolean; prompt?: string; checkToken?: (token: string) => Promise; debug?: boolean; } export declare class CodeOIDCClient { private options; private wellKnown; constructor(options: CodeOICClientOptions, wellKnown: WellKnownConfig); private lget; private lset; private lremove; /** * Clear all localstorage keys used by this object. */ lclear(): void; /** * * @param search The URLSearchParams of the current URL * @return once the state has been handled * @throws */ handleStateIfInURL(search: URLSearchParams): Promise; /** * Retrieve the access and refresh tokens and store them in the local storage. * Additionnaly, check validity of the token with the provided checkToken function. * @param code The code from the authorization response * @return once retrieval is complete */ private retrieveAndStoreTokens; private doTokenQuery; /** * Start a log in process. * This will redirect to the SSO and back to the provided redirect URI. */ createAuthorizeAndUpdateLocalStorage(scopes?: string[]): Promise; /** * * @param token A well-formed token * @return the parsed payload or undefined if the token is not well-formed * @throws if not a well formed JWT token or not in a secured browsing context */ parseJwtPayload(token: string): JWTPayload; private doRefreshToken; /** * @deprecated all tokens are not JWT * @param token * @returns */ isActiveToken(token: string): boolean; protected isInsideValidityPeriod(expiration: number, leeway?: number): boolean; getActiveToken(): Promise; refreshToken(): Promise; getActiveIdToken(): string; logout(document: Document): void; /** * * @param token Valid access token * @return the userinfo response */ retrieveUserInfo(token: string): Promise; } export {}; //# sourceMappingURL=code.d.ts.map