@auth0/auth0-spa-js 2.18.0 → 2.18.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/dist/auth0-spa-js.development.js +394 -297
- 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 +71 -21
- 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 +417 -317
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/package.json +4 -3
- package/src/Auth0Client.ts +10 -7
- package/src/index.ts +6 -3
- package/src/utils.ts +2 -1
- package/src/version.ts +1 -1
- package/dist/typings/Auth0Client.d.ts +0 -439
- package/dist/typings/Auth0Client.utils.d.ts +0 -90
- package/dist/typings/MyAccountApiClient.d.ts +0 -92
- package/dist/typings/TokenExchange.d.ts +0 -77
- package/dist/typings/api.d.ts +0 -2
- package/dist/typings/cache/cache-localstorage.d.ts +0 -7
- package/dist/typings/cache/cache-manager.d.ts +0 -56
- package/dist/typings/cache/cache-memory.d.ts +0 -4
- package/dist/typings/cache/index.d.ts +0 -4
- package/dist/typings/cache/key-manifest.d.ts +0 -12
- package/dist/typings/cache/shared.d.ts +0 -68
- package/dist/typings/constants.d.ts +0 -58
- package/dist/typings/dpop/dpop.d.ts +0 -17
- package/dist/typings/dpop/storage.d.ts +0 -27
- package/dist/typings/dpop/utils.d.ts +0 -15
- package/dist/typings/errors.d.ts +0 -96
- package/dist/typings/fetcher.d.ts +0 -54
- package/dist/typings/global.d.ts +0 -819
- package/dist/typings/http.d.ts +0 -5
- package/dist/typings/index.d.ts +0 -23
- package/dist/typings/jwt.d.ts +0 -21
- package/dist/typings/lock.d.ts +0 -32
- package/dist/typings/mfa/MfaApiClient.d.ts +0 -225
- package/dist/typings/mfa/MfaContextManager.d.ts +0 -79
- package/dist/typings/mfa/constants.d.ts +0 -23
- package/dist/typings/mfa/errors.d.ts +0 -117
- package/dist/typings/mfa/index.d.ts +0 -4
- package/dist/typings/mfa/types.d.ts +0 -181
- package/dist/typings/mfa/utils.d.ts +0 -23
- package/dist/typings/promise-utils.d.ts +0 -2
- package/dist/typings/scope.d.ts +0 -35
- package/dist/typings/storage.d.ts +0 -26
- package/dist/typings/transaction-manager.d.ts +0 -33
- package/dist/typings/utils.d.ts +0 -36
- package/dist/typings/version.d.ts +0 -2
- package/dist/typings/worker/token.worker.d.ts +0 -1
- package/dist/typings/worker/worker.types.d.ts +0 -15
- package/dist/typings/worker/worker.utils.d.ts +0 -7
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { MfaGrantTypes } from './constants';
|
|
2
|
-
/**
|
|
3
|
-
* Represents an MFA authenticator enrolled by a user
|
|
4
|
-
*/
|
|
5
|
-
export interface Authenticator {
|
|
6
|
-
/** Unique identifier for the authenticator */
|
|
7
|
-
id: string;
|
|
8
|
-
/** Type of authenticator */
|
|
9
|
-
authenticatorType: AuthenticatorType;
|
|
10
|
-
/** Whether the authenticator is active */
|
|
11
|
-
active: boolean;
|
|
12
|
-
/** Optional friendly name */
|
|
13
|
-
name?: string;
|
|
14
|
-
/** ISO 8601 timestamp when created */
|
|
15
|
-
createdAt?: string;
|
|
16
|
-
/** ISO 8601 timestamp of last authentication */
|
|
17
|
-
lastAuth?: string;
|
|
18
|
-
/** Types of MFA challenges*/
|
|
19
|
-
type?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Supported authenticator types.
|
|
23
|
-
* Note: Email authenticators use 'oob' type with oobChannel: 'email'
|
|
24
|
-
*/
|
|
25
|
-
export type AuthenticatorType = 'otp' | 'oob' | 'recovery-code';
|
|
26
|
-
/**
|
|
27
|
-
* Types of MFA challenges
|
|
28
|
-
*/
|
|
29
|
-
export type ChallengeType = 'otp' | 'phone' | 'recovery-code' | 'email' | 'push-notification' | 'totp';
|
|
30
|
-
/**
|
|
31
|
-
* Out-of-band delivery channels.
|
|
32
|
-
* Includes 'email' which is also delivered out-of-band.
|
|
33
|
-
*/
|
|
34
|
-
export type OobChannel = 'sms' | 'voice' | 'auth0' | 'email';
|
|
35
|
-
/**
|
|
36
|
-
* Supported MFA factors for enrollment
|
|
37
|
-
*/
|
|
38
|
-
export type MfaFactorType = 'otp' | 'sms' | 'email' | 'push' | 'voice';
|
|
39
|
-
/**
|
|
40
|
-
* Base parameters for all enrollment types
|
|
41
|
-
*/
|
|
42
|
-
export interface EnrollBaseParams {
|
|
43
|
-
/** MFA token from mfa_required error */
|
|
44
|
-
mfaToken: string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* OTP (Time-based One-Time Password) enrollment parameters
|
|
48
|
-
*/
|
|
49
|
-
export interface EnrollOtpParams extends EnrollBaseParams {
|
|
50
|
-
/** The factor type for enrollment */
|
|
51
|
-
factorType: 'otp';
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* SMS enrollment parameters
|
|
55
|
-
*/
|
|
56
|
-
export interface EnrollSmsParams extends EnrollBaseParams {
|
|
57
|
-
/** The factor type for enrollment */
|
|
58
|
-
factorType: 'sms';
|
|
59
|
-
/** Phone number in E.164 format (required for SMS) */
|
|
60
|
-
phoneNumber: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Voice enrollment parameters
|
|
64
|
-
*/
|
|
65
|
-
export interface EnrollVoiceParams extends EnrollBaseParams {
|
|
66
|
-
/** The factor type for enrollment */
|
|
67
|
-
factorType: 'voice';
|
|
68
|
-
/** Phone number in E.164 format (required for voice) */
|
|
69
|
-
phoneNumber: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Email enrollment parameters
|
|
73
|
-
*/
|
|
74
|
-
export interface EnrollEmailParams extends EnrollBaseParams {
|
|
75
|
-
/** The factor type for enrollment */
|
|
76
|
-
factorType: 'email';
|
|
77
|
-
/** Email address (optional, uses user's email if not provided) */
|
|
78
|
-
email?: string;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Push notification enrollment parameters
|
|
82
|
-
*/
|
|
83
|
-
export interface EnrollPushParams extends EnrollBaseParams {
|
|
84
|
-
/** The factor type for enrollment */
|
|
85
|
-
factorType: 'push';
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Union type for all enrollment parameter types
|
|
89
|
-
*/
|
|
90
|
-
export type EnrollParams = EnrollOtpParams | EnrollSmsParams | EnrollVoiceParams | EnrollEmailParams | EnrollPushParams;
|
|
91
|
-
/**
|
|
92
|
-
* Response when enrolling an OTP authenticator
|
|
93
|
-
*/
|
|
94
|
-
export interface OtpEnrollmentResponse {
|
|
95
|
-
/** Authenticator type */
|
|
96
|
-
authenticatorType: 'otp';
|
|
97
|
-
/** Base32-encoded secret for TOTP generation */
|
|
98
|
-
secret: string;
|
|
99
|
-
/** URI for generating QR code (otpauth://...) */
|
|
100
|
-
barcodeUri: string;
|
|
101
|
-
/** Recovery codes for account recovery */
|
|
102
|
-
recoveryCodes?: string[];
|
|
103
|
-
/** Authenticator ID */
|
|
104
|
-
id?: string;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Response when enrolling an OOB authenticator
|
|
108
|
-
*/
|
|
109
|
-
export interface OobEnrollmentResponse {
|
|
110
|
-
/** Authenticator type */
|
|
111
|
-
authenticatorType: 'oob';
|
|
112
|
-
/** Delivery channel used */
|
|
113
|
-
oobChannel: OobChannel;
|
|
114
|
-
/** Out-of-band code for verification */
|
|
115
|
-
oobCode?: string;
|
|
116
|
-
/** Binding method (e.g., 'prompt' for user code entry) */
|
|
117
|
-
bindingMethod?: string;
|
|
118
|
-
/** Recovery codes (generated when enrolling first MFA factor) */
|
|
119
|
-
recoveryCodes?: string[];
|
|
120
|
-
/** Authenticator ID */
|
|
121
|
-
id?: string;
|
|
122
|
-
/** URI for QR code (for Push/Guardian enrollment) */
|
|
123
|
-
barcodeUri?: string;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Union type for all enrollment response types
|
|
127
|
-
*/
|
|
128
|
-
export type EnrollmentResponse = OtpEnrollmentResponse | OobEnrollmentResponse;
|
|
129
|
-
/**
|
|
130
|
-
* Parameters for initiating an MFA challenge
|
|
131
|
-
*/
|
|
132
|
-
export interface ChallengeAuthenticatorParams {
|
|
133
|
-
/** MFA token from mfa_required error or MFA-scoped access token */
|
|
134
|
-
mfaToken: string;
|
|
135
|
-
/** Type of challenge to initiate */
|
|
136
|
-
challengeType: 'otp' | 'oob';
|
|
137
|
-
/** Specific authenticator to challenge (optional) */
|
|
138
|
-
authenticatorId?: string;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Response from initiating an MFA challenge
|
|
142
|
-
*/
|
|
143
|
-
export interface ChallengeResponse {
|
|
144
|
-
/** Type of challenge created */
|
|
145
|
-
challengeType: 'otp' | 'oob';
|
|
146
|
-
/** Out-of-band code (for OOB challenges) */
|
|
147
|
-
oobCode?: string;
|
|
148
|
-
/** Binding method for OOB (e.g., 'prompt') */
|
|
149
|
-
bindingMethod?: string;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Grant types for MFA verification (derived from MfaGrantTypes constants)
|
|
153
|
-
*/
|
|
154
|
-
export type MfaGrantType = (typeof MfaGrantTypes)[keyof typeof MfaGrantTypes];
|
|
155
|
-
/**
|
|
156
|
-
* Parameters for verifying an MFA challenge.
|
|
157
|
-
*
|
|
158
|
-
* The grant_type is automatically inferred from which verification field is provided:
|
|
159
|
-
* - `otp` field → MFA-OTP grant type
|
|
160
|
-
* - `oobCode` field → MFA-OOB grant type
|
|
161
|
-
* - `recoveryCode` field → MFA-RECOVERY-CODE grant type
|
|
162
|
-
*/
|
|
163
|
-
export interface VerifyParams {
|
|
164
|
-
/** MFA token from challenge flow */
|
|
165
|
-
mfaToken: string;
|
|
166
|
-
/** One-time password (for OTP challenges) */
|
|
167
|
-
otp?: string;
|
|
168
|
-
/** Out-of-band code (for OOB challenges) */
|
|
169
|
-
oobCode?: string;
|
|
170
|
-
/** Binding code (for OOB challenges with binding) */
|
|
171
|
-
bindingCode?: string;
|
|
172
|
-
/** Recovery code (for recovery code verification) */
|
|
173
|
-
recoveryCode?: string;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Enrollment factor returned by getEnrollmentFactors
|
|
177
|
-
*/
|
|
178
|
-
export interface EnrollmentFactor {
|
|
179
|
-
/** Type of enrollment factor available */
|
|
180
|
-
type: string;
|
|
181
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { EnrollParams, VerifyParams, MfaGrantType } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Converts factor-based enrollment params to auth-js format
|
|
4
|
-
*
|
|
5
|
-
* @param params - The enrollment parameters with factorType
|
|
6
|
-
* @returns Parameters in auth-js format with authenticatorTypes/oobChannels
|
|
7
|
-
*/
|
|
8
|
-
export declare function getAuthJsEnrollParams(params: EnrollParams): {
|
|
9
|
-
email?: string | undefined;
|
|
10
|
-
phoneNumber?: string | undefined;
|
|
11
|
-
oobChannels?: import("./types").OobChannel[] | undefined;
|
|
12
|
-
mfaToken: string;
|
|
13
|
-
authenticatorTypes: ["otp"] | ["oob"];
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Gets the grant type from verification parameters based on which field is provided.
|
|
17
|
-
*
|
|
18
|
-
* Priority order: otp > oobCode > recoveryCode
|
|
19
|
-
*
|
|
20
|
-
* @param params - The verification parameters
|
|
21
|
-
* @returns The grant type or undefined if no verification field is present
|
|
22
|
-
*/
|
|
23
|
-
export declare function getGrantType(params: VerifyParams): MfaGrantType | undefined;
|
package/dist/typings/scope.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ignore
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Returns a string of unique scopes by removing duplicates and unnecessary whitespace.
|
|
6
|
-
*
|
|
7
|
-
* @param {...(string | undefined)[]} scopes - A list of scope strings or undefined values.
|
|
8
|
-
* @returns {string} A string containing unique scopes separated by a single space.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getUniqueScopes: (...scopes: (string | undefined)[]) => string;
|
|
11
|
-
/**
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* We will check if the developer has created the client with a string or object of audience:scopes. We will inject
|
|
16
|
-
* the base scopes to each audience, and store the base ones inside default key. As well, if the developer created the Auth0Client
|
|
17
|
-
* with a string of scopes, we will store the requested ones with the base scopes inside the default key as well.
|
|
18
|
-
* @param authScopes The scopes requested by the user when creating the Auth0Client
|
|
19
|
-
* @param openIdScope openId scope
|
|
20
|
-
* @param extraScopes Other scopes to accumulate such as offline_access
|
|
21
|
-
* @returns {Record<string, string>} An object with all scopes that are going to be accumulated.
|
|
22
|
-
*/
|
|
23
|
-
export declare const injectDefaultScopes: (authScopes: string | Record<string, string> | undefined, openIdScope: string, ...extraScopes: string[]) => Record<string, string>;
|
|
24
|
-
/**
|
|
25
|
-
* @ignore
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Will return a string of scopes. If a specific audience was requested and it exist inside the scopes object, we will return those
|
|
29
|
-
* related to that audience that we want to accumulate. If not, we will return the ones stored inside the default key.
|
|
30
|
-
* @param authScopes Object of audience:scopes that are going to be accumulated
|
|
31
|
-
* @param methodScopes The scopes requested for the developer in a specific request
|
|
32
|
-
* @param audience The audience the developer requested for an specific request or the one they configured in the Auth0Client
|
|
33
|
-
* @returns {string} A combination of Auth0Client scopes and the ones requested by the developer for a specific request
|
|
34
|
-
*/
|
|
35
|
-
export declare const scopesToRequest: (authScopes: Record<string, string>, methodScopes: string | undefined, audience: string | undefined) => string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
interface ClientStorageOptions {
|
|
2
|
-
daysUntilExpire?: number;
|
|
3
|
-
cookieDomain?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Defines a type that handles storage to/from a storage location
|
|
7
|
-
*/
|
|
8
|
-
export type ClientStorage = {
|
|
9
|
-
get<T extends Object>(key: string): T | undefined;
|
|
10
|
-
save(key: string, value: any, options?: ClientStorageOptions): void;
|
|
11
|
-
remove(key: string, options?: ClientStorageOptions): void;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* A storage protocol for marshalling data to/from cookies
|
|
15
|
-
*/
|
|
16
|
-
export declare const CookieStorage: ClientStorage;
|
|
17
|
-
/**
|
|
18
|
-
* Cookie storage that creates a cookie for modern and legacy browsers.
|
|
19
|
-
* See: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
|
|
20
|
-
*/
|
|
21
|
-
export declare const CookieStorageWithLegacySameSite: ClientStorage;
|
|
22
|
-
/**
|
|
23
|
-
* A storage protocol for marshalling data to/from session storage
|
|
24
|
-
*/
|
|
25
|
-
export declare const SessionStorage: ClientStorage;
|
|
26
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ClientStorage } from './storage';
|
|
2
|
-
export interface LoginTransaction {
|
|
3
|
-
nonce: string;
|
|
4
|
-
scope: string;
|
|
5
|
-
audience: string;
|
|
6
|
-
appState?: any;
|
|
7
|
-
code_verifier: string;
|
|
8
|
-
redirect_uri?: string;
|
|
9
|
-
organization?: string;
|
|
10
|
-
state?: string;
|
|
11
|
-
response_type: 'code';
|
|
12
|
-
}
|
|
13
|
-
export interface ConnectAccountTransaction {
|
|
14
|
-
appState?: any;
|
|
15
|
-
audience?: string;
|
|
16
|
-
auth_session: string;
|
|
17
|
-
code_verifier: string;
|
|
18
|
-
redirect_uri: string;
|
|
19
|
-
scope?: string;
|
|
20
|
-
state: string;
|
|
21
|
-
connection: string;
|
|
22
|
-
response_type: 'connect_code';
|
|
23
|
-
}
|
|
24
|
-
export declare class TransactionManager {
|
|
25
|
-
private storage;
|
|
26
|
-
private clientId;
|
|
27
|
-
private cookieDomain?;
|
|
28
|
-
private storageKey;
|
|
29
|
-
constructor(storage: ClientStorage, clientId: string, cookieDomain?: string | undefined);
|
|
30
|
-
create<T extends Object = LoginTransaction>(transaction: T): void;
|
|
31
|
-
get<T extends Object = LoginTransaction>(): T | undefined;
|
|
32
|
-
remove(): void;
|
|
33
|
-
}
|
package/dist/typings/utils.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AuthenticationResult, PopupConfigOptions } from './global';
|
|
2
|
-
export declare const parseAuthenticationResult: (queryString: string) => AuthenticationResult;
|
|
3
|
-
export declare const runIframe: (authorizeUrl: string, eventOrigin: string, timeoutInSeconds?: number) => Promise<AuthenticationResult>;
|
|
4
|
-
export declare const openPopup: (url: string) => Window | null;
|
|
5
|
-
export declare const runPopup: (config: PopupConfigOptions) => Promise<AuthenticationResult>;
|
|
6
|
-
export declare const getCrypto: () => Crypto;
|
|
7
|
-
export declare const createRandomString: () => string;
|
|
8
|
-
export declare const encode: (value: string) => string;
|
|
9
|
-
export declare const decode: (value: string) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Strips any property that is not present in ALLOWED_AUTH0CLIENT_PROPERTIES
|
|
12
|
-
* @param auth0Client - The full auth0Client object
|
|
13
|
-
* @param excludeEnv - If true, excludes the 'env' property from the result
|
|
14
|
-
* @returns The stripped auth0Client object
|
|
15
|
-
*/
|
|
16
|
-
export declare const stripAuth0Client: (auth0Client: any, excludeEnv?: boolean) => any;
|
|
17
|
-
export declare const createQueryParams: ({ clientId: client_id, ...params }: any) => string;
|
|
18
|
-
export declare const sha256: (s: string) => Promise<any>;
|
|
19
|
-
export declare const urlDecodeB64: (input: string) => string;
|
|
20
|
-
export declare const bufferToBase64UrlEncoded: (input: number[] | Uint8Array) => string;
|
|
21
|
-
export declare const validateCrypto: () => void;
|
|
22
|
-
/**
|
|
23
|
-
* @ignore
|
|
24
|
-
*/
|
|
25
|
-
export declare const getDomain: (domainUrl: string) => string;
|
|
26
|
-
/**
|
|
27
|
-
* @ignore
|
|
28
|
-
*/
|
|
29
|
-
export declare const getTokenIssuer: (issuer: string | undefined, domainUrl: string) => string;
|
|
30
|
-
export declare const parseNumber: (value: any) => number | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Ponyfill for `Object.fromEntries()`, which is not available until ES2020.
|
|
33
|
-
*
|
|
34
|
-
* When the target of this project reaches ES2020, this can be removed.
|
|
35
|
-
*/
|
|
36
|
-
export declare const fromEntries: <T = any>(iterable: Iterable<[PropertyKey, T]>) => Record<PropertyKey, T>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FetchOptions } from '../global';
|
|
2
|
-
/**
|
|
3
|
-
* @ts-ignore
|
|
4
|
-
*/
|
|
5
|
-
export type WorkerRefreshTokenMessage = {
|
|
6
|
-
timeout: number;
|
|
7
|
-
fetchUrl: string;
|
|
8
|
-
fetchOptions: FetchOptions;
|
|
9
|
-
useFormData?: boolean;
|
|
10
|
-
useMrrt?: boolean;
|
|
11
|
-
auth: {
|
|
12
|
-
audience: string;
|
|
13
|
-
scope: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { WorkerRefreshTokenMessage } from './worker.types';
|
|
2
|
-
/**
|
|
3
|
-
* Sends the specified message to the web worker
|
|
4
|
-
* @param message The message to send
|
|
5
|
-
* @param to The worker to send the message to
|
|
6
|
-
*/
|
|
7
|
-
export declare const sendMessage: (message: WorkerRefreshTokenMessage, to: Worker) => Promise<unknown>;
|