@productcraft/auth 0.5.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.
@@ -0,0 +1,2508 @@
1
+ import { PCClientConfig } from '@productcraft/core';
2
+ export { PCAuth, PCClientConfig } from '@productcraft/core';
3
+ import { ResponseConfig, Client } from '@kubb/plugin-client/clients/fetch';
4
+ import { JWTHeaderParameters, FlattenedJWSInput, CryptoKey, JWTPayload } from 'jose';
5
+
6
+ /**
7
+ * Generated by Kubb (https://kubb.dev/).
8
+ * Do not edit manually.
9
+ */
10
+ type PlatformUserStatsResponseDto = {
11
+ /**
12
+ * @description API keys across those apps. Rows are hard-deleted on revoke so existence implies active.
13
+ * @type number
14
+ */
15
+ api_keys_active: number;
16
+ /**
17
+ * @description Auth apps the caller is a member of (any role).
18
+ * @type number
19
+ */
20
+ apps: number;
21
+ /**
22
+ * @description EndUsers across those apps.
23
+ * @type number
24
+ */
25
+ end_users: number;
26
+ };
27
+
28
+ /**
29
+ * Generated by Kubb (https://kubb.dev/).
30
+ * Do not edit manually.
31
+ */
32
+ declare const appResponseDtoStatusEnum: {
33
+ readonly active: "active";
34
+ readonly suspended: "suspended";
35
+ readonly archived: "archived";
36
+ };
37
+ type AppResponseDtoStatusEnumKey = (typeof appResponseDtoStatusEnum)[keyof typeof appResponseDtoStatusEnum];
38
+ type AppResponseDto = {
39
+ /**
40
+ * @type string, date-time
41
+ */
42
+ created_at: string;
43
+ /**
44
+ * @description Account that created the app.
45
+ * @type string
46
+ */
47
+ created_by: string;
48
+ /**
49
+ * @type string
50
+ */
51
+ display_name: string;
52
+ /**
53
+ * @type string
54
+ */
55
+ id: string;
56
+ /**
57
+ * @type object
58
+ */
59
+ metadata: object;
60
+ /**
61
+ * @type string
62
+ */
63
+ slug: string;
64
+ /**
65
+ * @type string
66
+ */
67
+ status: AppResponseDtoStatusEnumKey;
68
+ /**
69
+ * @type string, date-time
70
+ */
71
+ updated_at: string;
72
+ /**
73
+ * @description Owning workspace UUID.
74
+ * @type string
75
+ */
76
+ workspace_id: string;
77
+ };
78
+
79
+ /**
80
+ * Generated by Kubb (https://kubb.dev/).
81
+ * Do not edit manually.
82
+ */
83
+ type PaginationDto = {
84
+ /**
85
+ * @description True iff another page exists; if true, pass `next_cursor` on the next request.
86
+ * @type boolean
87
+ */
88
+ has_more: boolean;
89
+ /**
90
+ * @description Opaque cursor for the next page. `null` when no more pages are available.
91
+ * @type string
92
+ */
93
+ next_cursor: string | null;
94
+ };
95
+
96
+ /**
97
+ * Generated by Kubb (https://kubb.dev/).
98
+ * Do not edit manually.
99
+ */
100
+
101
+ type AppListResponseDto = {
102
+ /**
103
+ * @type array
104
+ */
105
+ data: AppResponseDto[];
106
+ /**
107
+ * @type object
108
+ */
109
+ pagination: PaginationDto;
110
+ };
111
+
112
+ /**
113
+ * Custom HTTP client passed to kubb-generated request functions.
114
+ *
115
+ * Each generated client function accepts an optional `{ client }`
116
+ * override matching kubb's `Client` shape:
117
+ * <TData, TError, TVars>(config: RequestConfig<TVars>) => Promise<ResponseConfig<TData>>
118
+ *
119
+ * We construct one per `Auth` instance — bound to that instance's
120
+ * baseUrl + auth credential — so generated functions don't need to
121
+ * know anything about authentication or environment selection.
122
+ */
123
+
124
+ /** Thrown for any non-2xx response; `response.data` is the parsed body. */
125
+ declare class AuthHttpError<TData = unknown> extends Error {
126
+ readonly status: number;
127
+ readonly statusText: string;
128
+ readonly data: TData;
129
+ constructor(response: ResponseConfig<TData>);
130
+ }
131
+
132
+ /**
133
+ * Generated by Kubb (https://kubb.dev/).
134
+ * Do not edit manually.
135
+ */
136
+ type AuditLogEntryDto = {
137
+ /**
138
+ * @description Canonical action string (e.g. `app.member.removed`, `role.created`).
139
+ * @type string
140
+ */
141
+ action: string;
142
+ /**
143
+ * @description Account id that triggered the action. `null` for `system` actor type.
144
+ * @type string
145
+ */
146
+ actor_id: string | null;
147
+ /**
148
+ * @description App this audit row belongs to.
149
+ * @type string
150
+ */
151
+ app_id: string;
152
+ /**
153
+ * @description ISO 8601 timestamp.
154
+ * @type string, date-time
155
+ */
156
+ created_at: string;
157
+ /**
158
+ * @description Free-form structured detail object captured at log time.
159
+ * @type object
160
+ */
161
+ details: object | null;
162
+ /**
163
+ * @description Audit row UUID.
164
+ * @type string
165
+ */
166
+ id: string;
167
+ /**
168
+ * @description Resource id touched.
169
+ * @type string
170
+ */
171
+ resource_id: string | null;
172
+ /**
173
+ * @description Resource type touched (e.g. `app_membership`, `role`).
174
+ * @type string
175
+ */
176
+ resource_type: string | null;
177
+ };
178
+
179
+ /**
180
+ * Generated by Kubb (https://kubb.dev/).
181
+ * Do not edit manually.
182
+ */
183
+
184
+ type AuditLogListResponseDto = {
185
+ /**
186
+ * @type array
187
+ */
188
+ data: AuditLogEntryDto[];
189
+ /**
190
+ * @type object
191
+ */
192
+ pagination: PaginationDto;
193
+ };
194
+
195
+ /**
196
+ * Generated by Kubb (https://kubb.dev/).
197
+ * Do not edit manually.
198
+ */
199
+ type M2MRotateSecretResponseDto = {
200
+ /**
201
+ * @type string
202
+ */
203
+ client_id: string;
204
+ /**
205
+ * @description New plaintext client secret. Returned exactly once.
206
+ * @type string
207
+ */
208
+ client_secret: string;
209
+ };
210
+
211
+ /**
212
+ * Generated by Kubb (https://kubb.dev/).
213
+ * Do not edit manually.
214
+ */
215
+ type M2MScopeEntryDto = {
216
+ /**
217
+ * @type string
218
+ */
219
+ action: string;
220
+ /**
221
+ * @type string
222
+ */
223
+ resource: string;
224
+ };
225
+
226
+ /**
227
+ * Generated by Kubb (https://kubb.dev/).
228
+ * Do not edit manually.
229
+ */
230
+
231
+ type M2MClientDetailResponseDto = {
232
+ /**
233
+ * @type string
234
+ */
235
+ app_id: string;
236
+ /**
237
+ * @type string
238
+ */
239
+ client_id: string;
240
+ /**
241
+ * @type string, date-time
242
+ */
243
+ created_at: string;
244
+ /**
245
+ * @type string
246
+ */
247
+ id: string;
248
+ /**
249
+ * @type boolean
250
+ */
251
+ is_active: boolean;
252
+ /**
253
+ * @type string, date-time
254
+ */
255
+ last_used_at: string | null;
256
+ /**
257
+ * @type string
258
+ */
259
+ name: string;
260
+ /**
261
+ * @type array
262
+ */
263
+ scopes: M2MScopeEntryDto[];
264
+ };
265
+
266
+ /**
267
+ * Generated by Kubb (https://kubb.dev/).
268
+ * Do not edit manually.
269
+ */
270
+ type M2MClientCreateResponseDto = {
271
+ /**
272
+ * @type string
273
+ */
274
+ client_id: string;
275
+ /**
276
+ * @description Plaintext client secret. Returned exactly once.
277
+ * @type string
278
+ */
279
+ client_secret: string;
280
+ /**
281
+ * @type string, date-time
282
+ */
283
+ created_at: string;
284
+ /**
285
+ * @type string
286
+ */
287
+ id: string;
288
+ /**
289
+ * @type string
290
+ */
291
+ name: string;
292
+ };
293
+
294
+ /**
295
+ * Generated by Kubb (https://kubb.dev/).
296
+ * Do not edit manually.
297
+ */
298
+ type M2MClientSummaryDto = {
299
+ /**
300
+ * @type string
301
+ */
302
+ app_id: string;
303
+ /**
304
+ * @type string
305
+ */
306
+ client_id: string;
307
+ /**
308
+ * @type string, date-time
309
+ */
310
+ created_at: string;
311
+ /**
312
+ * @type string
313
+ */
314
+ id: string;
315
+ /**
316
+ * @type boolean
317
+ */
318
+ is_active: boolean;
319
+ /**
320
+ * @type string, date-time
321
+ */
322
+ last_used_at: string | null;
323
+ /**
324
+ * @type string
325
+ */
326
+ name: string;
327
+ };
328
+
329
+ /**
330
+ * Generated by Kubb (https://kubb.dev/).
331
+ * Do not edit manually.
332
+ */
333
+
334
+ type M2MClientListResponseDto = {
335
+ /**
336
+ * @type array
337
+ */
338
+ data: M2MClientSummaryDto[];
339
+ /**
340
+ * @type object
341
+ */
342
+ pagination: PaginationDto;
343
+ };
344
+
345
+ /**
346
+ * Generated by Kubb (https://kubb.dev/).
347
+ * Do not edit manually.
348
+ */
349
+ type CreateApiKeyResponseDto = {
350
+ /**
351
+ * @type string, date-time
352
+ */
353
+ created_at: string;
354
+ /**
355
+ * @description API key row UUID.
356
+ * @type string
357
+ */
358
+ id: string;
359
+ /**
360
+ * @description Raw API key. Returned exactly once — store it now.
361
+ * @type string
362
+ */
363
+ key: string;
364
+ /**
365
+ * @description First 16 chars of the key — safe to display in lists.
366
+ * @type string
367
+ */
368
+ key_prefix: string;
369
+ /**
370
+ * @description Display name.
371
+ * @type string
372
+ */
373
+ name: string;
374
+ /**
375
+ * @description Permission scope.
376
+ * @type array
377
+ */
378
+ permissions: string[];
379
+ };
380
+
381
+ /**
382
+ * Generated by Kubb (https://kubb.dev/).
383
+ * Do not edit manually.
384
+ */
385
+ type ApiKeySummaryDto = {
386
+ /**
387
+ * @type string, date-time
388
+ */
389
+ created_at: string;
390
+ /**
391
+ * @type string
392
+ */
393
+ id: string;
394
+ /**
395
+ * @description Prefix only — full key is never returned after creation.
396
+ * @type string
397
+ */
398
+ key_prefix: string;
399
+ /**
400
+ * @type string, date-time
401
+ */
402
+ last_used_at: string | null;
403
+ /**
404
+ * @type string
405
+ */
406
+ name: string;
407
+ /**
408
+ * @type array
409
+ */
410
+ permissions: string[];
411
+ };
412
+
413
+ /**
414
+ * Generated by Kubb (https://kubb.dev/).
415
+ * Do not edit manually.
416
+ */
417
+
418
+ type ApiKeyListResponseDto = {
419
+ /**
420
+ * @type array
421
+ */
422
+ data: ApiKeySummaryDto[];
423
+ /**
424
+ * @type object
425
+ */
426
+ pagination: PaginationDto;
427
+ };
428
+
429
+ /**
430
+ * Generated by Kubb (https://kubb.dev/).
431
+ * Do not edit manually.
432
+ */
433
+ type PermissionDto = {
434
+ /**
435
+ * @type string
436
+ */
437
+ action: string;
438
+ /**
439
+ * @description App scope. `null` for system permissions.
440
+ * @type string
441
+ */
442
+ app_id: string | null;
443
+ /**
444
+ * @type string, date-time
445
+ */
446
+ created_at: string;
447
+ /**
448
+ * @description Free-text description of what this permission allows.
449
+ * @type string
450
+ */
451
+ description: string | null;
452
+ /**
453
+ * @description Permission row UUID.
454
+ * @type string
455
+ */
456
+ id: string;
457
+ /**
458
+ * @type string
459
+ */
460
+ resource: string;
461
+ };
462
+
463
+ /**
464
+ * Generated by Kubb (https://kubb.dev/).
465
+ * Do not edit manually.
466
+ */
467
+
468
+ /**
469
+ * @description Flat list — system + per-app permissions.
470
+ */
471
+ type PermissionControllerListPermissions200 = PermissionDto[];
472
+
473
+ /**
474
+ * Generated by Kubb (https://kubb.dev/).
475
+ * Do not edit manually.
476
+ */
477
+ type AppPermissionCatalogEntryDto = {
478
+ /**
479
+ * @type string
480
+ */
481
+ action: string;
482
+ /**
483
+ * @description App scope. `null` for system permissions.
484
+ * @type string
485
+ */
486
+ app_id: string | null;
487
+ /**
488
+ * @type string, date-time
489
+ */
490
+ created_at: string;
491
+ /**
492
+ * @type string
493
+ */
494
+ description: string | null;
495
+ /**
496
+ * @type string
497
+ */
498
+ id: string;
499
+ /**
500
+ * @description True iff the row is a system (shared) permission.
501
+ * @type boolean
502
+ */
503
+ is_system: boolean;
504
+ /**
505
+ * @type string
506
+ */
507
+ resource: string;
508
+ };
509
+
510
+ /**
511
+ * Generated by Kubb (https://kubb.dev/).
512
+ * Do not edit manually.
513
+ */
514
+
515
+ type RoleControllerListPermissions200 = AppPermissionCatalogEntryDto[];
516
+
517
+ /**
518
+ * Generated by Kubb (https://kubb.dev/).
519
+ * Do not edit manually.
520
+ */
521
+ type AppMembershipResponseDto = {
522
+ /**
523
+ * @description Account UUID.
524
+ * @type string
525
+ */
526
+ account_id: string;
527
+ /**
528
+ * @description App UUID.
529
+ * @type string
530
+ */
531
+ app_id: string;
532
+ /**
533
+ * @type string
534
+ */
535
+ id: string;
536
+ /**
537
+ * @type string, date-time
538
+ */
539
+ joined_at: string;
540
+ /**
541
+ * @description Role UUID.
542
+ * @type string
543
+ */
544
+ role_id: string;
545
+ };
546
+
547
+ /**
548
+ * Generated by Kubb (https://kubb.dev/).
549
+ * Do not edit manually.
550
+ */
551
+ type RoleResponseDto = {
552
+ /**
553
+ * @description App scope (UUID).
554
+ * @type string
555
+ */
556
+ app_id: string;
557
+ /**
558
+ * @type string, date-time
559
+ */
560
+ created_at: string;
561
+ /**
562
+ * @description Free-text description.
563
+ * @type string
564
+ */
565
+ description: string | null;
566
+ /**
567
+ * @description Role UUID.
568
+ * @type string
569
+ */
570
+ id: string;
571
+ /**
572
+ * @description Whether this is a system role (owner / admin / member).
573
+ * @type boolean
574
+ */
575
+ is_system: boolean;
576
+ /**
577
+ * @description Role name slug.
578
+ * @type string
579
+ */
580
+ name: string;
581
+ /**
582
+ * @type string, date-time
583
+ */
584
+ updated_at: string;
585
+ };
586
+
587
+ /**
588
+ * Generated by Kubb (https://kubb.dev/).
589
+ * Do not edit manually.
590
+ */
591
+
592
+ type RoleListResponseDto = {
593
+ /**
594
+ * @type array
595
+ */
596
+ data: RoleResponseDto[];
597
+ /**
598
+ * @type object
599
+ */
600
+ pagination: PaginationDto;
601
+ };
602
+
603
+ /**
604
+ * Generated by Kubb (https://kubb.dev/).
605
+ * Do not edit manually.
606
+ */
607
+ declare const endUserSummaryDtoStatusEnum: {
608
+ readonly active: "active";
609
+ readonly suspended: "suspended";
610
+ readonly deactivated: "deactivated";
611
+ };
612
+ type EndUserSummaryDtoStatusEnumKey = (typeof endUserSummaryDtoStatusEnum)[keyof typeof endUserSummaryDtoStatusEnum];
613
+ type EndUserSummaryDto = {
614
+ /**
615
+ * @type number
616
+ */
617
+ active_session_count: number;
618
+ /**
619
+ * @type string, date-time
620
+ */
621
+ created_at: string;
622
+ /**
623
+ * @type string
624
+ */
625
+ display_name: string | null;
626
+ /**
627
+ * @type string
628
+ */
629
+ email: string | null;
630
+ /**
631
+ * @type string, date-time
632
+ */
633
+ email_verified_at: string | null;
634
+ /**
635
+ * @type string
636
+ */
637
+ id: string;
638
+ /**
639
+ * @type string, date-time
640
+ */
641
+ joined_at: string | null;
642
+ /**
643
+ * @type string, date-time
644
+ */
645
+ last_used_at: string | null;
646
+ /**
647
+ * @type string
648
+ */
649
+ role: string | null;
650
+ /**
651
+ * @type string
652
+ */
653
+ status: EndUserSummaryDtoStatusEnumKey;
654
+ /**
655
+ * @type string
656
+ */
657
+ username: string;
658
+ };
659
+
660
+ /**
661
+ * Generated by Kubb (https://kubb.dev/).
662
+ * Do not edit manually.
663
+ */
664
+
665
+ type EndUserListResponseDto = {
666
+ /**
667
+ * @type array
668
+ */
669
+ data: EndUserSummaryDto[];
670
+ /**
671
+ * @type object
672
+ */
673
+ pagination: PaginationDto;
674
+ };
675
+
676
+ /**
677
+ * Generated by Kubb (https://kubb.dev/).
678
+ * Do not edit manually.
679
+ */
680
+ type AppMemberSummaryDto = {
681
+ /**
682
+ * @type string
683
+ */
684
+ account_id: string;
685
+ /**
686
+ * @type string
687
+ */
688
+ display_name: string | null;
689
+ /**
690
+ * @type string
691
+ */
692
+ id: string;
693
+ /**
694
+ * @type string, date-time
695
+ */
696
+ joined_at: string;
697
+ /**
698
+ * @type string
699
+ */
700
+ primary_email: string | null;
701
+ /**
702
+ * @type string
703
+ */
704
+ role_id: string;
705
+ /**
706
+ * @type string
707
+ */
708
+ role_name: string;
709
+ /**
710
+ * @type string
711
+ */
712
+ username: string;
713
+ };
714
+
715
+ /**
716
+ * Generated by Kubb (https://kubb.dev/).
717
+ * Do not edit manually.
718
+ */
719
+
720
+ type AppMemberListResponseDto = {
721
+ /**
722
+ * @type array
723
+ */
724
+ data: AppMemberSummaryDto[];
725
+ /**
726
+ * @type object
727
+ */
728
+ pagination: PaginationDto;
729
+ };
730
+
731
+ /**
732
+ * Generated by Kubb (https://kubb.dev/).
733
+ * Do not edit manually.
734
+ */
735
+ type EndUserInviteResponseDto = {
736
+ /**
737
+ * @description Invite code the recipient submits to accept.
738
+ * @type string
739
+ */
740
+ code: string;
741
+ /**
742
+ * @type string, date-time
743
+ */
744
+ created_at: string;
745
+ /**
746
+ * @type string
747
+ */
748
+ email: string | null;
749
+ /**
750
+ * @type string, date-time
751
+ */
752
+ expires_at: string | null;
753
+ /**
754
+ * @type string
755
+ */
756
+ id: string;
757
+ /**
758
+ * @type number
759
+ */
760
+ max_uses: number | null;
761
+ /**
762
+ * @type string, date-time
763
+ */
764
+ revoked_at: string | null;
765
+ /**
766
+ * @type string
767
+ */
768
+ role_id: string;
769
+ /**
770
+ * @type string
771
+ */
772
+ role_name: string | null;
773
+ /**
774
+ * @type number
775
+ */
776
+ use_count: number;
777
+ };
778
+
779
+ /**
780
+ * Generated by Kubb (https://kubb.dev/).
781
+ * Do not edit manually.
782
+ */
783
+
784
+ type EndUserInviteListResponseDto = {
785
+ /**
786
+ * @type array
787
+ */
788
+ data: EndUserInviteResponseDto[];
789
+ /**
790
+ * @type object
791
+ */
792
+ pagination: PaginationDto;
793
+ };
794
+
795
+ /**
796
+ * Generated by Kubb (https://kubb.dev/).
797
+ * Do not edit manually.
798
+ */
799
+ declare const authConfigResponseDtoOauthLinkPolicyEnum: {
800
+ readonly auto: "auto";
801
+ readonly confirm: "confirm";
802
+ readonly reject: "reject";
803
+ };
804
+ type AuthConfigResponseDtoOauthLinkPolicyEnumKey = (typeof authConfigResponseDtoOauthLinkPolicyEnum)[keyof typeof authConfigResponseDtoOauthLinkPolicyEnum];
805
+ type AuthConfigResponseDto = {
806
+ /**
807
+ * @type array
808
+ */
809
+ allowed_redirect_origins: string[];
810
+ /**
811
+ * @type boolean
812
+ */
813
+ enforce_app_permissions: boolean;
814
+ /**
815
+ * @type number
816
+ */
817
+ max_failed_login_attempts: number;
818
+ /**
819
+ * @type number
820
+ */
821
+ max_sessions: number;
822
+ /**
823
+ * @type string
824
+ */
825
+ oauth_link_policy: AuthConfigResponseDtoOauthLinkPolicyEnumKey;
826
+ /**
827
+ * @type number
828
+ */
829
+ password_min_length: number;
830
+ /**
831
+ * @type boolean
832
+ */
833
+ password_require_number: boolean;
834
+ /**
835
+ * @type boolean
836
+ */
837
+ password_require_symbol: boolean;
838
+ /**
839
+ * @type boolean
840
+ */
841
+ password_require_uppercase: boolean;
842
+ /**
843
+ * @type number
844
+ */
845
+ session_duration_minutes: number;
846
+ /**
847
+ * @type boolean
848
+ */
849
+ signin_enabled: boolean;
850
+ /**
851
+ * @type array
852
+ */
853
+ signup_allowed_email_domains: string[];
854
+ /**
855
+ * @type string
856
+ */
857
+ signup_default_role: string;
858
+ /**
859
+ * @type boolean
860
+ */
861
+ signup_enabled: boolean;
862
+ };
863
+
864
+ /**
865
+ * Generated by Kubb (https://kubb.dev/).
866
+ * Do not edit manually.
867
+ */
868
+ type UpdateAppDto = {
869
+ /**
870
+ * @description New display name
871
+ * @type string | undefined
872
+ */
873
+ display_name?: string;
874
+ /**
875
+ * @description Arbitrary metadata attached to the app
876
+ * @type object | undefined
877
+ */
878
+ metadata?: object;
879
+ /**
880
+ * @description Rename the app\'s slug. The old slug remains resolvable for 30 days as a JWKS-URL alias so existing customer-side verifiers don\'t break instantly. Same shape as the create-slug: lowercase alphanumeric + hyphens, 3–48 chars.
881
+ * @type string | undefined
882
+ */
883
+ slug?: string;
884
+ };
885
+
886
+ /**
887
+ * Generated by Kubb (https://kubb.dev/).
888
+ * Do not edit manually.
889
+ */
890
+ declare const updateAppStatusDtoStatusEnum: {
891
+ readonly active: "active";
892
+ readonly suspended: "suspended";
893
+ readonly archived: "archived";
894
+ };
895
+ type UpdateAppStatusDtoStatusEnumKey = (typeof updateAppStatusDtoStatusEnum)[keyof typeof updateAppStatusDtoStatusEnum];
896
+ type UpdateAppStatusDto = {
897
+ /**
898
+ * @description New app status
899
+ * @type string
900
+ */
901
+ status: UpdateAppStatusDtoStatusEnumKey;
902
+ };
903
+
904
+ /**
905
+ * Generated by Kubb (https://kubb.dev/).
906
+ * Do not edit manually.
907
+ */
908
+ declare const updateAuthConfigDtoOauthLinkPolicyEnum: {
909
+ readonly auto: "auto";
910
+ readonly confirm: "confirm";
911
+ readonly reject: "reject";
912
+ };
913
+ type UpdateAuthConfigDtoOauthLinkPolicyEnumKey = (typeof updateAuthConfigDtoOauthLinkPolicyEnum)[keyof typeof updateAuthConfigDtoOauthLinkPolicyEnum];
914
+ type UpdateAuthConfigDto = {
915
+ /**
916
+ * @description Allowed origins for the `return_to` parameter on the OAuth web redirect callback. Exact origin match (scheme + host + port); no paths, no wildcards. Empty array disables the web redirect flow for this app. Prevents the callback from acting as an open-redirect.
917
+ * @type array | undefined
918
+ */
919
+ allowed_redirect_origins?: string[];
920
+ /**
921
+ * @description When true, Consumer-API routes annotated with `@RequireAppPermission(perm)` enforce the requested perm against the EndUser\'s role-resolved permission set. When false (default), permission checks are bypassed — any valid token can call any annotated route. Flip on once you\'ve authored roles + permissions for this app and want them to actually mean something.
922
+ * @type boolean | undefined
923
+ */
924
+ enforce_app_permissions?: boolean;
925
+ /**
926
+ * @description Failed-login attempts before the EndUser account is locked.
927
+ * @minLength 1
928
+ * @maxLength 100
929
+ * @type number | undefined
930
+ */
931
+ max_failed_login_attempts?: number;
932
+ /**
933
+ * @description Maximum concurrent sessions per EndUser. Oldest is evicted on overflow.
934
+ * @minLength 1
935
+ * @maxLength 50
936
+ * @type number | undefined
937
+ */
938
+ max_sessions?: number;
939
+ /**
940
+ * @description How to handle a federated sign-in (Apple, Google, …) that lands on a verified email already belonging to an account in this app. `confirm` (default) refuses to auto-link and surfaces `link_required` so the user signs in with their original method. `auto` silently links when the provider claims the email is verified AND the email is not a private relay. `reject` refuses outright. Private-relay emails never auto-link regardless.
941
+ * @type string | undefined
942
+ */
943
+ oauth_link_policy?: UpdateAuthConfigDtoOauthLinkPolicyEnumKey;
944
+ /**
945
+ * @description Minimum password length (NIST minimum is 8).
946
+ * @minLength 8
947
+ * @maxLength 128
948
+ * @type number | undefined
949
+ */
950
+ password_min_length?: number;
951
+ /**
952
+ * @description Require a digit in passwords.
953
+ * @type boolean | undefined
954
+ */
955
+ password_require_number?: boolean;
956
+ /**
957
+ * @description Require a symbol in passwords.
958
+ * @type boolean | undefined
959
+ */
960
+ password_require_symbol?: boolean;
961
+ /**
962
+ * @description Require an uppercase letter in passwords.
963
+ * @type boolean | undefined
964
+ */
965
+ password_require_uppercase?: boolean;
966
+ /**
967
+ * @description Session lifetime in minutes (1 minute to 30 days).
968
+ * @minLength 1
969
+ * @maxLength 43200
970
+ * @type number | undefined
971
+ */
972
+ session_duration_minutes?: number;
973
+ /**
974
+ * @description Whether existing EndUsers can sign in.
975
+ * @type boolean | undefined
976
+ */
977
+ signin_enabled?: boolean;
978
+ /**
979
+ * @description Optional allowlist of email domains for signup. Empty array = any domain.
980
+ * @type array | undefined
981
+ */
982
+ signup_allowed_email_domains?: string[];
983
+ /**
984
+ * @description Role slug newly-signed-up EndUsers receive (e.g. `member`).
985
+ * @type string | undefined
986
+ */
987
+ signup_default_role?: string;
988
+ /**
989
+ * @description Whether new EndUsers can sign up.
990
+ * @type boolean | undefined
991
+ */
992
+ signup_enabled?: boolean;
993
+ };
994
+
995
+ /**
996
+ * Generated by Kubb (https://kubb.dev/).
997
+ * Do not edit manually.
998
+ */
999
+ type CreateEndUserInviteDto = {
1000
+ /**
1001
+ * @description Invitee email. Locks the invite to this address.
1002
+ * @type string
1003
+ */
1004
+ email: string;
1005
+ /**
1006
+ * @description Hours until the invite expires. Defaults to 72 (3 days).
1007
+ * @minLength 1
1008
+ * @maxLength 720
1009
+ * @type number | undefined
1010
+ */
1011
+ expires_in_hours?: number;
1012
+ /**
1013
+ * @description Maximum number of accepts. Defaults to 1.
1014
+ * @minLength 1
1015
+ * @maxLength 10000
1016
+ * @type number | undefined
1017
+ */
1018
+ max_uses?: number;
1019
+ /**
1020
+ * @description Optional human-readable name shown in the email.
1021
+ * @type string | undefined
1022
+ */
1023
+ name?: string;
1024
+ /**
1025
+ * @description Role slug to grant on accept. Defaults to `member`.
1026
+ * @type string | undefined
1027
+ */
1028
+ role_name?: string;
1029
+ };
1030
+
1031
+ /**
1032
+ * Generated by Kubb (https://kubb.dev/).
1033
+ * Do not edit manually.
1034
+ */
1035
+ type UpdateEndUserDto = {
1036
+ /**
1037
+ * @description New display name
1038
+ * @type string | undefined
1039
+ */
1040
+ display_name?: string;
1041
+ /**
1042
+ * @description New primary email
1043
+ * @type string | undefined
1044
+ */
1045
+ email?: string;
1046
+ };
1047
+
1048
+ /**
1049
+ * Generated by Kubb (https://kubb.dev/).
1050
+ * Do not edit manually.
1051
+ */
1052
+ type UpdateEndUserRoleDto = {
1053
+ /**
1054
+ * @description Name of the role to assign
1055
+ * @type string
1056
+ */
1057
+ role_name: string;
1058
+ };
1059
+
1060
+ /**
1061
+ * Generated by Kubb (https://kubb.dev/).
1062
+ * Do not edit manually.
1063
+ */
1064
+ declare const updateEndUserStatusDtoStatusEnum: {
1065
+ readonly active: "active";
1066
+ readonly suspended: "suspended";
1067
+ readonly deactivated: "deactivated";
1068
+ };
1069
+ type UpdateEndUserStatusDtoStatusEnumKey = (typeof updateEndUserStatusDtoStatusEnum)[keyof typeof updateEndUserStatusDtoStatusEnum];
1070
+ type UpdateEndUserStatusDto = {
1071
+ /**
1072
+ * @description New end-user status
1073
+ * @type string
1074
+ */
1075
+ status: UpdateEndUserStatusDtoStatusEnumKey;
1076
+ };
1077
+
1078
+ /**
1079
+ * Generated by Kubb (https://kubb.dev/).
1080
+ * Do not edit manually.
1081
+ */
1082
+ type CreateRoleDto = {
1083
+ /**
1084
+ * @type string | undefined
1085
+ */
1086
+ description?: string;
1087
+ /**
1088
+ * @type string
1089
+ */
1090
+ name: string;
1091
+ };
1092
+
1093
+ /**
1094
+ * Generated by Kubb (https://kubb.dev/).
1095
+ * Do not edit manually.
1096
+ */
1097
+ type UpdateRoleDto = {
1098
+ /**
1099
+ * @type string | undefined
1100
+ */
1101
+ description?: string;
1102
+ };
1103
+
1104
+ /**
1105
+ * Generated by Kubb (https://kubb.dev/).
1106
+ * Do not edit manually.
1107
+ */
1108
+ type AssignRoleDto = {
1109
+ /**
1110
+ * @description Account ID of the user
1111
+ * @type string
1112
+ */
1113
+ account_id: string;
1114
+ /**
1115
+ * @description Role name to assign
1116
+ * @type string
1117
+ */
1118
+ role: string;
1119
+ };
1120
+
1121
+ /**
1122
+ * Generated by Kubb (https://kubb.dev/).
1123
+ * Do not edit manually.
1124
+ */
1125
+ type SetPermissionsDto = {
1126
+ /**
1127
+ * @description Array of permission strings in resource.action format
1128
+ * @type array
1129
+ */
1130
+ permissions: string[];
1131
+ };
1132
+
1133
+ /**
1134
+ * Generated by Kubb (https://kubb.dev/).
1135
+ * Do not edit manually.
1136
+ */
1137
+ type CreatePermissionDto = {
1138
+ /**
1139
+ * @description Action name
1140
+ * @type string
1141
+ */
1142
+ action: string;
1143
+ /**
1144
+ * @type string | undefined
1145
+ */
1146
+ description?: string;
1147
+ /**
1148
+ * @description Resource name
1149
+ * @type string
1150
+ */
1151
+ resource: string;
1152
+ };
1153
+
1154
+ /**
1155
+ * Generated by Kubb (https://kubb.dev/).
1156
+ * Do not edit manually.
1157
+ */
1158
+ type CreateApiKeyDto = {
1159
+ /**
1160
+ * @description Human-readable label for this key (shown in the API keys list).
1161
+ * @minLength 1
1162
+ * @maxLength 120
1163
+ * @type string
1164
+ */
1165
+ name: string;
1166
+ /**
1167
+ * @description Permission scope for the key. Each entry must match `resource.action` (lowercase + underscores).
1168
+ * @type array
1169
+ */
1170
+ permissions: string[];
1171
+ };
1172
+
1173
+ /**
1174
+ * Generated by Kubb (https://kubb.dev/).
1175
+ * Do not edit manually.
1176
+ */
1177
+ type CreateM2MClientDto = {
1178
+ /**
1179
+ * @description Client display name
1180
+ * @type string
1181
+ */
1182
+ name: string;
1183
+ };
1184
+
1185
+ /**
1186
+ * Generated by Kubb (https://kubb.dev/).
1187
+ * Do not edit manually.
1188
+ */
1189
+ type UpdateM2MClientDto = {
1190
+ /**
1191
+ * @description Set active or inactive
1192
+ * @type boolean | undefined
1193
+ */
1194
+ is_active?: boolean;
1195
+ };
1196
+
1197
+ /**
1198
+ * Generated by Kubb (https://kubb.dev/).
1199
+ * Do not edit manually.
1200
+ */
1201
+ type SetScopesDto = {
1202
+ /**
1203
+ * @description Permission strings in resource.action format to assign as scopes
1204
+ * @type array
1205
+ */
1206
+ permissions: string[];
1207
+ };
1208
+
1209
+ /**
1210
+ * Generated by Kubb (https://kubb.dev/).
1211
+ * Do not edit manually.
1212
+ */
1213
+
1214
+ type EndUserInviteControllerListQueryParams = {
1215
+ /**
1216
+ * @type string | undefined
1217
+ */
1218
+ limit?: string;
1219
+ /**
1220
+ * @type string | undefined
1221
+ */
1222
+ cursor?: string;
1223
+ };
1224
+
1225
+ /**
1226
+ * Generated by Kubb (https://kubb.dev/).
1227
+ * Do not edit manually.
1228
+ */
1229
+
1230
+ type AppControllerListMembersQueryParams = {
1231
+ /**
1232
+ * @type string | undefined
1233
+ */
1234
+ limit?: string;
1235
+ /**
1236
+ * @type string | undefined
1237
+ */
1238
+ cursor?: string;
1239
+ };
1240
+
1241
+ /**
1242
+ * Generated by Kubb (https://kubb.dev/).
1243
+ * Do not edit manually.
1244
+ */
1245
+
1246
+ type EndUserControllerListEndUsersQueryParams = {
1247
+ /**
1248
+ * @type string | undefined
1249
+ */
1250
+ limit?: string;
1251
+ /**
1252
+ * @type string | undefined
1253
+ */
1254
+ cursor?: string;
1255
+ /**
1256
+ * @type string | undefined
1257
+ */
1258
+ status?: string;
1259
+ /**
1260
+ * @type string | undefined
1261
+ */
1262
+ search?: string;
1263
+ };
1264
+
1265
+ /**
1266
+ * Generated by Kubb (https://kubb.dev/).
1267
+ * Do not edit manually.
1268
+ */
1269
+
1270
+ type AppAuditControllerGetAuditLogsQueryParams = {
1271
+ /**
1272
+ * @type string | undefined
1273
+ */
1274
+ limit?: string;
1275
+ /**
1276
+ * @type string | undefined
1277
+ */
1278
+ cursor?: string;
1279
+ /**
1280
+ * @type string | undefined
1281
+ */
1282
+ action?: string;
1283
+ /**
1284
+ * @type string | undefined
1285
+ */
1286
+ actor_id?: string;
1287
+ };
1288
+
1289
+ /**
1290
+ * Generated by Kubb (https://kubb.dev/).
1291
+ * Do not edit manually.
1292
+ */
1293
+
1294
+ type M2MControllerListClientsQueryParams = {
1295
+ /**
1296
+ * @type string | undefined
1297
+ */
1298
+ limit?: string;
1299
+ /**
1300
+ * @type string | undefined
1301
+ */
1302
+ cursor?: string;
1303
+ };
1304
+
1305
+ /**
1306
+ * Generated by Kubb (https://kubb.dev/).
1307
+ * Do not edit manually.
1308
+ */
1309
+
1310
+ type RoleControllerListRolesQueryParams = {
1311
+ /**
1312
+ * @type string | undefined
1313
+ */
1314
+ limit?: string;
1315
+ /**
1316
+ * @type string | undefined
1317
+ */
1318
+ cursor?: string;
1319
+ };
1320
+
1321
+ declare class AppScope {
1322
+ /** The appId bound to this scope. */
1323
+ readonly appId: string;
1324
+ private readonly client;
1325
+ constructor(appId: string, client: Client);
1326
+ /**
1327
+ * Direct HTTP escape hatch used to call endpoints whose spec is buggy
1328
+ * — currently those whose path declares `{appId}` but whose
1329
+ * `parameters[]` omits it, so the kubb-generated code leaves the
1330
+ * URL template unfilled. Tracked upstream; remove once the spec is
1331
+ * fixed and the per-call wrappers can move back to kubb's output.
1332
+ */
1333
+ private callDirect;
1334
+ get: () => Promise<AppResponseDto>;
1335
+ update: (data: UpdateAppDto) => Promise<AppResponseDto>;
1336
+ delete: () => Promise<any>;
1337
+ updateStatus: (data: UpdateAppStatusDto) => Promise<AppResponseDto>;
1338
+ readonly authConfig: {
1339
+ get: () => Promise<AuthConfigResponseDto>;
1340
+ update: (data: UpdateAuthConfigDto) => Promise<AuthConfigResponseDto>;
1341
+ };
1342
+ readonly invites: {
1343
+ list: (params?: Partial<EndUserInviteControllerListQueryParams>) => Promise<EndUserInviteListResponseDto>;
1344
+ create: (data: CreateEndUserInviteDto) => Promise<EndUserInviteResponseDto>;
1345
+ revoke: (inviteId: string) => Promise<any>;
1346
+ };
1347
+ readonly members: {
1348
+ list: (params?: Partial<AppControllerListMembersQueryParams>) => Promise<AppMemberListResponseDto>;
1349
+ remove: (accountId: string) => Promise<any>;
1350
+ };
1351
+ readonly endUsers: {
1352
+ list: (params?: Partial<EndUserControllerListEndUsersQueryParams>) => Promise<EndUserListResponseDto>;
1353
+ get: (userId: string) => Promise<EndUserSummaryDto>;
1354
+ update: (userId: string, data: UpdateEndUserDto) => Promise<EndUserSummaryDto>;
1355
+ delete: (userId: string) => Promise<any>;
1356
+ updateRole: (userId: string, data: UpdateEndUserRoleDto) => Promise<any>;
1357
+ updateStatus: (userId: string, data: UpdateEndUserStatusDto) => Promise<EndUserSummaryDto>;
1358
+ /** Spec bug: appId missing in spec params (see callDirect). */
1359
+ revokeAllSessions: (userId: string) => Promise<void>;
1360
+ };
1361
+ readonly roles: {
1362
+ list: (params?: Partial<RoleControllerListRolesQueryParams>) => Promise<RoleListResponseDto>;
1363
+ /** Spec bug: appId missing in spec params (see callDirect). */
1364
+ get: (roleName: string) => Promise<unknown>;
1365
+ create: (data: CreateRoleDto) => Promise<RoleResponseDto>;
1366
+ /** Spec bug: appId missing in spec params (see callDirect). */
1367
+ update: (roleName: string, data: UpdateRoleDto) => Promise<unknown>;
1368
+ /** Spec bug: appId missing in spec params (see callDirect). */
1369
+ delete: (roleName: string) => Promise<void>;
1370
+ assign: (data: AssignRoleDto) => Promise<AppMembershipResponseDto>;
1371
+ setPermissions: (roleName: string, data: SetPermissionsDto) => Promise<any>;
1372
+ listPermissions: () => Promise<RoleControllerListPermissions200>;
1373
+ };
1374
+ readonly permissions: {
1375
+ list: () => Promise<PermissionControllerListPermissions200>;
1376
+ create: (data: CreatePermissionDto) => Promise<PermissionDto>;
1377
+ delete: (permissionKey: string) => Promise<any>;
1378
+ };
1379
+ readonly apiKeys: {
1380
+ list: () => Promise<ApiKeyListResponseDto>;
1381
+ create: (data: CreateApiKeyDto) => Promise<CreateApiKeyResponseDto>;
1382
+ delete: (keyId: string) => Promise<any>;
1383
+ };
1384
+ readonly credentials: {
1385
+ list: (params?: Partial<M2MControllerListClientsQueryParams>) => Promise<M2MClientListResponseDto>;
1386
+ create: (data: CreateM2MClientDto) => Promise<M2MClientCreateResponseDto>;
1387
+ get: (clientId: string) => Promise<M2MClientDetailResponseDto>;
1388
+ update: (clientId: string, data: UpdateM2MClientDto) => Promise<any>;
1389
+ delete: (clientId: string) => Promise<any>;
1390
+ rotateSecret: (clientId: string) => Promise<M2MRotateSecretResponseDto>;
1391
+ setScopes: (clientId: string, data: SetScopesDto) => Promise<any>;
1392
+ };
1393
+ readonly auditLogs: {
1394
+ list: (params?: Partial<AppAuditControllerGetAuditLogsQueryParams>) => Promise<AuditLogListResponseDto>;
1395
+ };
1396
+ }
1397
+
1398
+ /**
1399
+ * Generated by Kubb (https://kubb.dev/).
1400
+ * Do not edit manually.
1401
+ */
1402
+ type OAuthTokenResponseDto = {
1403
+ /**
1404
+ * @description Access token (RS256 JWT signed with the app JWKS key).
1405
+ * @type string
1406
+ */
1407
+ access_token: string;
1408
+ /**
1409
+ * @description Access-token lifetime in seconds.
1410
+ * @type number
1411
+ */
1412
+ expires_in: number;
1413
+ /**
1414
+ * @description Space-separated scopes, RFC 6749.
1415
+ * @type string
1416
+ */
1417
+ scope: string;
1418
+ /**
1419
+ * @type string
1420
+ */
1421
+ token_type: string;
1422
+ };
1423
+
1424
+ /**
1425
+ * Generated by Kubb (https://kubb.dev/).
1426
+ * Do not edit manually.
1427
+ */
1428
+ type AuthorizeBatchResultDto = {
1429
+ /**
1430
+ * @type boolean
1431
+ */
1432
+ authorized: boolean;
1433
+ /**
1434
+ * @description Caller-supplied id from the corresponding check entry. Echoed back so callers can correlate results to inputs without relying on array order.
1435
+ * @type string | undefined
1436
+ */
1437
+ id?: string;
1438
+ /**
1439
+ * @type array
1440
+ */
1441
+ missing_permissions: string[];
1442
+ };
1443
+
1444
+ /**
1445
+ * Generated by Kubb (https://kubb.dev/).
1446
+ * Do not edit manually.
1447
+ */
1448
+
1449
+ type AuthorizeBatchResponseDto = {
1450
+ /**
1451
+ * @type array
1452
+ */
1453
+ results: AuthorizeBatchResultDto[];
1454
+ };
1455
+
1456
+ /**
1457
+ * Generated by Kubb (https://kubb.dev/).
1458
+ * Do not edit manually.
1459
+ */
1460
+ type AuthorizeResponseDto = {
1461
+ /**
1462
+ * @type boolean
1463
+ */
1464
+ authorized: boolean;
1465
+ /**
1466
+ * @description Failure code on `authorized: false`.
1467
+ * @type string | undefined
1468
+ */
1469
+ error?: string;
1470
+ /**
1471
+ * @description Permissions the token does not hold.
1472
+ * @type array | undefined
1473
+ */
1474
+ missing_permissions?: string[];
1475
+ };
1476
+
1477
+ /**
1478
+ * Generated by Kubb (https://kubb.dev/).
1479
+ * Do not edit manually.
1480
+ */
1481
+ type VerifyPrincipalDto = {
1482
+ /**
1483
+ * @description App UUID this token is bound to.
1484
+ * @type string
1485
+ */
1486
+ aid: string;
1487
+ /**
1488
+ * @description Permission claim — only set on M2M tokens.
1489
+ * @type array | undefined
1490
+ */
1491
+ permissions?: string[];
1492
+ /**
1493
+ * @description App-level role name when EndUser.
1494
+ * @type string | undefined
1495
+ */
1496
+ role?: string;
1497
+ /**
1498
+ * @description Subject — EndUser account id or M2M client id.
1499
+ * @type string
1500
+ */
1501
+ sub: string;
1502
+ /**
1503
+ * @description Principal type, e.g. `end_user` or `m2m`.
1504
+ * @type string
1505
+ */
1506
+ type: string;
1507
+ };
1508
+
1509
+ /**
1510
+ * Generated by Kubb (https://kubb.dev/).
1511
+ * Do not edit manually.
1512
+ */
1513
+
1514
+ type VerifyResponseDto = {
1515
+ /**
1516
+ * @description Failure code on `valid: false` — e.g. `TOKEN_INVALID`, `TOKEN_EXPIRED`, `TOKEN_REVOKED`, `ACCOUNT_SUSPENDED`.
1517
+ * @type string | undefined
1518
+ */
1519
+ error?: string;
1520
+ /**
1521
+ * @type object | undefined
1522
+ */
1523
+ principal?: VerifyPrincipalDto;
1524
+ /**
1525
+ * @description True iff the signature, issuer, audience, and session are all valid.
1526
+ * @type boolean
1527
+ */
1528
+ valid: boolean;
1529
+ };
1530
+
1531
+ /**
1532
+ * Generated by Kubb (https://kubb.dev/).
1533
+ * Do not edit manually.
1534
+ */
1535
+ type ConsumerMfaChallengeFactorDto = {
1536
+ /**
1537
+ * @type string
1538
+ */
1539
+ id: string;
1540
+ /**
1541
+ * @type string
1542
+ */
1543
+ label: string | null;
1544
+ /**
1545
+ * @description Factor type — currently `totp`; widens as new factor types ship.
1546
+ * @type string
1547
+ */
1548
+ type: string;
1549
+ };
1550
+
1551
+ /**
1552
+ * Generated by Kubb (https://kubb.dev/).
1553
+ * Do not edit manually.
1554
+ */
1555
+
1556
+ type ConsumerMfaChallengeResponseDto = {
1557
+ /**
1558
+ * @description When the challenge expires (ISO 8601, UTC).
1559
+ * @type string, date-time
1560
+ */
1561
+ expires_at: string;
1562
+ /**
1563
+ * @description Factors the user can satisfy this challenge with (any-of).
1564
+ * @type array
1565
+ */
1566
+ factors: ConsumerMfaChallengeFactorDto[];
1567
+ /**
1568
+ * @description Always `true` on this response. Distinguishes it from the normal token response shape.
1569
+ * @type boolean
1570
+ */
1571
+ mfa_required: boolean;
1572
+ /**
1573
+ * @description Single-use challenge id. Pass back as `mfa_token` on `/auth/mfa/verify` or `/auth/mfa/recover` to complete the sign-in. 5-minute TTL.
1574
+ * @type string
1575
+ */
1576
+ mfa_token: string;
1577
+ };
1578
+
1579
+ /**
1580
+ * Generated by Kubb (https://kubb.dev/).
1581
+ * Do not edit manually.
1582
+ */
1583
+ type ConsumerSigninDto = {
1584
+ /**
1585
+ * @description Username or verified primary email — either accepted. Secondary or unverified emails do not authenticate.
1586
+ * @type string
1587
+ */
1588
+ identifier: string;
1589
+ /**
1590
+ * @description EndUser password.
1591
+ * @type string
1592
+ */
1593
+ password: string;
1594
+ /**
1595
+ * @description Optional tenant UUID. When set, the issued JWT carries `tid` + `trole` claims and the user must already be a member of that tenant — non-membership returns 403.
1596
+ * @type string | undefined
1597
+ */
1598
+ tenant_id?: string;
1599
+ };
1600
+
1601
+ /**
1602
+ * Generated by Kubb (https://kubb.dev/).
1603
+ * Do not edit manually.
1604
+ */
1605
+ type ConsumerTokenResponseDto = {
1606
+ /**
1607
+ * @description Short-lived JWT signed with the app-scoped JWKS key. Carries sub, role, permissions[], type=end_user.
1608
+ * @type string
1609
+ */
1610
+ access_token: string;
1611
+ /**
1612
+ * @description Access-token lifetime in seconds.
1613
+ * @type number
1614
+ */
1615
+ expires_in: number;
1616
+ /**
1617
+ * @description Long-lived opaque-ish JWT used to mint a new access token via /auth/refresh. Rotated on use.
1618
+ * @type string
1619
+ */
1620
+ refresh_token: string;
1621
+ /**
1622
+ * @type string
1623
+ */
1624
+ token_type: string;
1625
+ };
1626
+
1627
+ /**
1628
+ * Generated by Kubb (https://kubb.dev/).
1629
+ * Do not edit manually.
1630
+ */
1631
+
1632
+ /**
1633
+ * @description Either a normal token response or an MFA challenge — distinguish by `mfa_required`.
1634
+ */
1635
+ type ConsumerAuthControllerSignin200 = ConsumerTokenResponseDto | ConsumerMfaChallengeResponseDto;
1636
+
1637
+ /**
1638
+ * Generated by Kubb (https://kubb.dev/).
1639
+ * Do not edit manually.
1640
+ */
1641
+ type ConsumerSignupDto = {
1642
+ /**
1643
+ * @description Optional display name shown back to the user.
1644
+ * @type string | undefined
1645
+ */
1646
+ display_name?: string;
1647
+ /**
1648
+ * @description EndUser email address. Becomes the primary email contact and the default verification target.
1649
+ * @type string
1650
+ */
1651
+ email: string;
1652
+ /**
1653
+ * @description Password. Must satisfy the app-configured policy (default: 8+ chars).
1654
+ * @type string
1655
+ */
1656
+ password: string;
1657
+ /**
1658
+ * @description Unique username inside the app. 3+ chars.
1659
+ * @type string
1660
+ */
1661
+ username: string;
1662
+ };
1663
+
1664
+ /**
1665
+ * Generated by Kubb (https://kubb.dev/).
1666
+ * Do not edit manually.
1667
+ */
1668
+ type ConsumerRefreshDto = {
1669
+ /**
1670
+ * @description Refresh token returned from signin/signup/previous refresh. Each refresh rotates the token; the previous one is revoked.
1671
+ * @type string
1672
+ */
1673
+ refresh_token: string;
1674
+ };
1675
+
1676
+ /**
1677
+ * Generated by Kubb (https://kubb.dev/).
1678
+ * Do not edit manually.
1679
+ */
1680
+ type ConsumerLogoutDto = {
1681
+ /**
1682
+ * @description Refresh token to revoke. The matching session is destroyed; the access token continues to verify until its TTL expires.
1683
+ * @type string
1684
+ */
1685
+ refresh_token: string;
1686
+ };
1687
+
1688
+ /**
1689
+ * Generated by Kubb (https://kubb.dev/).
1690
+ * Do not edit manually.
1691
+ */
1692
+ type ConsumerRequestPasswordResetDto = {
1693
+ /**
1694
+ * @description Email contact value to target. Set this OR `phone`, not both.
1695
+ * @type string | undefined
1696
+ */
1697
+ email?: string;
1698
+ /**
1699
+ * @description Phone contact value (any format the customer normalised; recommended E.164). Set this OR `email`, not both.
1700
+ * @type string | undefined
1701
+ */
1702
+ phone?: string;
1703
+ };
1704
+
1705
+ /**
1706
+ * Generated by Kubb (https://kubb.dev/).
1707
+ * Do not edit manually.
1708
+ */
1709
+ type ConsumerResetPasswordDto = {
1710
+ /**
1711
+ * @description 6-digit numeric code from the password-reset message.
1712
+ * @type string
1713
+ */
1714
+ code: string;
1715
+ /**
1716
+ * @description New password. Must satisfy the app-configured policy.
1717
+ * @type string
1718
+ */
1719
+ new_password: string;
1720
+ };
1721
+
1722
+ /**
1723
+ * Generated by Kubb (https://kubb.dev/).
1724
+ * Do not edit manually.
1725
+ */
1726
+ type ConsumerRequestVerificationDto = {
1727
+ /**
1728
+ * @description Email contact value to target. Set this OR `phone`, not both.
1729
+ * @type string | undefined
1730
+ */
1731
+ email?: string;
1732
+ /**
1733
+ * @description Phone contact value (any format the customer normalised; recommended E.164). Set this OR `email`, not both.
1734
+ * @type string | undefined
1735
+ */
1736
+ phone?: string;
1737
+ };
1738
+
1739
+ /**
1740
+ * Generated by Kubb (https://kubb.dev/).
1741
+ * Do not edit manually.
1742
+ */
1743
+ type ConsumerSendVerificationEmailDto = {
1744
+ /**
1745
+ * @description Email contact value to send the verification code to.
1746
+ * @type string
1747
+ */
1748
+ email: string;
1749
+ };
1750
+
1751
+ /**
1752
+ * Generated by Kubb (https://kubb.dev/).
1753
+ * Do not edit manually.
1754
+ */
1755
+ type ConsumerVerifyDto = {
1756
+ /**
1757
+ * @description 6-digit numeric verification code. The server resolves which contact the code is for from the code value itself.
1758
+ * @type string
1759
+ */
1760
+ code: string;
1761
+ };
1762
+
1763
+ /**
1764
+ * Generated by Kubb (https://kubb.dev/).
1765
+ * Do not edit manually.
1766
+ */
1767
+ type ConsumerAcceptInviteDto = {
1768
+ /**
1769
+ * @description Invite code from the invitation email (`inv_…`).
1770
+ * @type string
1771
+ */
1772
+ code: string;
1773
+ /**
1774
+ * @description Optional display name shown back to the user.
1775
+ * @type string | undefined
1776
+ */
1777
+ display_name?: string;
1778
+ /**
1779
+ * @description Password the accepter sets for their new account.
1780
+ * @type string
1781
+ */
1782
+ password: string;
1783
+ /**
1784
+ * @description Optional username override. Defaults to a derivation of the invite email local-part.
1785
+ * @type string | undefined
1786
+ */
1787
+ username?: string;
1788
+ };
1789
+
1790
+ /**
1791
+ * Generated by Kubb (https://kubb.dev/).
1792
+ * Do not edit manually.
1793
+ */
1794
+ type ConsumerVerifyResponseDto = {
1795
+ /**
1796
+ * @description EndUser account id whose contact was verified.
1797
+ * @type string
1798
+ */
1799
+ account_id: string;
1800
+ /**
1801
+ * @description Account_contact id that just flipped to verified.
1802
+ * @type string
1803
+ */
1804
+ contact_id: string;
1805
+ /**
1806
+ * @description Contact type: `email` or `phone`.
1807
+ * @type string
1808
+ */
1809
+ type: string;
1810
+ /**
1811
+ * @description Normalised contact value.
1812
+ * @type string
1813
+ */
1814
+ value: string;
1815
+ /**
1816
+ * @description Verification timestamp, ISO 8601.
1817
+ * @type string
1818
+ */
1819
+ verified_at: string;
1820
+ };
1821
+
1822
+ /**
1823
+ * Generated by Kubb (https://kubb.dev/).
1824
+ * Do not edit manually.
1825
+ */
1826
+ type ConsumerCodeIssueResponseDto = {
1827
+ /**
1828
+ * @description Plaintext 6-digit code. Returned when the contact matches an EndUser in this app and the precondition is satisfied (contact unverified, for verification; contact verified, for reset). Otherwise the response is `{}` (no code) — same shape on both branches to prevent enumeration.
1829
+ * @type string
1830
+ */
1831
+ code: string;
1832
+ /**
1833
+ * @description Code expiry, ISO 8601. Codes live for 10 minutes.
1834
+ * @type string
1835
+ */
1836
+ expires_at: string;
1837
+ };
1838
+
1839
+ /**
1840
+ * Generated by Kubb (https://kubb.dev/).
1841
+ * Do not edit manually.
1842
+ */
1843
+ type ConsumerCodeDispatchResponseDto = {
1844
+ /**
1845
+ * @description Code expiry, ISO 8601. The plaintext code is NOT returned — Mail has dispatched it.
1846
+ * @type string
1847
+ */
1848
+ expires_at: string;
1849
+ };
1850
+
1851
+ /**
1852
+ * Generated by Kubb (https://kubb.dev/).
1853
+ * Do not edit manually.
1854
+ */
1855
+ type UpdateMeDto = {
1856
+ /**
1857
+ * @description New display name. Pass an empty string to clear it; omit to leave unchanged.
1858
+ * @minLength 0
1859
+ * @maxLength 120
1860
+ * @type string | undefined
1861
+ */
1862
+ display_name?: string;
1863
+ };
1864
+
1865
+ /**
1866
+ * Generated by Kubb (https://kubb.dev/).
1867
+ * Do not edit manually.
1868
+ */
1869
+ type VerifyBody = {
1870
+ /**
1871
+ * @description EndUser or M2M JWT to verify against the app JWKS. Optional — if omitted, the token is read from the `Authorization: Bearer <jwt>` header instead.
1872
+ * @type string | undefined
1873
+ */
1874
+ token?: string;
1875
+ };
1876
+
1877
+ /**
1878
+ * Generated by Kubb (https://kubb.dev/).
1879
+ * Do not edit manually.
1880
+ */
1881
+ type AuthorizeBody = {
1882
+ /**
1883
+ * @description Single permission to check, e.g. \'user.read\'. Use this OR `permissions`.
1884
+ * @type string | undefined
1885
+ */
1886
+ permission?: string;
1887
+ /**
1888
+ * @description Multiple permissions; the token must hold ALL of them.
1889
+ * @type array | undefined
1890
+ */
1891
+ permissions?: string[];
1892
+ /**
1893
+ * @description JWT to verify and authorize. Optional — if omitted, the token is read from the `Authorization: Bearer <jwt>` header.
1894
+ * @type string | undefined
1895
+ */
1896
+ token?: string;
1897
+ };
1898
+
1899
+ /**
1900
+ * Generated by Kubb (https://kubb.dev/).
1901
+ * Do not edit manually.
1902
+ */
1903
+ type AuthorizeBatchEntry = {
1904
+ /**
1905
+ * @description Caller-chosen correlation id for this check. Echoed back on the matching result so the caller can map results to inputs without relying on array order.
1906
+ * @type string | undefined
1907
+ */
1908
+ id?: string;
1909
+ /**
1910
+ * @description Single permission to check, e.g. \'invoice.read\'. Use this OR `permissions`.
1911
+ * @type string | undefined
1912
+ */
1913
+ permission?: string;
1914
+ /**
1915
+ * @description Multiple permissions; ALL must be held for this check to pass.
1916
+ * @type array | undefined
1917
+ */
1918
+ permissions?: string[];
1919
+ };
1920
+
1921
+ /**
1922
+ * Generated by Kubb (https://kubb.dev/).
1923
+ * Do not edit manually.
1924
+ */
1925
+
1926
+ type AuthorizeBatchBody = {
1927
+ /**
1928
+ * @description List of checks. Each returns { id?, authorized, missing_permissions }.
1929
+ * @type array
1930
+ */
1931
+ checks: AuthorizeBatchEntry[];
1932
+ /**
1933
+ * @description JWT to verify and authorize against each check. Optional — if omitted, the token is read from the `Authorization: Bearer <jwt>` header.
1934
+ * @type string | undefined
1935
+ */
1936
+ token?: string;
1937
+ };
1938
+
1939
+ /**
1940
+ * Generated by Kubb (https://kubb.dev/).
1941
+ * Do not edit manually.
1942
+ */
1943
+ type ClientCredentialsDto = {
1944
+ /**
1945
+ * @description M2M client identifier (m2m_*).
1946
+ * @type string
1947
+ */
1948
+ client_id: string;
1949
+ /**
1950
+ * @description M2M client secret (issued at client creation, never returned again).
1951
+ * @type string
1952
+ */
1953
+ client_secret: string;
1954
+ /**
1955
+ * @description OAuth grant type. Only \'client_credentials\' is supported.
1956
+ * @type string
1957
+ */
1958
+ grant_type: string;
1959
+ };
1960
+
1961
+ /**
1962
+ * Generated by Kubb (https://kubb.dev/).
1963
+ * Do not edit manually.
1964
+ */
1965
+ type IdpNativeUserHintDto = {
1966
+ /**
1967
+ * @type string | undefined
1968
+ */
1969
+ email?: string;
1970
+ /**
1971
+ * @type string | undefined
1972
+ */
1973
+ name?: string;
1974
+ };
1975
+
1976
+ /**
1977
+ * Generated by Kubb (https://kubb.dev/).
1978
+ * Do not edit manually.
1979
+ */
1980
+
1981
+ type IdpNativeSigninDto = {
1982
+ /**
1983
+ * @description Provider-issued ID token (JWT). For Apple, the value returned by `ASAuthorizationAppleIDCredential.identityToken` after UTF-8 decoding the data.
1984
+ * @minLength 16
1985
+ * @maxLength 8192
1986
+ * @type string
1987
+ */
1988
+ id_token: string;
1989
+ /**
1990
+ * @description Raw nonce the client generated and SHA-256-hashed into the authorize request. Backend recomputes the hash and compares to the token\'s `nonce` claim. Must be at least 32 bytes of entropy (base64url-encoded ~43 chars).
1991
+ * @minLength 16
1992
+ * @maxLength 256
1993
+ * @type string
1994
+ */
1995
+ nonce: string;
1996
+ /**
1997
+ * @description Apple-specific first-signin payload: { name, email }. Persist for display only — the verified JWT is the source of truth.
1998
+ */
1999
+ user?: IdpNativeUserHintDto;
2000
+ };
2001
+
2002
+ /**
2003
+ * Generated by Kubb (https://kubb.dev/).
2004
+ * Do not edit manually.
2005
+ */
2006
+ declare const idpTokenResponseDtoTokenTypeEnum: {
2007
+ readonly Bearer: "Bearer";
2008
+ };
2009
+ type IdpTokenResponseDtoTokenTypeEnumKey = (typeof idpTokenResponseDtoTokenTypeEnum)[keyof typeof idpTokenResponseDtoTokenTypeEnum];
2010
+ type IdpTokenResponseDto = {
2011
+ /**
2012
+ * @type string
2013
+ */
2014
+ access_token: string;
2015
+ /**
2016
+ * @description Lifetime of the access token in seconds.
2017
+ * @type number
2018
+ */
2019
+ expires_in: number;
2020
+ /**
2021
+ * @type string
2022
+ */
2023
+ refresh_token: string;
2024
+ /**
2025
+ * @type string
2026
+ */
2027
+ token_type: IdpTokenResponseDtoTokenTypeEnumKey;
2028
+ };
2029
+
2030
+ /**
2031
+ * Generated by Kubb (https://kubb.dev/).
2032
+ * Do not edit manually.
2033
+ */
2034
+
2035
+ declare const consumerIdpControllerNativeSignInPathParamsProviderEnum: {
2036
+ readonly apple: "apple";
2037
+ readonly google: "google";
2038
+ readonly github: "github";
2039
+ };
2040
+ type ConsumerIdpControllerNativeSignInPathParamsProviderEnumKey = (typeof consumerIdpControllerNativeSignInPathParamsProviderEnum)[keyof typeof consumerIdpControllerNativeSignInPathParamsProviderEnum];
2041
+
2042
+ /**
2043
+ * In-process JWKS cache for a single app's `/.well-known/jwks.json`.
2044
+ *
2045
+ * Thin wrapper over `jose.createRemoteJWKSet`, which already gives us:
2046
+ * - TTL-based cache (cacheMaxAge)
2047
+ * - Cooldown between failed fetches (cooldownDuration)
2048
+ * - Singleflight (concurrent verifies share one inflight fetch)
2049
+ * - Auto-refetch when the token's `kid` isn't in the cached JWKS
2050
+ * (rotation handling)
2051
+ *
2052
+ * We add:
2053
+ * - Translation of jose's internal `JWKSNoMatchingKey` /
2054
+ * `JWKSTimeout` / etc. errors into our typed `JwksKeyNotFoundError`
2055
+ * / `JwksFetchError`.
2056
+ * - A `refresh()` method for explicit cache busting (rare, but useful
2057
+ * for tests + manual rotation drills).
2058
+ *
2059
+ * Instances are returned by `ConsumerScope.jwks` and are jose-compatible
2060
+ * out of the box — `jose.jwtVerify(token, scope.jwks.getKey, ...)` works.
2061
+ */
2062
+
2063
+ interface JwksCacheOptions {
2064
+ url: URL;
2065
+ /** Cache lifetime in ms. Default 10 minutes — same as jose's default. */
2066
+ ttlMs?: number;
2067
+ /** Min ms between failed fetches. Default 30 seconds. */
2068
+ cooldownMs?: number;
2069
+ /** Network timeout per fetch. Default 5 seconds. */
2070
+ timeoutMs?: number;
2071
+ /** Pin a custom fetch implementation (e.g. undici with retry, mock fetch in tests). */
2072
+ fetch?: typeof fetch;
2073
+ }
2074
+ type AuthGetKeyFn = (protectedHeader?: JWTHeaderParameters, token?: FlattenedJWSInput) => Promise<CryptoKey>;
2075
+ declare class JwksCache {
2076
+ readonly url: URL;
2077
+ private readonly _jose;
2078
+ constructor(options: JwksCacheOptions);
2079
+ /**
2080
+ * Resolve a signing key for a given JWT header.
2081
+ * Bound as an arrow-function field so it can be passed around
2082
+ * (`jose.jwtVerify(token, cache.getKey, ...)`, passport-jwt, etc.)
2083
+ * without losing `this`.
2084
+ */
2085
+ readonly getKey: AuthGetKeyFn;
2086
+ /**
2087
+ * Force a refetch on the next verify. Useful in tests and for
2088
+ * external rotation drills — the normal flow self-heals because
2089
+ * jose auto-refetches on kid miss.
2090
+ */
2091
+ refresh(): void;
2092
+ }
2093
+
2094
+ /**
2095
+ * `verifyAuthToken` — the 80%-case verify helper.
2096
+ *
2097
+ * Wraps `jose.jwtVerify` with:
2098
+ * - Sensible defaults (algorithm allow-list, clockTolerance)
2099
+ * - Typed claim payload (`AuthClaims`)
2100
+ * - Translation of jose errors into our typed error hierarchy
2101
+ */
2102
+
2103
+ /**
2104
+ * Claims that an Auth-issued EndUser access token is expected to
2105
+ * carry. Unknown claims pass through as `string | number | unknown`
2106
+ * (jose's `JWTPayload` is open-ended) — callers can intersect with
2107
+ * their own custom-claim type if they've configured Auth to add
2108
+ * extras.
2109
+ */
2110
+ interface AuthClaims extends JWTPayload {
2111
+ /** EndUser id. */
2112
+ sub: string;
2113
+ /** App slug the token was issued for. */
2114
+ iss: string;
2115
+ /** Audience — usually the app slug or oauth client_id. */
2116
+ aud?: string | string[];
2117
+ /** Standard exp/iat/nbf. */
2118
+ exp: number;
2119
+ iat: number;
2120
+ nbf?: number;
2121
+ /** JWT id — present on refreshable tokens. */
2122
+ jti?: string;
2123
+ /** Role assigned by Auth, if any. */
2124
+ role?: string;
2125
+ /** Permission keys the EndUser is authorized for. */
2126
+ permissions?: string[];
2127
+ /** Email on the EndUser profile, when claimed. */
2128
+ email?: string;
2129
+ /** Whether the email is verified. */
2130
+ email_verified?: boolean;
2131
+ }
2132
+ interface VerifyOptions {
2133
+ /** Expected `iss` claim. Defaults to the value set on the consumer scope. */
2134
+ issuer?: string | string[];
2135
+ /** Expected `aud` claim. If unset (and unset on the scope), aud check is skipped. */
2136
+ audience?: string | string[];
2137
+ /** Allowed JWS algorithms. Default ['ES256', 'RS256', 'EdDSA']. */
2138
+ algorithms?: string[];
2139
+ /**
2140
+ * Acceptable clock skew. Number = seconds, string = jose duration
2141
+ * (`"30s"`, `"2m"`, ...). Default 5 seconds.
2142
+ */
2143
+ clockTolerance?: string | number;
2144
+ /** Additional claims that must be present (non-empty) on the token. */
2145
+ requiredClaims?: string[];
2146
+ /** Override the verify time. Default `Date.now()`. */
2147
+ currentDate?: Date;
2148
+ /** Maximum token age — passed straight to jose. */
2149
+ maxTokenAge?: string | number;
2150
+ }
2151
+ /**
2152
+ * Verify an Auth-issued JWT against a JWKS resolver.
2153
+ *
2154
+ * @param token The compact-form JWT (header.payload.signature)
2155
+ * @param getKey A jose-compatible key resolver — pass
2156
+ * `scope.jwks.getKey` from a `ConsumerScope`
2157
+ * @param opts Defaults supplied by the scope; override here
2158
+ * for one-off cases.
2159
+ */
2160
+ declare function verifyAuthToken(token: string, getKey: AuthGetKeyFn, opts?: VerifyOptions): Promise<AuthClaims>;
2161
+
2162
+ /**
2163
+ * Legacy `iss` claim Auth Consumer-API tokens used to be minted
2164
+ * with. Kept exported so consumers verifying tokens issued before the
2165
+ * 2026-05-24 per-app-issuer migration can still match `iss` while a
2166
+ * deployment cycles to fresh tokens. New tokens carry the per-app
2167
+ * issuer URL — `${baseUrl}/${appSlug}` — accessible via
2168
+ * `scope.expectedIssuer`.
2169
+ */
2170
+ declare const AUTH_LEGACY_ISSUER = "heimdall";
2171
+ interface ConsumerScopeInternals {
2172
+ client: Client;
2173
+ baseUrl: string;
2174
+ /** Custom fetch — forwarded to the JWKS cache so tests / undici / proxies work. */
2175
+ fetch?: typeof fetch;
2176
+ }
2177
+ declare class ConsumerScope {
2178
+ /** The appSlug bound to this scope. */
2179
+ readonly appSlug: string;
2180
+ /**
2181
+ * Issuer the Auth Consumer API stamps on every token for this
2182
+ * app — the public Auth API base joined with the app slug
2183
+ * (e.g. `https://api.auth.productcraft.co/acme`). Pin it in
2184
+ * your local verifier so a token minted for another app on the
2185
+ * platform cannot pass.
2186
+ *
2187
+ * `scope.verifyToken` already enforces this for you. Pass it as a
2188
+ * second-position issuer if you're wiring `jose.jwtVerify`,
2189
+ * `passport-jwt`, or PyJWT yourself.
2190
+ */
2191
+ readonly expectedIssuer: string;
2192
+ /**
2193
+ * Audience the Consumer API stamps on every token for this app —
2194
+ * literally the app slug (e.g. `"acme"`). Pin it in your verifier
2195
+ * the same way as `expectedIssuer`. `scope.verifyToken` enforces
2196
+ * it by default.
2197
+ */
2198
+ readonly expectedAudience: string;
2199
+ /**
2200
+ * Both accepted issuer strings (`expectedIssuer` + the legacy
2201
+ * `'auth'` literal). `verifyToken` passes this to jose so tokens
2202
+ * minted before the 2026-05-24 per-app-issuer migration keep
2203
+ * verifying alongside fresh ones — useful for the ~1-hour transition
2204
+ * window per access-token TTL, and the longer session TTL on
2205
+ * refresh tokens.
2206
+ */
2207
+ readonly acceptedIssuers: readonly string[];
2208
+ /** jose-compatible JWKS resolver. Drop into `jose.jwtVerify`, passport-jwt, etc. */
2209
+ readonly jwks: JwksCache;
2210
+ private readonly client;
2211
+ constructor(appSlug: string, internals: ConsumerScopeInternals, opts?: {
2212
+ jwksTtlMs?: number;
2213
+ });
2214
+ /**
2215
+ * Direct HTTP escape hatch for endpoints whose spec is buggy
2216
+ * (path declares `{appSlug}` but parameters[] omits it). Tracked
2217
+ * upstream; remove once the spec is fixed.
2218
+ */
2219
+ private callDirect;
2220
+ /**
2221
+ * Verify an Auth-issued JWT against this app's JWKS.
2222
+ *
2223
+ * Checks the signature, expiry, `iss`, and `aud`. Accepts both the
2224
+ * per-app issuer URL (`expectedIssuer`) and the legacy `'heimdall'`
2225
+ * literal during the issuer-migration transition window — callers
2226
+ * who want to refuse legacy tokens can override with
2227
+ * `{ issuer: scope.expectedIssuer }`. Audience defaults to the app
2228
+ * slug (`expectedAudience`); pass `{ audience: false }` (in an
2229
+ * options override) to skip the audience check entirely.
2230
+ */
2231
+ verifyToken(token: string, opts?: VerifyOptions): Promise<AuthClaims>;
2232
+ readonly auth: {
2233
+ signin: (data: ConsumerSigninDto) => Promise<ConsumerAuthControllerSignin200>;
2234
+ /**
2235
+ * Signup may require a Platform API Key when the app has
2236
+ * `signup_requires_pak: true`. Configure that on the Auth
2237
+ * instance (`new Auth({ auth: { type: "apiKey", key: "..." } })`)
2238
+ * — our HTTP client attaches the Authorization header automatically.
2239
+ */
2240
+ signup: (data: ConsumerSignupDto) => Promise<unknown>;
2241
+ refresh: (data: ConsumerRefreshDto) => Promise<ConsumerTokenResponseDto>;
2242
+ logout: (data: ConsumerLogoutDto) => Promise<any>;
2243
+ /**
2244
+ * PAK-required: caller must instantiate `Auth` with
2245
+ * `auth: { type: "apiKey", key: "pcft_live_..." }`. The
2246
+ * kubb-generated `headers.authorization` slot is a stub — the
2247
+ * HTTP client's auth middleware overrides whatever's passed.
2248
+ */
2249
+ requestReset: (data: ConsumerRequestPasswordResetDto) => Promise<ConsumerCodeIssueResponseDto>;
2250
+ resetPassword: (data: ConsumerResetPasswordDto) => Promise<any>;
2251
+ /**
2252
+ * Mint a 6-digit contact-verification code bound to the email or
2253
+ * phone in the body. Returns `{ code, expires_at }` for delivery
2254
+ * via the customer's own channel — or `{}` if no match / already
2255
+ * verified (uniform shape — no account enumeration).
2256
+ *
2257
+ * PAK-required: caller must instantiate `Auth` with
2258
+ * `auth: { type: "apiKey", key: "pcft_live_..." }` carrying
2259
+ * `auth.user.verify.create` narrowed to this app's URN. The
2260
+ * kubb-generated `headers.authorization` slot is a stub — the
2261
+ * HTTP client's auth middleware overrides whatever's passed.
2262
+ */
2263
+ requestVerification: (data: ConsumerRequestVerificationDto) => Promise<ConsumerCodeIssueResponseDto>;
2264
+ /**
2265
+ * Mint + dispatch a verification email via Mail in one call.
2266
+ * Returns `{ expires_at }` on success; the plaintext code is NOT
2267
+ * returned. Returns `{}` when the contact is missing or already
2268
+ * verified (same enumeration defence as `requestVerification`).
2269
+ *
2270
+ * PAK-required with `auth.user.verify.send-email` — distinct
2271
+ * permission from the bare mint so customers can enable mint
2272
+ * without enabling outbound Mail traffic. Surfaces typed 412
2273
+ * precondition errors (e.g. `ENVOI_NOT_ENABLED`) rather than the
2274
+ * silent fail-closed of a fire-and-forget mailer.
2275
+ */
2276
+ sendVerificationEmail: (data: ConsumerSendVerificationEmailDto) => Promise<ConsumerCodeDispatchResponseDto>;
2277
+ /**
2278
+ * Consume a 6-digit verification code, flipping the bound
2279
+ * contact's `verified_at`. Public — anyone holding the code can
2280
+ * submit it; that is the whole point of the flow. Server resolves
2281
+ * the contact + account from the code value itself. Returns
2282
+ * `{ account_id, email_verified_at }` on success; 410 on invalid /
2283
+ * expired / consumed code.
2284
+ */
2285
+ verify: (data: ConsumerVerifyDto) => Promise<ConsumerVerifyResponseDto>;
2286
+ /**
2287
+ * Accept an end-user invite into this app. The invite is minted by
2288
+ * an app admin (`auth.app(appId).invites.create`) and delivered
2289
+ * to the invitee out-of-band; this consumes the invite token and
2290
+ * provisions the EndUser. Public — the caller is unauthenticated
2291
+ * until the invite is accepted.
2292
+ */
2293
+ acceptInvite: (data: ConsumerAcceptInviteDto) => Promise<ConsumerTokenResponseDto>;
2294
+ /**
2295
+ * Sign in / sign up with a provider ID token (native flow).
2296
+ *
2297
+ * Submit the identity token Apple (or Google, once enabled) issued
2298
+ * to a native client (iOS `ASAuthorizationController`, Google
2299
+ * Sign-In for iOS / Android). Auth verifies the signature
2300
+ * against the provider's JWKS, pins the issuer, checks the
2301
+ * audience against the app's configured native client ids,
2302
+ * recomputes `sha256(nonce)` and compares to the token's `nonce`
2303
+ * claim, then resolves or creates the EndUser. Same response
2304
+ * shape as `auth.signin`.
2305
+ *
2306
+ * Account linking: when an EndUser already exists with a verified
2307
+ * primary email matching the token's `email` claim, the app's
2308
+ * `oauth_link_policy` decides the outcome:
2309
+ * - `confirm` (default): refuse with 409 `link_required`. UI
2310
+ * should sign the user in via their original method to bind.
2311
+ * - `auto`: silently link the identity to the existing account
2312
+ * (provider claims `email_verified: true` AND the email is
2313
+ * not an Apple private relay).
2314
+ * - `reject`: refuse with 409 `account_exists_with_different_provider`.
2315
+ *
2316
+ * Apple's private-relay emails (`*@privaterelay.appleid.com`) are
2317
+ * persisted as-is on the EndUser's primary email contact and
2318
+ * never participate in auto-link.
2319
+ *
2320
+ * Apple sends the user's display name only on the FIRST sign-in.
2321
+ * Pass it through `user.name` on that call — Auth persists it
2322
+ * to the EndUser row. Subsequent sign-ins should omit `user`.
2323
+ */
2324
+ signinWithProvider: (args: {
2325
+ provider: ConsumerIdpControllerNativeSignInPathParamsProviderEnumKey;
2326
+ id_token: IdpNativeSigninDto["id_token"];
2327
+ nonce: IdpNativeSigninDto["nonce"];
2328
+ user?: IdpNativeSigninDto["user"];
2329
+ }) => Promise<IdpTokenResponseDto>;
2330
+ };
2331
+ readonly me: {
2332
+ getProfile: () => Promise<unknown>;
2333
+ updateProfile: (data: UpdateMeDto) => Promise<unknown>;
2334
+ listSessions: (params?: Record<string, string | number>) => Promise<unknown>;
2335
+ revokeSession: (id: string) => Promise<void>;
2336
+ getActivity: (params?: Record<string, string | number>) => Promise<unknown>;
2337
+ deleteAccount: () => Promise<void>;
2338
+ };
2339
+ readonly verify: {
2340
+ /**
2341
+ * The kubb-generated client makes `headers.authorization` a required
2342
+ * arg because the server controllers accept the bearer as a fallback
2343
+ * to `body.token`. We stub an empty string here — the HTTP client's
2344
+ * auth middleware overrides whatever's passed with the configured
2345
+ * credential (`PCAuth.apiKey` / `bearer` / `cookie`).
2346
+ */
2347
+ verify: (data: VerifyBody) => Promise<VerifyResponseDto>;
2348
+ authorize: (data: AuthorizeBody) => Promise<AuthorizeResponseDto>;
2349
+ authorizeBatch: (data: AuthorizeBatchBody) => Promise<AuthorizeBatchResponseDto>;
2350
+ };
2351
+ readonly oauth: {
2352
+ clientCredentials: (data: ClientCredentialsDto) => Promise<OAuthTokenResponseDto>;
2353
+ };
2354
+ }
2355
+
2356
+ /**
2357
+ * Generated by Kubb (https://kubb.dev/).
2358
+ * Do not edit manually.
2359
+ */
2360
+ type CreateAppDto = {
2361
+ /**
2362
+ * @description Display name shown in the console.
2363
+ * @minLength 1
2364
+ * @maxLength 120
2365
+ * @type string
2366
+ */
2367
+ display_name: string;
2368
+ /**
2369
+ * @description URL-friendly app slug (lowercase letters, digits, hyphens).
2370
+ * @minLength 3
2371
+ * @maxLength 64
2372
+ * @type string
2373
+ */
2374
+ slug: string;
2375
+ /**
2376
+ * @description UUID of the platform workspace that will own the new app. The caller must hold `auth.create` on this workspace.
2377
+ * @type string
2378
+ */
2379
+ workspace_id: string;
2380
+ };
2381
+
2382
+ /**
2383
+ * Generated by Kubb (https://kubb.dev/).
2384
+ * Do not edit manually.
2385
+ */
2386
+
2387
+ type AppControllerListMyAppsQueryParams = {
2388
+ /**
2389
+ * @type string | undefined
2390
+ */
2391
+ limit?: string;
2392
+ /**
2393
+ * @type string | undefined
2394
+ */
2395
+ cursor?: string;
2396
+ /**
2397
+ * @type string | undefined
2398
+ */
2399
+ workspace_id?: string;
2400
+ };
2401
+
2402
+ /**
2403
+ * Generated by Kubb (https://kubb.dev/).
2404
+ * Do not edit manually.
2405
+ */
2406
+
2407
+ type StatsControllerGetMyStatsQueryParams = {
2408
+ /**
2409
+ * @type string | undefined
2410
+ */
2411
+ workspace_id?: string;
2412
+ };
2413
+
2414
+ /**
2415
+ * Typed error hierarchy for JWT verification. All errors inherit from
2416
+ * `JwtVerifyError` so callers can do one `instanceof` to catch any
2417
+ * verify failure, or branch on more specific subclasses for UX.
2418
+ */
2419
+ declare class JwtVerifyError extends Error {
2420
+ readonly code: string;
2421
+ constructor(code: string, message: string, options?: {
2422
+ cause?: unknown;
2423
+ });
2424
+ }
2425
+ /** Signature didn't match, header malformed, or token structure invalid. */
2426
+ declare class JwtInvalidError extends JwtVerifyError {
2427
+ constructor(message: string, options?: {
2428
+ cause?: unknown;
2429
+ });
2430
+ }
2431
+ /** Token's `exp` claim is in the past (allowing for clockTolerance). */
2432
+ declare class JwtExpiredError extends JwtVerifyError {
2433
+ readonly expiredAt?: Date;
2434
+ constructor(message: string, expiredAt?: Date, options?: {
2435
+ cause?: unknown;
2436
+ });
2437
+ }
2438
+ /** Token's `nbf` is in the future. */
2439
+ declare class JwtNotYetValidError extends JwtVerifyError {
2440
+ constructor(message: string, options?: {
2441
+ cause?: unknown;
2442
+ });
2443
+ }
2444
+ /** `iss` claim doesn't match the expected issuer. */
2445
+ declare class JwtIssuerMismatchError extends JwtVerifyError {
2446
+ constructor(message: string, options?: {
2447
+ cause?: unknown;
2448
+ });
2449
+ }
2450
+ /** `aud` claim doesn't match the expected audience. */
2451
+ declare class JwtAudienceMismatchError extends JwtVerifyError {
2452
+ constructor(message: string, options?: {
2453
+ cause?: unknown;
2454
+ });
2455
+ }
2456
+ /** The token's `kid` isn't in the JWKS (even after a forced refetch). */
2457
+ declare class JwksKeyNotFoundError extends JwtVerifyError {
2458
+ readonly kid: string | undefined;
2459
+ constructor(kid: string | undefined, options?: {
2460
+ cause?: unknown;
2461
+ });
2462
+ }
2463
+ /** Network / non-2xx fetching the JWKS endpoint. */
2464
+ declare class JwksFetchError extends JwtVerifyError {
2465
+ constructor(message: string, options?: {
2466
+ cause?: unknown;
2467
+ });
2468
+ }
2469
+
2470
+ interface AuthConfig extends PCClientConfig {
2471
+ /** Per-app JWKS cache lifetime in ms. Default 10 minutes. */
2472
+ jwksTtlMs?: number;
2473
+ }
2474
+ declare class Auth {
2475
+ private readonly client;
2476
+ private readonly baseUrl;
2477
+ private readonly fetch;
2478
+ private readonly jwtConfig;
2479
+ constructor(config?: AuthConfig);
2480
+ /**
2481
+ * Returns an `AppScope` bound to the given appId. All operations under
2482
+ * `/v1/apps/{appId}/...` are exposed as resource namespaces on the
2483
+ * returned object.
2484
+ */
2485
+ app(appId: string): AppScope;
2486
+ /**
2487
+ * Returns a `ConsumerScope` bound to the given appSlug. Exposes the
2488
+ * `/{appSlug}/v1/...` surface (sign-in, sign-up, me, verify, oauth)
2489
+ * and the JWT-verify helper for tokens issued by this app.
2490
+ */
2491
+ consumer(appSlug: string): ConsumerScope;
2492
+ readonly apps: {
2493
+ /** List apps the caller's workspace can see. */
2494
+ list: (params?: Partial<AppControllerListMyAppsQueryParams>) => Promise<AppListResponseDto>;
2495
+ /** Create a new app under the caller's workspace. */
2496
+ create: (data: CreateAppDto) => Promise<AppResponseDto>;
2497
+ };
2498
+ readonly stats: {
2499
+ /**
2500
+ * Get the signed-in PlatformUser's aggregate counts. Pass
2501
+ * `workspaceId` to scope to a single workspace; omit to total
2502
+ * across every workspace the caller belongs to.
2503
+ */
2504
+ get: (params?: Partial<StatsControllerGetMyStatsQueryParams>) => Promise<PlatformUserStatsResponseDto>;
2505
+ };
2506
+ }
2507
+
2508
+ export { AUTH_LEGACY_ISSUER, AppScope, type AssignRoleDto, Auth, type AuthClaims, type AuthConfig, AuthHttpError, type AuthorizeBatchBody, type AuthorizeBody, type ClientCredentialsDto, type ConsumerAcceptInviteDto, type ConsumerLogoutDto, type ConsumerRefreshDto, type ConsumerRequestPasswordResetDto, type ConsumerResetPasswordDto, ConsumerScope, type ConsumerSigninDto, type ConsumerSignupDto, type ConsumerTokenResponseDto, type CreateApiKeyDto, type CreateAppDto, type CreateEndUserInviteDto, type CreateM2MClientDto, type CreatePermissionDto, type CreateRoleDto, type EndUserInviteResponseDto, type IdpNativeSigninDto, type IdpNativeUserHintDto, type IdpTokenResponseDto, JwksCache, JwksFetchError, JwksKeyNotFoundError, JwtAudienceMismatchError, JwtExpiredError, JwtInvalidError, JwtIssuerMismatchError, JwtNotYetValidError, JwtVerifyError, type SetPermissionsDto, type SetScopesDto, type UpdateAppDto, type UpdateAppStatusDto, type UpdateAuthConfigDto, type UpdateEndUserDto, type UpdateEndUserRoleDto, type UpdateEndUserStatusDto, type UpdateM2MClientDto, type UpdateMeDto, type UpdateRoleDto, type VerifyBody, type VerifyOptions, verifyAuthToken };