@auth0/auth0-spa-js 2.18.3 → 2.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auth0-spa-js.development.js +427 -370
- package/dist/auth0-spa-js.development.js.map +1 -1
- package/dist/auth0-spa-js.production.esm.js +1 -1
- package/dist/auth0-spa-js.production.esm.js.map +1 -1
- package/dist/auth0-spa-js.production.js +1 -1
- package/dist/auth0-spa-js.production.js.map +1 -1
- package/dist/auth0-spa-js.worker.development.js +132 -81
- package/dist/auth0-spa-js.worker.development.js.map +1 -1
- package/dist/auth0-spa-js.worker.production.js +1 -1
- package/dist/auth0-spa-js.worker.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +449 -393
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +476 -439
- package/dist/typings/Auth0Client.utils.d.ts +90 -90
- package/dist/typings/MyAccountApiClient.d.ts +92 -92
- package/dist/typings/TokenExchange.d.ts +77 -77
- package/dist/typings/api.d.ts +33 -2
- package/dist/typings/cache/cache-localstorage.d.ts +7 -7
- package/dist/typings/cache/cache-manager.d.ts +69 -56
- package/dist/typings/cache/cache-memory.d.ts +4 -4
- package/dist/typings/cache/index.d.ts +4 -4
- package/dist/typings/cache/key-manifest.d.ts +12 -12
- package/dist/typings/cache/shared.d.ts +68 -68
- package/dist/typings/constants.d.ts +58 -58
- package/dist/typings/dpop/dpop.d.ts +17 -17
- package/dist/typings/dpop/storage.d.ts +27 -27
- package/dist/typings/dpop/utils.d.ts +15 -15
- package/dist/typings/errors.d.ts +96 -96
- package/dist/typings/fetcher.d.ts +54 -54
- package/dist/typings/global.d.ts +826 -819
- package/dist/typings/http.d.ts +11 -5
- package/dist/typings/index.d.ts +24 -24
- package/dist/typings/jwt.d.ts +21 -21
- package/dist/typings/lock.d.ts +32 -32
- package/dist/typings/mfa/MfaApiClient.d.ts +225 -225
- package/dist/typings/mfa/MfaContextManager.d.ts +79 -79
- package/dist/typings/mfa/constants.d.ts +23 -23
- package/dist/typings/mfa/errors.d.ts +117 -117
- package/dist/typings/mfa/index.d.ts +4 -4
- package/dist/typings/mfa/types.d.ts +181 -181
- package/dist/typings/mfa/utils.d.ts +23 -23
- package/dist/typings/promise-utils.d.ts +2 -2
- package/dist/typings/scope.d.ts +35 -35
- package/dist/typings/storage.d.ts +26 -26
- package/dist/typings/transaction-manager.d.ts +33 -33
- package/dist/typings/utils.d.ts +36 -36
- package/dist/typings/version.d.ts +2 -2
- package/dist/typings/worker/token.worker.d.ts +1 -1
- package/dist/typings/worker/worker.types.d.ts +27 -20
- package/dist/typings/worker/worker.utils.d.ts +13 -7
- package/package.json +2 -2
- package/src/Auth0Client.ts +73 -2
- package/src/api.ts +116 -2
- package/src/cache/cache-manager.ts +85 -9
- package/src/global.ts +8 -0
- package/src/http.ts +28 -21
- package/src/version.ts +1 -1
- package/src/worker/token.worker.ts +120 -5
- package/src/worker/worker.types.ts +17 -6
- package/src/worker/worker.utils.ts +18 -7
|
@@ -1,56 +1,69 @@
|
|
|
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, useMrrt?: boolean, cacheMode?: string): Promise<Partial<CacheEntry> | undefined>;
|
|
11
|
-
private modifiedCachedEntry;
|
|
12
|
-
set(entry: CacheEntry): Promise<void>;
|
|
13
|
-
remove(client_id: string, audience?: string, scope?: string): Promise<void>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
28
|
-
* - `
|
|
29
|
-
* - `
|
|
30
|
-
* - `
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @param
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* - `
|
|
41
|
-
*
|
|
42
|
-
* @param
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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, useMrrt?: boolean, cacheMode?: string): Promise<Partial<CacheEntry> | undefined>;
|
|
11
|
+
private modifiedCachedEntry;
|
|
12
|
+
set(entry: CacheEntry): Promise<void>;
|
|
13
|
+
remove(client_id: string, audience?: string, scope?: string): Promise<void>;
|
|
14
|
+
stripRefreshToken(refreshToken: string): Promise<void>;
|
|
15
|
+
clear(clientId?: string): Promise<void>;
|
|
16
|
+
private wrapCacheEntry;
|
|
17
|
+
private getCacheKeys;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the cache key to be used to store the id token
|
|
20
|
+
* @param clientId The client id used to link to the id token
|
|
21
|
+
* @returns The constructed cache key, as a string, to store the id token
|
|
22
|
+
*/
|
|
23
|
+
private getIdTokenCacheKey;
|
|
24
|
+
/**
|
|
25
|
+
* Finds the corresponding key in the cache based on the provided cache key.
|
|
26
|
+
* The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
|
|
27
|
+
* The first key in the cache that satisfies the following conditions is returned
|
|
28
|
+
* - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
|
|
29
|
+
* - `clientId` is strict equal to the `cacheKey.clientId`
|
|
30
|
+
* - `audience` is strict equal to the `cacheKey.audience`
|
|
31
|
+
* - `scope` contains at least all the `cacheKey.scope` values
|
|
32
|
+
* *
|
|
33
|
+
* @param keyToMatch The provided cache key
|
|
34
|
+
* @param allKeys A list of existing cache keys
|
|
35
|
+
*/
|
|
36
|
+
private matchExistingCacheKey;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the first entry that contains a refresh_token that satisfies the following conditions
|
|
39
|
+
* The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
|
|
40
|
+
* - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
|
|
41
|
+
* - `clientId` is strict equal to the `cacheKey.clientId`
|
|
42
|
+
* @param keyToMatch The provided cache key
|
|
43
|
+
* @param allKeys A list of existing cache keys
|
|
44
|
+
*/
|
|
45
|
+
private getEntryWithRefreshToken;
|
|
46
|
+
/**
|
|
47
|
+
* Returns all distinct refresh tokens stored for a given audience and client.
|
|
48
|
+
*
|
|
49
|
+
* Multiple cache entries may exist for the same audience when different scope
|
|
50
|
+
* combinations were obtained via separate authorization flows, each potentially
|
|
51
|
+
* carrying a different refresh token. A Set is used to deduplicate tokens that
|
|
52
|
+
* are shared across entries (e.g. MRRT).
|
|
53
|
+
*
|
|
54
|
+
* @param audience The audience to look up
|
|
55
|
+
* @param clientId The client id to scope the lookup
|
|
56
|
+
*/
|
|
57
|
+
getRefreshTokensByAudience(audience: string, clientId: string): Promise<string[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Updates the refresh token in all cache entries that contain the old refresh token.
|
|
60
|
+
*
|
|
61
|
+
* When a refresh token is rotated, multiple cache entries (for different audiences/scopes)
|
|
62
|
+
* may share the same refresh token. This method propagates the new refresh token to all
|
|
63
|
+
* matching entries.
|
|
64
|
+
*
|
|
65
|
+
* @param oldRefreshToken The refresh token that was used and is now invalid
|
|
66
|
+
* @param newRefreshToken The new refresh token received from the server
|
|
67
|
+
*/
|
|
68
|
+
updateEntry(oldRefreshToken: string, newRefreshToken: string): Promise<void>;
|
|
69
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICache } from './shared';
|
|
2
|
-
export declare class InMemoryCache {
|
|
3
|
-
enclosedCache: ICache;
|
|
4
|
-
}
|
|
1
|
+
import { ICache } from './shared';
|
|
2
|
+
export declare class InMemoryCache {
|
|
3
|
+
enclosedCache: ICache;
|
|
4
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './cache-localstorage';
|
|
2
|
-
export * from './cache-memory';
|
|
3
|
-
export * from './cache-manager';
|
|
4
|
-
export * from './shared';
|
|
1
|
+
export * from './cache-localstorage';
|
|
2
|
+
export * from './cache-memory';
|
|
3
|
+
export * from './cache-manager';
|
|
4
|
+
export * from './shared';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ICache, KeyManifestEntry, MaybePromise } from './shared';
|
|
2
|
-
export declare class CacheKeyManifest {
|
|
3
|
-
private cache;
|
|
4
|
-
private clientId;
|
|
5
|
-
private readonly manifestKey;
|
|
6
|
-
constructor(cache: ICache, clientId: string);
|
|
7
|
-
add(key: string): Promise<void>;
|
|
8
|
-
remove(key: string): Promise<void>;
|
|
9
|
-
get(): MaybePromise<KeyManifestEntry | undefined>;
|
|
10
|
-
clear(): MaybePromise<void>;
|
|
11
|
-
private createManifestKeyFrom;
|
|
12
|
-
}
|
|
1
|
+
import { ICache, KeyManifestEntry, MaybePromise } from './shared';
|
|
2
|
+
export declare class CacheKeyManifest {
|
|
3
|
+
private cache;
|
|
4
|
+
private clientId;
|
|
5
|
+
private readonly manifestKey;
|
|
6
|
+
constructor(cache: ICache, clientId: string);
|
|
7
|
+
add(key: string): Promise<void>;
|
|
8
|
+
remove(key: string): Promise<void>;
|
|
9
|
+
get(): MaybePromise<KeyManifestEntry | undefined>;
|
|
10
|
+
clear(): MaybePromise<void>;
|
|
11
|
+
private createManifestKeyFrom;
|
|
12
|
+
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { IdToken, User } from '../global';
|
|
2
|
-
export declare const CACHE_KEY_PREFIX = "@@auth0spajs@@";
|
|
3
|
-
export declare const CACHE_KEY_ID_TOKEN_SUFFIX = "@@user@@";
|
|
4
|
-
export type CacheKeyData = {
|
|
5
|
-
audience?: string;
|
|
6
|
-
scope?: string;
|
|
7
|
-
clientId: string;
|
|
8
|
-
};
|
|
9
|
-
export declare class CacheKey {
|
|
10
|
-
prefix: string;
|
|
11
|
-
suffix?: string | undefined;
|
|
12
|
-
clientId: string;
|
|
13
|
-
scope?: string;
|
|
14
|
-
audience?: string;
|
|
15
|
-
constructor(data: CacheKeyData, prefix?: string, suffix?: string | undefined);
|
|
16
|
-
/**
|
|
17
|
-
* Converts this `CacheKey` instance into a string for use in a cache
|
|
18
|
-
* @returns A string representation of the key
|
|
19
|
-
*/
|
|
20
|
-
toKey(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Converts a cache key string into a `CacheKey` instance.
|
|
23
|
-
* @param key The key to convert
|
|
24
|
-
* @returns An instance of `CacheKey`
|
|
25
|
-
*/
|
|
26
|
-
static fromKey(key: string): CacheKey;
|
|
27
|
-
/**
|
|
28
|
-
* Utility function to build a `CacheKey` instance from a cache entry
|
|
29
|
-
* @param entry The entry
|
|
30
|
-
* @returns An instance of `CacheKey`
|
|
31
|
-
*/
|
|
32
|
-
static fromCacheEntry(entry: CacheEntry): CacheKey;
|
|
33
|
-
}
|
|
34
|
-
export interface DecodedToken {
|
|
35
|
-
claims: IdToken;
|
|
36
|
-
user: User;
|
|
37
|
-
}
|
|
38
|
-
export interface IdTokenEntry {
|
|
39
|
-
id_token: string;
|
|
40
|
-
decodedToken: DecodedToken;
|
|
41
|
-
}
|
|
42
|
-
export type CacheEntry = {
|
|
43
|
-
id_token?: string;
|
|
44
|
-
token_type?: string;
|
|
45
|
-
access_token: string;
|
|
46
|
-
expires_in: number;
|
|
47
|
-
decodedToken?: DecodedToken;
|
|
48
|
-
audience: string;
|
|
49
|
-
scope: string;
|
|
50
|
-
client_id: string;
|
|
51
|
-
refresh_token?: string;
|
|
52
|
-
oauthTokenScope?: string;
|
|
53
|
-
};
|
|
54
|
-
export type WrappedCacheEntry = {
|
|
55
|
-
body: Partial<CacheEntry>;
|
|
56
|
-
expiresAt: number;
|
|
57
|
-
};
|
|
58
|
-
export type KeyManifestEntry = {
|
|
59
|
-
keys: string[];
|
|
60
|
-
};
|
|
61
|
-
export type Cacheable = WrappedCacheEntry | KeyManifestEntry;
|
|
62
|
-
export type MaybePromise<T> = Promise<T> | T;
|
|
63
|
-
export interface ICache {
|
|
64
|
-
set<T = Cacheable>(key: string, entry: T): MaybePromise<void>;
|
|
65
|
-
get<T = Cacheable>(key: string): MaybePromise<T | undefined>;
|
|
66
|
-
remove(key: string): MaybePromise<void>;
|
|
67
|
-
allKeys?(): MaybePromise<string[]>;
|
|
68
|
-
}
|
|
1
|
+
import { IdToken, User } from '../global';
|
|
2
|
+
export declare const CACHE_KEY_PREFIX = "@@auth0spajs@@";
|
|
3
|
+
export declare const CACHE_KEY_ID_TOKEN_SUFFIX = "@@user@@";
|
|
4
|
+
export type CacheKeyData = {
|
|
5
|
+
audience?: string;
|
|
6
|
+
scope?: string;
|
|
7
|
+
clientId: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class CacheKey {
|
|
10
|
+
prefix: string;
|
|
11
|
+
suffix?: string | undefined;
|
|
12
|
+
clientId: string;
|
|
13
|
+
scope?: string;
|
|
14
|
+
audience?: string;
|
|
15
|
+
constructor(data: CacheKeyData, prefix?: string, suffix?: string | undefined);
|
|
16
|
+
/**
|
|
17
|
+
* Converts this `CacheKey` instance into a string for use in a cache
|
|
18
|
+
* @returns A string representation of the key
|
|
19
|
+
*/
|
|
20
|
+
toKey(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Converts a cache key string into a `CacheKey` instance.
|
|
23
|
+
* @param key The key to convert
|
|
24
|
+
* @returns An instance of `CacheKey`
|
|
25
|
+
*/
|
|
26
|
+
static fromKey(key: string): CacheKey;
|
|
27
|
+
/**
|
|
28
|
+
* Utility function to build a `CacheKey` instance from a cache entry
|
|
29
|
+
* @param entry The entry
|
|
30
|
+
* @returns An instance of `CacheKey`
|
|
31
|
+
*/
|
|
32
|
+
static fromCacheEntry(entry: CacheEntry): CacheKey;
|
|
33
|
+
}
|
|
34
|
+
export interface DecodedToken {
|
|
35
|
+
claims: IdToken;
|
|
36
|
+
user: User;
|
|
37
|
+
}
|
|
38
|
+
export interface IdTokenEntry {
|
|
39
|
+
id_token: string;
|
|
40
|
+
decodedToken: DecodedToken;
|
|
41
|
+
}
|
|
42
|
+
export type CacheEntry = {
|
|
43
|
+
id_token?: string;
|
|
44
|
+
token_type?: string;
|
|
45
|
+
access_token: string;
|
|
46
|
+
expires_in: number;
|
|
47
|
+
decodedToken?: DecodedToken;
|
|
48
|
+
audience: string;
|
|
49
|
+
scope: string;
|
|
50
|
+
client_id: string;
|
|
51
|
+
refresh_token?: string;
|
|
52
|
+
oauthTokenScope?: string;
|
|
53
|
+
};
|
|
54
|
+
export type WrappedCacheEntry = {
|
|
55
|
+
body: Partial<CacheEntry>;
|
|
56
|
+
expiresAt: number;
|
|
57
|
+
};
|
|
58
|
+
export type KeyManifestEntry = {
|
|
59
|
+
keys: string[];
|
|
60
|
+
};
|
|
61
|
+
export type Cacheable = WrappedCacheEntry | KeyManifestEntry;
|
|
62
|
+
export type MaybePromise<T> = Promise<T> | T;
|
|
63
|
+
export interface ICache {
|
|
64
|
+
set<T = Cacheable>(key: string, entry: T): MaybePromise<void>;
|
|
65
|
+
get<T = Cacheable>(key: string): MaybePromise<T | undefined>;
|
|
66
|
+
remove(key: string): MaybePromise<void>;
|
|
67
|
+
allKeys?(): MaybePromise<string[]>;
|
|
68
|
+
}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { PopupConfigOptions } from './global';
|
|
2
|
-
/**
|
|
3
|
-
* @ignore
|
|
4
|
-
*/
|
|
5
|
-
export declare const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
6
|
-
/**
|
|
7
|
-
* @ignore
|
|
8
|
-
*/
|
|
9
|
-
export declare const DEFAULT_POPUP_CONFIG_OPTIONS: PopupConfigOptions;
|
|
10
|
-
/**
|
|
11
|
-
* @ignore
|
|
12
|
-
*/
|
|
13
|
-
export declare const DEFAULT_SILENT_TOKEN_RETRY_COUNT = 3;
|
|
14
|
-
/**
|
|
15
|
-
* @ignore
|
|
16
|
-
*/
|
|
17
|
-
export declare const CLEANUP_IFRAME_TIMEOUT_IN_SECONDS = 2;
|
|
18
|
-
/**
|
|
19
|
-
* @ignore
|
|
20
|
-
*/
|
|
21
|
-
export declare const DEFAULT_FETCH_TIMEOUT_MS = 10000;
|
|
22
|
-
export declare const CACHE_LOCATION_MEMORY = "memory";
|
|
23
|
-
export declare const CACHE_LOCATION_LOCAL_STORAGE = "localstorage";
|
|
24
|
-
/**
|
|
25
|
-
* @ignore
|
|
26
|
-
*/
|
|
27
|
-
export declare const MISSING_REFRESH_TOKEN_ERROR_MESSAGE = "Missing Refresh Token";
|
|
28
|
-
/**
|
|
29
|
-
* @ignore
|
|
30
|
-
*/
|
|
31
|
-
export declare const INVALID_REFRESH_TOKEN_ERROR_MESSAGE = "invalid refresh token";
|
|
32
|
-
/**
|
|
33
|
-
* @ignore
|
|
34
|
-
*/
|
|
35
|
-
export declare const USER_BLOCKED_ERROR_MESSAGE = "user is blocked";
|
|
36
|
-
/**
|
|
37
|
-
* @ignore
|
|
38
|
-
* The error_description returned by the /authorize endpoint when MFA is required
|
|
39
|
-
* but prompt=none prevents interaction (iframe silent auth flow).
|
|
40
|
-
*/
|
|
41
|
-
export declare const MFA_STEP_UP_ERROR_DESCRIPTION = "Multifactor authentication required";
|
|
42
|
-
/**
|
|
43
|
-
* @ignore
|
|
44
|
-
*/
|
|
45
|
-
export declare const DEFAULT_SCOPE = "openid profile email";
|
|
46
|
-
/**
|
|
47
|
-
* @ignore
|
|
48
|
-
*/
|
|
49
|
-
export declare const DEFAULT_SESSION_CHECK_EXPIRY_DAYS = 1;
|
|
50
|
-
/**
|
|
51
|
-
* @ignore
|
|
52
|
-
*/
|
|
53
|
-
export declare const DEFAULT_AUTH0_CLIENT: {
|
|
54
|
-
name: string;
|
|
55
|
-
version: string;
|
|
56
|
-
};
|
|
57
|
-
export declare const DEFAULT_NOW_PROVIDER: () => number;
|
|
58
|
-
export declare const DEFAULT_AUDIENCE = "default";
|
|
1
|
+
import { PopupConfigOptions } from './global';
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
6
|
+
/**
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_POPUP_CONFIG_OPTIONS: PopupConfigOptions;
|
|
10
|
+
/**
|
|
11
|
+
* @ignore
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_SILENT_TOKEN_RETRY_COUNT = 3;
|
|
14
|
+
/**
|
|
15
|
+
* @ignore
|
|
16
|
+
*/
|
|
17
|
+
export declare const CLEANUP_IFRAME_TIMEOUT_IN_SECONDS = 2;
|
|
18
|
+
/**
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_FETCH_TIMEOUT_MS = 10000;
|
|
22
|
+
export declare const CACHE_LOCATION_MEMORY = "memory";
|
|
23
|
+
export declare const CACHE_LOCATION_LOCAL_STORAGE = "localstorage";
|
|
24
|
+
/**
|
|
25
|
+
* @ignore
|
|
26
|
+
*/
|
|
27
|
+
export declare const MISSING_REFRESH_TOKEN_ERROR_MESSAGE = "Missing Refresh Token";
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
export declare const INVALID_REFRESH_TOKEN_ERROR_MESSAGE = "invalid refresh token";
|
|
32
|
+
/**
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
export declare const USER_BLOCKED_ERROR_MESSAGE = "user is blocked";
|
|
36
|
+
/**
|
|
37
|
+
* @ignore
|
|
38
|
+
* The error_description returned by the /authorize endpoint when MFA is required
|
|
39
|
+
* but prompt=none prevents interaction (iframe silent auth flow).
|
|
40
|
+
*/
|
|
41
|
+
export declare const MFA_STEP_UP_ERROR_DESCRIPTION = "Multifactor authentication required";
|
|
42
|
+
/**
|
|
43
|
+
* @ignore
|
|
44
|
+
*/
|
|
45
|
+
export declare const DEFAULT_SCOPE = "openid profile email";
|
|
46
|
+
/**
|
|
47
|
+
* @ignore
|
|
48
|
+
*/
|
|
49
|
+
export declare const DEFAULT_SESSION_CHECK_EXPIRY_DAYS = 1;
|
|
50
|
+
/**
|
|
51
|
+
* @ignore
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEFAULT_AUTH0_CLIENT: {
|
|
54
|
+
name: string;
|
|
55
|
+
version: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const DEFAULT_NOW_PROVIDER: () => number;
|
|
58
|
+
export declare const DEFAULT_AUDIENCE = "default";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { DpopStorage } from './storage';
|
|
2
|
-
import * as dpopUtils from './utils';
|
|
3
|
-
export declare class Dpop {
|
|
4
|
-
protected readonly storage: DpopStorage;
|
|
5
|
-
constructor(clientId: string);
|
|
6
|
-
getNonce(id?: string): Promise<string | undefined>;
|
|
7
|
-
setNonce(nonce: string, id?: string): Promise<void>;
|
|
8
|
-
protected getOrGenerateKeyPair(): Promise<dpopUtils.KeyPair>;
|
|
9
|
-
generateProof(params: {
|
|
10
|
-
url: string;
|
|
11
|
-
method: string;
|
|
12
|
-
nonce?: string;
|
|
13
|
-
accessToken?: string;
|
|
14
|
-
}): Promise<string>;
|
|
15
|
-
calculateThumbprint(): Promise<string>;
|
|
16
|
-
clear(): Promise<void>;
|
|
17
|
-
}
|
|
1
|
+
import { DpopStorage } from './storage';
|
|
2
|
+
import * as dpopUtils from './utils';
|
|
3
|
+
export declare class Dpop {
|
|
4
|
+
protected readonly storage: DpopStorage;
|
|
5
|
+
constructor(clientId: string);
|
|
6
|
+
getNonce(id?: string): Promise<string | undefined>;
|
|
7
|
+
setNonce(nonce: string, id?: string): Promise<void>;
|
|
8
|
+
protected getOrGenerateKeyPair(): Promise<dpopUtils.KeyPair>;
|
|
9
|
+
generateProof(params: {
|
|
10
|
+
url: string;
|
|
11
|
+
method: string;
|
|
12
|
+
nonce?: string;
|
|
13
|
+
accessToken?: string;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
calculateThumbprint(): Promise<string>;
|
|
16
|
+
clear(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { type KeyPair } from './utils';
|
|
2
|
-
declare const TABLES: {
|
|
3
|
-
readonly NONCE: "nonce";
|
|
4
|
-
readonly KEYPAIR: "keypair";
|
|
5
|
-
};
|
|
6
|
-
type Table = (typeof TABLES)[keyof typeof TABLES];
|
|
7
|
-
export declare class DpopStorage {
|
|
8
|
-
protected readonly clientId: string;
|
|
9
|
-
protected dbHandle: IDBDatabase | undefined;
|
|
10
|
-
constructor(clientId: string);
|
|
11
|
-
protected getVersion(): number;
|
|
12
|
-
protected createDbHandle(): Promise<IDBDatabase>;
|
|
13
|
-
protected getDbHandle(): Promise<IDBDatabase>;
|
|
14
|
-
protected executeDbRequest<T = unknown>(table: string, mode: IDBTransactionMode, requestFactory: (table: IDBObjectStore) => IDBRequest<T>): Promise<T>;
|
|
15
|
-
protected buildKey(id?: string): string;
|
|
16
|
-
setNonce(nonce: string, id?: string): Promise<void>;
|
|
17
|
-
setKeyPair(keyPair: KeyPair): Promise<void>;
|
|
18
|
-
protected save(table: Table, key: IDBValidKey, obj: unknown): Promise<void>;
|
|
19
|
-
findNonce(id?: string): Promise<string | undefined>;
|
|
20
|
-
findKeyPair(): Promise<KeyPair | undefined>;
|
|
21
|
-
protected find<T = unknown>(table: Table, key: IDBValidKey): Promise<T | undefined>;
|
|
22
|
-
protected deleteBy(table: Table, predicate: (key: IDBValidKey) => boolean): Promise<void>;
|
|
23
|
-
protected deleteByClientId(table: Table, clientId: string): Promise<void>;
|
|
24
|
-
clearNonces(): Promise<void>;
|
|
25
|
-
clearKeyPairs(): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
1
|
+
import { type KeyPair } from './utils';
|
|
2
|
+
declare const TABLES: {
|
|
3
|
+
readonly NONCE: "nonce";
|
|
4
|
+
readonly KEYPAIR: "keypair";
|
|
5
|
+
};
|
|
6
|
+
type Table = (typeof TABLES)[keyof typeof TABLES];
|
|
7
|
+
export declare class DpopStorage {
|
|
8
|
+
protected readonly clientId: string;
|
|
9
|
+
protected dbHandle: IDBDatabase | undefined;
|
|
10
|
+
constructor(clientId: string);
|
|
11
|
+
protected getVersion(): number;
|
|
12
|
+
protected createDbHandle(): Promise<IDBDatabase>;
|
|
13
|
+
protected getDbHandle(): Promise<IDBDatabase>;
|
|
14
|
+
protected executeDbRequest<T = unknown>(table: string, mode: IDBTransactionMode, requestFactory: (table: IDBObjectStore) => IDBRequest<T>): Promise<T>;
|
|
15
|
+
protected buildKey(id?: string): string;
|
|
16
|
+
setNonce(nonce: string, id?: string): Promise<void>;
|
|
17
|
+
setKeyPair(keyPair: KeyPair): Promise<void>;
|
|
18
|
+
protected save(table: Table, key: IDBValidKey, obj: unknown): Promise<void>;
|
|
19
|
+
findNonce(id?: string): Promise<string | undefined>;
|
|
20
|
+
findKeyPair(): Promise<KeyPair | undefined>;
|
|
21
|
+
protected find<T = unknown>(table: Table, key: IDBValidKey): Promise<T | undefined>;
|
|
22
|
+
protected deleteBy(table: Table, predicate: (key: IDBValidKey) => boolean): Promise<void>;
|
|
23
|
+
protected deleteByClientId(table: Table, clientId: string): Promise<void>;
|
|
24
|
+
clearNonces(): Promise<void>;
|
|
25
|
+
clearKeyPairs(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as dpopLib from 'dpop';
|
|
2
|
-
export declare const DPOP_NONCE_HEADER = "dpop-nonce";
|
|
3
|
-
export type KeyPair = Readonly<dpopLib.KeyPair>;
|
|
4
|
-
type GenerateProofParams = {
|
|
5
|
-
keyPair: KeyPair;
|
|
6
|
-
url: string;
|
|
7
|
-
method: string;
|
|
8
|
-
nonce?: string;
|
|
9
|
-
accessToken?: string;
|
|
10
|
-
};
|
|
11
|
-
export declare function generateKeyPair(): Promise<KeyPair>;
|
|
12
|
-
export declare function calculateThumbprint(keyPair: Pick<KeyPair, 'publicKey'>): Promise<string>;
|
|
13
|
-
export declare function generateProof({ keyPair, url, method, nonce, accessToken }: GenerateProofParams): Promise<string>;
|
|
14
|
-
export declare function isGrantTypeSupported(grantType: string): boolean;
|
|
15
|
-
export {};
|
|
1
|
+
import * as dpopLib from 'dpop';
|
|
2
|
+
export declare const DPOP_NONCE_HEADER = "dpop-nonce";
|
|
3
|
+
export type KeyPair = Readonly<dpopLib.KeyPair>;
|
|
4
|
+
type GenerateProofParams = {
|
|
5
|
+
keyPair: KeyPair;
|
|
6
|
+
url: string;
|
|
7
|
+
method: string;
|
|
8
|
+
nonce?: string;
|
|
9
|
+
accessToken?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function generateKeyPair(): Promise<KeyPair>;
|
|
12
|
+
export declare function calculateThumbprint(keyPair: Pick<KeyPair, 'publicKey'>): Promise<string>;
|
|
13
|
+
export declare function generateProof({ keyPair, url, method, nonce, accessToken }: GenerateProofParams): Promise<string>;
|
|
14
|
+
export declare function isGrantTypeSupported(grantType: string): boolean;
|
|
15
|
+
export {};
|