@metamask/profile-sync-controller 32.1.1 → 32.3.0

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 (89) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/README.md +21 -0
  3. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts +80 -1
  4. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +1 -1
  5. package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +1 -1
  6. package/dist/controllers/authentication/AuthenticationController.d.ts +79 -2
  7. package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -1
  8. package/dist/controllers/authentication/AuthenticationController.js +374 -12
  9. package/dist/controllers/authentication/AuthenticationController.js.map +1 -1
  10. package/dist/controllers/authentication/index.d.ts +1 -1
  11. package/dist/controllers/authentication/index.d.ts.map +1 -1
  12. package/dist/controllers/authentication/index.js.map +1 -1
  13. package/dist/controllers/authentication/mocks/mockResponses.d.ts +5 -0
  14. package/dist/controllers/authentication/mocks/mockResponses.d.ts.map +1 -1
  15. package/dist/controllers/authentication/mocks/mockResponses.js +26 -1
  16. package/dist/controllers/authentication/mocks/mockResponses.js.map +1 -1
  17. package/dist/controllers/user-storage/UserStorageController.d.ts.map +1 -1
  18. package/dist/controllers/user-storage/UserStorageController.js +6 -5
  19. package/dist/controllers/user-storage/UserStorageController.js.map +1 -1
  20. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts +60 -2
  21. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -1
  22. package/dist/sdk/authentication-jwt-bearer/flow-srp.js +122 -2
  23. package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -1
  24. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts +693 -0
  25. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts.map +1 -0
  26. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js +266 -0
  27. package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js.map +1 -0
  28. package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts +104 -0
  29. package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts.map +1 -0
  30. package/dist/sdk/authentication-jwt-bearer/mfa/services.js +368 -0
  31. package/dist/sdk/authentication-jwt-bearer/mfa/services.js.map +1 -0
  32. package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts +125 -0
  33. package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts.map +1 -0
  34. package/dist/sdk/authentication-jwt-bearer/mfa/types.js +3 -0
  35. package/dist/sdk/authentication-jwt-bearer/mfa/types.js.map +1 -0
  36. package/dist/sdk/authentication-jwt-bearer/services.d.ts +4 -5
  37. package/dist/sdk/authentication-jwt-bearer/services.d.ts.map +1 -1
  38. package/dist/sdk/authentication-jwt-bearer/services.js +7 -4
  39. package/dist/sdk/authentication-jwt-bearer/services.js.map +1 -1
  40. package/dist/sdk/authentication-jwt-bearer/types.d.ts +9 -0
  41. package/dist/sdk/authentication-jwt-bearer/types.d.ts.map +1 -1
  42. package/dist/sdk/authentication-jwt-bearer/types.js.map +1 -1
  43. package/dist/sdk/authentication.d.ts +17 -7
  44. package/dist/sdk/authentication.d.ts.map +1 -1
  45. package/dist/sdk/authentication.js +25 -1
  46. package/dist/sdk/authentication.js.map +1 -1
  47. package/dist/sdk/constants.d.ts +3 -0
  48. package/dist/sdk/constants.d.ts.map +1 -1
  49. package/dist/sdk/constants.js +3 -0
  50. package/dist/sdk/constants.js.map +1 -1
  51. package/dist/sdk/errors.d.ts +106 -0
  52. package/dist/sdk/errors.d.ts.map +1 -1
  53. package/dist/sdk/errors.js +179 -0
  54. package/dist/sdk/errors.js.map +1 -1
  55. package/dist/sdk/index.d.ts +3 -0
  56. package/dist/sdk/index.d.ts.map +1 -1
  57. package/dist/sdk/index.js +1 -0
  58. package/dist/sdk/index.js.map +1 -1
  59. package/dist/sdk/mocks/auth.d.ts +63 -0
  60. package/dist/sdk/mocks/auth.d.ts.map +1 -1
  61. package/dist/sdk/mocks/auth.js +90 -0
  62. package/dist/sdk/mocks/auth.js.map +1 -1
  63. package/dist/sdk/utils/as-record.d.ts +10 -0
  64. package/dist/sdk/utils/as-record.d.ts.map +1 -0
  65. package/dist/sdk/utils/as-record.js +14 -0
  66. package/dist/sdk/utils/as-record.js.map +1 -0
  67. package/dist/sdk/utils/jwt.d.ts +13 -0
  68. package/dist/sdk/utils/jwt.d.ts.map +1 -0
  69. package/dist/sdk/utils/jwt.js +21 -0
  70. package/dist/sdk/utils/jwt.js.map +1 -0
  71. package/dist/sdk/utils/to-error-message.d.ts +8 -0
  72. package/dist/sdk/utils/to-error-message.d.ts.map +1 -0
  73. package/dist/sdk/utils/to-error-message.js +10 -0
  74. package/dist/sdk/utils/to-error-message.js.map +1 -0
  75. package/dist/sdk/utils/validate-login-response.d.ts.map +1 -1
  76. package/dist/sdk/utils/validate-login-response.js +5 -7
  77. package/dist/sdk/utils/validate-login-response.js.map +1 -1
  78. package/dist/sdk/utils/validate-pair-response.d.ts +4 -0
  79. package/dist/sdk/utils/validate-pair-response.d.ts.map +1 -1
  80. package/dist/sdk/utils/validate-pair-response.js.map +1 -1
  81. package/dist/shared/storage-schema.d.ts +1 -0
  82. package/dist/shared/storage-schema.d.ts.map +1 -1
  83. package/dist/shared/storage-schema.js +1 -0
  84. package/dist/shared/storage-schema.js.map +1 -1
  85. package/dist/shared/utils/entropy-source.d.ts +3 -12
  86. package/dist/shared/utils/entropy-source.d.ts.map +1 -1
  87. package/dist/shared/utils/entropy-source.js +4 -17
  88. package/dist/shared/utils/entropy-source.js.map +1 -1
  89. package/package.json +12 -9
@@ -0,0 +1,693 @@
1
+ import type { Struct } from '@metamask/superstruct';
2
+ export declare const MFA_CREDENTIAL_TYPES: readonly ['passkey', 'email_otp'];
3
+ export declare const MfaCredentialTypeStruct: Struct<"email_otp" | "passkey", {
4
+ email_otp: "email_otp";
5
+ passkey: "passkey";
6
+ }>;
7
+ export declare const PublicKeyCredentialCreationOptionsJSONStruct: Struct<{
8
+ rp: {
9
+ id: string;
10
+ name: string;
11
+ };
12
+ user: {
13
+ id: string;
14
+ name: string;
15
+ displayName: string;
16
+ };
17
+ challenge: string;
18
+ pubKeyCredParams: {
19
+ type: "public-key";
20
+ alg: number;
21
+ }[];
22
+ excludeCredentials?: {
23
+ type: "public-key";
24
+ id: string;
25
+ transports?: string[] | undefined;
26
+ }[] | undefined;
27
+ authenticatorSelection?: {
28
+ authenticatorAttachment?: string | undefined;
29
+ residentKey?: string | undefined;
30
+ requireResidentKey?: boolean | undefined;
31
+ userVerification?: string | undefined;
32
+ } | undefined;
33
+ attestation?: string | undefined;
34
+ timeout?: number | undefined;
35
+ extensions?: {} | undefined;
36
+ }, {
37
+ rp: Struct<{
38
+ id: string;
39
+ name: string;
40
+ }, {
41
+ id: Struct<string, null>;
42
+ name: Struct<string, null>;
43
+ }>;
44
+ user: Struct<{
45
+ id: string;
46
+ name: string;
47
+ displayName: string;
48
+ }, {
49
+ id: Struct<string, null>;
50
+ name: Struct<string, null>;
51
+ displayName: Struct<string, null>;
52
+ }>;
53
+ challenge: Struct<string, null>;
54
+ pubKeyCredParams: Struct<{
55
+ type: "public-key";
56
+ alg: number;
57
+ }[], Struct<{
58
+ type: "public-key";
59
+ alg: number;
60
+ }, {
61
+ type: Struct<"public-key", "public-key">;
62
+ alg: Struct<number, null>;
63
+ }>>;
64
+ excludeCredentials: Struct<{
65
+ type: "public-key";
66
+ id: string;
67
+ transports?: string[] | undefined;
68
+ }[] | undefined, Struct<{
69
+ type: "public-key";
70
+ id: string;
71
+ transports?: string[] | undefined;
72
+ }, {
73
+ type: Struct<"public-key", "public-key">;
74
+ id: Struct<string, null>;
75
+ transports: Struct<string[] | undefined, Struct<string, null>>;
76
+ }>>;
77
+ authenticatorSelection: Struct<{
78
+ authenticatorAttachment?: string | undefined;
79
+ residentKey?: string | undefined;
80
+ requireResidentKey?: boolean | undefined;
81
+ userVerification?: string | undefined;
82
+ } | undefined, {
83
+ authenticatorAttachment: Struct<string | undefined, null>;
84
+ residentKey: Struct<string | undefined, null>;
85
+ requireResidentKey: Struct<boolean | undefined, null>;
86
+ userVerification: Struct<string | undefined, null>;
87
+ }>;
88
+ attestation: Struct<string | undefined, null>;
89
+ timeout: Struct<number | undefined, null>;
90
+ extensions: Struct<{} | undefined, {}>;
91
+ }>;
92
+ export declare const PublicKeyCredentialRequestOptionsJSONStruct: Struct<{
93
+ challenge: string;
94
+ rpId?: string | undefined;
95
+ allowCredentials?: {
96
+ type: "public-key";
97
+ id: string;
98
+ transports?: string[] | undefined;
99
+ }[] | undefined;
100
+ userVerification?: string | undefined;
101
+ timeout?: number | undefined;
102
+ extensions?: {} | undefined;
103
+ }, {
104
+ challenge: Struct<string, null>;
105
+ rpId: Struct<string | undefined, null>;
106
+ allowCredentials: Struct<{
107
+ type: "public-key";
108
+ id: string;
109
+ transports?: string[] | undefined;
110
+ }[] | undefined, Struct<{
111
+ type: "public-key";
112
+ id: string;
113
+ transports?: string[] | undefined;
114
+ }, {
115
+ type: Struct<"public-key", "public-key">;
116
+ id: Struct<string, null>;
117
+ transports: Struct<string[] | undefined, Struct<string, null>>;
118
+ }>>;
119
+ userVerification: Struct<string | undefined, null>;
120
+ timeout: Struct<number | undefined, null>;
121
+ extensions: Struct<{} | undefined, {}>;
122
+ }>;
123
+ export declare const PasskeyCreateDataStruct: Struct<{
124
+ publicKey: {
125
+ rp: {
126
+ id: string;
127
+ name: string;
128
+ };
129
+ user: {
130
+ id: string;
131
+ name: string;
132
+ displayName: string;
133
+ };
134
+ challenge: string;
135
+ pubKeyCredParams: {
136
+ type: "public-key";
137
+ alg: number;
138
+ }[];
139
+ excludeCredentials?: {
140
+ type: "public-key";
141
+ id: string;
142
+ transports?: string[] | undefined;
143
+ }[] | undefined;
144
+ authenticatorSelection?: {
145
+ authenticatorAttachment?: string | undefined;
146
+ residentKey?: string | undefined;
147
+ requireResidentKey?: boolean | undefined;
148
+ userVerification?: string | undefined;
149
+ } | undefined;
150
+ attestation?: string | undefined;
151
+ timeout?: number | undefined;
152
+ extensions?: {} | undefined;
153
+ };
154
+ }, {
155
+ publicKey: Struct<{
156
+ rp: {
157
+ id: string;
158
+ name: string;
159
+ };
160
+ user: {
161
+ id: string;
162
+ name: string;
163
+ displayName: string;
164
+ };
165
+ challenge: string;
166
+ pubKeyCredParams: {
167
+ type: "public-key";
168
+ alg: number;
169
+ }[];
170
+ excludeCredentials?: {
171
+ type: "public-key";
172
+ id: string;
173
+ transports?: string[] | undefined;
174
+ }[] | undefined;
175
+ authenticatorSelection?: {
176
+ authenticatorAttachment?: string | undefined;
177
+ residentKey?: string | undefined;
178
+ requireResidentKey?: boolean | undefined;
179
+ userVerification?: string | undefined;
180
+ } | undefined;
181
+ attestation?: string | undefined;
182
+ timeout?: number | undefined;
183
+ extensions?: {} | undefined;
184
+ }, {
185
+ rp: Struct<{
186
+ id: string;
187
+ name: string;
188
+ }, {
189
+ id: Struct<string, null>;
190
+ name: Struct<string, null>;
191
+ }>;
192
+ user: Struct<{
193
+ id: string;
194
+ name: string;
195
+ displayName: string;
196
+ }, {
197
+ id: Struct<string, null>;
198
+ name: Struct<string, null>;
199
+ displayName: Struct<string, null>;
200
+ }>;
201
+ challenge: Struct<string, null>;
202
+ pubKeyCredParams: Struct<{
203
+ type: "public-key";
204
+ alg: number;
205
+ }[], Struct<{
206
+ type: "public-key";
207
+ alg: number;
208
+ }, {
209
+ type: Struct<"public-key", "public-key">;
210
+ alg: Struct<number, null>;
211
+ }>>;
212
+ excludeCredentials: Struct<{
213
+ type: "public-key";
214
+ id: string;
215
+ transports?: string[] | undefined;
216
+ }[] | undefined, Struct<{
217
+ type: "public-key";
218
+ id: string;
219
+ transports?: string[] | undefined;
220
+ }, {
221
+ type: Struct<"public-key", "public-key">;
222
+ id: Struct<string, null>;
223
+ transports: Struct<string[] | undefined, Struct<string, null>>;
224
+ }>>;
225
+ authenticatorSelection: Struct<{
226
+ authenticatorAttachment?: string | undefined;
227
+ residentKey?: string | undefined;
228
+ requireResidentKey?: boolean | undefined;
229
+ userVerification?: string | undefined;
230
+ } | undefined, {
231
+ authenticatorAttachment: Struct<string | undefined, null>;
232
+ residentKey: Struct<string | undefined, null>;
233
+ requireResidentKey: Struct<boolean | undefined, null>;
234
+ userVerification: Struct<string | undefined, null>;
235
+ }>;
236
+ attestation: Struct<string | undefined, null>;
237
+ timeout: Struct<number | undefined, null>;
238
+ extensions: Struct<{} | undefined, {}>;
239
+ }>;
240
+ }>;
241
+ export declare const PasskeyRequestDataStruct: Struct<{
242
+ publicKey: {
243
+ challenge: string;
244
+ rpId?: string | undefined;
245
+ allowCredentials?: {
246
+ type: "public-key";
247
+ id: string;
248
+ transports?: string[] | undefined;
249
+ }[] | undefined;
250
+ userVerification?: string | undefined;
251
+ timeout?: number | undefined;
252
+ extensions?: {} | undefined;
253
+ };
254
+ }, {
255
+ publicKey: Struct<{
256
+ challenge: string;
257
+ rpId?: string | undefined;
258
+ allowCredentials?: {
259
+ type: "public-key";
260
+ id: string;
261
+ transports?: string[] | undefined;
262
+ }[] | undefined;
263
+ userVerification?: string | undefined;
264
+ timeout?: number | undefined;
265
+ extensions?: {} | undefined;
266
+ }, {
267
+ challenge: Struct<string, null>;
268
+ rpId: Struct<string | undefined, null>;
269
+ allowCredentials: Struct<{
270
+ type: "public-key";
271
+ id: string;
272
+ transports?: string[] | undefined;
273
+ }[] | undefined, Struct<{
274
+ type: "public-key";
275
+ id: string;
276
+ transports?: string[] | undefined;
277
+ }, {
278
+ type: Struct<"public-key", "public-key">;
279
+ id: Struct<string, null>;
280
+ transports: Struct<string[] | undefined, Struct<string, null>>;
281
+ }>>;
282
+ userVerification: Struct<string | undefined, null>;
283
+ timeout: Struct<number | undefined, null>;
284
+ extensions: Struct<{} | undefined, {}>;
285
+ }>;
286
+ }>;
287
+ export declare const RegistrationResponseJSONStruct: Struct<{
288
+ id: string;
289
+ rawId: string;
290
+ type: "public-key";
291
+ response: {
292
+ attestationObject: string;
293
+ clientDataJSON: string;
294
+ transports?: string[] | undefined;
295
+ publicKeyAlgorithm?: number | undefined;
296
+ publicKey?: string | undefined;
297
+ authenticatorData?: string | undefined;
298
+ };
299
+ authenticatorAttachment?: string | null | undefined;
300
+ clientExtensionResults?: {} | undefined;
301
+ }, {
302
+ id: Struct<string, null>;
303
+ rawId: Struct<string, null>;
304
+ type: Struct<"public-key", "public-key">;
305
+ response: Struct<{
306
+ attestationObject: string;
307
+ clientDataJSON: string;
308
+ transports?: string[] | undefined;
309
+ publicKeyAlgorithm?: number | undefined;
310
+ publicKey?: string | undefined;
311
+ authenticatorData?: string | undefined;
312
+ }, {
313
+ attestationObject: Struct<string, null>;
314
+ clientDataJSON: Struct<string, null>;
315
+ transports: Struct<string[] | undefined, Struct<string, null>>;
316
+ publicKeyAlgorithm: Struct<number | undefined, null>;
317
+ publicKey: Struct<string | undefined, null>;
318
+ authenticatorData: Struct<string | undefined, null>;
319
+ }>;
320
+ authenticatorAttachment: Struct<string | null | undefined, null>;
321
+ clientExtensionResults: Struct<{} | undefined, {}>;
322
+ }>;
323
+ export declare const AuthenticationResponseJSONStruct: Struct<{
324
+ id: string;
325
+ rawId: string;
326
+ type: "public-key";
327
+ response: {
328
+ authenticatorData: string;
329
+ clientDataJSON: string;
330
+ signature: string;
331
+ userHandle?: string | null | undefined;
332
+ };
333
+ authenticatorAttachment?: string | null | undefined;
334
+ clientExtensionResults?: {} | undefined;
335
+ }, {
336
+ id: Struct<string, null>;
337
+ rawId: Struct<string, null>;
338
+ type: Struct<"public-key", "public-key">;
339
+ response: Struct<{
340
+ authenticatorData: string;
341
+ clientDataJSON: string;
342
+ signature: string;
343
+ userHandle?: string | null | undefined;
344
+ }, {
345
+ authenticatorData: Struct<string, null>;
346
+ clientDataJSON: Struct<string, null>;
347
+ signature: Struct<string, null>;
348
+ userHandle: Struct<string | null | undefined, null>;
349
+ }>;
350
+ authenticatorAttachment: Struct<string | null | undefined, null>;
351
+ clientExtensionResults: Struct<{} | undefined, {}>;
352
+ }>;
353
+ /**
354
+ * Only the assertion JWT is consumed from the verification response; the
355
+ * profile fields on the wire duplicate what the login flow already resolved.
356
+ */
357
+ export declare const MfaVerifyCompleteResponseStruct: Struct<{
358
+ token: string;
359
+ expires_in: number;
360
+ }, {
361
+ token: Struct<string, null>;
362
+ expires_in: Struct<number, null>;
363
+ }>;
364
+ export declare const MfaEnrollResponseStruct: Struct<{
365
+ flow_id: string;
366
+ expires_at: string;
367
+ passkey_create_data?: string | undefined;
368
+ }, {
369
+ flow_id: Struct<string, null>;
370
+ expires_at: Struct<string, null>;
371
+ passkey_create_data: Struct<string | undefined, null>;
372
+ }>;
373
+ export declare const MfaEnrollCompleteResponseStruct: Struct<{
374
+ status: "enrolled";
375
+ }, {
376
+ status: Struct<"enrolled", "enrolled">;
377
+ }>;
378
+ export declare const MfaVerifyResponseStruct: Struct<{
379
+ flow_id: string;
380
+ expires_at: string;
381
+ passkey_request_data?: string | undefined;
382
+ }, {
383
+ flow_id: Struct<string, null>;
384
+ expires_at: Struct<string, null>;
385
+ passkey_request_data: Struct<string | undefined, null>;
386
+ }>;
387
+ export declare const MfaPasskeyDetailStruct: Struct<{
388
+ display_name?: string | undefined;
389
+ added_at?: string | undefined;
390
+ }, {
391
+ display_name: Struct<string | undefined, null>;
392
+ added_at: Struct<string | undefined, null>;
393
+ }>;
394
+ export declare const MfaEmailDetailStruct: Struct<{
395
+ address?: string | undefined;
396
+ verified?: boolean | undefined;
397
+ }, {
398
+ address: Struct<string | undefined, null>;
399
+ verified: Struct<boolean | undefined, null>;
400
+ }>;
401
+ export declare const MfaCredentialStruct: Struct<{
402
+ credential_type: string;
403
+ status: string;
404
+ enrolled_at?: string | undefined;
405
+ passkey?: {
406
+ display_name?: string | undefined;
407
+ added_at?: string | undefined;
408
+ } | undefined;
409
+ email?: {
410
+ address?: string | undefined;
411
+ verified?: boolean | undefined;
412
+ } | undefined;
413
+ }, {
414
+ credential_type: Struct<string, null>;
415
+ status: Struct<string, null>;
416
+ enrolled_at: Struct<string | undefined, null>;
417
+ passkey: Struct<{
418
+ display_name?: string | undefined;
419
+ added_at?: string | undefined;
420
+ } | undefined, {
421
+ display_name: Struct<string | undefined, null>;
422
+ added_at: Struct<string | undefined, null>;
423
+ }>;
424
+ email: Struct<{
425
+ address?: string | undefined;
426
+ verified?: boolean | undefined;
427
+ } | undefined, {
428
+ address: Struct<string | undefined, null>;
429
+ verified: Struct<boolean | undefined, null>;
430
+ }>;
431
+ }>;
432
+ export declare const MfaCredentialsResponseStruct: Struct<{
433
+ credentials: {
434
+ credential_type: string;
435
+ status: string;
436
+ enrolled_at?: string | undefined;
437
+ passkey?: {
438
+ display_name?: string | undefined;
439
+ added_at?: string | undefined;
440
+ } | undefined;
441
+ email?: {
442
+ address?: string | undefined;
443
+ verified?: boolean | undefined;
444
+ } | undefined;
445
+ }[];
446
+ }, {
447
+ credentials: Struct<{
448
+ credential_type: string;
449
+ status: string;
450
+ enrolled_at?: string | undefined;
451
+ passkey?: {
452
+ display_name?: string | undefined;
453
+ added_at?: string | undefined;
454
+ } | undefined;
455
+ email?: {
456
+ address?: string | undefined;
457
+ verified?: boolean | undefined;
458
+ } | undefined;
459
+ }[], Struct<{
460
+ credential_type: string;
461
+ status: string;
462
+ enrolled_at?: string | undefined;
463
+ passkey?: {
464
+ display_name?: string | undefined;
465
+ added_at?: string | undefined;
466
+ } | undefined;
467
+ email?: {
468
+ address?: string | undefined;
469
+ verified?: boolean | undefined;
470
+ } | undefined;
471
+ }, {
472
+ credential_type: Struct<string, null>;
473
+ status: Struct<string, null>;
474
+ enrolled_at: Struct<string | undefined, null>;
475
+ passkey: Struct<{
476
+ display_name?: string | undefined;
477
+ added_at?: string | undefined;
478
+ } | undefined, {
479
+ display_name: Struct<string | undefined, null>;
480
+ added_at: Struct<string | undefined, null>;
481
+ }>;
482
+ email: Struct<{
483
+ address?: string | undefined;
484
+ verified?: boolean | undefined;
485
+ } | undefined, {
486
+ address: Struct<string | undefined, null>;
487
+ verified: Struct<boolean | undefined, null>;
488
+ }>;
489
+ }>>;
490
+ }>;
491
+ export declare const MfaErrorResponseStruct: Struct<{
492
+ code?: string | undefined;
493
+ message: string;
494
+ retry_after_seconds?: number | undefined;
495
+ }, {
496
+ code: Struct<string | undefined, null>;
497
+ message: Struct<string, null>;
498
+ retry_after_seconds: Struct<number | undefined, null>;
499
+ }>;
500
+ export declare const TokenReasonStruct: Struct<{
501
+ operation: string;
502
+ }, {
503
+ operation: Struct<string, null>;
504
+ }>;
505
+ export declare const BeginEnrollmentRequestStruct: Struct<{
506
+ type: "email_otp" | "passkey";
507
+ email?: string | undefined;
508
+ reason: {
509
+ operation: string;
510
+ };
511
+ }, {
512
+ type: Struct<"email_otp" | "passkey", {
513
+ email_otp: "email_otp";
514
+ passkey: "passkey";
515
+ }>;
516
+ email: Struct<string | undefined, null>;
517
+ reason: Struct<{
518
+ operation: string;
519
+ }, {
520
+ operation: Struct<string, null>;
521
+ }>;
522
+ }>;
523
+ export declare const CompleteEnrollmentRequestStruct: Struct<{
524
+ flowId: string;
525
+ proof: {
526
+ type: "passkey";
527
+ attestation: {
528
+ id: string;
529
+ rawId: string;
530
+ type: "public-key";
531
+ response: {
532
+ attestationObject: string;
533
+ clientDataJSON: string;
534
+ transports?: string[] | undefined;
535
+ publicKeyAlgorithm?: number | undefined;
536
+ publicKey?: string | undefined;
537
+ authenticatorData?: string | undefined;
538
+ };
539
+ authenticatorAttachment?: string | null | undefined;
540
+ clientExtensionResults?: {} | undefined;
541
+ };
542
+ } | {
543
+ type: "email_otp";
544
+ code: string;
545
+ };
546
+ reason: {
547
+ operation: string;
548
+ };
549
+ }, {
550
+ flowId: Struct<string, null>;
551
+ proof: Struct<{
552
+ type: "passkey";
553
+ attestation: {
554
+ id: string;
555
+ rawId: string;
556
+ type: "public-key";
557
+ response: {
558
+ attestationObject: string;
559
+ clientDataJSON: string;
560
+ transports?: string[] | undefined;
561
+ publicKeyAlgorithm?: number | undefined;
562
+ publicKey?: string | undefined;
563
+ authenticatorData?: string | undefined;
564
+ };
565
+ authenticatorAttachment?: string | null | undefined;
566
+ clientExtensionResults?: {} | undefined;
567
+ };
568
+ } | {
569
+ type: "email_otp";
570
+ code: string;
571
+ }, null>;
572
+ reason: Struct<{
573
+ operation: string;
574
+ }, {
575
+ operation: Struct<string, null>;
576
+ }>;
577
+ }>;
578
+ export declare const BeginStepUpRequestStruct: Struct<{
579
+ type: "email_otp" | "passkey";
580
+ reason: {
581
+ operation: string;
582
+ };
583
+ }, {
584
+ type: Struct<"email_otp" | "passkey", {
585
+ email_otp: "email_otp";
586
+ passkey: "passkey";
587
+ }>;
588
+ reason: Struct<{
589
+ operation: string;
590
+ }, {
591
+ operation: Struct<string, null>;
592
+ }>;
593
+ }>;
594
+ export declare const CompleteStepUpRequestStruct: Struct<{
595
+ flowId: string;
596
+ proof: {
597
+ type: "passkey";
598
+ assertion: {
599
+ id: string;
600
+ rawId: string;
601
+ type: "public-key";
602
+ response: {
603
+ authenticatorData: string;
604
+ clientDataJSON: string;
605
+ signature: string;
606
+ userHandle?: string | null | undefined;
607
+ };
608
+ authenticatorAttachment?: string | null | undefined;
609
+ clientExtensionResults?: {} | undefined;
610
+ };
611
+ } | {
612
+ type: "email_otp";
613
+ code: string;
614
+ };
615
+ reason: {
616
+ operation: string;
617
+ };
618
+ }, {
619
+ flowId: Struct<string, null>;
620
+ proof: Struct<{
621
+ type: "passkey";
622
+ assertion: {
623
+ id: string;
624
+ rawId: string;
625
+ type: "public-key";
626
+ response: {
627
+ authenticatorData: string;
628
+ clientDataJSON: string;
629
+ signature: string;
630
+ userHandle?: string | null | undefined;
631
+ };
632
+ authenticatorAttachment?: string | null | undefined;
633
+ clientExtensionResults?: {} | undefined;
634
+ };
635
+ } | {
636
+ type: "email_otp";
637
+ code: string;
638
+ }, null>;
639
+ reason: Struct<{
640
+ operation: string;
641
+ }, {
642
+ operation: Struct<string, null>;
643
+ }>;
644
+ }>;
645
+ export declare const GetElevatedTokenRequestStruct: Struct<{
646
+ maxSessionAgeMs?: number | undefined;
647
+ }, {
648
+ maxSessionAgeMs: Struct<number | undefined, null>;
649
+ }>;
650
+ export declare const ElevatedTokenClaimsStruct: Struct<{
651
+ sub: string;
652
+ aal: 2;
653
+ exp: number;
654
+ amr: "email_otp" | "passkey" | ("email_otp" | "passkey")[];
655
+ }, {
656
+ sub: Struct<string, null>;
657
+ aal: Struct<2, 2>;
658
+ exp: Struct<number, null>;
659
+ amr: Struct<"email_otp" | "passkey" | ("email_otp" | "passkey")[], null>;
660
+ }>;
661
+ /**
662
+ * Validates data received from the authentication service.
663
+ *
664
+ * @param value - Untrusted response data.
665
+ * @param struct - Expected response structure.
666
+ * @throws MfaError if the response does not match the structure.
667
+ */
668
+ export declare function assertValidMfaResponse<Value>(value: unknown, struct: Struct<Value>): asserts value is Value;
669
+ /**
670
+ * Validates data received from an untyped controller boundary.
671
+ *
672
+ * @param value - Untrusted request data.
673
+ * @param struct - Expected request structure.
674
+ * @throws MfaError if the request does not match the structure.
675
+ */
676
+ export declare function assertValidMfaRequest<Value>(value: unknown, struct: Struct<Value>): asserts value is Value;
677
+ /**
678
+ * Validates and normalizes claims from an elevated access token.
679
+ *
680
+ * Hydra places hook-supplied claims under `ext` unless they are promoted to
681
+ * the top level, so `aal` and `amr` are read from either location.
682
+ *
683
+ * @param payload - Decoded JWT payload.
684
+ * @returns Validated claims with `amr` represented as an array.
685
+ * @throws ElevatedTokenInvalidError if claims are missing or invalid.
686
+ */
687
+ export declare function parseElevatedTokenClaims(payload: unknown): {
688
+ sub: string;
689
+ aal: 2;
690
+ exp: number;
691
+ amr: ('passkey' | 'email_otp')[];
692
+ };
693
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/mfa/schemas.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAu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