@kya-os/consent 0.1.4 → 0.1.6
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/components/mcp-consent.d.ts +19 -0
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +25 -1
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/consent.js +27 -8
- package/dist/schemas/api.schemas.d.ts +159 -159
- package/dist/schemas/config.schemas.d.ts +160 -160
- package/dist/schemas/modes.schemas.d.ts +28 -28
- package/dist/types/modes.types.d.ts +45 -8
- package/dist/types/modes.types.d.ts.map +1 -1
- package/dist/types/modes.types.js +45 -8
- package/dist/types/modes.types.js.map +1 -1
- package/package.json +1 -1
|
@@ -23,21 +23,21 @@ export declare const CredentialsConfigSchema: z.ZodObject<{
|
|
|
23
23
|
showForgotPassword: z.ZodOptional<z.ZodBoolean>;
|
|
24
24
|
forgotPasswordUrl: z.ZodOptional<z.ZodString>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
showForgotPassword?: boolean | undefined;
|
|
27
|
-
forgotPasswordUrl?: string | undefined;
|
|
28
26
|
usernameLabel?: string | undefined;
|
|
29
27
|
usernamePlaceholder?: string | undefined;
|
|
30
28
|
passwordLabel?: string | undefined;
|
|
31
29
|
passwordPlaceholder?: string | undefined;
|
|
32
30
|
showRememberMe?: boolean | undefined;
|
|
33
|
-
}, {
|
|
34
31
|
showForgotPassword?: boolean | undefined;
|
|
35
32
|
forgotPasswordUrl?: string | undefined;
|
|
33
|
+
}, {
|
|
36
34
|
usernameLabel?: string | undefined;
|
|
37
35
|
usernamePlaceholder?: string | undefined;
|
|
38
36
|
passwordLabel?: string | undefined;
|
|
39
37
|
passwordPlaceholder?: string | undefined;
|
|
40
38
|
showRememberMe?: boolean | undefined;
|
|
39
|
+
showForgotPassword?: boolean | undefined;
|
|
40
|
+
forgotPasswordUrl?: string | undefined;
|
|
41
41
|
}>;
|
|
42
42
|
export type CredentialsConfigSchemaType = z.infer<typeof CredentialsConfigSchema>;
|
|
43
43
|
/**
|
|
@@ -67,17 +67,17 @@ export declare const MagicLinkConfigSchema: z.ZodObject<{
|
|
|
67
67
|
buttonText: z.ZodOptional<z.ZodString>;
|
|
68
68
|
resendCooldown: z.ZodOptional<z.ZodNumber>;
|
|
69
69
|
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
resendCooldown?: number | undefined;
|
|
71
70
|
buttonText?: string | undefined;
|
|
72
71
|
enabled?: boolean | undefined;
|
|
73
72
|
emailLabel?: string | undefined;
|
|
74
73
|
emailPlaceholder?: string | undefined;
|
|
75
|
-
}, {
|
|
76
74
|
resendCooldown?: number | undefined;
|
|
75
|
+
}, {
|
|
77
76
|
buttonText?: string | undefined;
|
|
78
77
|
enabled?: boolean | undefined;
|
|
79
78
|
emailLabel?: string | undefined;
|
|
80
79
|
emailPlaceholder?: string | undefined;
|
|
80
|
+
resendCooldown?: number | undefined;
|
|
81
81
|
}>;
|
|
82
82
|
export type MagicLinkConfigSchemaType = z.infer<typeof MagicLinkConfigSchema>;
|
|
83
83
|
/**
|
|
@@ -91,19 +91,19 @@ export declare const OTPConfigSchema: z.ZodObject<{
|
|
|
91
91
|
digits: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>]>>;
|
|
92
92
|
resendCooldown: z.ZodOptional<z.ZodNumber>;
|
|
93
93
|
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
resendCooldown?: number | undefined;
|
|
95
94
|
enabled?: boolean | undefined;
|
|
95
|
+
resendCooldown?: number | undefined;
|
|
96
96
|
phoneLabel?: string | undefined;
|
|
97
97
|
phonePlaceholder?: string | undefined;
|
|
98
98
|
instructions?: string | undefined;
|
|
99
|
-
digits?:
|
|
99
|
+
digits?: 8 | 4 | 6 | undefined;
|
|
100
100
|
}, {
|
|
101
|
-
resendCooldown?: number | undefined;
|
|
102
101
|
enabled?: boolean | undefined;
|
|
102
|
+
resendCooldown?: number | undefined;
|
|
103
103
|
phoneLabel?: string | undefined;
|
|
104
104
|
phonePlaceholder?: string | undefined;
|
|
105
105
|
instructions?: string | undefined;
|
|
106
|
-
digits?:
|
|
106
|
+
digits?: 8 | 4 | 6 | undefined;
|
|
107
107
|
}>;
|
|
108
108
|
export type OTPConfigSchemaType = z.infer<typeof OTPConfigSchema>;
|
|
109
109
|
/**
|
|
@@ -182,21 +182,21 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
182
182
|
showForgotPassword: z.ZodOptional<z.ZodBoolean>;
|
|
183
183
|
forgotPasswordUrl: z.ZodOptional<z.ZodString>;
|
|
184
184
|
}, "strip", z.ZodTypeAny, {
|
|
185
|
-
showForgotPassword?: boolean | undefined;
|
|
186
|
-
forgotPasswordUrl?: string | undefined;
|
|
187
185
|
usernameLabel?: string | undefined;
|
|
188
186
|
usernamePlaceholder?: string | undefined;
|
|
189
187
|
passwordLabel?: string | undefined;
|
|
190
188
|
passwordPlaceholder?: string | undefined;
|
|
191
189
|
showRememberMe?: boolean | undefined;
|
|
192
|
-
}, {
|
|
193
190
|
showForgotPassword?: boolean | undefined;
|
|
194
191
|
forgotPasswordUrl?: string | undefined;
|
|
192
|
+
}, {
|
|
195
193
|
usernameLabel?: string | undefined;
|
|
196
194
|
usernamePlaceholder?: string | undefined;
|
|
197
195
|
passwordLabel?: string | undefined;
|
|
198
196
|
passwordPlaceholder?: string | undefined;
|
|
199
197
|
showRememberMe?: boolean | undefined;
|
|
198
|
+
showForgotPassword?: boolean | undefined;
|
|
199
|
+
forgotPasswordUrl?: string | undefined;
|
|
200
200
|
}>>;
|
|
201
201
|
oauth: z.ZodOptional<z.ZodObject<{
|
|
202
202
|
providerId: z.ZodOptional<z.ZodString>;
|
|
@@ -218,17 +218,17 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
218
218
|
buttonText: z.ZodOptional<z.ZodString>;
|
|
219
219
|
resendCooldown: z.ZodOptional<z.ZodNumber>;
|
|
220
220
|
}, "strip", z.ZodTypeAny, {
|
|
221
|
-
resendCooldown?: number | undefined;
|
|
222
221
|
buttonText?: string | undefined;
|
|
223
222
|
enabled?: boolean | undefined;
|
|
224
223
|
emailLabel?: string | undefined;
|
|
225
224
|
emailPlaceholder?: string | undefined;
|
|
226
|
-
}, {
|
|
227
225
|
resendCooldown?: number | undefined;
|
|
226
|
+
}, {
|
|
228
227
|
buttonText?: string | undefined;
|
|
229
228
|
enabled?: boolean | undefined;
|
|
230
229
|
emailLabel?: string | undefined;
|
|
231
230
|
emailPlaceholder?: string | undefined;
|
|
231
|
+
resendCooldown?: number | undefined;
|
|
232
232
|
}>>;
|
|
233
233
|
otp: z.ZodOptional<z.ZodObject<{
|
|
234
234
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -238,19 +238,19 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
238
238
|
digits: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>]>>;
|
|
239
239
|
resendCooldown: z.ZodOptional<z.ZodNumber>;
|
|
240
240
|
}, "strip", z.ZodTypeAny, {
|
|
241
|
-
resendCooldown?: number | undefined;
|
|
242
241
|
enabled?: boolean | undefined;
|
|
242
|
+
resendCooldown?: number | undefined;
|
|
243
243
|
phoneLabel?: string | undefined;
|
|
244
244
|
phonePlaceholder?: string | undefined;
|
|
245
245
|
instructions?: string | undefined;
|
|
246
|
-
digits?:
|
|
246
|
+
digits?: 8 | 4 | 6 | undefined;
|
|
247
247
|
}, {
|
|
248
|
-
resendCooldown?: number | undefined;
|
|
249
248
|
enabled?: boolean | undefined;
|
|
249
|
+
resendCooldown?: number | undefined;
|
|
250
250
|
phoneLabel?: string | undefined;
|
|
251
251
|
phonePlaceholder?: string | undefined;
|
|
252
252
|
instructions?: string | undefined;
|
|
253
|
-
digits?:
|
|
253
|
+
digits?: 8 | 4 | 6 | undefined;
|
|
254
254
|
}>>;
|
|
255
255
|
qrCode: z.ZodOptional<z.ZodObject<{
|
|
256
256
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -305,13 +305,13 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
305
305
|
}>>;
|
|
306
306
|
}, "strip", z.ZodTypeAny, {
|
|
307
307
|
credentials?: {
|
|
308
|
-
showForgotPassword?: boolean | undefined;
|
|
309
|
-
forgotPasswordUrl?: string | undefined;
|
|
310
308
|
usernameLabel?: string | undefined;
|
|
311
309
|
usernamePlaceholder?: string | undefined;
|
|
312
310
|
passwordLabel?: string | undefined;
|
|
313
311
|
passwordPlaceholder?: string | undefined;
|
|
314
312
|
showRememberMe?: boolean | undefined;
|
|
313
|
+
showForgotPassword?: boolean | undefined;
|
|
314
|
+
forgotPasswordUrl?: string | undefined;
|
|
315
315
|
} | undefined;
|
|
316
316
|
oauth?: {
|
|
317
317
|
providerId?: string | undefined;
|
|
@@ -319,12 +319,12 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
319
319
|
buttonText?: string | undefined;
|
|
320
320
|
} | undefined;
|
|
321
321
|
otp?: {
|
|
322
|
-
resendCooldown?: number | undefined;
|
|
323
322
|
enabled?: boolean | undefined;
|
|
323
|
+
resendCooldown?: number | undefined;
|
|
324
324
|
phoneLabel?: string | undefined;
|
|
325
325
|
phonePlaceholder?: string | undefined;
|
|
326
326
|
instructions?: string | undefined;
|
|
327
|
-
digits?:
|
|
327
|
+
digits?: 8 | 4 | 6 | undefined;
|
|
328
328
|
} | undefined;
|
|
329
329
|
passkey?: {
|
|
330
330
|
buttonText?: string | undefined;
|
|
@@ -340,11 +340,11 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
340
340
|
estimatedTime?: string | undefined;
|
|
341
341
|
} | undefined;
|
|
342
342
|
magicLink?: {
|
|
343
|
-
resendCooldown?: number | undefined;
|
|
344
343
|
buttonText?: string | undefined;
|
|
345
344
|
enabled?: boolean | undefined;
|
|
346
345
|
emailLabel?: string | undefined;
|
|
347
346
|
emailPlaceholder?: string | undefined;
|
|
347
|
+
resendCooldown?: number | undefined;
|
|
348
348
|
} | undefined;
|
|
349
349
|
qrCode?: {
|
|
350
350
|
enabled?: boolean | undefined;
|
|
@@ -354,13 +354,13 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
354
354
|
} | undefined;
|
|
355
355
|
}, {
|
|
356
356
|
credentials?: {
|
|
357
|
-
showForgotPassword?: boolean | undefined;
|
|
358
|
-
forgotPasswordUrl?: string | undefined;
|
|
359
357
|
usernameLabel?: string | undefined;
|
|
360
358
|
usernamePlaceholder?: string | undefined;
|
|
361
359
|
passwordLabel?: string | undefined;
|
|
362
360
|
passwordPlaceholder?: string | undefined;
|
|
363
361
|
showRememberMe?: boolean | undefined;
|
|
362
|
+
showForgotPassword?: boolean | undefined;
|
|
363
|
+
forgotPasswordUrl?: string | undefined;
|
|
364
364
|
} | undefined;
|
|
365
365
|
oauth?: {
|
|
366
366
|
providerId?: string | undefined;
|
|
@@ -368,12 +368,12 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
368
368
|
buttonText?: string | undefined;
|
|
369
369
|
} | undefined;
|
|
370
370
|
otp?: {
|
|
371
|
-
resendCooldown?: number | undefined;
|
|
372
371
|
enabled?: boolean | undefined;
|
|
372
|
+
resendCooldown?: number | undefined;
|
|
373
373
|
phoneLabel?: string | undefined;
|
|
374
374
|
phonePlaceholder?: string | undefined;
|
|
375
375
|
instructions?: string | undefined;
|
|
376
|
-
digits?:
|
|
376
|
+
digits?: 8 | 4 | 6 | undefined;
|
|
377
377
|
} | undefined;
|
|
378
378
|
passkey?: {
|
|
379
379
|
buttonText?: string | undefined;
|
|
@@ -389,11 +389,11 @@ export declare const ModeConfigsSchema: z.ZodObject<{
|
|
|
389
389
|
estimatedTime?: string | undefined;
|
|
390
390
|
} | undefined;
|
|
391
391
|
magicLink?: {
|
|
392
|
-
resendCooldown?: number | undefined;
|
|
393
392
|
buttonText?: string | undefined;
|
|
394
393
|
enabled?: boolean | undefined;
|
|
395
394
|
emailLabel?: string | undefined;
|
|
396
395
|
emailPlaceholder?: string | undefined;
|
|
396
|
+
resendCooldown?: number | undefined;
|
|
397
397
|
} | undefined;
|
|
398
398
|
qrCode?: {
|
|
399
399
|
enabled?: boolean | undefined;
|
|
@@ -3,6 +3,39 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Canonical type definitions for authentication modes and their configurations.
|
|
5
5
|
*
|
|
6
|
+
* ## Consent Flow Architecture
|
|
7
|
+
*
|
|
8
|
+
* The consent flow has two patterns based on the auth mode:
|
|
9
|
+
*
|
|
10
|
+
* ### Flow 1: Consent Only (CONSENT_ONLY mode) - 2 Screens
|
|
11
|
+
* ```
|
|
12
|
+
* [Consent Screen] → [Success Screen]
|
|
13
|
+
* ↓
|
|
14
|
+
* User confirms → DelegationCredential (VC) created
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ### Flow 2: Auth First (CREDENTIALS, OAUTH, etc.) - 3 Screens
|
|
18
|
+
* ```
|
|
19
|
+
* [Auth Screen] → [Consent Screen] → [Success Screen]
|
|
20
|
+
* ↓ ↓
|
|
21
|
+
* Verify identity User confirms → DelegationCredential (VC) created
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ## Relationship to AuthorizationRequirement
|
|
25
|
+
*
|
|
26
|
+
* - `AUTH_MODES` here define what UI to render for authentication
|
|
27
|
+
* - `AuthorizationRequirement` in @kya-os/contracts defines what a TOOL requires
|
|
28
|
+
*
|
|
29
|
+
* Mapping:
|
|
30
|
+
* | AUTH_MODE | AuthorizationRequirement.type |
|
|
31
|
+
* |-----------|-------------------------------|
|
|
32
|
+
* | CONSENT_ONLY | 'none' |
|
|
33
|
+
* | CREDENTIALS | 'password' |
|
|
34
|
+
* | OAUTH | 'oauth' |
|
|
35
|
+
* | IDV | 'idv' |
|
|
36
|
+
* | MAGIC_LINK | (future) |
|
|
37
|
+
* | OTP | (future) |
|
|
38
|
+
*
|
|
6
39
|
* @module @kya-os/consent/types/modes
|
|
7
40
|
*/
|
|
8
41
|
/**
|
|
@@ -10,23 +43,27 @@
|
|
|
10
43
|
*
|
|
11
44
|
* Constants for all supported auth modes in consent pages.
|
|
12
45
|
* Matches AgentShield's AUTH_MODES constant.
|
|
46
|
+
*
|
|
47
|
+
* The mode determines the screen flow:
|
|
48
|
+
* - CONSENT_ONLY: Consent → Success (2 screens) - Direct to consent, no auth
|
|
49
|
+
* - All others: Auth → Consent → Success (3 screens) - Auth first, then consent
|
|
13
50
|
*/
|
|
14
51
|
export declare const AUTH_MODES: {
|
|
15
|
-
/** Simple consent with no authentication */
|
|
52
|
+
/** Simple consent with no authentication - Consent → Success (2 screens) */
|
|
16
53
|
readonly CONSENT_ONLY: "consent-only";
|
|
17
|
-
/** Username/password authentication */
|
|
54
|
+
/** Username/password authentication - Auth → Consent → Success (3 screens) */
|
|
18
55
|
readonly CREDENTIALS: "credentials";
|
|
19
|
-
/** OAuth provider authentication */
|
|
56
|
+
/** OAuth provider authentication - Auth → Consent → Success (3 screens) */
|
|
20
57
|
readonly OAUTH: "oauth";
|
|
21
|
-
/** Email magic link authentication */
|
|
58
|
+
/** Email magic link authentication - Auth → Consent → Success (3 screens) */
|
|
22
59
|
readonly MAGIC_LINK: "magic-link";
|
|
23
|
-
/** One-time password (SMS/TOTP) authentication */
|
|
60
|
+
/** One-time password (SMS/TOTP) authentication - Auth → Consent → Success (3 screens) */
|
|
24
61
|
readonly OTP: "otp";
|
|
25
|
-
/** QR code scanning authentication (future) */
|
|
62
|
+
/** QR code scanning authentication (future) - Auth → Consent → Success (3 screens) */
|
|
26
63
|
readonly QR_CODE: "qr-code";
|
|
27
|
-
/** Passkey/WebAuthn authentication (future) */
|
|
64
|
+
/** Passkey/WebAuthn authentication (future) - Auth → Consent → Success (3 screens) */
|
|
28
65
|
readonly PASSKEY: "passkey";
|
|
29
|
-
/** Identity verification (future) */
|
|
66
|
+
/** Identity verification (future) - Auth → Consent → Success (3 screens) */
|
|
30
67
|
readonly IDV: "idv";
|
|
31
68
|
};
|
|
32
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modes.types.d.ts","sourceRoot":"","sources":["../../src/types/modes.types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"modes.types.d.ts","sourceRoot":"","sources":["../../src/types/modes.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,6 +3,39 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Canonical type definitions for authentication modes and their configurations.
|
|
5
5
|
*
|
|
6
|
+
* ## Consent Flow Architecture
|
|
7
|
+
*
|
|
8
|
+
* The consent flow has two patterns based on the auth mode:
|
|
9
|
+
*
|
|
10
|
+
* ### Flow 1: Consent Only (CONSENT_ONLY mode) - 2 Screens
|
|
11
|
+
* ```
|
|
12
|
+
* [Consent Screen] → [Success Screen]
|
|
13
|
+
* ↓
|
|
14
|
+
* User confirms → DelegationCredential (VC) created
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ### Flow 2: Auth First (CREDENTIALS, OAUTH, etc.) - 3 Screens
|
|
18
|
+
* ```
|
|
19
|
+
* [Auth Screen] → [Consent Screen] → [Success Screen]
|
|
20
|
+
* ↓ ↓
|
|
21
|
+
* Verify identity User confirms → DelegationCredential (VC) created
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ## Relationship to AuthorizationRequirement
|
|
25
|
+
*
|
|
26
|
+
* - `AUTH_MODES` here define what UI to render for authentication
|
|
27
|
+
* - `AuthorizationRequirement` in @kya-os/contracts defines what a TOOL requires
|
|
28
|
+
*
|
|
29
|
+
* Mapping:
|
|
30
|
+
* | AUTH_MODE | AuthorizationRequirement.type |
|
|
31
|
+
* |-----------|-------------------------------|
|
|
32
|
+
* | CONSENT_ONLY | 'none' |
|
|
33
|
+
* | CREDENTIALS | 'password' |
|
|
34
|
+
* | OAUTH | 'oauth' |
|
|
35
|
+
* | IDV | 'idv' |
|
|
36
|
+
* | MAGIC_LINK | (future) |
|
|
37
|
+
* | OTP | (future) |
|
|
38
|
+
*
|
|
6
39
|
* @module @kya-os/consent/types/modes
|
|
7
40
|
*/
|
|
8
41
|
/**
|
|
@@ -10,23 +43,27 @@
|
|
|
10
43
|
*
|
|
11
44
|
* Constants for all supported auth modes in consent pages.
|
|
12
45
|
* Matches AgentShield's AUTH_MODES constant.
|
|
46
|
+
*
|
|
47
|
+
* The mode determines the screen flow:
|
|
48
|
+
* - CONSENT_ONLY: Consent → Success (2 screens) - Direct to consent, no auth
|
|
49
|
+
* - All others: Auth → Consent → Success (3 screens) - Auth first, then consent
|
|
13
50
|
*/
|
|
14
51
|
export const AUTH_MODES = {
|
|
15
|
-
/** Simple consent with no authentication */
|
|
52
|
+
/** Simple consent with no authentication - Consent → Success (2 screens) */
|
|
16
53
|
CONSENT_ONLY: "consent-only",
|
|
17
|
-
/** Username/password authentication */
|
|
54
|
+
/** Username/password authentication - Auth → Consent → Success (3 screens) */
|
|
18
55
|
CREDENTIALS: "credentials",
|
|
19
|
-
/** OAuth provider authentication */
|
|
56
|
+
/** OAuth provider authentication - Auth → Consent → Success (3 screens) */
|
|
20
57
|
OAUTH: "oauth",
|
|
21
|
-
/** Email magic link authentication */
|
|
58
|
+
/** Email magic link authentication - Auth → Consent → Success (3 screens) */
|
|
22
59
|
MAGIC_LINK: "magic-link",
|
|
23
|
-
/** One-time password (SMS/TOTP) authentication */
|
|
60
|
+
/** One-time password (SMS/TOTP) authentication - Auth → Consent → Success (3 screens) */
|
|
24
61
|
OTP: "otp",
|
|
25
|
-
/** QR code scanning authentication (future) */
|
|
62
|
+
/** QR code scanning authentication (future) - Auth → Consent → Success (3 screens) */
|
|
26
63
|
QR_CODE: "qr-code",
|
|
27
|
-
/** Passkey/WebAuthn authentication (future) */
|
|
64
|
+
/** Passkey/WebAuthn authentication (future) - Auth → Consent → Success (3 screens) */
|
|
28
65
|
PASSKEY: "passkey",
|
|
29
|
-
/** Identity verification (future) */
|
|
66
|
+
/** Identity verification (future) - Auth → Consent → Success (3 screens) */
|
|
30
67
|
IDV: "idv",
|
|
31
68
|
};
|
|
32
69
|
//# sourceMappingURL=modes.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modes.types.js","sourceRoot":"","sources":["../../src/types/modes.types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"modes.types.js","sourceRoot":"","sources":["../../src/types/modes.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,4EAA4E;IAC5E,YAAY,EAAE,cAAc;IAE5B,8EAA8E;IAC9E,WAAW,EAAE,aAAa;IAE1B,2EAA2E;IAC3E,KAAK,EAAE,OAAO;IAEd,6EAA6E;IAC7E,UAAU,EAAE,YAAY;IAExB,yFAAyF;IACzF,GAAG,EAAE,KAAK;IAEV,sFAAsF;IACtF,OAAO,EAAE,SAAS;IAElB,sFAAsF;IACtF,OAAO,EAAE,SAAS;IAElB,4EAA4E;IAC5E,GAAG,EAAE,KAAK;CACF,CAAC"}
|