import { State } from '../shared/State'; import { UserSessionMetaType } from './AuthenticateOps'; import { type AccessTokenMetaType } from './OAuth2OidcOps'; export type TokenCache = { /** * Get connection profiles file name * @returns {string} connection profiles file name */ getTokenCachePath(): string; /** * Initialize token cache * * This method is called from app.ts and runs before any of the message handlers are registered. * Therefore none of the Console message functions will produce any output. */ initTokenCache(): void; /** * Check if there are suitable tokens in the cache * @param {tokenType} tokenType type of token * @returns {Promise} true if tokens found in cache, false otherwise */ hasToken(tokenType: tokenType): Promise; /** * Check if there are suitable user session tokens in the cache * @returns {Promise} true if tokens found in cache, false otherwise */ hasUserSessionToken(): Promise; /** * Check if there are suitable user bearer tokens in the cache * @returns {Promise} true if tokens found in cache, false otherwise */ hasUserBearerToken(): Promise; /** * Check if there are suitable service account bearer tokens in the cache * @returns {Promise} true if tokens found in cache, false otherwise */ hasSaBearerToken(): Promise; /** * Read token * @param {tokenType} tokenType type of token * @returns {Promise} token or null */ readToken(tokenType: tokenType): Promise; /** * Read user session token * @returns {Promise} token or null */ readUserSessionToken(): Promise; /** * Read user bearer token * @returns {Promise} token or null */ readUserBearerToken(): Promise; /** * Read service account bearer token * @returns {Promise} token or null */ readSaBearerToken(): Promise; /** * Save user session token for current connection * @returns {Promise} true if the operation succeeded, false otherwise */ saveUserSessionToken(token: UserSessionMetaType): Promise; /** * Save user bearer token for current connection * @returns {Promise} true if the operation succeeded, false otherwise */ saveUserBearerToken(token: AccessTokenMetaType): Promise; /** * Save service account bearer token for current connection * @returns {Promise} true if the operation succeeded, false otherwise */ saveSaBearerToken(token: AccessTokenMetaType): Promise; /** * Purge all expired tokens from cache * @returns {TokenCacheInterface} purged cache */ purge(): TokenCacheInterface; /** * Flush cache * @returns {boolean} true if the operation succeeded, false otherwise */ flush(): boolean; }; declare const _default: (state: State) => TokenCache; export default _default; export interface tokenTypeInterface { userSession: string; userBearer: string; saBearer: string; } export type tokenType = 'userSession' | 'userBearer' | 'saBearer'; export interface TokenCacheInterface { [hostKey: string]: { [realmKey: string]: { [typeKey in keyof typeKey]: { [subjectKey: string]: { [expKey: string]: string; }; }; }; }; } /** * Get token cache file name * @param {State} state library state * @returns {String} connection profiles file name */ export declare function getTokenCachePath({ state }: { state: State; }): string; /** * Initialize connection profiles * * This method is called from app.ts and runs before any of the message handlers are registered. * Therefore none of the Console message functions will produce any output. * @param {State} state library state */ export declare function initTokenCache({ state }: { state: State; }): void; export declare function hasToken({ tokenType, state, }: { tokenType: tokenType; state: State; }): Promise; export declare function hasUserSessionToken({ state, }: { state: State; }): Promise; export declare function hasUserBearerToken({ state, }: { state: State; }): Promise; export declare function hasSaBearerToken({ state, }: { state: State; }): Promise; export declare function readToken({ tokenType, state, }: { tokenType: tokenType; state: State; }): Promise; export declare function readUserSessionToken({ state, }: { state: State; }): Promise; export declare function readUserBearerToken({ state, }: { state: State; }): Promise; export declare function readSaBearerToken({ state, }: { state: State; }): Promise; export declare function saveUserSessionToken({ token, state, }: { token: UserSessionMetaType; state: State; }): Promise; export declare function saveUserBearerToken({ token, state, }: { token: AccessTokenMetaType; state: State; }): Promise; export declare function saveSaBearerToken({ token, state, }: { token: AccessTokenMetaType; state: State; }): Promise; export declare function purge({ state }: { state: State; }): TokenCacheInterface; export declare function flush({ state }: { state: State; }): boolean; //# sourceMappingURL=TokenCacheOps.d.ts.map