@auth0/auth0-spa-js 2.18.0 → 2.18.2

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.
Files changed (55) hide show
  1. package/dist/auth0-spa-js.development.js +330 -296
  2. package/dist/auth0-spa-js.development.js.map +1 -1
  3. package/dist/auth0-spa-js.production.esm.js +1 -1
  4. package/dist/auth0-spa-js.production.esm.js.map +1 -1
  5. package/dist/auth0-spa-js.production.js +1 -1
  6. package/dist/auth0-spa-js.production.js.map +1 -1
  7. package/dist/auth0-spa-js.worker.development.js +71 -21
  8. package/dist/auth0-spa-js.worker.development.js.map +1 -1
  9. package/dist/auth0-spa-js.worker.production.js +1 -1
  10. package/dist/auth0-spa-js.worker.production.js.map +1 -1
  11. package/dist/lib/auth0-spa-js.cjs.js +353 -316
  12. package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
  13. package/dist/typings/Auth0Client.d.ts +439 -439
  14. package/dist/typings/Auth0Client.utils.d.ts +90 -90
  15. package/dist/typings/MyAccountApiClient.d.ts +92 -92
  16. package/dist/typings/TokenExchange.d.ts +77 -77
  17. package/dist/typings/api.d.ts +2 -2
  18. package/dist/typings/cache/cache-localstorage.d.ts +7 -7
  19. package/dist/typings/cache/cache-manager.d.ts +56 -56
  20. package/dist/typings/cache/cache-memory.d.ts +4 -4
  21. package/dist/typings/cache/index.d.ts +4 -4
  22. package/dist/typings/cache/key-manifest.d.ts +12 -12
  23. package/dist/typings/cache/shared.d.ts +68 -68
  24. package/dist/typings/constants.d.ts +58 -58
  25. package/dist/typings/dpop/dpop.d.ts +17 -17
  26. package/dist/typings/dpop/storage.d.ts +27 -27
  27. package/dist/typings/dpop/utils.d.ts +15 -15
  28. package/dist/typings/errors.d.ts +96 -96
  29. package/dist/typings/fetcher.d.ts +54 -54
  30. package/dist/typings/global.d.ts +819 -819
  31. package/dist/typings/http.d.ts +5 -5
  32. package/dist/typings/index.d.ts +24 -23
  33. package/dist/typings/jwt.d.ts +21 -21
  34. package/dist/typings/lock.d.ts +32 -32
  35. package/dist/typings/mfa/MfaApiClient.d.ts +225 -225
  36. package/dist/typings/mfa/MfaContextManager.d.ts +79 -79
  37. package/dist/typings/mfa/constants.d.ts +23 -23
  38. package/dist/typings/mfa/errors.d.ts +117 -117
  39. package/dist/typings/mfa/index.d.ts +4 -4
  40. package/dist/typings/mfa/types.d.ts +181 -181
  41. package/dist/typings/mfa/utils.d.ts +23 -23
  42. package/dist/typings/promise-utils.d.ts +2 -2
  43. package/dist/typings/scope.d.ts +35 -35
  44. package/dist/typings/storage.d.ts +26 -26
  45. package/dist/typings/transaction-manager.d.ts +33 -33
  46. package/dist/typings/utils.d.ts +36 -36
  47. package/dist/typings/version.d.ts +2 -2
  48. package/dist/typings/worker/token.worker.d.ts +1 -1
  49. package/dist/typings/worker/worker.types.d.ts +15 -15
  50. package/dist/typings/worker/worker.utils.d.ts +7 -7
  51. package/package.json +6 -4
  52. package/src/Auth0Client.ts +10 -7
  53. package/src/index.ts +6 -3
  54. package/src/utils.ts +2 -1
  55. package/src/version.ts +1 -1
@@ -1,181 +1,181 @@
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
+ 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 +1,23 @@
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;
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;
@@ -1,2 +1,2 @@
1
- export declare const singlePromise: <T>(cb: () => Promise<T>, key: string) => Promise<T>;
2
- export declare const retryPromise: (cb: () => Promise<boolean>, maxNumberOfRetries?: number) => Promise<boolean>;
1
+ export declare const singlePromise: <T>(cb: () => Promise<T>, key: string) => Promise<T>;
2
+ export declare const retryPromise: (cb: () => Promise<boolean>, maxNumberOfRetries?: number) => Promise<boolean>;
@@ -1,35 +1,35 @@
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
+ /**
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 +1,26 @@
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
+ 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 +1,33 @@
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
- }
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
+ }