@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,79 +1,79 @@
|
|
|
1
|
-
import { MfaRequirements } from '../errors';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the stored context for an MFA flow
|
|
4
|
-
*/
|
|
5
|
-
export interface MfaContext {
|
|
6
|
-
/** The OAuth scope for the original token request */
|
|
7
|
-
scope?: string;
|
|
8
|
-
/** The API audience for the original token request */
|
|
9
|
-
audience?: string;
|
|
10
|
-
/** MFA requirements from the mfa_required error (camelCase for TypeScript conventions) */
|
|
11
|
-
mfaRequirements?: MfaRequirements;
|
|
12
|
-
/** Timestamp when the context was created */
|
|
13
|
-
createdAt: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Manages MFA authentication contexts keyed by MFA token.
|
|
17
|
-
*
|
|
18
|
-
* When an mfa_required error occurs, the SDK stores the original request's
|
|
19
|
-
* scope and audience. When the user later provides an MFA token for verification,
|
|
20
|
-
* the SDK retrieves the matching context to complete the token exchange.
|
|
21
|
-
*
|
|
22
|
-
* This enables concurrent MFA flows without state conflicts.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const manager = new MfaContextManager();
|
|
27
|
-
*
|
|
28
|
-
* // Store context when mfa_required error occurs
|
|
29
|
-
* manager.set('mfaTokenAbc', { scope: 'openid profile', audience: 'https://api.example.com' });
|
|
30
|
-
*
|
|
31
|
-
* // Retrieve context when user completes MFA
|
|
32
|
-
* const context = manager.get('mfaTokenAbc');
|
|
33
|
-
* // { scope: 'openid profile', audience: 'https://api.example.com', createdAt: ... }
|
|
34
|
-
*
|
|
35
|
-
* // Remove after successful verification
|
|
36
|
-
* manager.remove('mfaTokenAbc');
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare class MfaContextManager {
|
|
40
|
-
private contexts;
|
|
41
|
-
private readonly ttlMs;
|
|
42
|
-
/**
|
|
43
|
-
* Creates a new MfaContextManager
|
|
44
|
-
* @param ttlMs - Time-to-live for contexts in milliseconds (default: 10 minutes)
|
|
45
|
-
*/
|
|
46
|
-
constructor(ttlMs?: number);
|
|
47
|
-
/**
|
|
48
|
-
* Stores an MFA context keyed by the MFA token.
|
|
49
|
-
* Runs cleanup to remove expired entries before storing.
|
|
50
|
-
*
|
|
51
|
-
* @param mfaToken - The MFA token from the mfa_required error
|
|
52
|
-
* @param context - The scope and audience from the original request
|
|
53
|
-
*/
|
|
54
|
-
set(mfaToken: string, context: Omit<MfaContext, 'createdAt'>): void;
|
|
55
|
-
/**
|
|
56
|
-
* Retrieves the MFA context for a given token.
|
|
57
|
-
* Returns undefined if the token is not found or has expired.
|
|
58
|
-
*
|
|
59
|
-
* @param mfaToken - The MFA token to look up
|
|
60
|
-
* @returns The stored context, or undefined if not found/expired
|
|
61
|
-
*/
|
|
62
|
-
get(mfaToken: string): MfaContext | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Removes an MFA context.
|
|
65
|
-
* Should be called after successful MFA verification.
|
|
66
|
-
*
|
|
67
|
-
* @param mfaToken - The MFA token to remove
|
|
68
|
-
*/
|
|
69
|
-
remove(mfaToken: string): void;
|
|
70
|
-
/**
|
|
71
|
-
* Removes all expired contexts from the Map.
|
|
72
|
-
* Called automatically on every `set` operation.
|
|
73
|
-
*/
|
|
74
|
-
private cleanup;
|
|
75
|
-
/**
|
|
76
|
-
* Returns the number of stored contexts
|
|
77
|
-
*/
|
|
78
|
-
get size(): number;
|
|
79
|
-
}
|
|
1
|
+
import { MfaRequirements } from '../errors';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the stored context for an MFA flow
|
|
4
|
+
*/
|
|
5
|
+
export interface MfaContext {
|
|
6
|
+
/** The OAuth scope for the original token request */
|
|
7
|
+
scope?: string;
|
|
8
|
+
/** The API audience for the original token request */
|
|
9
|
+
audience?: string;
|
|
10
|
+
/** MFA requirements from the mfa_required error (camelCase for TypeScript conventions) */
|
|
11
|
+
mfaRequirements?: MfaRequirements;
|
|
12
|
+
/** Timestamp when the context was created */
|
|
13
|
+
createdAt: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Manages MFA authentication contexts keyed by MFA token.
|
|
17
|
+
*
|
|
18
|
+
* When an mfa_required error occurs, the SDK stores the original request's
|
|
19
|
+
* scope and audience. When the user later provides an MFA token for verification,
|
|
20
|
+
* the SDK retrieves the matching context to complete the token exchange.
|
|
21
|
+
*
|
|
22
|
+
* This enables concurrent MFA flows without state conflicts.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const manager = new MfaContextManager();
|
|
27
|
+
*
|
|
28
|
+
* // Store context when mfa_required error occurs
|
|
29
|
+
* manager.set('mfaTokenAbc', { scope: 'openid profile', audience: 'https://api.example.com' });
|
|
30
|
+
*
|
|
31
|
+
* // Retrieve context when user completes MFA
|
|
32
|
+
* const context = manager.get('mfaTokenAbc');
|
|
33
|
+
* // { scope: 'openid profile', audience: 'https://api.example.com', createdAt: ... }
|
|
34
|
+
*
|
|
35
|
+
* // Remove after successful verification
|
|
36
|
+
* manager.remove('mfaTokenAbc');
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class MfaContextManager {
|
|
40
|
+
private contexts;
|
|
41
|
+
private readonly ttlMs;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new MfaContextManager
|
|
44
|
+
* @param ttlMs - Time-to-live for contexts in milliseconds (default: 10 minutes)
|
|
45
|
+
*/
|
|
46
|
+
constructor(ttlMs?: number);
|
|
47
|
+
/**
|
|
48
|
+
* Stores an MFA context keyed by the MFA token.
|
|
49
|
+
* Runs cleanup to remove expired entries before storing.
|
|
50
|
+
*
|
|
51
|
+
* @param mfaToken - The MFA token from the mfa_required error
|
|
52
|
+
* @param context - The scope and audience from the original request
|
|
53
|
+
*/
|
|
54
|
+
set(mfaToken: string, context: Omit<MfaContext, 'createdAt'>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves the MFA context for a given token.
|
|
57
|
+
* Returns undefined if the token is not found or has expired.
|
|
58
|
+
*
|
|
59
|
+
* @param mfaToken - The MFA token to look up
|
|
60
|
+
* @returns The stored context, or undefined if not found/expired
|
|
61
|
+
*/
|
|
62
|
+
get(mfaToken: string): MfaContext | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Removes an MFA context.
|
|
65
|
+
* Should be called after successful MFA verification.
|
|
66
|
+
*
|
|
67
|
+
* @param mfaToken - The MFA token to remove
|
|
68
|
+
*/
|
|
69
|
+
remove(mfaToken: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Removes all expired contexts from the Map.
|
|
72
|
+
* Called automatically on every `set` operation.
|
|
73
|
+
*/
|
|
74
|
+
private cleanup;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the number of stored contexts
|
|
77
|
+
*/
|
|
78
|
+
get size(): number;
|
|
79
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { MfaFactorType, OobChannel } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Mapping configuration for a factor type
|
|
4
|
-
*/
|
|
5
|
-
export interface FactorMapping {
|
|
6
|
-
authenticatorTypes: ['otp'] | ['oob'];
|
|
7
|
-
oobChannels?: OobChannel[];
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Maps MFA factor types to auth-js enrollment parameters
|
|
11
|
-
*/
|
|
12
|
-
export declare const FACTOR_MAPPING: Record<MfaFactorType, FactorMapping>;
|
|
13
|
-
/**
|
|
14
|
-
* MFA grant type constants for verification
|
|
15
|
-
*/
|
|
16
|
-
export declare const MfaGrantTypes: {
|
|
17
|
-
/** Grant type for OTP (TOTP) verification */
|
|
18
|
-
readonly OTP: "http://auth0.com/oauth/grant-type/mfa-otp";
|
|
19
|
-
/** Grant type for OOB (SMS, Email, Push) verification */
|
|
20
|
-
readonly OOB: "http://auth0.com/oauth/grant-type/mfa-oob";
|
|
21
|
-
/** Grant type for recovery code verification */
|
|
22
|
-
readonly RECOVERY_CODE: "http://auth0.com/oauth/grant-type/mfa-recovery-code";
|
|
23
|
-
};
|
|
1
|
+
import type { MfaFactorType, OobChannel } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Mapping configuration for a factor type
|
|
4
|
+
*/
|
|
5
|
+
export interface FactorMapping {
|
|
6
|
+
authenticatorTypes: ['otp'] | ['oob'];
|
|
7
|
+
oobChannels?: OobChannel[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Maps MFA factor types to auth-js enrollment parameters
|
|
11
|
+
*/
|
|
12
|
+
export declare const FACTOR_MAPPING: Record<MfaFactorType, FactorMapping>;
|
|
13
|
+
/**
|
|
14
|
+
* MFA grant type constants for verification
|
|
15
|
+
*/
|
|
16
|
+
export declare const MfaGrantTypes: {
|
|
17
|
+
/** Grant type for OTP (TOTP) verification */
|
|
18
|
+
readonly OTP: "http://auth0.com/oauth/grant-type/mfa-otp";
|
|
19
|
+
/** Grant type for OOB (SMS, Email, Push) verification */
|
|
20
|
+
readonly OOB: "http://auth0.com/oauth/grant-type/mfa-oob";
|
|
21
|
+
/** Grant type for recovery code verification */
|
|
22
|
+
readonly RECOVERY_CODE: "http://auth0.com/oauth/grant-type/mfa-recovery-code";
|
|
23
|
+
};
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
import { MfaApiErrorResponse } from '@auth0/auth0-auth-js';
|
|
2
|
-
import { GenericError } from '../errors';
|
|
3
|
-
/**
|
|
4
|
-
* Base class for MFA-related errors in auth0-spa-js.
|
|
5
|
-
* Extends GenericError for unified error hierarchy across the SDK.
|
|
6
|
-
*/
|
|
7
|
-
export declare class MfaError extends GenericError {
|
|
8
|
-
constructor(error: string, error_description: string);
|
|
9
|
-
static fromPayload({ error, error_description }: {
|
|
10
|
-
error: string;
|
|
11
|
-
error_description: string;
|
|
12
|
-
}): MfaError;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Error thrown when listing MFA authenticators fails.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* try {
|
|
20
|
-
* const authenticators = await mfa.getAuthenticators();
|
|
21
|
-
* } catch (error) {
|
|
22
|
-
* if (error instanceof MfaListAuthenticatorsError) {
|
|
23
|
-
* console.log(error.error); // 'access_denied'
|
|
24
|
-
* console.log(error.error_description); // 'Unauthorized'
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare class MfaListAuthenticatorsError extends MfaError {
|
|
30
|
-
constructor(error: string, error_description: string);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Error thrown when enrolling an MFA authenticator fails.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* try {
|
|
38
|
-
* const enrollment = await mfa.enroll({
|
|
39
|
-
* authenticator_types: ['otp']
|
|
40
|
-
* });
|
|
41
|
-
* } catch (error) {
|
|
42
|
-
* if (error instanceof MfaEnrollmentError) {
|
|
43
|
-
* console.log(error.error); // 'invalid_phone_number'
|
|
44
|
-
* console.log(error.error_description); // 'Invalid phone number format'
|
|
45
|
-
* }
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare class MfaEnrollmentError extends MfaError {
|
|
50
|
-
constructor(error: string, error_description: string);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Error thrown when initiating an MFA challenge fails.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* try {
|
|
58
|
-
* const challenge = await mfa.challenge({
|
|
59
|
-
* mfaToken: mfaToken,
|
|
60
|
-
* challengeType: 'otp',
|
|
61
|
-
* authenticatorId: 'otp|dev_123'
|
|
62
|
-
* });
|
|
63
|
-
* } catch (error) {
|
|
64
|
-
* if (error instanceof MfaChallengeError) {
|
|
65
|
-
* console.log(error.error); // 'too_many_attempts'
|
|
66
|
-
* console.log(error.error_description); // 'Rate limit exceeded'
|
|
67
|
-
* }
|
|
68
|
-
* }
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export declare class MfaChallengeError extends MfaError {
|
|
72
|
-
constructor(error: string, error_description: string);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Error thrown when verifying an MFA challenge fails.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* try {
|
|
80
|
-
* const tokens = await mfa.verify({
|
|
81
|
-
* mfaToken: mfaToken,
|
|
82
|
-
* grant_type: 'http://auth0.com/oauth/grant-type/mfa-otp',
|
|
83
|
-
* otp: '123456'
|
|
84
|
-
* });
|
|
85
|
-
* } catch (error) {
|
|
86
|
-
* if (error instanceof MfaVerifyError) {
|
|
87
|
-
* console.log(error.error); // 'invalid_otp' or 'context_not_found'
|
|
88
|
-
* console.log(error.error_description); // Error details
|
|
89
|
-
* }
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
export declare class MfaVerifyError extends MfaError {
|
|
94
|
-
constructor(error: string, error_description: string);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Error thrown when getting enrollment factors fails.
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* try {
|
|
102
|
-
* const factors = await mfa.getEnrollmentFactors(mfaToken);
|
|
103
|
-
* } catch (error) {
|
|
104
|
-
* if (error instanceof MfaEnrollmentFactorsError) {
|
|
105
|
-
* console.log(error.error); // 'mfa_context_not_found'
|
|
106
|
-
* console.log(error.error_description); // 'MFA context not found...'
|
|
107
|
-
* }
|
|
108
|
-
* }
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
export declare class MfaEnrollmentFactorsError extends MfaError {
|
|
112
|
-
constructor(error: string, error_description: string);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Re-export MfaApiErrorResponse type for convenience
|
|
116
|
-
*/
|
|
117
|
-
export type { MfaApiErrorResponse };
|
|
1
|
+
import { MfaApiErrorResponse } from '@auth0/auth0-auth-js';
|
|
2
|
+
import { GenericError } from '../errors';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for MFA-related errors in auth0-spa-js.
|
|
5
|
+
* Extends GenericError for unified error hierarchy across the SDK.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MfaError extends GenericError {
|
|
8
|
+
constructor(error: string, error_description: string);
|
|
9
|
+
static fromPayload({ error, error_description }: {
|
|
10
|
+
error: string;
|
|
11
|
+
error_description: string;
|
|
12
|
+
}): MfaError;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when listing MFA authenticators fails.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* try {
|
|
20
|
+
* const authenticators = await mfa.getAuthenticators();
|
|
21
|
+
* } catch (error) {
|
|
22
|
+
* if (error instanceof MfaListAuthenticatorsError) {
|
|
23
|
+
* console.log(error.error); // 'access_denied'
|
|
24
|
+
* console.log(error.error_description); // 'Unauthorized'
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class MfaListAuthenticatorsError extends MfaError {
|
|
30
|
+
constructor(error: string, error_description: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Error thrown when enrolling an MFA authenticator fails.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* try {
|
|
38
|
+
* const enrollment = await mfa.enroll({
|
|
39
|
+
* authenticator_types: ['otp']
|
|
40
|
+
* });
|
|
41
|
+
* } catch (error) {
|
|
42
|
+
* if (error instanceof MfaEnrollmentError) {
|
|
43
|
+
* console.log(error.error); // 'invalid_phone_number'
|
|
44
|
+
* console.log(error.error_description); // 'Invalid phone number format'
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare class MfaEnrollmentError extends MfaError {
|
|
50
|
+
constructor(error: string, error_description: string);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Error thrown when initiating an MFA challenge fails.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* try {
|
|
58
|
+
* const challenge = await mfa.challenge({
|
|
59
|
+
* mfaToken: mfaToken,
|
|
60
|
+
* challengeType: 'otp',
|
|
61
|
+
* authenticatorId: 'otp|dev_123'
|
|
62
|
+
* });
|
|
63
|
+
* } catch (error) {
|
|
64
|
+
* if (error instanceof MfaChallengeError) {
|
|
65
|
+
* console.log(error.error); // 'too_many_attempts'
|
|
66
|
+
* console.log(error.error_description); // 'Rate limit exceeded'
|
|
67
|
+
* }
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare class MfaChallengeError extends MfaError {
|
|
72
|
+
constructor(error: string, error_description: string);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Error thrown when verifying an MFA challenge fails.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* try {
|
|
80
|
+
* const tokens = await mfa.verify({
|
|
81
|
+
* mfaToken: mfaToken,
|
|
82
|
+
* grant_type: 'http://auth0.com/oauth/grant-type/mfa-otp',
|
|
83
|
+
* otp: '123456'
|
|
84
|
+
* });
|
|
85
|
+
* } catch (error) {
|
|
86
|
+
* if (error instanceof MfaVerifyError) {
|
|
87
|
+
* console.log(error.error); // 'invalid_otp' or 'context_not_found'
|
|
88
|
+
* console.log(error.error_description); // Error details
|
|
89
|
+
* }
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare class MfaVerifyError extends MfaError {
|
|
94
|
+
constructor(error: string, error_description: string);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Error thrown when getting enrollment factors fails.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* try {
|
|
102
|
+
* const factors = await mfa.getEnrollmentFactors(mfaToken);
|
|
103
|
+
* } catch (error) {
|
|
104
|
+
* if (error instanceof MfaEnrollmentFactorsError) {
|
|
105
|
+
* console.log(error.error); // 'mfa_context_not_found'
|
|
106
|
+
* console.log(error.error_description); // 'MFA context not found...'
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare class MfaEnrollmentFactorsError extends MfaError {
|
|
112
|
+
constructor(error: string, error_description: string);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Re-export MfaApiErrorResponse type for convenience
|
|
116
|
+
*/
|
|
117
|
+
export type { MfaApiErrorResponse };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MfaApiClient } from './MfaApiClient';
|
|
2
|
-
export { MfaContextManager } from './MfaContextManager';
|
|
3
|
-
export type { MfaContext } from './MfaContextManager';
|
|
4
|
-
export type { Authenticator, AuthenticatorType, OobChannel, MfaFactorType, EnrollBaseParams, EnrollParams, EnrollOtpParams, EnrollSmsParams, EnrollVoiceParams, EnrollEmailParams, EnrollPushParams, EnrollmentResponse, OtpEnrollmentResponse, OobEnrollmentResponse, ChallengeAuthenticatorParams, ChallengeResponse, VerifyParams, MfaGrantType, EnrollmentFactor } from './types';
|
|
1
|
+
export { MfaApiClient } from './MfaApiClient';
|
|
2
|
+
export { MfaContextManager } from './MfaContextManager';
|
|
3
|
+
export type { MfaContext } from './MfaContextManager';
|
|
4
|
+
export type { Authenticator, AuthenticatorType, OobChannel, MfaFactorType, EnrollBaseParams, EnrollParams, EnrollOtpParams, EnrollSmsParams, EnrollVoiceParams, EnrollEmailParams, EnrollPushParams, EnrollmentResponse, OtpEnrollmentResponse, OobEnrollmentResponse, ChallengeAuthenticatorParams, ChallengeResponse, VerifyParams, MfaGrantType, EnrollmentFactor } from './types';
|