/// import EventEmitter from 'events'; import { ZitiBrowserClientOptions } from './global'; declare global { interface Window { _zitiContext?: object; } } /** * ZitiBrowserClient: * * This is the main class that Web Applications should interface with */ export declare class ZitiBrowserClient extends EventEmitter { private readonly cacheManager; private readonly nowProvider; private readonly zitiBrowzerCore; private readonly zitiContext; private readonly logger; private readonly userCache; private readonly options; private readonly defaultOptions; /** * To support the ZitiBrowserClient.ready property */ private _readyPromise; private _resolveReady; /** * ZitiBrowserClient ctor * * @param options */ constructor(options: ZitiBrowserClientOptions); private _initializeZitiContext; /** ----------------------------------------------------------- * PUBLIC APIs * ----------------------------------------------------------*/ /** * ```js * zitiBrowserClient.ready; * ``` * * Do not return/resolve until the SDK is fully initialized */ get ready(): Promise; private _ready; private _init; private _noServiceEventHandler; private _noConfigForHostnameEventHandler; private _sessionCreationErrorEventHandler; /** * ```js * const result = zitiBrowserClient.setAccessToken(); * ``` * * Set the JWT to be used to auth with Ziti Controller. */ setAccessToken(token: string): boolean; /** * ```js * const result = zitiBrowserClient.setAPISessionToken(); * ``` * * Set the zt-session token to be used to make REST calls to the Ziti Controller. */ setAPISessionToken(token: string): void; /** * ```js * const result = zitiBrowserClient.getFreshAPISession(); * ``` * * Authenticates with Ziti Controller. */ getFreshAPISession(): boolean; /** * ```js * const result = zitiBrowserClient.fetchServices(); * ``` * * Authenticates with Ziti Controller. */ fetchServices(): Promise; /** * ```js * const result = zitiBrowserClient.enroll(); * ``` * * Does all PKI work necessary to obtain an ephemeral Cert from Ziti Controller. */ enroll(): Promise; /** * ```js * const result = zitiBrowserClient.printEphemeralCert(); * ``` * * Prints ephemeral Cert obtained from Ziti Controller to the console. */ printEphemeralCert(): Promise; /** * ```js * const result = zitiBrowserClient.fetch(); * ``` * * tbw... */ fetch(resource: string | Request, options: RequestInit | null): Promise; getWASMInstance(): Promise; /** * ```js * const claims = await zitiBrowserClient.generateKeyPair(); * ``` * * Does stuff... */ generateKeyPair(): Promise; /** * ```js * await zitiBrowserClient.logout(); * ``` * * Clears the application session. * */ logout(): Promise; private _saveEntryInCache; private _setAccessToken; private _setAPISessionToken; private _getFreshAPISession; private _fetchServices; private _enroll; private _printEphemeralCert; private _fetch; private _getWASMInstance; private _generateKeyPair; }