1 | import { CacheKeyManifest } from './key-manifest';
|
2 | import { CacheEntry, ICache, CacheKey, DecodedToken, IdTokenEntry } from './shared';
|
3 | export declare class CacheManager {
|
4 | private cache;
|
5 | private keyManifest?;
|
6 | private nowProvider;
|
7 | constructor(cache: ICache, keyManifest?: CacheKeyManifest | undefined, nowProvider?: () => number | Promise<number>);
|
8 | setIdToken(clientId: string, idToken: string, decodedToken: DecodedToken): Promise<void>;
|
9 | getIdToken(cacheKey: CacheKey): Promise<IdTokenEntry | undefined>;
|
10 | get(cacheKey: CacheKey, expiryAdjustmentSeconds?: number): Promise<Partial<CacheEntry> | undefined>;
|
11 | set(entry: CacheEntry): Promise<void>;
|
12 | clear(clientId?: string): Promise<void>;
|
13 | private wrapCacheEntry;
|
14 | private getCacheKeys;
|
15 | /**
|
16 | * Returns the cache key to be used to store the id token
|
17 | * @param clientId The client id used to link to the id token
|
18 | * @returns The constructed cache key, as a string, to store the id token
|
19 | */
|
20 | private getIdTokenCacheKey;
|
21 | /**
|
22 | * Finds the corresponding key in the cache based on the provided cache key.
|
23 | * The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
|
24 | * The first key in the cache that satisfies the following conditions is returned
|
25 | * - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
|
26 | * - `clientId` is strict equal to the `cacheKey.clientId`
|
27 | * - `audience` is strict equal to the `cacheKey.audience`
|
28 | * - `scope` contains at least all the `cacheKey.scope` values
|
29 | * *
|
30 | * @param keyToMatch The provided cache key
|
31 | * @param allKeys A list of existing cache keys
|
32 | */
|
33 | private matchExistingCacheKey;
|
34 | }
|