import TokenKind from './TokenKind.js'; import TokenProvider from './TokenProvider.js'; import type { OptionsStorageProvider, OptionsStorageSerializer, UserTokenRequester } from '../types/TokenManagerOptions.types.js'; export declare const DEFAULT_STORAGE_KEY = "UserToken"; /** * Token provider for authenticated users. */ declare class UserTokenProvider extends TokenProvider { currentGetAccessTokenPromise: Promise | null; /** * Creates a new UserTokenProvider instance. * * @param requester - A function that will be responsible to request new tokens. If async, * the call will be awaited. * @param storageProvider - An object implementing the Storage API's methods getItem, setItem and * removeItem. If those methods are async, the calls will be awaited. * @param tokenDataSerializer - An object implementing the serializeTokenData and deserializeTokenData * methods. If storage provider is defined, tokenDataSerializer is * required. * @param storageKey - The storage key that will be used on the calls to storageProvider's * methods as the key argument. If not provided, a default will be used. */ constructor(requester: UserTokenRequester, storageProvider?: OptionsStorageProvider, tokenDataSerializer?: OptionsStorageSerializer, storageKey?: string); /** * Overrides TokenProvider's getSupportedTokenKind method. Returns the kind of * tokens that will be produced by this token provider. * * @returns User token kind. */ getSupportedTokenKind(): TokenKind; /** * Overrides TokenProvider's getAccessToken method. Will retrieve valid access * token from either the cache or through the requester. * * @param useCache - If cache should be used or not. * * @returns Promise that will be resolved with a valid access token to be used. */ getAccessToken(useCache?: boolean): Promise; /** * Overrides TokenProvider's canRetrieveTokens method. Will return true if there is * a refresh token and a requester available and false otherwise. * * @returns - True if the instance is ready to retrieve tokens and false otherwise. */ canRetrieveTokens(): boolean; } export default UserTokenProvider;