export declare const CACHE_KEY_PREFIX = "@viverse"; export declare const CACHE_KEY_ACCESS_TOKEN_SUFFIX = "@viverse/token"; export type CacheKeyData = { scope?: string; clientId: string; }; export declare class CacheKey { prefix: string; suffix?: string | undefined; clientId: string; scope?: string; constructor(data: CacheKeyData, prefix?: string, suffix?: string | undefined); /** * Converts this `CacheKey` instance into a string for use in a cache * @returns A string representation of the key */ toKey(): string; /** * Converts a cache key string into a `CacheKey` instance. * @param key The key to convert * @returns An instance of `CacheKey` */ static fromKey(key: string): CacheKey; /** * Utility function to build a `CacheKey` instance from a cache entry * @param entry The entry * @returns An instance of `CacheKey` */ static fromCacheEntry(entry: CacheEntry): CacheKey; } /** * authResult * { * "client_id": "${client_id}", * "access_token": "${access_token}", * "account_id": "${account_id}", * "expires_in": 86400, * "scope": "${scope}", * "token_type": "bearer", * "refresh_token": "${refresh_token}" * } */ export type CacheEntry = { client_id: string; access_token: string; account_id: string; /** * Expire in seconds */ expires_in: number; scope: string; token_type?: string; refresh_token?: string; created_at?: number; state?: string; }; export type WrappedCacheEntry = { body: Partial; expiresAt: number; }; export type KeyManifestEntry = { keys: string[]; }; export type Cacheable = WrappedCacheEntry | KeyManifestEntry; export type MaybePromise = Promise | T; export interface ICache { set(key: string, entry: T): MaybePromise; get(key: string): MaybePromise; remove(key: string): MaybePromise; allKeys?(): MaybePromise; }