import { type Logging } from 'homebridge'; /** * A class that's in charge of maintaining a valid OAuth/OpenID ID token * * Note that this class doesn't actively monitor the validity of the ID token. * It relies on the owner to notice that the ID token isn't working anymore. * The owner would then invoke `refreshToken` to tell this class to fetch a new one. */ export declare class OpenIDSession { private readonly log; private emitter; private refresh_token?; private id_token?; private readonly request; constructor(log: Logging); /** * Force-set the ID token (if known) * @param token An OAuth/OpenID ID token (A JWT token) */ setIdToken(token: string): void; /** * Set the refresh token * @param token An OAuth/OpenID refresh token (A JWT token) */ setRefreshToken(token: string): void; /** * Mark the ID token as invalid, and attempt to fetch a new one * * @throws {UnknownResponseError} If we somehow failed to parse a response from the authorization service * @throws {NetworkServiceError} If we encounter a transient network error (e.g. a network hiccup) * @throws {TokenExpiredError} If all avenues for fetching a new ID token have expired */ refreshToken(): Promise; /** * Get the ID token * @returns The OAuth/OpenID ID token (in JWT format) */ getIdToken(): string; /** * Check the validity of the ID token. * Note that this does not check the expiration status of the ID token, * so this function is mostly checking if the ID token is known. * @returns True if the ID token is valid */ isValid(): boolean; /** * Register a callback for when the ID and/or refresh token changed * @param handler A callback function */ onTokenChanged(handler: (id_token: string, refresh_token: string) => void): void; private getIDTokenUsingRefreshToken; private emitTokenChanged; }