@witnium-tech/witniumchain 0.11.0 → 0.12.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.
package/dist/index.d.mts CHANGED
@@ -73,8 +73,8 @@ interface paths$1 {
73
73
  };
74
74
  };
75
75
  responses: {
76
- /** @description Success */
77
- 200: {
76
+ /** @description Created */
77
+ 201: {
78
78
  headers: {
79
79
  [name: string]: unknown;
80
80
  };
@@ -264,8 +264,8 @@ interface paths$1 {
264
264
  };
265
265
  requestBody?: never;
266
266
  responses: {
267
- /** @description Success */
268
- 200: {
267
+ /** @description Created */
268
+ 201: {
269
269
  headers: {
270
270
  [name: string]: unknown;
271
271
  };
@@ -323,7 +323,7 @@ interface paths$1 {
323
323
  put?: never;
324
324
  /**
325
325
  * Log in with email + password
326
- * @description On success, sets a `wac_session` cookie (httpOnly, secure, SameSite=Lax, 30-day TTL) and returns a 200. No token is included in the body.
326
+ * @description Without confirmed TOTP: sets a `wac_session` cookie (httpOnly, secure, 30-day TTL) and returns `status: "authenticated"`. With confirmed TOTP: NO session is issued. The response is `status: "mfa_required"` and sets a `wac_mfa` challenge cookie (httpOnly, secure, Path=/v1/auth/login/mfa, 5 minutes); complete the login with `POST /v1/auth/login/mfa`. No token is included in the body.
327
327
  */
328
328
  post: {
329
329
  parameters: {
@@ -347,14 +347,163 @@ interface paths$1 {
347
347
  };
348
348
  };
349
349
  responses: {
350
- /** @description Success */
351
- 200: {
350
+ /** @description Created */
351
+ 201: {
352
+ headers: {
353
+ [name: string]: unknown;
354
+ };
355
+ content: {
356
+ "application/json": {
357
+ /**
358
+ * @description `authenticated`: the `wac_session` cookie is set. `mfa_required`: no session yet; send the second factor to `/v1/auth/login/mfa`.
359
+ * @enum {string}
360
+ */
361
+ status: "authenticated" | "mfa_required";
362
+ message: string;
363
+ /** @description Present when `status` is `mfa_required`. */
364
+ methods?: ("totp" | "recovery_code")[];
365
+ /** @description Challenge lifetime; present when `status` is `mfa_required`. */
366
+ expiresInSeconds?: number;
367
+ };
368
+ };
369
+ };
370
+ /** @description Bad Request — validation failed */
371
+ 400: {
372
+ headers: {
373
+ [name: string]: unknown;
374
+ };
375
+ content: {
376
+ "application/json": {
377
+ /**
378
+ * @description HTTP status code
379
+ * @example 400
380
+ */
381
+ statusCode?: number;
382
+ /**
383
+ * @description Short error label
384
+ * @example Bad Request
385
+ */
386
+ error?: string;
387
+ /**
388
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
389
+ * @example Validation failed
390
+ */
391
+ message: string | string[];
392
+ };
393
+ };
394
+ };
395
+ /** @description Unauthorized — authentication required or invalid */
396
+ 401: {
397
+ headers: {
398
+ [name: string]: unknown;
399
+ };
400
+ content: {
401
+ "application/json": {
402
+ /**
403
+ * @description HTTP status code
404
+ * @example 400
405
+ */
406
+ statusCode?: number;
407
+ /**
408
+ * @description Short error label
409
+ * @example Bad Request
410
+ */
411
+ error?: string;
412
+ /**
413
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
414
+ * @example Validation failed
415
+ */
416
+ message: string | string[];
417
+ };
418
+ };
419
+ };
420
+ /** @description Too Many Requests */
421
+ 429: {
422
+ headers: {
423
+ [name: string]: unknown;
424
+ };
425
+ content: {
426
+ "application/json": {
427
+ /**
428
+ * @description HTTP status code
429
+ * @example 400
430
+ */
431
+ statusCode?: number;
432
+ /**
433
+ * @description Short error label
434
+ * @example Bad Request
435
+ */
436
+ error?: string;
437
+ /**
438
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
439
+ * @example Validation failed
440
+ */
441
+ message: string | string[];
442
+ };
443
+ };
444
+ };
445
+ };
446
+ };
447
+ delete?: never;
448
+ options?: never;
449
+ head?: never;
450
+ patch?: never;
451
+ trace?: never;
452
+ };
453
+ "/v1/auth/login/mfa": {
454
+ parameters: {
455
+ query?: never;
456
+ header?: never;
457
+ path?: never;
458
+ cookie?: never;
459
+ };
460
+ get?: never;
461
+ put?: never;
462
+ /**
463
+ * Complete an MFA login with a TOTP or recovery code
464
+ * @description Second step after `/v1/auth/login` answered `mfa_required`. Requires the `wac_mfa` cookie that response set. On success sets `wac_session`, clears `wac_mfa` and returns `status: "authenticated"`. 401 with error `mfa_code_invalid`: wrong or already-used code, retry. 401 with error `mfa_challenge_invalid`: the challenge expired (5 min), was used, or saw 5 wrong codes; start again at `/v1/auth/login`. 429 `mfa_rate_limited`: the per-user attempt budget (10 per 15 min) is exhausted.
465
+ */
466
+ post: {
467
+ parameters: {
468
+ query?: never;
469
+ header?: never;
470
+ path?: never;
471
+ cookie?: never;
472
+ };
473
+ requestBody?: {
474
+ content: {
475
+ "application/json": {
476
+ /**
477
+ * @description Current 6-digit TOTP code. Each code is accepted once.
478
+ * @example 123456
479
+ */
480
+ code?: string;
481
+ /**
482
+ * @description An unused recovery code (consumed by this request).
483
+ * @example ABCD-EFGH
484
+ */
485
+ recoveryCode?: string;
486
+ };
487
+ };
488
+ };
489
+ responses: {
490
+ /** @description Created */
491
+ 201: {
352
492
  headers: {
353
493
  [name: string]: unknown;
354
494
  };
355
495
  content: {
356
496
  "application/json": {
497
+ /**
498
+ * @description `authenticated`: the `wac_session` cookie is set. `mfa_required`: no session yet; send the second factor to `/v1/auth/login/mfa`.
499
+ * @enum {string}
500
+ */
501
+ status: "authenticated" | "mfa_required";
357
502
  message: string;
503
+ /** @description Present when `status` is `mfa_required`. */
504
+ methods?: ("totp" | "recovery_code")[];
505
+ /** @description Challenge lifetime; present when `status` is `mfa_required`. */
506
+ expiresInSeconds?: number;
358
507
  };
359
508
  };
360
509
  };
@@ -452,7 +601,7 @@ interface paths$1 {
452
601
  put?: never;
453
602
  /**
454
603
  * Clear the current session
455
- * @description Revokes the session bound to the `wac_session` cookie (if present) and clears the cookie. Idempotent — works even with no active session.
604
+ * @description Revokes the session bound to the `wac_session` cookie (if present) and clears the cookie; access tokens minted from that session via `POST /v1/auth/access-token` stop working at once. Idempotent — works even with no active session.
456
605
  */
457
606
  post: {
458
607
  parameters: {
@@ -463,8 +612,8 @@ interface paths$1 {
463
612
  };
464
613
  requestBody?: never;
465
614
  responses: {
466
- /** @description Success */
467
- 200: {
615
+ /** @description Created */
616
+ 201: {
468
617
  headers: {
469
618
  [name: string]: unknown;
470
619
  };
@@ -515,8 +664,8 @@ interface paths$1 {
515
664
  };
516
665
  };
517
666
  responses: {
518
- /** @description Success */
519
- 200: {
667
+ /** @description Created */
668
+ 201: {
520
669
  headers: {
521
670
  [name: string]: unknown;
522
671
  };
@@ -595,7 +744,7 @@ interface paths$1 {
595
744
  put?: never;
596
745
  /**
597
746
  * Apply a password reset
598
- * @description Exchanges a reset token for a new password. The token from the email is single-use and time-limited.
747
+ * @description Exchanges a reset token for a new password. The token from the email is single-use and time-limited. Also signs the user out everywhere: every session, every token minted from one, and every connected OAuth app (grants revoked, security epoch bumped).
599
748
  */
600
749
  post: {
601
750
  parameters: {
@@ -615,8 +764,8 @@ interface paths$1 {
615
764
  };
616
765
  };
617
766
  responses: {
618
- /** @description Success */
619
- 200: {
767
+ /** @description Created */
768
+ 201: {
620
769
  headers: {
621
770
  [name: string]: unknown;
622
771
  };
@@ -708,7 +857,7 @@ interface paths$1 {
708
857
  content: {
709
858
  "application/json": {
710
859
  /**
711
- * @description Stripe Price ID. Drives the line item on the Checkout session — the Price's associated Product must carry a `witnessCredits` metadata key for credits to land in the ledger on `checkout.session.completed`.
860
+ * @description Stripe Price ID. Drives the line item on the Checkout session — the Price's Product must carry `credits` (and, for subscriptions, `plan_slug`) metadata for credits/plan to apply via the webhook.
712
861
  * @example price_1ABC...
713
862
  */
714
863
  priceId: string;
@@ -717,12 +866,22 @@ interface paths$1 {
717
866
  * @enum {string}
718
867
  */
719
868
  mode: "payment" | "subscription";
869
+ /**
870
+ * Format: uri
871
+ * @description Override the post-checkout success redirect.
872
+ */
873
+ successUrl?: string;
874
+ /**
875
+ * Format: uri
876
+ * @description Override the checkout-cancelled redirect.
877
+ */
878
+ cancelUrl?: string;
720
879
  };
721
880
  };
722
881
  };
723
882
  responses: {
724
- /** @description Success */
725
- 200: {
883
+ /** @description Created */
884
+ 201: {
726
885
  headers: {
727
886
  [name: string]: unknown;
728
887
  };
@@ -926,9 +1085,11 @@ interface paths$1 {
926
1085
  /**
927
1086
  * Stripe webhook receiver
928
1087
  * @description Source of truth for credit grants. Verifies the `stripe-signature` header against `STRIPE_WEBHOOK_SECRET` over the raw request body, then dispatches on event type:
929
- * - `checkout.session.completed` → grant `metadata.witnessCredits` from the Price's Product to the org's credit ledger.
930
- * - `invoice.paid` → grant subscription monthly credits.
931
- * - `customer.subscription.deleted` → noop (handled at access-control layer).
1088
+ * - `checkout.session.completed` (payment mode only) → grant pack `credits`.
1089
+ * - `invoice.paid` → grant subscription monthly `credits`.
1090
+ * - `customer.subscription.created`/`.updated` → set org `plan`, `current_period_end`, `subscription_status`.
1091
+ * - `customer.subscription.deleted` → revert to free plan + resume free-tier.
1092
+ * - `invoice.payment_failed` → mark `past_due` (grace).
932
1093
  * Idempotent via the `stripe_events` table keyed on `event.id`. Body is the raw Stripe event (consumed pre-JSON-parse), not the documented schema.
933
1094
  */
934
1095
  post: {
@@ -940,8 +1101,8 @@ interface paths$1 {
940
1101
  };
941
1102
  requestBody?: never;
942
1103
  responses: {
943
- /** @description Success */
944
- 200: {
1104
+ /** @description Created */
1105
+ 201: {
945
1106
  headers: {
946
1107
  [name: string]: unknown;
947
1108
  };
@@ -996,7 +1157,7 @@ interface paths$1 {
996
1157
  put?: never;
997
1158
  /**
998
1159
  * Create an organisation with client-generated keys
999
- * @description Phase RBAC Thread D — explicit org creation. The caller generates the owner key and the initial signing key client-side; Witnium never holds the private bytes. The response includes the freshly-deployed contract address and a one-time email-verify token.
1160
+ * @description Phase RBAC Thread D — explicit org creation. The caller generates the owner key and the initial signing key client-side; Witnium never holds the private bytes. The response includes the freshly-deployed contract address. The email-verify link is sent to adminEmail and is never returned. If that email cannot be sent, nothing is created and the route returns 502; retry the request.
1000
1161
  */
1001
1162
  post: {
1002
1163
  parameters: {
@@ -1034,8 +1195,8 @@ interface paths$1 {
1034
1195
  };
1035
1196
  };
1036
1197
  responses: {
1037
- /** @description Success */
1038
- 200: {
1198
+ /** @description Created */
1199
+ 201: {
1039
1200
  headers: {
1040
1201
  [name: string]: unknown;
1041
1202
  };
@@ -1055,8 +1216,6 @@ interface paths$1 {
1055
1216
  contractAddress: string;
1056
1217
  /** @description Semantic on-chain Solidity version (e.g. "5.0.0"). */
1057
1218
  contractVersion: string;
1058
- /** @description Email-verify token. Already sent to adminEmail; echoed here for flows that prefer to surface a "click this link" in their own UI. */
1059
- emailVerifyToken: string;
1060
1219
  };
1061
1220
  };
1062
1221
  };
@@ -1110,6 +1269,56 @@ interface paths$1 {
1110
1269
  };
1111
1270
  };
1112
1271
  };
1272
+ /** @description Too Many Requests */
1273
+ 429: {
1274
+ headers: {
1275
+ [name: string]: unknown;
1276
+ };
1277
+ content: {
1278
+ "application/json": {
1279
+ /**
1280
+ * @description HTTP status code
1281
+ * @example 400
1282
+ */
1283
+ statusCode?: number;
1284
+ /**
1285
+ * @description Short error label
1286
+ * @example Bad Request
1287
+ */
1288
+ error?: string;
1289
+ /**
1290
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
1291
+ * @example Validation failed
1292
+ */
1293
+ message: string | string[];
1294
+ };
1295
+ };
1296
+ };
1297
+ /** @description Bad Gateway */
1298
+ 502: {
1299
+ headers: {
1300
+ [name: string]: unknown;
1301
+ };
1302
+ content: {
1303
+ "application/json": {
1304
+ /**
1305
+ * @description HTTP status code
1306
+ * @example 400
1307
+ */
1308
+ statusCode?: number;
1309
+ /**
1310
+ * @description Short error label
1311
+ * @example Bad Request
1312
+ */
1313
+ error?: string;
1314
+ /**
1315
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
1316
+ * @example Validation failed
1317
+ */
1318
+ message: string | string[];
1319
+ };
1320
+ };
1321
+ };
1113
1322
  };
1114
1323
  };
1115
1324
  delete?: never;
@@ -1281,10 +1490,21 @@ interface paths$1 {
1281
1490
  createdAt: string;
1282
1491
  /**
1283
1492
  * Format: date-time
1284
- * @description ISO 8601 date-time string
1493
+ * @description When the user proved control of the mailbox by consuming an emailed verify token. Null for users the org created via its API key until they do; org creation is recorded in identityAttestedByOrgId instead.
1285
1494
  * @example 2026-05-20T10:30:00.000Z
1286
1495
  */
1287
1496
  emailVerifiedAt: string | null;
1497
+ /**
1498
+ * @description Org whose API key created the user and vouched for the identity. This is NOT proof of mailbox control.
1499
+ * @example 550e8400-e29b-41d4-a716-446655440000
1500
+ */
1501
+ identityAttestedByOrgId: string | null;
1502
+ /**
1503
+ * Format: date-time
1504
+ * @description ISO 8601 date-time string
1505
+ * @example 2026-05-20T10:30:00.000Z
1506
+ */
1507
+ identityAttestedAt: string | null;
1288
1508
  }[];
1289
1509
  };
1290
1510
  };
@@ -1343,8 +1563,8 @@ interface paths$1 {
1343
1563
  };
1344
1564
  };
1345
1565
  responses: {
1346
- /** @description Success */
1347
- 200: {
1566
+ /** @description Created */
1567
+ 201: {
1348
1568
  headers: {
1349
1569
  [name: string]: unknown;
1350
1570
  };
@@ -1552,7 +1772,10 @@ interface paths$1 {
1552
1772
  };
1553
1773
  get?: never;
1554
1774
  put?: never;
1555
- /** Invite a member to the caller's org */
1775
+ /**
1776
+ * Invite a member to the caller's org
1777
+ * @description Adds the membership and, unless the invitee already verified their email, mails them an invitation with the verify link. Idempotent: re-inviting re-sends the mail. 502 means the membership was recorded but the email could not be sent; retry.
1778
+ */
1556
1779
  post: {
1557
1780
  parameters: {
1558
1781
  query?: never;
@@ -1578,8 +1801,8 @@ interface paths$1 {
1578
1801
  };
1579
1802
  };
1580
1803
  responses: {
1581
- /** @description Success */
1582
- 200: {
1804
+ /** @description Created */
1805
+ 201: {
1583
1806
  headers: {
1584
1807
  [name: string]: unknown;
1585
1808
  };
@@ -1597,7 +1820,8 @@ interface paths$1 {
1597
1820
  membershipId: string;
1598
1821
  userPreexisted: boolean;
1599
1822
  membershipPreexisted: boolean;
1600
- emailVerifyToken?: string;
1823
+ /** @description True when an invitation email (with the verify link) was sent, i.e. the invitee had not yet verified their email. The token is never returned. */
1824
+ inviteEmailSent: boolean;
1601
1825
  };
1602
1826
  };
1603
1827
  };
@@ -1651,49 +1875,99 @@ interface paths$1 {
1651
1875
  };
1652
1876
  };
1653
1877
  };
1654
- };
1655
- };
1656
- delete?: never;
1657
- options?: never;
1658
- head?: never;
1659
- patch?: never;
1660
- trace?: never;
1661
- };
1662
- "/v1/orgs/me/members/{userId}/suspend": {
1663
- parameters: {
1664
- query?: never;
1665
- header?: never;
1666
- path?: never;
1667
- cookie?: never;
1668
- };
1669
- get?: never;
1670
- put?: never;
1671
- /** Suspend a member (reversible). The owner cannot be suspended. */
1672
- post: {
1673
- parameters: {
1674
- query?: never;
1675
- header?: never;
1676
- path?: never;
1677
- cookie?: never;
1678
- };
1679
- requestBody?: never;
1680
- responses: {
1681
- /** @description Success */
1682
- 200: {
1878
+ /** @description Too Many Requests */
1879
+ 429: {
1683
1880
  headers: {
1684
1881
  [name: string]: unknown;
1685
1882
  };
1686
1883
  content: {
1687
1884
  "application/json": {
1688
1885
  /**
1689
- * @description UUID v4
1690
- * @example 550e8400-e29b-41d4-a716-446655440000
1886
+ * @description HTTP status code
1887
+ * @example 400
1691
1888
  */
1692
- membershipId: string;
1889
+ statusCode?: number;
1693
1890
  /**
1694
- * Format: date-time
1695
- * @description ISO 8601 date-time string
1696
- * @example 2026-05-20T10:30:00.000Z
1891
+ * @description Short error label
1892
+ * @example Bad Request
1893
+ */
1894
+ error?: string;
1895
+ /**
1896
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
1897
+ * @example Validation failed
1898
+ */
1899
+ message: string | string[];
1900
+ };
1901
+ };
1902
+ };
1903
+ /** @description Bad Gateway */
1904
+ 502: {
1905
+ headers: {
1906
+ [name: string]: unknown;
1907
+ };
1908
+ content: {
1909
+ "application/json": {
1910
+ /**
1911
+ * @description HTTP status code
1912
+ * @example 400
1913
+ */
1914
+ statusCode?: number;
1915
+ /**
1916
+ * @description Short error label
1917
+ * @example Bad Request
1918
+ */
1919
+ error?: string;
1920
+ /**
1921
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
1922
+ * @example Validation failed
1923
+ */
1924
+ message: string | string[];
1925
+ };
1926
+ };
1927
+ };
1928
+ };
1929
+ };
1930
+ delete?: never;
1931
+ options?: never;
1932
+ head?: never;
1933
+ patch?: never;
1934
+ trace?: never;
1935
+ };
1936
+ "/v1/orgs/me/members/{userId}/suspend": {
1937
+ parameters: {
1938
+ query?: never;
1939
+ header?: never;
1940
+ path?: never;
1941
+ cookie?: never;
1942
+ };
1943
+ get?: never;
1944
+ put?: never;
1945
+ /** Suspend a member (reversible). The owner cannot be suspended. */
1946
+ post: {
1947
+ parameters: {
1948
+ query?: never;
1949
+ header?: never;
1950
+ path?: never;
1951
+ cookie?: never;
1952
+ };
1953
+ requestBody?: never;
1954
+ responses: {
1955
+ /** @description Created */
1956
+ 201: {
1957
+ headers: {
1958
+ [name: string]: unknown;
1959
+ };
1960
+ content: {
1961
+ "application/json": {
1962
+ /**
1963
+ * @description UUID v4
1964
+ * @example 550e8400-e29b-41d4-a716-446655440000
1965
+ */
1966
+ membershipId: string;
1967
+ /**
1968
+ * Format: date-time
1969
+ * @description ISO 8601 date-time string
1970
+ * @example 2026-05-20T10:30:00.000Z
1697
1971
  */
1698
1972
  suspendedAt: string;
1699
1973
  };
@@ -1801,8 +2075,8 @@ interface paths$1 {
1801
2075
  };
1802
2076
  requestBody?: never;
1803
2077
  responses: {
1804
- /** @description Success */
1805
- 200: {
2078
+ /** @description Created */
2079
+ 201: {
1806
2080
  headers: {
1807
2081
  [name: string]: unknown;
1808
2082
  };
@@ -2133,7 +2407,10 @@ interface paths$1 {
2133
2407
  };
2134
2408
  get?: never;
2135
2409
  put?: never;
2136
- /** Re-mint an email-verify token for a pending member */
2410
+ /**
2411
+ * Re-send the invitation email to a pending member
2412
+ * @description Mints a fresh verify token, invalidates earlier ones and mails it. The token is never returned. 502 means the email could not be sent and nothing changed (the previous link stays valid).
2413
+ */
2137
2414
  post: {
2138
2415
  parameters: {
2139
2416
  query?: never;
@@ -2143,14 +2420,13 @@ interface paths$1 {
2143
2420
  };
2144
2421
  requestBody?: never;
2145
2422
  responses: {
2146
- /** @description Success */
2147
- 200: {
2423
+ /** @description Created */
2424
+ 201: {
2148
2425
  headers: {
2149
2426
  [name: string]: unknown;
2150
2427
  };
2151
2428
  content: {
2152
2429
  "application/json": {
2153
- emailVerifyToken: string;
2154
2430
  /**
2155
2431
  * Format: email
2156
2432
  * @description RFC 5321 email address
@@ -2235,6 +2511,56 @@ interface paths$1 {
2235
2511
  };
2236
2512
  };
2237
2513
  };
2514
+ /** @description Too Many Requests */
2515
+ 429: {
2516
+ headers: {
2517
+ [name: string]: unknown;
2518
+ };
2519
+ content: {
2520
+ "application/json": {
2521
+ /**
2522
+ * @description HTTP status code
2523
+ * @example 400
2524
+ */
2525
+ statusCode?: number;
2526
+ /**
2527
+ * @description Short error label
2528
+ * @example Bad Request
2529
+ */
2530
+ error?: string;
2531
+ /**
2532
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
2533
+ * @example Validation failed
2534
+ */
2535
+ message: string | string[];
2536
+ };
2537
+ };
2538
+ };
2539
+ /** @description Bad Gateway */
2540
+ 502: {
2541
+ headers: {
2542
+ [name: string]: unknown;
2543
+ };
2544
+ content: {
2545
+ "application/json": {
2546
+ /**
2547
+ * @description HTTP status code
2548
+ * @example 400
2549
+ */
2550
+ statusCode?: number;
2551
+ /**
2552
+ * @description Short error label
2553
+ * @example Bad Request
2554
+ */
2555
+ error?: string;
2556
+ /**
2557
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
2558
+ * @example Validation failed
2559
+ */
2560
+ message: string | string[];
2561
+ };
2562
+ };
2563
+ };
2238
2564
  };
2239
2565
  };
2240
2566
  delete?: never;
@@ -2287,8 +2613,8 @@ interface paths$1 {
2287
2613
  };
2288
2614
  };
2289
2615
  responses: {
2290
- /** @description Success */
2291
- 200: {
2616
+ /** @description Created */
2617
+ 201: {
2292
2618
  headers: {
2293
2619
  [name: string]: unknown;
2294
2620
  };
@@ -2726,8 +3052,8 @@ interface paths$1 {
2726
3052
  };
2727
3053
  requestBody?: never;
2728
3054
  responses: {
2729
- /** @description Success */
2730
- 200: {
3055
+ /** @description Created */
3056
+ 201: {
2731
3057
  headers: {
2732
3058
  [name: string]: unknown;
2733
3059
  };
@@ -2877,8 +3203,8 @@ interface paths$1 {
2877
3203
  };
2878
3204
  };
2879
3205
  responses: {
2880
- /** @description Success */
2881
- 200: {
3206
+ /** @description Created */
3207
+ 201: {
2882
3208
  headers: {
2883
3209
  [name: string]: unknown;
2884
3210
  };
@@ -3016,6 +3342,10 @@ interface paths$1 {
3016
3342
  * @example 2026-05-20T10:30:00.000Z
3017
3343
  */
3018
3344
  revokedAt: string | null;
3345
+ /** @description True when the key belongs to one OAuth grant (a connected app): only that app can sign with it, and disconnecting the app ends it. */
3346
+ boundToOauthGrant: boolean;
3347
+ /** @description For a key that belongs to no grant: whether the user shared it with OAuth clients (PATCH). Only shared keys are visible and usable to them. */
3348
+ sharedWithOauthClients: boolean;
3019
3349
  }[];
3020
3350
  };
3021
3351
  };
@@ -3120,8 +3450,8 @@ interface paths$1 {
3120
3450
  };
3121
3451
  };
3122
3452
  responses: {
3123
- /** @description Success */
3124
- 200: {
3453
+ /** @description Created */
3454
+ 201: {
3125
3455
  headers: {
3126
3456
  [name: string]: unknown;
3127
3457
  };
@@ -3293,8 +3623,8 @@ interface paths$1 {
3293
3623
  };
3294
3624
  };
3295
3625
  responses: {
3296
- /** @description Success */
3297
- 200: {
3626
+ /** @description Created */
3627
+ 201: {
3298
3628
  headers: {
3299
3629
  [name: string]: unknown;
3300
3630
  };
@@ -3618,45 +3948,23 @@ interface paths$1 {
3618
3948
  };
3619
3949
  options?: never;
3620
3950
  head?: never;
3621
- patch?: never;
3622
- trace?: never;
3623
- };
3624
- "/v1/sign": {
3625
- parameters: {
3626
- query?: never;
3627
- header?: never;
3628
- path?: never;
3629
- cookie?: never;
3630
- };
3631
- get?: never;
3632
- put?: never;
3633
3951
  /**
3634
- * Sign bytes with a delegated key
3635
- * @description Vault Transit signs the supplied payload using the user's delegated key. Vault returns the signature; the accounts-service process never sees the private bytes (delegated keys are created with `exportable=false`).
3636
- *
3637
- * **Use:** sign the canonical-intent JSON returned by chain-api `POST /v5/contracts/.../witnesses/propose` (and the analogous v4 endpoint). The endpoint signs whatever bytes you submit because sign:write is an explicit grant to use the user's key — the on-chain authority of the key is bounded to witness ops on the user's contract, and nothing else in Witnium currently consumes these signatures. Future signing surfaces that need different keys or scopes get their own.
3638
- *
3639
- * **Limits:** payload ≤ 8 KiB (16384 hex chars), per-user rate-limited at 20 signs/minute (429 + Retry-After on excess). Both are resource bounds, not access-control fences.
3640
- *
3641
- * Optional `X-Request-Id` request header gets forwarded into the audit-log line; a UUID is generated if absent.
3952
+ * Share a durable delegated key with OAuth clients (or stop)
3953
+ * @description Dashboard only (a token from POST /v1/auth/access-token); OAuth tokens get 403. Applies to keys that belong to no OAuth grant. A shared key can be listed and used to sign by every OAuth client the user connected to this org, but submitted or revoked only from the dashboard.
3642
3954
  */
3643
- post: {
3955
+ patch: {
3644
3956
  parameters: {
3645
3957
  query?: never;
3646
3958
  header?: never;
3647
- path?: never;
3959
+ path: {
3960
+ id: string;
3961
+ };
3648
3962
  cookie?: never;
3649
3963
  };
3650
3964
  requestBody?: {
3651
3965
  content: {
3652
3966
  "application/json": {
3653
- /**
3654
- * @description The delegated key (per-user, per-contract) used to sign. Must be confirmed on-chain and not revoked.
3655
- * @example 550e8400-e29b-41d4-a716-446655440000
3656
- */
3657
- delegatedKeyId: string;
3658
- /** @description Hex-encoded bytes to sign (no 0x prefix). Must have an even length and at most 16384 hex characters (8 KiB raw). The expected use is signing the UTF-8 bytes of a v5 canonical-intent JSON returned by chain-api `/propose`, but the endpoint signs whatever bytes you submit — sign:write is an explicit grant to use the user's key. Witnium never logs the bytes; only their SHA-256 hash is recorded for audit cross-correlation with Vault. */
3659
- payload: string;
3967
+ sharedWithOauthClients: boolean;
3660
3968
  };
3661
3969
  };
3662
3970
  };
@@ -3668,18 +3976,46 @@ interface paths$1 {
3668
3976
  };
3669
3977
  content: {
3670
3978
  "application/json": {
3671
- /** @description Ed25519 signature over the payload bytes, hex-encoded. */
3672
- signature: string;
3673
3979
  /**
3674
- * @description Public key of the delegated key used to sign — for verification.
3980
+ * @description UUID v4
3981
+ * @example 550e8400-e29b-41d4-a716-446655440000
3982
+ */
3983
+ id: string;
3984
+ /**
3985
+ * @description Ethereum address (0x + 40 hex characters)
3986
+ * @example 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0
3987
+ */
3988
+ contractAddress: string;
3989
+ /**
3990
+ * @description Ed25519 public key — 32 bytes hex-encoded (64 chars, no 0x prefix)
3675
3991
  * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
3676
3992
  */
3677
- signerPublicKey: string;
3993
+ publicKey: string;
3678
3994
  /**
3679
- * @description UUID v4
3680
- * @example 550e8400-e29b-41d4-a716-446655440000
3995
+ * Format: date-time
3996
+ * @description ISO 8601 date-time string
3997
+ * @example 2026-05-20T10:30:00.000Z
3681
3998
  */
3682
- delegatedKeyId: string;
3999
+ createdAt: string;
4000
+ /**
4001
+ * Format: date-time
4002
+ * @description Set once the on-chain addSigningKey tx is mined.
4003
+ * @example 2026-05-20T10:30:00.000Z
4004
+ */
4005
+ confirmedAt: string | null;
4006
+ /** @description Transaction hash from the addSigningKey submission, if any. */
4007
+ confirmedTxHash: string | null;
4008
+ confirmedBlockNumber: number | null;
4009
+ /**
4010
+ * Format: date-time
4011
+ * @description Set when the user locally revokes the key (Vault key wiped). Does NOT mean the on-chain record was revoked.
4012
+ * @example 2026-05-20T10:30:00.000Z
4013
+ */
4014
+ revokedAt: string | null;
4015
+ /** @description True when the key belongs to one OAuth grant (a connected app): only that app can sign with it, and disconnecting the app ends it. */
4016
+ boundToOauthGrant: boolean;
4017
+ /** @description For a key that belongs to no grant: whether the user shared it with OAuth clients (PATCH). Only shared keys are visible and usable to them. */
4018
+ sharedWithOauthClients: boolean;
3683
4019
  };
3684
4020
  };
3685
4021
  };
@@ -3808,40 +4144,11 @@ interface paths$1 {
3808
4144
  };
3809
4145
  };
3810
4146
  };
3811
- /** @description Too Many Requests */
3812
- 429: {
3813
- headers: {
3814
- [name: string]: unknown;
3815
- };
3816
- content: {
3817
- "application/json": {
3818
- /**
3819
- * @description HTTP status code
3820
- * @example 400
3821
- */
3822
- statusCode?: number;
3823
- /**
3824
- * @description Short error label
3825
- * @example Bad Request
3826
- */
3827
- error?: string;
3828
- /**
3829
- * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
3830
- * @example Validation failed
3831
- */
3832
- message: string | string[];
3833
- };
3834
- };
3835
- };
3836
4147
  };
3837
4148
  };
3838
- delete?: never;
3839
- options?: never;
3840
- head?: never;
3841
- patch?: never;
3842
4149
  trace?: never;
3843
4150
  };
3844
- "/v1/contracts/provision": {
4151
+ "/v1/sign": {
3845
4152
  parameters: {
3846
4153
  query?: never;
3847
4154
  header?: never;
@@ -3851,8 +4158,14 @@ interface paths$1 {
3851
4158
  get?: never;
3852
4159
  put?: never;
3853
4160
  /**
3854
- * Provision a witness contract for a user
3855
- * @description Consumes the user's `provisioningToken` and deploys their on-chain WitnessRegistry. Email must already be verified (the token bundles that gate). Idempotent in the sense that a second call with the same token returns 4xx because the token is single-use.
4161
+ * Sign bytes with a delegated key
4162
+ * @description Vault Transit signs the supplied payload using the user's delegated key. Vault returns the signature; the accounts-service process never sees the private bytes (delegated keys are created with `exportable=false`).
4163
+ *
4164
+ * **Use:** sign the canonical-intent JSON returned by chain-api `POST /v5/contracts/.../witnesses/propose` (and the analogous v4 endpoint). The endpoint signs whatever bytes you submit because sign:write is an explicit grant to use the user's key — the on-chain authority of the key is bounded to witness ops on the user's contract, and nothing else in Witnium currently consumes these signatures. Future signing surfaces that need different keys or scopes get their own.
4165
+ *
4166
+ * **Limits:** payload ≤ 8 KiB (16384 hex chars), per-user rate-limited at 20 signs/minute (429 + Retry-After on excess). Both are resource bounds, not access-control fences.
4167
+ *
4168
+ * Optional `X-Request-Id` request header gets forwarded into the audit-log line; a UUID is generated if absent.
3856
4169
  */
3857
4170
  post: {
3858
4171
  parameters: {
@@ -3864,11 +4177,225 @@ interface paths$1 {
3864
4177
  requestBody?: {
3865
4178
  content: {
3866
4179
  "application/json": {
3867
- /** @description One-time token issued after email verification (or by an org admin via POST /v1/orgs/me/users). Consumed atomically. */
3868
- provisioningToken: string;
3869
4180
  /**
3870
- * @description Owner Ed25519 public key. Generated client-side and never seen by the server again — must NOT equal `initialSigningPublicKey`.
3871
- * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
4181
+ * @description The delegated key (per-user, per-contract) used to sign. Must be confirmed on-chain and not revoked.
4182
+ * @example 550e8400-e29b-41d4-a716-446655440000
4183
+ */
4184
+ delegatedKeyId: string;
4185
+ /** @description Hex-encoded bytes to sign (no 0x prefix). Must have an even length and at most 16384 hex characters (8 KiB raw). The expected use is signing the UTF-8 bytes of a v5 canonical-intent JSON returned by chain-api `/propose`, but the endpoint signs whatever bytes you submit — sign:write is an explicit grant to use the user's key. Witnium never logs the bytes; only their SHA-256 hash is recorded for audit cross-correlation with Vault. */
4186
+ payload: string;
4187
+ };
4188
+ };
4189
+ };
4190
+ responses: {
4191
+ /** @description Created */
4192
+ 201: {
4193
+ headers: {
4194
+ [name: string]: unknown;
4195
+ };
4196
+ content: {
4197
+ "application/json": {
4198
+ /** @description Ed25519 signature over the payload bytes, hex-encoded. */
4199
+ signature: string;
4200
+ /**
4201
+ * @description Public key of the delegated key used to sign — for verification.
4202
+ * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
4203
+ */
4204
+ signerPublicKey: string;
4205
+ /**
4206
+ * @description UUID v4
4207
+ * @example 550e8400-e29b-41d4-a716-446655440000
4208
+ */
4209
+ delegatedKeyId: string;
4210
+ };
4211
+ };
4212
+ };
4213
+ /** @description Bad Request — validation failed */
4214
+ 400: {
4215
+ headers: {
4216
+ [name: string]: unknown;
4217
+ };
4218
+ content: {
4219
+ "application/json": {
4220
+ /**
4221
+ * @description HTTP status code
4222
+ * @example 400
4223
+ */
4224
+ statusCode?: number;
4225
+ /**
4226
+ * @description Short error label
4227
+ * @example Bad Request
4228
+ */
4229
+ error?: string;
4230
+ /**
4231
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
4232
+ * @example Validation failed
4233
+ */
4234
+ message: string | string[];
4235
+ };
4236
+ };
4237
+ };
4238
+ /** @description Unauthorized — authentication required or invalid */
4239
+ 401: {
4240
+ headers: {
4241
+ [name: string]: unknown;
4242
+ };
4243
+ content: {
4244
+ "application/json": {
4245
+ /**
4246
+ * @description HTTP status code
4247
+ * @example 400
4248
+ */
4249
+ statusCode?: number;
4250
+ /**
4251
+ * @description Short error label
4252
+ * @example Bad Request
4253
+ */
4254
+ error?: string;
4255
+ /**
4256
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
4257
+ * @example Validation failed
4258
+ */
4259
+ message: string | string[];
4260
+ };
4261
+ };
4262
+ };
4263
+ /** @description Forbidden — insufficient permissions or scope */
4264
+ 403: {
4265
+ headers: {
4266
+ [name: string]: unknown;
4267
+ };
4268
+ content: {
4269
+ "application/json": {
4270
+ /**
4271
+ * @description HTTP status code
4272
+ * @example 400
4273
+ */
4274
+ statusCode?: number;
4275
+ /**
4276
+ * @description Short error label
4277
+ * @example Bad Request
4278
+ */
4279
+ error?: string;
4280
+ /**
4281
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
4282
+ * @example Validation failed
4283
+ */
4284
+ message: string | string[];
4285
+ };
4286
+ };
4287
+ };
4288
+ /** @description Not Found */
4289
+ 404: {
4290
+ headers: {
4291
+ [name: string]: unknown;
4292
+ };
4293
+ content: {
4294
+ "application/json": {
4295
+ /**
4296
+ * @description HTTP status code
4297
+ * @example 400
4298
+ */
4299
+ statusCode?: number;
4300
+ /**
4301
+ * @description Short error label
4302
+ * @example Bad Request
4303
+ */
4304
+ error?: string;
4305
+ /**
4306
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
4307
+ * @example Validation failed
4308
+ */
4309
+ message: string | string[];
4310
+ };
4311
+ };
4312
+ };
4313
+ /** @description Conflict */
4314
+ 409: {
4315
+ headers: {
4316
+ [name: string]: unknown;
4317
+ };
4318
+ content: {
4319
+ "application/json": {
4320
+ /**
4321
+ * @description HTTP status code
4322
+ * @example 400
4323
+ */
4324
+ statusCode?: number;
4325
+ /**
4326
+ * @description Short error label
4327
+ * @example Bad Request
4328
+ */
4329
+ error?: string;
4330
+ /**
4331
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
4332
+ * @example Validation failed
4333
+ */
4334
+ message: string | string[];
4335
+ };
4336
+ };
4337
+ };
4338
+ /** @description Too Many Requests */
4339
+ 429: {
4340
+ headers: {
4341
+ [name: string]: unknown;
4342
+ };
4343
+ content: {
4344
+ "application/json": {
4345
+ /**
4346
+ * @description HTTP status code
4347
+ * @example 400
4348
+ */
4349
+ statusCode?: number;
4350
+ /**
4351
+ * @description Short error label
4352
+ * @example Bad Request
4353
+ */
4354
+ error?: string;
4355
+ /**
4356
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
4357
+ * @example Validation failed
4358
+ */
4359
+ message: string | string[];
4360
+ };
4361
+ };
4362
+ };
4363
+ };
4364
+ };
4365
+ delete?: never;
4366
+ options?: never;
4367
+ head?: never;
4368
+ patch?: never;
4369
+ trace?: never;
4370
+ };
4371
+ "/v1/contracts/provision": {
4372
+ parameters: {
4373
+ query?: never;
4374
+ header?: never;
4375
+ path?: never;
4376
+ cookie?: never;
4377
+ };
4378
+ get?: never;
4379
+ put?: never;
4380
+ /**
4381
+ * Provision a witness contract for a user
4382
+ * @description Consumes the user's `provisioningToken` and deploys their on-chain WitnessRegistry. Email must already be verified (the token bundles that gate). Idempotent in the sense that a second call with the same token returns 4xx because the token is single-use.
4383
+ */
4384
+ post: {
4385
+ parameters: {
4386
+ query?: never;
4387
+ header?: never;
4388
+ path?: never;
4389
+ cookie?: never;
4390
+ };
4391
+ requestBody?: {
4392
+ content: {
4393
+ "application/json": {
4394
+ /** @description One-time token issued after email verification (or by an org admin via POST /v1/orgs/me/users). Consumed atomically. */
4395
+ provisioningToken: string;
4396
+ /**
4397
+ * @description Owner Ed25519 public key. Generated client-side and never seen by the server again — must NOT equal `initialSigningPublicKey`.
4398
+ * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
3872
4399
  */
3873
4400
  ownerPublicKey: string;
3874
4401
  /**
@@ -3880,8 +4407,8 @@ interface paths$1 {
3880
4407
  };
3881
4408
  };
3882
4409
  responses: {
3883
- /** @description Success */
3884
- 200: {
4410
+ /** @description Created */
4411
+ 201: {
3885
4412
  headers: {
3886
4413
  [name: string]: unknown;
3887
4414
  };
@@ -3993,8 +4520,8 @@ interface paths$1 {
3993
4520
  };
3994
4521
  };
3995
4522
  responses: {
3996
- /** @description Success */
3997
- 200: {
4523
+ /** @description Created */
4524
+ 201: {
3998
4525
  headers: {
3999
4526
  [name: string]: unknown;
4000
4527
  };
@@ -4098,8 +4625,8 @@ interface paths$1 {
4098
4625
  };
4099
4626
  };
4100
4627
  responses: {
4101
- /** @description Success */
4102
- 200: {
4628
+ /** @description Created */
4629
+ 201: {
4103
4630
  headers: {
4104
4631
  [name: string]: unknown;
4105
4632
  };
@@ -4198,8 +4725,8 @@ interface paths$1 {
4198
4725
  };
4199
4726
  };
4200
4727
  responses: {
4201
- /** @description Success */
4202
- 200: {
4728
+ /** @description Created */
4729
+ 201: {
4203
4730
  headers: {
4204
4731
  [name: string]: unknown;
4205
4732
  };
@@ -4298,8 +4825,8 @@ interface paths$1 {
4298
4825
  };
4299
4826
  };
4300
4827
  responses: {
4301
- /** @description Success */
4302
- 200: {
4828
+ /** @description Created */
4829
+ 201: {
4303
4830
  headers: {
4304
4831
  [name: string]: unknown;
4305
4832
  };
@@ -4411,8 +4938,8 @@ interface paths$1 {
4411
4938
  };
4412
4939
  };
4413
4940
  responses: {
4414
- /** @description Success */
4415
- 200: {
4941
+ /** @description Created */
4942
+ 201: {
4416
4943
  headers: {
4417
4944
  [name: string]: unknown;
4418
4945
  };
@@ -4543,8 +5070,8 @@ interface paths$1 {
4543
5070
  };
4544
5071
  };
4545
5072
  responses: {
4546
- /** @description Success */
4547
- 200: {
5073
+ /** @description Created */
5074
+ 201: {
4548
5075
  headers: {
4549
5076
  [name: string]: unknown;
4550
5077
  };
@@ -4662,8 +5189,8 @@ interface paths$1 {
4662
5189
  };
4663
5190
  requestBody?: never;
4664
5191
  responses: {
4665
- /** @description Success */
4666
- 200: {
5192
+ /** @description Created */
5193
+ 201: {
4667
5194
  headers: {
4668
5195
  [name: string]: unknown;
4669
5196
  };
@@ -4797,8 +5324,8 @@ interface paths$1 {
4797
5324
  };
4798
5325
  };
4799
5326
  responses: {
4800
- /** @description Success */
4801
- 200: {
5327
+ /** @description Created */
5328
+ 201: {
4802
5329
  headers: {
4803
5330
  [name: string]: unknown;
4804
5331
  };
@@ -4974,7 +5501,7 @@ interface paths$1 {
4974
5501
  put?: never;
4975
5502
  /**
4976
5503
  * Internal callback from chain-api
4977
- * @description NOT for external use. Invoked by chain-api when a witness tx settles so accounts can update its credit reservations. HMAC-authenticated via X-Witnium-Callback-{Timestamp,Signature} headers using the shared INTERNAL_CALLBACK_HMAC_SECRET. Listed in the spec for completeness; SDK consumers should ignore.
5504
+ * @description NOT for external use. Invoked by chain-api when a witness tx settles so accounts can update its credit reservations. Authenticated by internal callback protocol v1 (docs/internal-callback-protocol.md): X-Witnium-Event-Id, X-Witnium-Callback-Timestamp and X-Witnium-Callback-Signature, an HMAC over the event id, timestamp, method, path with query and body hash using the shared INTERNAL_CALLBACK_HMAC_SECRET. Deduplicated by event id: a redelivered event returns 200 without side effects. Listed in the spec for completeness; SDK consumers should ignore.
4978
5505
  */
4979
5506
  post: {
4980
5507
  parameters: {
@@ -4989,12 +5516,12 @@ interface paths$1 {
4989
5516
  content: {
4990
5517
  "application/json": {
4991
5518
  /** @description 32-byte hash, lower-case hex without 0x prefix. */
4992
- witnessId?: string;
5519
+ witnessId: string;
4993
5520
  /**
4994
- * @description Settlement state from chain-api. `confirmed` → release reservation against the witness. `failed` / `dropped` → release back to the org.
5521
+ * @description Settlement state from chain-api. `confirmed` → commit the reservation against the witness. `failed` → release it back to the org.
4995
5522
  * @enum {string}
4996
5523
  */
4997
- status?: "confirmed" | "failed" | "dropped";
5524
+ status: "confirmed" | "failed";
4998
5525
  error?: string;
4999
5526
  };
5000
5527
  };
@@ -5007,8 +5534,8 @@ interface paths$1 {
5007
5534
  };
5008
5535
  content: {
5009
5536
  "application/json": {
5010
- ok: boolean;
5011
- reason?: string;
5537
+ /** @enum {boolean} */
5538
+ ok: true;
5012
5539
  };
5013
5540
  };
5014
5541
  };
@@ -5675,24 +6202,25 @@ interface paths$1 {
5675
6202
  patch?: never;
5676
6203
  trace?: never;
5677
6204
  };
5678
- "/v1/account/provisioning-token/reissue": {
6205
+ "/v3/contracts/{contractAddress}/witnesses/intents/{intentId}": {
5679
6206
  parameters: {
5680
6207
  query?: never;
5681
6208
  header?: never;
5682
6209
  path?: never;
5683
6210
  cookie?: never;
5684
6211
  };
5685
- get?: never;
5686
- put?: never;
5687
6212
  /**
5688
- * Re-mint a provisioning token (verified-but-not-provisioned recovery)
5689
- * @description Mints a fresh single-use provisioning token for a signed-in user whose email is verified but who has no contract yet — recovery for when the token from email-verify was lost (e.g. verify opened on another device). Returns 409 if email is unverified or a contract already exists. Rate limited per account.
6213
+ * Recover a v3 witness intent's outcome
6214
+ * @description For a client that lost a finalize (or propose) response. Returns the stored finalize response when accounts has one, otherwise chain-api's status for the intent. The URL contract must be the caller's. Read-only: never finalizes.
5690
6215
  */
5691
- post: {
6216
+ get: {
5692
6217
  parameters: {
5693
6218
  query?: never;
5694
6219
  header?: never;
5695
- path?: never;
6220
+ path: {
6221
+ contractAddress: string;
6222
+ intentId: string;
6223
+ };
5696
6224
  cookie?: never;
5697
6225
  };
5698
6226
  requestBody?: never;
@@ -5704,16 +6232,77 @@ interface paths$1 {
5704
6232
  };
5705
6233
  content: {
5706
6234
  "application/json": {
5707
- provisioningToken: string;
6235
+ /** @enum {string} */
6236
+ source: "stored";
6237
+ intentId: string;
6238
+ registryVersion: number;
5708
6239
  /**
5709
- * Format: date-time
5710
- * @description ISO 8601 date-time string
5711
- * @example 2026-05-20T10:30:00.000Z
6240
+ * @description The caller's credit reservation for this intent: `held` (reserved, not finalized), `finalizing` (finalize forwarded, outcome pending), `committed` (charged), `released` / `expired` (refunded; nothing was charged).
6241
+ * @enum {string}
5712
6242
  */
5713
- expiresAt: string;
5714
- };
5715
- };
5716
- };
6243
+ reservationState: "held" | "finalizing" | "committed" | "released" | "expired";
6244
+ /** @description The finalize response, exactly as first returned. */
6245
+ result: {
6246
+ [key: string]: unknown;
6247
+ };
6248
+ } | {
6249
+ /** @enum {string} */
6250
+ source: "chain";
6251
+ intentId: string;
6252
+ registryVersion: number;
6253
+ /**
6254
+ * @description The caller's credit reservation for this intent: `held` (reserved, not finalized), `finalizing` (finalize forwarded, outcome pending), `committed` (charged), `released` / `expired` (refunded; nothing was charged).
6255
+ * @enum {string|null}
6256
+ */
6257
+ reservationState: "held" | "finalizing" | "committed" | "released" | "expired" | null;
6258
+ /**
6259
+ * WitnessIntentChainStatus
6260
+ * @description chain-api's status for the intent, verbatim.
6261
+ */
6262
+ status: {
6263
+ intentId: string;
6264
+ contractAddress: string;
6265
+ registryVersion: number;
6266
+ /** @enum {string} */
6267
+ status: "prepared" | "allocated" | "submitted" | "confirmed" | "failed" | "cancelled" | "expired_unsubmitted" | "unknown";
6268
+ prepareTtlSeconds: number;
6269
+ /** @description Present when `confirmed`. */
6270
+ witnessId?: string;
6271
+ /** @description Present when `confirmed`. */
6272
+ transactionHash?: string;
6273
+ /** @description Present when `confirmed`. */
6274
+ blockNumber?: number;
6275
+ /** @description Present when `unknown`. */
6276
+ reason?: string;
6277
+ };
6278
+ };
6279
+ };
6280
+ };
6281
+ /** @description Bad Request — validation failed */
6282
+ 400: {
6283
+ headers: {
6284
+ [name: string]: unknown;
6285
+ };
6286
+ content: {
6287
+ "application/json": {
6288
+ /**
6289
+ * @description HTTP status code
6290
+ * @example 400
6291
+ */
6292
+ statusCode?: number;
6293
+ /**
6294
+ * @description Short error label
6295
+ * @example Bad Request
6296
+ */
6297
+ error?: string;
6298
+ /**
6299
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6300
+ * @example Validation failed
6301
+ */
6302
+ message: string | string[];
6303
+ };
6304
+ };
6305
+ };
5717
6306
  /** @description Unauthorized — authentication required or invalid */
5718
6307
  401: {
5719
6308
  headers: {
@@ -5739,8 +6328,8 @@ interface paths$1 {
5739
6328
  };
5740
6329
  };
5741
6330
  };
5742
- /** @description Conflict */
5743
- 409: {
6331
+ /** @description Forbidden — insufficient permissions or scope */
6332
+ 403: {
5744
6333
  headers: {
5745
6334
  [name: string]: unknown;
5746
6335
  };
@@ -5764,8 +6353,8 @@ interface paths$1 {
5764
6353
  };
5765
6354
  };
5766
6355
  };
5767
- /** @description Too Many Requests */
5768
- 429: {
6356
+ /** @description Not Found */
6357
+ 404: {
5769
6358
  headers: {
5770
6359
  [name: string]: unknown;
5771
6360
  };
@@ -5791,13 +6380,15 @@ interface paths$1 {
5791
6380
  };
5792
6381
  };
5793
6382
  };
6383
+ put?: never;
6384
+ post?: never;
5794
6385
  delete?: never;
5795
6386
  options?: never;
5796
6387
  head?: never;
5797
6388
  patch?: never;
5798
6389
  trace?: never;
5799
6390
  };
5800
- "/v1/account": {
6391
+ "/v4/contracts/{contractAddress}/witnesses/intents/{intentId}": {
5801
6392
  parameters: {
5802
6393
  query?: never;
5803
6394
  header?: never;
@@ -5805,14 +6396,17 @@ interface paths$1 {
5805
6396
  cookie?: never;
5806
6397
  };
5807
6398
  /**
5808
- * Read the authenticated user's account
5809
- * @description Returns the user profile, a summary of their organisation, and the list of signing keys (active + revoked).
6399
+ * Recover a v4 witness intent's outcome
6400
+ * @description For a client that lost a finalize (or propose) response. Returns the stored finalize response when accounts has one, otherwise chain-api's status for the intent. The URL contract must be the caller's. Read-only: never finalizes.
5810
6401
  */
5811
6402
  get: {
5812
6403
  parameters: {
5813
6404
  query?: never;
5814
6405
  header?: never;
5815
- path?: never;
6406
+ path: {
6407
+ contractAddress: string;
6408
+ intentId: string;
6409
+ };
5816
6410
  cookie?: never;
5817
6411
  };
5818
6412
  requestBody?: never;
@@ -5824,89 +6418,74 @@ interface paths$1 {
5824
6418
  };
5825
6419
  content: {
5826
6420
  "application/json": {
5827
- /** AccountUser */
5828
- user: {
5829
- /**
5830
- * @description UUID v4
5831
- * @example 550e8400-e29b-41d4-a716-446655440000
5832
- */
5833
- id: string;
5834
- /**
5835
- * Format: email
5836
- * @description RFC 5321 email address
5837
- * @example user@example.com
5838
- */
5839
- email: string;
5840
- /**
5841
- * Format: date-time
5842
- * @description ISO 8601 date-time string
5843
- * @example 2026-05-20T10:30:00.000Z
5844
- */
5845
- emailVerifiedAt: string | null;
5846
- /**
5847
- * @description Ethereum address (0x + 40 hex characters)
5848
- * @example 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0
5849
- */
5850
- contractAddress: string | null;
5851
- /**
5852
- * @description Ed25519 public key — 32 bytes hex-encoded (64 chars, no 0x prefix)
5853
- * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
5854
- */
5855
- ownerPublicKey: string | null;
5856
- /** @description Server-cached owner nonce (`ownerNonceCached`). */
5857
- ownerNonce: number | null;
5858
- externalUserId: string | null;
5859
- /**
5860
- * Format: uri
5861
- * @description Webhook URL for chain-api to hit on witness settle (per-user).
5862
- */
5863
- callbackUrl: string | null;
6421
+ /** @enum {string} */
6422
+ source: "stored";
6423
+ intentId: string;
6424
+ registryVersion: number;
6425
+ /**
6426
+ * @description The caller's credit reservation for this intent: `held` (reserved, not finalized), `finalizing` (finalize forwarded, outcome pending), `committed` (charged), `released` / `expired` (refunded; nothing was charged).
6427
+ * @enum {string}
6428
+ */
6429
+ reservationState: "held" | "finalizing" | "committed" | "released" | "expired";
6430
+ /** @description The finalize response, exactly as first returned. */
6431
+ result: {
6432
+ [key: string]: unknown;
5864
6433
  };
5865
- /** AccountOrgSummary */
5866
- organization: {
5867
- /**
5868
- * @description UUID v4
5869
- * @example 550e8400-e29b-41d4-a716-446655440000
5870
- */
5871
- id: string;
5872
- name: string;
5873
- /**
5874
- * Format: email
5875
- * @description RFC 5321 email address
5876
- * @example user@example.com
5877
- */
5878
- email: string;
5879
- /**
5880
- * @description `metered` orgs pay per witness (credit ledger drives gating). `unlimited` orgs are flat-fee billed outside Stripe Checkout.
5881
- * @enum {string}
5882
- */
5883
- accountType: "metered" | "unlimited";
5884
- /** @description Cached credit balance; `null` for `unlimited` orgs. */
5885
- balance: number | null;
5886
- isPersonal: boolean;
6434
+ } | {
6435
+ /** @enum {string} */
6436
+ source: "chain";
6437
+ intentId: string;
6438
+ registryVersion: number;
6439
+ /**
6440
+ * @description The caller's credit reservation for this intent: `held` (reserved, not finalized), `finalizing` (finalize forwarded, outcome pending), `committed` (charged), `released` / `expired` (refunded; nothing was charged).
6441
+ * @enum {string|null}
6442
+ */
6443
+ reservationState: "held" | "finalizing" | "committed" | "released" | "expired" | null;
6444
+ /**
6445
+ * WitnessIntentChainStatus
6446
+ * @description chain-api's status for the intent, verbatim.
6447
+ */
6448
+ status: {
6449
+ intentId: string;
6450
+ contractAddress: string;
6451
+ registryVersion: number;
6452
+ /** @enum {string} */
6453
+ status: "prepared" | "allocated" | "submitted" | "confirmed" | "failed" | "cancelled" | "expired_unsubmitted" | "unknown";
6454
+ prepareTtlSeconds: number;
6455
+ /** @description Present when `confirmed`. */
6456
+ witnessId?: string;
6457
+ /** @description Present when `confirmed`. */
6458
+ transactionHash?: string;
6459
+ /** @description Present when `confirmed`. */
6460
+ blockNumber?: number;
6461
+ /** @description Present when `unknown`. */
6462
+ reason?: string;
5887
6463
  };
5888
- signingKeys: {
5889
- /**
5890
- * @description Ed25519 public key — 32 bytes hex-encoded (64 chars, no 0x prefix)
5891
- * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
5892
- */
5893
- publicKey: string;
5894
- label: string | null;
5895
- /**
5896
- * Format: date-time
5897
- * @description ISO 8601 date-time string
5898
- * @example 2026-05-20T10:30:00.000Z
5899
- */
5900
- addedAt: string;
5901
- /**
5902
- * Format: date-time
5903
- * @description ISO 8601 date-time string
5904
- * @example 2026-05-20T10:30:00.000Z
5905
- */
5906
- revokedAt: string | null;
5907
- /** @description `true` iff `revokedAt` is null. Convenience for clients. */
5908
- active: boolean;
5909
- }[];
6464
+ };
6465
+ };
6466
+ };
6467
+ /** @description Bad Request — validation failed */
6468
+ 400: {
6469
+ headers: {
6470
+ [name: string]: unknown;
6471
+ };
6472
+ content: {
6473
+ "application/json": {
6474
+ /**
6475
+ * @description HTTP status code
6476
+ * @example 400
6477
+ */
6478
+ statusCode?: number;
6479
+ /**
6480
+ * @description Short error label
6481
+ * @example Bad Request
6482
+ */
6483
+ error?: string;
6484
+ /**
6485
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6486
+ * @example Validation failed
6487
+ */
6488
+ message: string | string[];
5910
6489
  };
5911
6490
  };
5912
6491
  };
@@ -5935,6 +6514,31 @@ interface paths$1 {
5935
6514
  };
5936
6515
  };
5937
6516
  };
6517
+ /** @description Forbidden — insufficient permissions or scope */
6518
+ 403: {
6519
+ headers: {
6520
+ [name: string]: unknown;
6521
+ };
6522
+ content: {
6523
+ "application/json": {
6524
+ /**
6525
+ * @description HTTP status code
6526
+ * @example 400
6527
+ */
6528
+ statusCode?: number;
6529
+ /**
6530
+ * @description Short error label
6531
+ * @example Bad Request
6532
+ */
6533
+ error?: string;
6534
+ /**
6535
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6536
+ * @example Validation failed
6537
+ */
6538
+ message: string | string[];
6539
+ };
6540
+ };
6541
+ };
5938
6542
  /** @description Not Found */
5939
6543
  404: {
5940
6544
  headers: {
@@ -5964,15 +6568,31 @@ interface paths$1 {
5964
6568
  };
5965
6569
  put?: never;
5966
6570
  post?: never;
6571
+ delete?: never;
6572
+ options?: never;
6573
+ head?: never;
6574
+ patch?: never;
6575
+ trace?: never;
6576
+ };
6577
+ "/v5/contracts/{contractAddress}/witnesses/intents/{intentId}": {
6578
+ parameters: {
6579
+ query?: never;
6580
+ header?: never;
6581
+ path?: never;
6582
+ cookie?: never;
6583
+ };
5967
6584
  /**
5968
- * DEV-ONLY: delete the caller's account (pre-launch reset)
5969
- * @description Hard-deletes the authenticated user + their organisation + contracts + delegated keys (Vault keys destroyed too) so signup can be re-run from scratch. Gated behind WITNIUM_PRE_LAUNCH — returns 403 otherwise. The on-chain contract is orphaned (immutable). This endpoint is removed before customer onboarding; do not build product UI on it.
6585
+ * Recover a v5 witness intent's outcome
6586
+ * @description For a client that lost a finalize (or propose) response. Returns the stored finalize response when accounts has one, otherwise chain-api's status for the intent. The URL contract must be the caller's. Read-only: never finalizes.
5970
6587
  */
5971
- delete: {
6588
+ get: {
5972
6589
  parameters: {
5973
6590
  query?: never;
5974
6591
  header?: never;
5975
- path?: never;
6592
+ path: {
6593
+ contractAddress: string;
6594
+ intentId: string;
6595
+ };
5976
6596
  cookie?: never;
5977
6597
  };
5978
6598
  requestBody?: never;
@@ -5984,26 +6604,54 @@ interface paths$1 {
5984
6604
  };
5985
6605
  content: {
5986
6606
  "application/json": {
5987
- /** @enum {boolean} */
5988
- deleted: true;
6607
+ /** @enum {string} */
6608
+ source: "stored";
6609
+ intentId: string;
6610
+ registryVersion: number;
5989
6611
  /**
5990
- * @description UUID v4
5991
- * @example 550e8400-e29b-41d4-a716-446655440000
6612
+ * @description The caller's credit reservation for this intent: `held` (reserved, not finalized), `finalizing` (finalize forwarded, outcome pending), `committed` (charged), `released` / `expired` (refunded; nothing was charged).
6613
+ * @enum {string}
5992
6614
  */
5993
- userId: string;
6615
+ reservationState: "held" | "finalizing" | "committed" | "released" | "expired";
6616
+ /** @description The finalize response, exactly as first returned. */
6617
+ result: {
6618
+ [key: string]: unknown;
6619
+ };
6620
+ } | {
6621
+ /** @enum {string} */
6622
+ source: "chain";
6623
+ intentId: string;
6624
+ registryVersion: number;
5994
6625
  /**
5995
- * @description UUID v4
5996
- * @example 550e8400-e29b-41d4-a716-446655440000
6626
+ * @description The caller's credit reservation for this intent: `held` (reserved, not finalized), `finalizing` (finalize forwarded, outcome pending), `committed` (charged), `released` / `expired` (refunded; nothing was charged).
6627
+ * @enum {string|null}
5997
6628
  */
5998
- organizationId: string;
5999
- /** @description How many OpenBao Transit keys were destroyed. */
6000
- vaultKeysPurged: number;
6001
- notice: string;
6629
+ reservationState: "held" | "finalizing" | "committed" | "released" | "expired" | null;
6630
+ /**
6631
+ * WitnessIntentChainStatus
6632
+ * @description chain-api's status for the intent, verbatim.
6633
+ */
6634
+ status: {
6635
+ intentId: string;
6636
+ contractAddress: string;
6637
+ registryVersion: number;
6638
+ /** @enum {string} */
6639
+ status: "prepared" | "allocated" | "submitted" | "confirmed" | "failed" | "cancelled" | "expired_unsubmitted" | "unknown";
6640
+ prepareTtlSeconds: number;
6641
+ /** @description Present when `confirmed`. */
6642
+ witnessId?: string;
6643
+ /** @description Present when `confirmed`. */
6644
+ transactionHash?: string;
6645
+ /** @description Present when `confirmed`. */
6646
+ blockNumber?: number;
6647
+ /** @description Present when `unknown`. */
6648
+ reason?: string;
6649
+ };
6002
6650
  };
6003
6651
  };
6004
6652
  };
6005
- /** @description Unauthorized — authentication required or invalid */
6006
- 401: {
6653
+ /** @description Bad Request — validation failed */
6654
+ 400: {
6007
6655
  headers: {
6008
6656
  [name: string]: unknown;
6009
6657
  };
@@ -6027,8 +6675,8 @@ interface paths$1 {
6027
6675
  };
6028
6676
  };
6029
6677
  };
6030
- /** @description Forbidden — insufficient permissions or scope */
6031
- 403: {
6678
+ /** @description Unauthorized — authentication required or invalid */
6679
+ 401: {
6032
6680
  headers: {
6033
6681
  [name: string]: unknown;
6034
6682
  };
@@ -6052,76 +6700,730 @@ interface paths$1 {
6052
6700
  };
6053
6701
  };
6054
6702
  };
6055
- };
6056
- };
6057
- options?: never;
6058
- head?: never;
6059
- patch?: never;
6703
+ /** @description Forbidden — insufficient permissions or scope */
6704
+ 403: {
6705
+ headers: {
6706
+ [name: string]: unknown;
6707
+ };
6708
+ content: {
6709
+ "application/json": {
6710
+ /**
6711
+ * @description HTTP status code
6712
+ * @example 400
6713
+ */
6714
+ statusCode?: number;
6715
+ /**
6716
+ * @description Short error label
6717
+ * @example Bad Request
6718
+ */
6719
+ error?: string;
6720
+ /**
6721
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6722
+ * @example Validation failed
6723
+ */
6724
+ message: string | string[];
6725
+ };
6726
+ };
6727
+ };
6728
+ /** @description Not Found */
6729
+ 404: {
6730
+ headers: {
6731
+ [name: string]: unknown;
6732
+ };
6733
+ content: {
6734
+ "application/json": {
6735
+ /**
6736
+ * @description HTTP status code
6737
+ * @example 400
6738
+ */
6739
+ statusCode?: number;
6740
+ /**
6741
+ * @description Short error label
6742
+ * @example Bad Request
6743
+ */
6744
+ error?: string;
6745
+ /**
6746
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6747
+ * @example Validation failed
6748
+ */
6749
+ message: string | string[];
6750
+ };
6751
+ };
6752
+ };
6753
+ };
6754
+ };
6755
+ put?: never;
6756
+ post?: never;
6757
+ delete?: never;
6758
+ options?: never;
6759
+ head?: never;
6760
+ patch?: never;
6761
+ trace?: never;
6762
+ };
6763
+ "/v1/account/provisioning-token/reissue": {
6764
+ parameters: {
6765
+ query?: never;
6766
+ header?: never;
6767
+ path?: never;
6768
+ cookie?: never;
6769
+ };
6770
+ get?: never;
6771
+ put?: never;
6772
+ /**
6773
+ * Re-mint a provisioning token (verified-but-not-provisioned recovery)
6774
+ * @description Mints a fresh single-use provisioning token for a signed-in user whose email is verified but who has no contract yet — recovery for when the token from email-verify was lost (e.g. verify opened on another device). Returns 409 if email is unverified or a contract already exists. Rate limited per account.
6775
+ */
6776
+ post: {
6777
+ parameters: {
6778
+ query?: never;
6779
+ header?: never;
6780
+ path?: never;
6781
+ cookie?: never;
6782
+ };
6783
+ requestBody?: never;
6784
+ responses: {
6785
+ /** @description Success */
6786
+ 200: {
6787
+ headers: {
6788
+ [name: string]: unknown;
6789
+ };
6790
+ content: {
6791
+ "application/json": {
6792
+ provisioningToken: string;
6793
+ /**
6794
+ * Format: date-time
6795
+ * @description ISO 8601 date-time string
6796
+ * @example 2026-05-20T10:30:00.000Z
6797
+ */
6798
+ expiresAt: string;
6799
+ };
6800
+ };
6801
+ };
6802
+ /** @description Unauthorized — authentication required or invalid */
6803
+ 401: {
6804
+ headers: {
6805
+ [name: string]: unknown;
6806
+ };
6807
+ content: {
6808
+ "application/json": {
6809
+ /**
6810
+ * @description HTTP status code
6811
+ * @example 400
6812
+ */
6813
+ statusCode?: number;
6814
+ /**
6815
+ * @description Short error label
6816
+ * @example Bad Request
6817
+ */
6818
+ error?: string;
6819
+ /**
6820
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6821
+ * @example Validation failed
6822
+ */
6823
+ message: string | string[];
6824
+ };
6825
+ };
6826
+ };
6827
+ /** @description Conflict */
6828
+ 409: {
6829
+ headers: {
6830
+ [name: string]: unknown;
6831
+ };
6832
+ content: {
6833
+ "application/json": {
6834
+ /**
6835
+ * @description HTTP status code
6836
+ * @example 400
6837
+ */
6838
+ statusCode?: number;
6839
+ /**
6840
+ * @description Short error label
6841
+ * @example Bad Request
6842
+ */
6843
+ error?: string;
6844
+ /**
6845
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6846
+ * @example Validation failed
6847
+ */
6848
+ message: string | string[];
6849
+ };
6850
+ };
6851
+ };
6852
+ /** @description Too Many Requests */
6853
+ 429: {
6854
+ headers: {
6855
+ [name: string]: unknown;
6856
+ };
6857
+ content: {
6858
+ "application/json": {
6859
+ /**
6860
+ * @description HTTP status code
6861
+ * @example 400
6862
+ */
6863
+ statusCode?: number;
6864
+ /**
6865
+ * @description Short error label
6866
+ * @example Bad Request
6867
+ */
6868
+ error?: string;
6869
+ /**
6870
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6871
+ * @example Validation failed
6872
+ */
6873
+ message: string | string[];
6874
+ };
6875
+ };
6876
+ };
6877
+ };
6878
+ };
6879
+ delete?: never;
6880
+ options?: never;
6881
+ head?: never;
6882
+ patch?: never;
6883
+ trace?: never;
6884
+ };
6885
+ "/v1/account": {
6886
+ parameters: {
6887
+ query?: never;
6888
+ header?: never;
6889
+ path?: never;
6890
+ cookie?: never;
6891
+ };
6892
+ /**
6893
+ * Read the authenticated user's account
6894
+ * @description Returns the user profile, a summary of their organisation, and the list of signing keys (active + revoked).
6895
+ */
6896
+ get: {
6897
+ parameters: {
6898
+ query?: never;
6899
+ header?: never;
6900
+ path?: never;
6901
+ cookie?: never;
6902
+ };
6903
+ requestBody?: never;
6904
+ responses: {
6905
+ /** @description Success */
6906
+ 200: {
6907
+ headers: {
6908
+ [name: string]: unknown;
6909
+ };
6910
+ content: {
6911
+ "application/json": {
6912
+ /** AccountUser */
6913
+ user: {
6914
+ /**
6915
+ * @description UUID v4
6916
+ * @example 550e8400-e29b-41d4-a716-446655440000
6917
+ */
6918
+ id: string;
6919
+ /**
6920
+ * Format: email
6921
+ * @description RFC 5321 email address
6922
+ * @example user@example.com
6923
+ */
6924
+ email: string;
6925
+ /**
6926
+ * Format: date-time
6927
+ * @description ISO 8601 date-time string
6928
+ * @example 2026-05-20T10:30:00.000Z
6929
+ */
6930
+ emailVerifiedAt: string | null;
6931
+ /**
6932
+ * @description Ethereum address (0x + 40 hex characters)
6933
+ * @example 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0
6934
+ */
6935
+ contractAddress: string | null;
6936
+ /**
6937
+ * @description Ed25519 public key — 32 bytes hex-encoded (64 chars, no 0x prefix)
6938
+ * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
6939
+ */
6940
+ ownerPublicKey: string | null;
6941
+ /** @description Server-cached owner nonce (`ownerNonceCached`). */
6942
+ ownerNonce: number | null;
6943
+ externalUserId: string | null;
6944
+ /**
6945
+ * Format: uri
6946
+ * @description Webhook URL for chain-api to hit on witness settle (per-user).
6947
+ */
6948
+ callbackUrl: string | null;
6949
+ };
6950
+ /** AccountOrgSummary */
6951
+ organization: {
6952
+ /**
6953
+ * @description UUID v4
6954
+ * @example 550e8400-e29b-41d4-a716-446655440000
6955
+ */
6956
+ id: string;
6957
+ name: string;
6958
+ /**
6959
+ * Format: email
6960
+ * @description RFC 5321 email address
6961
+ * @example user@example.com
6962
+ */
6963
+ email: string;
6964
+ /**
6965
+ * @description `metered` orgs pay per witness (credit ledger drives gating). `unlimited` orgs are flat-fee billed outside Stripe Checkout.
6966
+ * @enum {string}
6967
+ */
6968
+ accountType: "metered" | "unlimited";
6969
+ /**
6970
+ * @description Subscription plan tier (drives the UI badge).
6971
+ * @enum {string}
6972
+ */
6973
+ plan: "free" | "starter" | "professional" | "business" | "enterprise";
6974
+ /**
6975
+ * @description Stripe subscription state; `none` on the free tier.
6976
+ * @enum {string}
6977
+ */
6978
+ subscriptionStatus: "none" | "active" | "past_due" | "canceled";
6979
+ /** @description ISO end of the current paid period ("Renews on…"); null on free. */
6980
+ currentPeriodEnd: string | null;
6981
+ /** @description Cached credit balance; `null` for `unlimited` orgs. */
6982
+ balance: number | null;
6983
+ isPersonal: boolean;
6984
+ };
6985
+ signingKeys: {
6986
+ /**
6987
+ * @description Ed25519 public key — 32 bytes hex-encoded (64 chars, no 0x prefix)
6988
+ * @example 4cdde7a3e3a1d8a48d2b9eaf2bcbe2db1d57d3e1a8d6c20e0a86c0f9c4b6cf2e
6989
+ */
6990
+ publicKey: string;
6991
+ label: string | null;
6992
+ /**
6993
+ * Format: date-time
6994
+ * @description ISO 8601 date-time string
6995
+ * @example 2026-05-20T10:30:00.000Z
6996
+ */
6997
+ addedAt: string;
6998
+ /**
6999
+ * Format: date-time
7000
+ * @description ISO 8601 date-time string
7001
+ * @example 2026-05-20T10:30:00.000Z
7002
+ */
7003
+ revokedAt: string | null;
7004
+ /** @description `true` iff `revokedAt` is null. Convenience for clients. */
7005
+ active: boolean;
7006
+ }[];
7007
+ };
7008
+ };
7009
+ };
7010
+ /** @description Unauthorized — authentication required or invalid */
7011
+ 401: {
7012
+ headers: {
7013
+ [name: string]: unknown;
7014
+ };
7015
+ content: {
7016
+ "application/json": {
7017
+ /**
7018
+ * @description HTTP status code
7019
+ * @example 400
7020
+ */
7021
+ statusCode?: number;
7022
+ /**
7023
+ * @description Short error label
7024
+ * @example Bad Request
7025
+ */
7026
+ error?: string;
7027
+ /**
7028
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7029
+ * @example Validation failed
7030
+ */
7031
+ message: string | string[];
7032
+ };
7033
+ };
7034
+ };
7035
+ /** @description Not Found */
7036
+ 404: {
7037
+ headers: {
7038
+ [name: string]: unknown;
7039
+ };
7040
+ content: {
7041
+ "application/json": {
7042
+ /**
7043
+ * @description HTTP status code
7044
+ * @example 400
7045
+ */
7046
+ statusCode?: number;
7047
+ /**
7048
+ * @description Short error label
7049
+ * @example Bad Request
7050
+ */
7051
+ error?: string;
7052
+ /**
7053
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7054
+ * @example Validation failed
7055
+ */
7056
+ message: string | string[];
7057
+ };
7058
+ };
7059
+ };
7060
+ };
7061
+ };
7062
+ put?: never;
7063
+ post?: never;
7064
+ /**
7065
+ * DEV-ONLY: delete the caller's account (pre-launch reset)
7066
+ * @description Hard-deletes the authenticated user + their organisation + contracts + delegated keys (Vault keys destroyed too) so signup can be re-run from scratch. Gated behind WITNIUM_PRE_LAUNCH — returns 403 otherwise. The on-chain contract is orphaned (immutable). This endpoint is removed before customer onboarding; do not build product UI on it.
7067
+ */
7068
+ delete: {
7069
+ parameters: {
7070
+ query?: never;
7071
+ header?: never;
7072
+ path?: never;
7073
+ cookie?: never;
7074
+ };
7075
+ requestBody?: never;
7076
+ responses: {
7077
+ /** @description Success */
7078
+ 200: {
7079
+ headers: {
7080
+ [name: string]: unknown;
7081
+ };
7082
+ content: {
7083
+ "application/json": {
7084
+ /** @enum {boolean} */
7085
+ deleted: true;
7086
+ /**
7087
+ * @description UUID v4
7088
+ * @example 550e8400-e29b-41d4-a716-446655440000
7089
+ */
7090
+ userId: string;
7091
+ /**
7092
+ * @description UUID v4
7093
+ * @example 550e8400-e29b-41d4-a716-446655440000
7094
+ */
7095
+ organizationId: string;
7096
+ /** @description True if the org was also deleted (personal org). False for a shared org, where only the caller was removed and the org left intact. */
7097
+ orgDeleted: boolean;
7098
+ /** @description How many OpenBao Transit keys were destroyed. */
7099
+ vaultKeysPurged: number;
7100
+ notice: string;
7101
+ };
7102
+ };
7103
+ };
7104
+ /** @description Unauthorized — authentication required or invalid */
7105
+ 401: {
7106
+ headers: {
7107
+ [name: string]: unknown;
7108
+ };
7109
+ content: {
7110
+ "application/json": {
7111
+ /**
7112
+ * @description HTTP status code
7113
+ * @example 400
7114
+ */
7115
+ statusCode?: number;
7116
+ /**
7117
+ * @description Short error label
7118
+ * @example Bad Request
7119
+ */
7120
+ error?: string;
7121
+ /**
7122
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7123
+ * @example Validation failed
7124
+ */
7125
+ message: string | string[];
7126
+ };
7127
+ };
7128
+ };
7129
+ /** @description Forbidden — insufficient permissions or scope */
7130
+ 403: {
7131
+ headers: {
7132
+ [name: string]: unknown;
7133
+ };
7134
+ content: {
7135
+ "application/json": {
7136
+ /**
7137
+ * @description HTTP status code
7138
+ * @example 400
7139
+ */
7140
+ statusCode?: number;
7141
+ /**
7142
+ * @description Short error label
7143
+ * @example Bad Request
7144
+ */
7145
+ error?: string;
7146
+ /**
7147
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7148
+ * @example Validation failed
7149
+ */
7150
+ message: string | string[];
7151
+ };
7152
+ };
7153
+ };
7154
+ };
7155
+ };
7156
+ options?: never;
7157
+ head?: never;
7158
+ patch?: never;
7159
+ trace?: never;
7160
+ };
7161
+ "/v1/account/ledger": {
7162
+ parameters: {
7163
+ query?: never;
7164
+ header?: never;
7165
+ path?: never;
7166
+ cookie?: never;
7167
+ };
7168
+ /**
7169
+ * Read the org's credit ledger
7170
+ * @description Returns the most recent 200 ledger entries for the authenticated user's organisation. Use to render the credits/billing history view.
7171
+ */
7172
+ get: {
7173
+ parameters: {
7174
+ query?: never;
7175
+ header?: never;
7176
+ path?: never;
7177
+ cookie?: never;
7178
+ };
7179
+ requestBody?: never;
7180
+ responses: {
7181
+ /** @description Success */
7182
+ 200: {
7183
+ headers: {
7184
+ [name: string]: unknown;
7185
+ };
7186
+ content: {
7187
+ "application/json": {
7188
+ entries: {
7189
+ /**
7190
+ * @description UUID v4
7191
+ * @example 550e8400-e29b-41d4-a716-446655440000
7192
+ */
7193
+ id: string;
7194
+ /**
7195
+ * @description UUID v4
7196
+ * @example 550e8400-e29b-41d4-a716-446655440000
7197
+ */
7198
+ organizationId: string;
7199
+ /**
7200
+ * @description Set when the entry was caused by a user action; null for org-level grants.
7201
+ * @example 550e8400-e29b-41d4-a716-446655440000
7202
+ */
7203
+ userId: string | null;
7204
+ /** @description Positive = credits added, negative = credits consumed/released. */
7205
+ delta: number;
7206
+ /**
7207
+ * LedgerReason
7208
+ * @description Why a credit-ledger entry was written. Matches the pg enum on disk.
7209
+ * @enum {string}
7210
+ */
7211
+ reason: "signup_grant" | "purchase" | "subscription_grant" | "reservation_hold" | "reservation_commit" | "reservation_release" | "adjustment";
7212
+ /** @description External ref (e.g. Stripe session ID, witnessId). */
7213
+ ref: string | null;
7214
+ note: string | null;
7215
+ /**
7216
+ * Format: date-time
7217
+ * @description ISO 8601 date-time string
7218
+ * @example 2026-05-20T10:30:00.000Z
7219
+ */
7220
+ createdAt: string;
7221
+ }[];
7222
+ };
7223
+ };
7224
+ };
7225
+ /** @description Unauthorized — authentication required or invalid */
7226
+ 401: {
7227
+ headers: {
7228
+ [name: string]: unknown;
7229
+ };
7230
+ content: {
7231
+ "application/json": {
7232
+ /**
7233
+ * @description HTTP status code
7234
+ * @example 400
7235
+ */
7236
+ statusCode?: number;
7237
+ /**
7238
+ * @description Short error label
7239
+ * @example Bad Request
7240
+ */
7241
+ error?: string;
7242
+ /**
7243
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7244
+ * @example Validation failed
7245
+ */
7246
+ message: string | string[];
7247
+ };
7248
+ };
7249
+ };
7250
+ };
7251
+ };
7252
+ put?: never;
7253
+ post?: never;
7254
+ delete?: never;
7255
+ options?: never;
7256
+ head?: never;
7257
+ patch?: never;
7258
+ trace?: never;
7259
+ };
7260
+ "/v1/oauth/sessions": {
7261
+ parameters: {
7262
+ query?: never;
7263
+ header?: never;
7264
+ path?: never;
7265
+ cookie?: never;
7266
+ };
7267
+ /**
7268
+ * List the caller's active OAuth sessions
7269
+ * @description Returns every non-revoked, non-expired access + refresh token belonging to the authenticated user. Drives the "active devices" view in the dashboard.
7270
+ */
7271
+ get: {
7272
+ parameters: {
7273
+ query?: never;
7274
+ header?: never;
7275
+ path?: never;
7276
+ cookie?: never;
7277
+ };
7278
+ requestBody?: never;
7279
+ responses: {
7280
+ /** @description Success */
7281
+ 200: {
7282
+ headers: {
7283
+ [name: string]: unknown;
7284
+ };
7285
+ content: {
7286
+ "application/json": {
7287
+ sessions: {
7288
+ /** @description Opaque identifier of the token: the sha256 of its id, never the token itself. Use as the path param for DELETE. */
7289
+ jti: string;
7290
+ /** @enum {string} */
7291
+ kind: "AccessToken" | "RefreshToken";
7292
+ clientId: string;
7293
+ /** @description Human-readable client name from oauth_clients (falls back to clientId). */
7294
+ clientName: string;
7295
+ /** @description Space-separated OAuth scopes granted to this token. */
7296
+ scope: string;
7297
+ /** @description `resource` claim from RFC 8707 — `aud` of the access token. Typically `https://api.witniumchain.com` for the chain RS. */
7298
+ resource: string | null;
7299
+ /**
7300
+ * Format: date-time
7301
+ * @description ISO 8601 date-time string
7302
+ * @example 2026-05-20T10:30:00.000Z
7303
+ */
7304
+ issuedAt: string;
7305
+ /**
7306
+ * Format: date-time
7307
+ * @description ISO 8601 date-time string
7308
+ * @example 2026-05-20T10:30:00.000Z
7309
+ */
7310
+ expiresAt: string;
7311
+ }[];
7312
+ };
7313
+ };
7314
+ };
7315
+ /** @description Unauthorized — authentication required or invalid */
7316
+ 401: {
7317
+ headers: {
7318
+ [name: string]: unknown;
7319
+ };
7320
+ content: {
7321
+ "application/json": {
7322
+ /**
7323
+ * @description HTTP status code
7324
+ * @example 400
7325
+ */
7326
+ statusCode?: number;
7327
+ /**
7328
+ * @description Short error label
7329
+ * @example Bad Request
7330
+ */
7331
+ error?: string;
7332
+ /**
7333
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7334
+ * @example Validation failed
7335
+ */
7336
+ message: string | string[];
7337
+ };
7338
+ };
7339
+ };
7340
+ };
7341
+ };
7342
+ put?: never;
7343
+ post?: never;
7344
+ /**
7345
+ * Revoke all of the caller's OAuth sessions
7346
+ * @description Cascades `revokeByGrantId` across every distinct grant the user holds, plus deletes any non-grant rows. Returns 204.
7347
+ */
7348
+ delete: {
7349
+ parameters: {
7350
+ query?: never;
7351
+ header?: never;
7352
+ path?: never;
7353
+ cookie?: never;
7354
+ };
7355
+ requestBody?: never;
7356
+ responses: {
7357
+ /** @description No Content */
7358
+ 204: {
7359
+ headers: {
7360
+ [name: string]: unknown;
7361
+ };
7362
+ content?: never;
7363
+ };
7364
+ /** @description Unauthorized — authentication required or invalid */
7365
+ 401: {
7366
+ headers: {
7367
+ [name: string]: unknown;
7368
+ };
7369
+ content: {
7370
+ "application/json": {
7371
+ /**
7372
+ * @description HTTP status code
7373
+ * @example 400
7374
+ */
7375
+ statusCode?: number;
7376
+ /**
7377
+ * @description Short error label
7378
+ * @example Bad Request
7379
+ */
7380
+ error?: string;
7381
+ /**
7382
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7383
+ * @example Validation failed
7384
+ */
7385
+ message: string | string[];
7386
+ };
7387
+ };
7388
+ };
7389
+ };
7390
+ };
7391
+ options?: never;
7392
+ head?: never;
7393
+ patch?: never;
6060
7394
  trace?: never;
6061
7395
  };
6062
- "/v1/account/ledger": {
7396
+ "/v1/oauth/sessions/{jti}": {
6063
7397
  parameters: {
6064
7398
  query?: never;
6065
7399
  header?: never;
6066
7400
  path?: never;
6067
7401
  cookie?: never;
6068
7402
  };
7403
+ get?: never;
7404
+ put?: never;
7405
+ post?: never;
6069
7406
  /**
6070
- * Read the org's credit ledger
6071
- * @description Returns the most recent 200 ledger entries for the authenticated user's organisation. Use to render the credits/billing history view.
7407
+ * Revoke a single OAuth session
7408
+ * @description Revokes one jti by walking up to its `grantId` and calling `provider.AccessToken.revokeByGrantId` — that cascades through the whole refresh-token rotation chain, not just this jti. Returns 204 whether the jti exists or not (to avoid leaking which jtis belong to which user).
6072
7409
  */
6073
- get: {
7410
+ delete: {
6074
7411
  parameters: {
6075
7412
  query?: never;
6076
7413
  header?: never;
6077
- path?: never;
7414
+ path: {
7415
+ jti: string;
7416
+ };
6078
7417
  cookie?: never;
6079
7418
  };
6080
7419
  requestBody?: never;
6081
7420
  responses: {
6082
- /** @description Success */
6083
- 200: {
7421
+ /** @description No Content */
7422
+ 204: {
6084
7423
  headers: {
6085
7424
  [name: string]: unknown;
6086
7425
  };
6087
- content: {
6088
- "application/json": {
6089
- entries: {
6090
- /**
6091
- * @description UUID v4
6092
- * @example 550e8400-e29b-41d4-a716-446655440000
6093
- */
6094
- id: string;
6095
- /**
6096
- * @description UUID v4
6097
- * @example 550e8400-e29b-41d4-a716-446655440000
6098
- */
6099
- organizationId: string;
6100
- /**
6101
- * @description Set when the entry was caused by a user action; null for org-level grants.
6102
- * @example 550e8400-e29b-41d4-a716-446655440000
6103
- */
6104
- userId: string | null;
6105
- /** @description Positive = credits added, negative = credits consumed/released. */
6106
- delta: number;
6107
- /**
6108
- * LedgerReason
6109
- * @description Why a credit-ledger entry was written. Matches the pg enum on disk.
6110
- * @enum {string}
6111
- */
6112
- reason: "signup_grant" | "purchase" | "subscription_grant" | "reservation_hold" | "reservation_commit" | "reservation_release" | "adjustment";
6113
- /** @description External ref (e.g. Stripe session ID, witnessId). */
6114
- ref: string | null;
6115
- note: string | null;
6116
- /**
6117
- * Format: date-time
6118
- * @description ISO 8601 date-time string
6119
- * @example 2026-05-20T10:30:00.000Z
6120
- */
6121
- createdAt: string;
6122
- }[];
6123
- };
6124
- };
7426
+ content?: never;
6125
7427
  };
6126
7428
  /** @description Unauthorized — authentication required or invalid */
6127
7429
  401: {
@@ -6150,33 +7452,39 @@ interface paths$1 {
6150
7452
  };
6151
7453
  };
6152
7454
  };
6153
- put?: never;
6154
- post?: never;
6155
- delete?: never;
6156
7455
  options?: never;
6157
7456
  head?: never;
6158
7457
  patch?: never;
6159
7458
  trace?: never;
6160
7459
  };
6161
- "/v1/oauth/sessions": {
7460
+ "/v1/oauth/introspect": {
6162
7461
  parameters: {
6163
7462
  query?: never;
6164
7463
  header?: never;
6165
7464
  path?: never;
6166
7465
  cookie?: never;
6167
7466
  };
7467
+ get?: never;
7468
+ put?: never;
6168
7469
  /**
6169
- * List the caller's active OAuth sessions
6170
- * @description Returns every non-revoked, non-expired access + refresh token belonging to the authenticated user. Drives the "active devices" view in the dashboard.
7470
+ * Check whether an accounts-minted access token is still active
7471
+ * @description For resource servers (MCP, chain API). Verifies the signature, then checks the security epoch, the grant or session the token came from, and the membership, uncached. Answers 200 `{active:false}` for any token that is not active. Callers MUST treat any non-200 answer or network failure as inactive. See docs/token-introspection.md.
6171
7472
  */
6172
- get: {
7473
+ post: {
6173
7474
  parameters: {
6174
7475
  query?: never;
6175
7476
  header?: never;
6176
7477
  path?: never;
6177
7478
  cookie?: never;
6178
7479
  };
6179
- requestBody?: never;
7480
+ requestBody?: {
7481
+ content: {
7482
+ "application/json": {
7483
+ /** @description The bearer JWT the caller received (an accounts-minted access token). */
7484
+ token: string;
7485
+ };
7486
+ };
7487
+ };
6180
7488
  responses: {
6181
7489
  /** @description Success */
6182
7490
  200: {
@@ -6185,36 +7493,42 @@ interface paths$1 {
6185
7493
  };
6186
7494
  content: {
6187
7495
  "application/json": {
6188
- sessions: {
6189
- /** @description Token identifier (UUID-shaped in practice). Use as the path param for DELETE. */
6190
- jti: string;
6191
- /** @enum {string} */
6192
- kind: "AccessToken" | "RefreshToken";
6193
- clientId: string;
6194
- /** @description Human-readable client name from oauth_clients (falls back to clientId). */
6195
- clientName: string;
6196
- /** @description Space-separated OAuth scopes granted to this token. */
6197
- scope: string;
6198
- /** @description `resource` claim from RFC 8707 — `aud` of the access token. Typically `https://api.witniumchain.com` for the chain RS. */
6199
- resource: string | null;
6200
- /**
6201
- * Format: date-time
6202
- * @description ISO 8601 date-time string
6203
- * @example 2026-05-20T10:30:00.000Z
6204
- */
6205
- issuedAt: string;
6206
- /**
6207
- * Format: date-time
6208
- * @description ISO 8601 date-time string
6209
- * @example 2026-05-20T10:30:00.000Z
6210
- */
6211
- expiresAt: string;
6212
- }[];
7496
+ /** @enum {boolean} */
7497
+ active: true;
7498
+ /**
7499
+ * @description `oauth`: issued by the OAuth flow from a grant. `session`: minted by POST /v1/auth/access-token.
7500
+ * @enum {string}
7501
+ */
7502
+ token_kind: "oauth" | "session";
7503
+ /** @description False when the membership in `org` is suspended: the caller MUST refuse writes. */
7504
+ writable: boolean;
7505
+ sub: string;
7506
+ client_id: string | null;
7507
+ scope: string;
7508
+ aud: string | string[] | unknown;
7509
+ iss: string;
7510
+ exp: number;
7511
+ iat: number;
7512
+ jti: string;
7513
+ /** @description Organization the token acts in; its membership is active. */
7514
+ org: string;
7515
+ /**
7516
+ * @description The CURRENT membership role in `org` (authoritative over the token's `role` claim).
7517
+ * @enum {string}
7518
+ */
7519
+ role: "org-admin" | "member";
7520
+ contracts: string[];
7521
+ sepoch: number;
7522
+ grant_id: string | null;
7523
+ session_id: string | null;
7524
+ } | {
7525
+ /** @enum {boolean} */
7526
+ active: false;
6213
7527
  };
6214
7528
  };
6215
7529
  };
6216
- /** @description Unauthorized — authentication required or invalid */
6217
- 401: {
7530
+ /** @description Bad Request — validation failed */
7531
+ 400: {
6218
7532
  headers: {
6219
7533
  [name: string]: unknown;
6220
7534
  };
@@ -6240,13 +7554,26 @@ interface paths$1 {
6240
7554
  };
6241
7555
  };
6242
7556
  };
7557
+ delete?: never;
7558
+ options?: never;
7559
+ head?: never;
7560
+ patch?: never;
7561
+ trace?: never;
7562
+ };
7563
+ "/v1/account/mfa/totp/enroll": {
7564
+ parameters: {
7565
+ query?: never;
7566
+ header?: never;
7567
+ path?: never;
7568
+ cookie?: never;
7569
+ };
7570
+ get?: never;
6243
7571
  put?: never;
6244
- post?: never;
6245
7572
  /**
6246
- * Revoke all of the caller's OAuth sessions
6247
- * @description Cascades `revokeByGrantId` across every distinct grant the user holds, plus deletes any non-grant rows. Returns 204.
7573
+ * Start TOTP enrolment
7574
+ * @description Generates a fresh TOTP secret + otpauth URL. The user scans the QR (rendered client-side from `otpauthUrl`) into their authenticator app and then calls `/v1/account/mfa/totp/confirm` with the first 6-digit code. The enrolment is NOT a usable second factor until confirmed.
6248
7575
  */
6249
- delete: {
7576
+ post: {
6250
7577
  parameters: {
6251
7578
  query?: never;
6252
7579
  header?: never;
@@ -6255,12 +7582,50 @@ interface paths$1 {
6255
7582
  };
6256
7583
  requestBody?: never;
6257
7584
  responses: {
6258
- /** @description No Content */
6259
- 204: {
7585
+ /** @description Created */
7586
+ 201: {
6260
7587
  headers: {
6261
7588
  [name: string]: unknown;
6262
7589
  };
6263
- content?: never;
7590
+ content: {
7591
+ "application/json": {
7592
+ /**
7593
+ * @description Base32 TOTP secret. Show to the user as a typeable fallback alongside the QR code rendered from `otpauthUrl`.
7594
+ * @example JBSWY3DPEHPK3PXP
7595
+ */
7596
+ secret: string;
7597
+ /**
7598
+ * @description Standard `otpauth://totp/...` URL. The dashboard renders this as a QR code; the user scans it with an authenticator app.
7599
+ * @example otpauth://totp/WitniumChain:alice%40example.com?secret=JBSWY3DPEHPK3PXP&issuer=WitniumChain&algorithm=SHA1&digits=6&period=30
7600
+ */
7601
+ otpauthUrl: string;
7602
+ };
7603
+ };
7604
+ };
7605
+ /** @description Bad Request — validation failed */
7606
+ 400: {
7607
+ headers: {
7608
+ [name: string]: unknown;
7609
+ };
7610
+ content: {
7611
+ "application/json": {
7612
+ /**
7613
+ * @description HTTP status code
7614
+ * @example 400
7615
+ */
7616
+ statusCode?: number;
7617
+ /**
7618
+ * @description Short error label
7619
+ * @example Bad Request
7620
+ */
7621
+ error?: string;
7622
+ /**
7623
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7624
+ * @example Validation failed
7625
+ */
7626
+ message: string | string[];
7627
+ };
7628
+ };
6264
7629
  };
6265
7630
  /** @description Unauthorized — authentication required or invalid */
6266
7631
  401: {
@@ -6289,12 +7654,13 @@ interface paths$1 {
6289
7654
  };
6290
7655
  };
6291
7656
  };
7657
+ delete?: never;
6292
7658
  options?: never;
6293
7659
  head?: never;
6294
7660
  patch?: never;
6295
7661
  trace?: never;
6296
7662
  };
6297
- "/v1/oauth/sessions/{jti}": {
7663
+ "/v1/account/mfa/totp/confirm": {
6298
7664
  parameters: {
6299
7665
  query?: never;
6300
7666
  header?: never;
@@ -6303,28 +7669,65 @@ interface paths$1 {
6303
7669
  };
6304
7670
  get?: never;
6305
7671
  put?: never;
6306
- post?: never;
6307
7672
  /**
6308
- * Revoke a single OAuth session
6309
- * @description Revokes one jti by walking up to its `grantId` and calling `provider.AccessToken.revokeByGrantId` — that cascades through the whole refresh-token rotation chain, not just this jti. Returns 204 whether the jti exists or not (to avoid leaking which jtis belong to which user).
7673
+ * Confirm TOTP enrolment
7674
+ * @description Validates the first user-supplied code against the secret minted by `/enroll`, marks the enrolment confirmed, and returns 10 single-use recovery codes. The recovery codes appear ONCE in this response and are never readable again — the dashboard must show them immediately and prompt the user to store them. Confirming bumps the user's security epoch: every OTHER session, session-minted access token and OAuth grant of the user ends; the calling session stays valid. Access tokens minted earlier from this session via `/v1/auth/access-token` stop working too and must be re-minted. 409 when the enrolment was restarted (`/enroll` called again) after this code was checked: scan the new QR code and confirm again. 429 when the per-user second-factor attempt budget is exhausted.
6310
7675
  */
6311
- delete: {
7676
+ post: {
6312
7677
  parameters: {
6313
7678
  query?: never;
6314
7679
  header?: never;
6315
- path: {
6316
- jti: string;
6317
- };
7680
+ path?: never;
6318
7681
  cookie?: never;
6319
7682
  };
6320
- requestBody?: never;
7683
+ requestBody?: {
7684
+ content: {
7685
+ "application/json": {
7686
+ /**
7687
+ * @description Current 6-digit TOTP code shown by the authenticator app.
7688
+ * @example 123456
7689
+ */
7690
+ code: string;
7691
+ };
7692
+ };
7693
+ };
6321
7694
  responses: {
6322
- /** @description No Content */
6323
- 204: {
7695
+ /** @description Created */
7696
+ 201: {
6324
7697
  headers: {
6325
7698
  [name: string]: unknown;
6326
7699
  };
6327
- content?: never;
7700
+ content: {
7701
+ "application/json": {
7702
+ /** @description Ten single-use recovery codes. Shown ONCE and never returned again — the user must store them now. Each code is consumed atomically when used in place of a TOTP code at MFA challenge time. */
7703
+ recoveryCodes: string[];
7704
+ };
7705
+ };
7706
+ };
7707
+ /** @description Bad Request — validation failed */
7708
+ 400: {
7709
+ headers: {
7710
+ [name: string]: unknown;
7711
+ };
7712
+ content: {
7713
+ "application/json": {
7714
+ /**
7715
+ * @description HTTP status code
7716
+ * @example 400
7717
+ */
7718
+ statusCode?: number;
7719
+ /**
7720
+ * @description Short error label
7721
+ * @example Bad Request
7722
+ */
7723
+ error?: string;
7724
+ /**
7725
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7726
+ * @example Validation failed
7727
+ */
7728
+ message: string | string[];
7729
+ };
7730
+ };
6328
7731
  };
6329
7732
  /** @description Unauthorized — authentication required or invalid */
6330
7733
  401: {
@@ -6351,57 +7754,8 @@ interface paths$1 {
6351
7754
  };
6352
7755
  };
6353
7756
  };
6354
- };
6355
- };
6356
- options?: never;
6357
- head?: never;
6358
- patch?: never;
6359
- trace?: never;
6360
- };
6361
- "/v1/account/mfa/totp/enroll": {
6362
- parameters: {
6363
- query?: never;
6364
- header?: never;
6365
- path?: never;
6366
- cookie?: never;
6367
- };
6368
- get?: never;
6369
- put?: never;
6370
- /**
6371
- * Start TOTP enrolment
6372
- * @description Generates a fresh TOTP secret + otpauth URL. The user scans the QR (rendered client-side from `otpauthUrl`) into their authenticator app and then calls `/v1/account/mfa/totp/confirm` with the first 6-digit code. The enrolment is NOT a usable second factor until confirmed.
6373
- */
6374
- post: {
6375
- parameters: {
6376
- query?: never;
6377
- header?: never;
6378
- path?: never;
6379
- cookie?: never;
6380
- };
6381
- requestBody?: never;
6382
- responses: {
6383
- /** @description Success */
6384
- 200: {
6385
- headers: {
6386
- [name: string]: unknown;
6387
- };
6388
- content: {
6389
- "application/json": {
6390
- /**
6391
- * @description Base32 TOTP secret. Show to the user as a typeable fallback alongside the QR code rendered from `otpauthUrl`.
6392
- * @example JBSWY3DPEHPK3PXP
6393
- */
6394
- secret: string;
6395
- /**
6396
- * @description Standard `otpauth://totp/...` URL. The dashboard renders this as a QR code; the user scans it with an authenticator app.
6397
- * @example otpauth://totp/WitniumChain:alice%40example.com?secret=JBSWY3DPEHPK3PXP&issuer=WitniumChain&algorithm=SHA1&digits=6&period=30
6398
- */
6399
- otpauthUrl: string;
6400
- };
6401
- };
6402
- };
6403
- /** @description Bad Request — validation failed */
6404
- 400: {
7757
+ /** @description Conflict */
7758
+ 409: {
6405
7759
  headers: {
6406
7760
  [name: string]: unknown;
6407
7761
  };
@@ -6425,8 +7779,8 @@ interface paths$1 {
6425
7779
  };
6426
7780
  };
6427
7781
  };
6428
- /** @description Unauthorized — authentication required or invalid */
6429
- 401: {
7782
+ /** @description Too Many Requests */
7783
+ 429: {
6430
7784
  headers: {
6431
7785
  [name: string]: unknown;
6432
7786
  };
@@ -6458,7 +7812,7 @@ interface paths$1 {
6458
7812
  patch?: never;
6459
7813
  trace?: never;
6460
7814
  };
6461
- "/v1/account/mfa/totp/confirm": {
7815
+ "/v1/account/mfa/totp": {
6462
7816
  parameters: {
6463
7817
  query?: never;
6464
7818
  header?: never;
@@ -6467,11 +7821,12 @@ interface paths$1 {
6467
7821
  };
6468
7822
  get?: never;
6469
7823
  put?: never;
7824
+ post?: never;
6470
7825
  /**
6471
- * Confirm TOTP enrolment
6472
- * @description Validates the first user-supplied code against the secret minted by `/enroll`, marks the enrolment confirmed, and returns 10 single-use recovery codes. The recovery codes appear ONCE in this response and are never readable again — the dashboard must show them immediately and prompt the user to store them.
7826
+ * Disable TOTP and clear recovery codes
7827
+ * @description Wipes the TOTP secret and all recovery codes. The user re-enrolls from scratch with `/enroll`. Step-up: the JSON body must carry a fresh second factor (`code` or `recoveryCode`); 403 `mfa_step_up_failed` when it is wrong or already used, 429 when the attempt budget is exhausted.
6473
7828
  */
6474
- post: {
7829
+ delete: {
6475
7830
  parameters: {
6476
7831
  query?: never;
6477
7832
  header?: never;
@@ -6482,10 +7837,15 @@ interface paths$1 {
6482
7837
  content: {
6483
7838
  "application/json": {
6484
7839
  /**
6485
- * @description Current 6-digit TOTP code shown by the authenticator app.
7840
+ * @description Current 6-digit TOTP code. Each code is accepted once.
6486
7841
  * @example 123456
6487
7842
  */
6488
- code: string;
7843
+ code?: string;
7844
+ /**
7845
+ * @description An unused recovery code (consumed by this request).
7846
+ * @example ABCD-EFGH
7847
+ */
7848
+ recoveryCode?: string;
6489
7849
  };
6490
7850
  };
6491
7851
  };
@@ -6497,8 +7857,8 @@ interface paths$1 {
6497
7857
  };
6498
7858
  content: {
6499
7859
  "application/json": {
6500
- /** @description Ten single-use recovery codes. Shown ONCE and never returned again — the user must store them now. Each code is consumed atomically when used in place of a TOTP code at MFA challenge time. */
6501
- recoveryCodes: string[];
7860
+ /** @enum {boolean} */
7861
+ disabled: true;
6502
7862
  };
6503
7863
  };
6504
7864
  };
@@ -6552,51 +7912,33 @@ interface paths$1 {
6552
7912
  };
6553
7913
  };
6554
7914
  };
6555
- };
6556
- };
6557
- delete?: never;
6558
- options?: never;
6559
- head?: never;
6560
- patch?: never;
6561
- trace?: never;
6562
- };
6563
- "/v1/account/mfa/totp": {
6564
- parameters: {
6565
- query?: never;
6566
- header?: never;
6567
- path?: never;
6568
- cookie?: never;
6569
- };
6570
- get?: never;
6571
- put?: never;
6572
- post?: never;
6573
- /**
6574
- * Disable TOTP and clear recovery codes
6575
- * @description Wipes the TOTP secret and all recovery codes. The user re-enrolls from scratch with `/enroll`. Future versions of this endpoint will require a recent MFA assertion (step-up) — Thread E of Phase AUTH.
6576
- */
6577
- delete: {
6578
- parameters: {
6579
- query?: never;
6580
- header?: never;
6581
- path?: never;
6582
- cookie?: never;
6583
- };
6584
- requestBody?: never;
6585
- responses: {
6586
- /** @description Success */
6587
- 200: {
7915
+ /** @description Forbidden — insufficient permissions or scope */
7916
+ 403: {
6588
7917
  headers: {
6589
7918
  [name: string]: unknown;
6590
7919
  };
6591
7920
  content: {
6592
7921
  "application/json": {
6593
- /** @enum {boolean} */
6594
- disabled: true;
7922
+ /**
7923
+ * @description HTTP status code
7924
+ * @example 400
7925
+ */
7926
+ statusCode?: number;
7927
+ /**
7928
+ * @description Short error label
7929
+ * @example Bad Request
7930
+ */
7931
+ error?: string;
7932
+ /**
7933
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
7934
+ * @example Validation failed
7935
+ */
7936
+ message: string | string[];
6595
7937
  };
6596
7938
  };
6597
7939
  };
6598
- /** @description Unauthorized — authentication required or invalid */
6599
- 401: {
7940
+ /** @description Too Many Requests */
7941
+ 429: {
6600
7942
  headers: {
6601
7943
  [name: string]: unknown;
6602
7944
  };
@@ -6638,7 +7980,7 @@ interface paths$1 {
6638
7980
  put?: never;
6639
7981
  /**
6640
7982
  * Generate a fresh set of recovery codes
6641
- * @description Invalidates the prior set and issues 10 new codes. Future versions will require step-up auth.
7983
+ * @description Invalidates the prior set and issues 10 new codes. Step-up: the JSON body must carry a fresh second factor (`code` or `recoveryCode`); 403 `mfa_step_up_failed` when it is wrong or already used, 429 when the attempt budget is exhausted.
6642
7984
  */
6643
7985
  post: {
6644
7986
  parameters: {
@@ -6647,10 +7989,25 @@ interface paths$1 {
6647
7989
  path?: never;
6648
7990
  cookie?: never;
6649
7991
  };
6650
- requestBody?: never;
7992
+ requestBody?: {
7993
+ content: {
7994
+ "application/json": {
7995
+ /**
7996
+ * @description Current 6-digit TOTP code. Each code is accepted once.
7997
+ * @example 123456
7998
+ */
7999
+ code?: string;
8000
+ /**
8001
+ * @description An unused recovery code (consumed by this request).
8002
+ * @example ABCD-EFGH
8003
+ */
8004
+ recoveryCode?: string;
8005
+ };
8006
+ };
8007
+ };
6651
8008
  responses: {
6652
- /** @description Success */
6653
- 200: {
8009
+ /** @description Created */
8010
+ 201: {
6654
8011
  headers: {
6655
8012
  [name: string]: unknown;
6656
8013
  };
@@ -6711,6 +8068,56 @@ interface paths$1 {
6711
8068
  };
6712
8069
  };
6713
8070
  };
8071
+ /** @description Forbidden — insufficient permissions or scope */
8072
+ 403: {
8073
+ headers: {
8074
+ [name: string]: unknown;
8075
+ };
8076
+ content: {
8077
+ "application/json": {
8078
+ /**
8079
+ * @description HTTP status code
8080
+ * @example 400
8081
+ */
8082
+ statusCode?: number;
8083
+ /**
8084
+ * @description Short error label
8085
+ * @example Bad Request
8086
+ */
8087
+ error?: string;
8088
+ /**
8089
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
8090
+ * @example Validation failed
8091
+ */
8092
+ message: string | string[];
8093
+ };
8094
+ };
8095
+ };
8096
+ /** @description Too Many Requests */
8097
+ 429: {
8098
+ headers: {
8099
+ [name: string]: unknown;
8100
+ };
8101
+ content: {
8102
+ "application/json": {
8103
+ /**
8104
+ * @description HTTP status code
8105
+ * @example 400
8106
+ */
8107
+ statusCode?: number;
8108
+ /**
8109
+ * @description Short error label
8110
+ * @example Bad Request
8111
+ */
8112
+ error?: string;
8113
+ /**
8114
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
8115
+ * @example Validation failed
8116
+ */
8117
+ message: string | string[];
8118
+ };
8119
+ };
8120
+ };
6714
8121
  };
6715
8122
  };
6716
8123
  delete?: never;
@@ -7238,12 +8645,6 @@ interface paths {
7238
8645
  * @description AGE-armored tlock ciphertext, hex-encoded UTF-8. Output of tlock-js `timelockEncrypt`. Max 4096 bytes (8192 hex chars).
7239
8646
  */
7240
8647
  tlockCiphertext?: string;
7241
- /**
7242
- * Format: uri
7243
- * @description Valid URL
7244
- * @example https://example.com/path
7245
- */
7246
- callbackUrl?: string;
7247
8648
  };
7248
8649
  };
7249
8650
  };
@@ -8494,14 +9895,20 @@ interface paths {
8494
9895
  };
8495
9896
  /**
8496
9897
  * List v5 witnesses (optionally filtered by dataId)
8497
- * @description Scans the WitnessCreated event log from contract deployment to head. The v5 event adds drandRound — non-zero means the witness carries a drand IBE ciphertext decryptable at that round. Query the full witness via /get for the ciphertext bytes.
9898
+ * @description Lists WitnessCreated events, newest first. The v5 event adds drandRound — non-zero means the witness carries a drand IBE ciphertext decryptable at that round. Query the full witness via /get for the ciphertext bytes. Each request scans one window of at most 200,000 blocks of the WitnessCreated event log, newest first: from `beforeBlock - 1` (or the head) down, never below the deploy block. To list everything, repeat the request with `beforeBlock = nextBeforeBlock`, `beforeLogIndex = nextBeforeLogIndex` (omitted when null) and no `offset`, until `nextBeforeBlock` is null; every matching witness is returned exactly once, newest first. A page can be empty while older witnesses exist; only a null `nextBeforeBlock` means the listing is exhausted. `hasMore` reports more matches inside the current window.
8498
9899
  */
8499
9900
  get: {
8500
9901
  parameters: {
8501
9902
  query?: {
8502
9903
  dataId?: string;
9904
+ /** @description Page size, 1-200, default 50. */
8503
9905
  limit?: number;
9906
+ /** @description Offset into the matches of this scan window, 0-10000. */
8504
9907
  offset?: number | null;
9908
+ /** @description Exclusive upper bound of the scan: blocks below it are scanned. Omit for the head; to continue, pass the previous response's `nextBeforeBlock`. At most the current head + 1. */
9909
+ beforeBlock?: number | null;
9910
+ /** @description Requires `beforeBlock`. Within block `beforeBlock - 1`, only logs with a lower log index are listed. Pass the previous response's `nextBeforeLogIndex` when it is not null. */
9911
+ beforeLogIndex?: number | null;
8505
9912
  };
8506
9913
  header?: never;
8507
9914
  path: {
@@ -8536,6 +9943,12 @@ interface paths {
8536
9943
  }[];
8537
9944
  hasMore: boolean;
8538
9945
  totalReturned: number;
9946
+ /** @description True when this request's scan window reached the contract's deploy block. */
9947
+ scanComplete: boolean;
9948
+ /** @description The `beforeBlock` of the next page. Null when every matching witness has been listed. */
9949
+ nextBeforeBlock: number | null;
9950
+ /** @description The `beforeLogIndex` of the next page, or null to start at the top of block `nextBeforeBlock - 1`. */
9951
+ nextBeforeLogIndex: number | null;
8539
9952
  };
8540
9953
  };
8541
9954
  };
@@ -9004,6 +10417,8 @@ interface paths {
9004
10417
  *
9005
10418
  * Response shape is identical to GET /v5/contracts/{addr}/witnesses; the
9006
10419
  * scan is always newest-first.
10420
+ *
10421
+ * Each request scans one window of at most 200,000 blocks of the WitnessCreated event log, newest first: from `beforeBlock - 1` (or the head) down, never below the deploy block. To list everything, repeat the request with `beforeBlock = nextBeforeBlock`, `beforeLogIndex = nextBeforeLogIndex` (omitted when null) and no `offset`, until `nextBeforeBlock` is null; every matching witness is returned exactly once, newest first. A page can be empty while older witnesses exist; only a null `nextBeforeBlock` means the listing is exhausted. `hasMore` reports more matches inside the current window.
9007
10422
  */
9008
10423
  get: {
9009
10424
  parameters: {
@@ -9016,8 +10431,12 @@ interface paths {
9016
10431
  timeLock?: "locked" | "none" | "any";
9017
10432
  /** @description Page size, 1-200, default 50. */
9018
10433
  limit?: number;
9019
- /** @description Offset into the filtered set, default 0. */
10434
+ /** @description Offset into the matches of this scan window, 0-10000. */
9020
10435
  offset?: number | null;
10436
+ /** @description Exclusive upper bound of the scan: blocks below it are scanned. Omit for the head; to continue, pass the previous response's `nextBeforeBlock`. At most the current head + 1. */
10437
+ beforeBlock?: number | null;
10438
+ /** @description Requires `beforeBlock`. Within block `beforeBlock - 1`, only logs with a lower log index are listed. Pass the previous response's `nextBeforeLogIndex` when it is not null. */
10439
+ beforeLogIndex?: number | null;
9021
10440
  };
9022
10441
  header?: never;
9023
10442
  path?: never;
@@ -9049,6 +10468,12 @@ interface paths {
9049
10468
  }[];
9050
10469
  hasMore: boolean;
9051
10470
  totalReturned: number;
10471
+ /** @description True when this request's scan window reached the contract's deploy block. */
10472
+ scanComplete: boolean;
10473
+ /** @description The `beforeBlock` of the next page. Null when every matching witness has been listed. */
10474
+ nextBeforeBlock: number | null;
10475
+ /** @description The `beforeLogIndex` of the next page, or null to start at the top of block `nextBeforeBlock - 1`. */
10476
+ nextBeforeLogIndex: number | null;
9052
10477
  };
9053
10478
  };
9054
10479
  };
@@ -10062,7 +11487,7 @@ interface paths {
10062
11487
  };
10063
11488
  /**
10064
11489
  * Liveness probe
10065
- * @description Kubernetes liveness probe. Fails if queue connection lost for > 1 minute.
11490
+ * @description Kubernetes liveness probe. Answers 200 while the process serves HTTP; it checks no dependency (dependency health is the readiness probe).
10066
11491
  */
10067
11492
  get: {
10068
11493
  parameters: {
@@ -10081,41 +11506,7 @@ interface paths {
10081
11506
  content: {
10082
11507
  "application/json": {
10083
11508
  /** @enum {string} */
10084
- status: "healthy";
10085
- /**
10086
- * QueueStatus
10087
- * @description Queue health status
10088
- */
10089
- queue: {
10090
- healthy: boolean;
10091
- timeSinceLastPingMs: number;
10092
- /** Format: date-time */
10093
- lastPing?: string;
10094
- };
10095
- };
10096
- };
10097
- };
10098
- /** @description Service Unavailable */
10099
- 503: {
10100
- headers: {
10101
- [name: string]: unknown;
10102
- };
10103
- content: {
10104
- "application/json": {
10105
- /**
10106
- * @description Error message
10107
- * @example Validation failed
10108
- */
10109
- error: string;
10110
- /**
10111
- * @description Machine-readable error code
10112
- * @example VALIDATION_FAILED
10113
- */
10114
- code?: string;
10115
- /** @description Field-level validation errors */
10116
- details?: {
10117
- [key: string]: string[];
10118
- };
11509
+ status: "alive";
10119
11510
  };
10120
11511
  };
10121
11512
  };
@@ -10329,11 +11720,15 @@ type JsonBody<T> = T extends {
10329
11720
  type Req<P extends keyof paths$1, M extends keyof paths$1[P]> = JsonBody<Extract<paths$1[P][M], {
10330
11721
  requestBody?: unknown;
10331
11722
  }>['requestBody']>;
10332
- type Res<P extends keyof paths$1, M extends keyof paths$1[P], S extends number = 200> = paths$1[P][M] extends {
10333
- responses: {
10334
- [K in S]: infer R;
10335
- };
10336
- } ? JsonBody<R> : never;
11723
+ /** HTTP success codes an operation's response body is taken from. */
11724
+ type SuccessCode = 200 | 201 | 202 | 203;
11725
+ /**
11726
+ * The JSON body of an accounts operation's success response, whichever 2xx
11727
+ * code the spec documents (accounts answers POSTs with 201).
11728
+ */
11729
+ type Res<P extends keyof paths$1, M extends keyof paths$1[P]> = paths$1[P][M] extends {
11730
+ responses: infer R;
11731
+ } ? JsonBody<R[Extract<keyof R, SuccessCode>]> : never;
10337
11732
  type ChainRes<P extends keyof paths, M extends keyof paths[P], S extends number = 200> = paths[P][M] extends {
10338
11733
  responses: {
10339
11734
  [K in S]: infer R;
@@ -10344,6 +11739,7 @@ type SignupResponse = Res<'/v1/auth/signup', 'post'>;
10344
11739
  type VerifyEmailResponse = Res<'/v1/auth/verify', 'get'>;
10345
11740
  type LoginRequest = Req<'/v1/auth/login', 'post'>;
10346
11741
  type LoginResponse = Res<'/v1/auth/login', 'post'>;
11742
+ type LoginMfaResponse = Res<'/v1/auth/login/mfa', 'post'>;
10347
11743
  type LogoutResponse = Res<'/v1/auth/logout', 'post'>;
10348
11744
  type ForgotPasswordRequest = Req<'/v1/auth/forgot-password', 'post'>;
10349
11745
  type ForgotPasswordResponse = Res<'/v1/auth/forgot-password', 'post'>;
@@ -10406,6 +11802,18 @@ type LedgerResponse = Res<'/v1/account/ledger', 'get'>;
10406
11802
  type TotpEnrollResponse = Res<'/v1/account/mfa/totp/enroll', 'post'>;
10407
11803
  type TotpConfirmRequest = Req<'/v1/account/mfa/totp/confirm', 'post'>;
10408
11804
  type TotpConfirmResponse = Res<'/v1/account/mfa/totp/confirm', 'post'>;
11805
+ /**
11806
+ * A second-factor proof: exactly one of a 6-digit TOTP `code` or a
11807
+ * `recoveryCode` (`ABCD-EFGH`). The spec types both as optional; the server
11808
+ * rejects a body with neither or both, so the SDK type enforces exactly one.
11809
+ */
11810
+ type MfaProofRequest = {
11811
+ code: string;
11812
+ recoveryCode?: never;
11813
+ } | {
11814
+ recoveryCode: string;
11815
+ code?: never;
11816
+ };
10409
11817
  type TotpDisableResponse = Res<'/v1/account/mfa/totp', 'delete'>;
10410
11818
  type RecoveryCodesRegenerateResponse = Res<'/v1/account/mfa/recovery-codes/regenerate', 'post'>;
10411
11819
  type ListOauthSessionsResponse = Res<'/v1/oauth/sessions', 'get'>;
@@ -10667,9 +12075,10 @@ declare class WitniumchainClient {
10667
12075
  * the contract with the caller's client-generated `ownerPublicKey` +
10668
12076
  * `initialSigningPublicKey`. Witnium never sees the private bytes.
10669
12077
  *
10670
- * Returns `{ orgId, userId, contractAddress, contractVersion,
10671
- * emailVerifyToken }`. The verify token is also emailed; it's echoed here
10672
- * for UIs that prefer to render the verify link themselves.
12078
+ * Returns `{ orgId, userId, contractAddress, contractVersion }`. The
12079
+ * email-verify link is mailed to `adminEmail` and never returned, so there
12080
+ * is nothing to render. If the mail cannot be sent, nothing is created and
12081
+ * the call fails with a 502; retry it.
10673
12082
  */
10674
12083
  createOrg(body: CreateOrgRequest): Promise<CreateOrgResponse>;
10675
12084
  listMembers(): Promise<MembersListResponse>;
@@ -10682,7 +12091,26 @@ declare class WitniumchainClient {
10682
12091
  removeMember(userId: string): Promise<RemoveMemberResponse>;
10683
12092
  resendMemberInvite(userId: string): Promise<ResendInviteResponse>;
10684
12093
  verifyEmail(token: string): Promise<VerifyEmailResponse>;
12094
+ /**
12095
+ * Password login. Check `status`: `'authenticated'` means the session
12096
+ * cookie is set. `'mfa_required'` means NO session exists yet: the server
12097
+ * set a short-lived challenge cookie, and {@link loginMfa} must follow with
12098
+ * the user's TOTP or recovery code.
12099
+ */
10685
12100
  login(body: LoginRequest): Promise<LoginResponse>;
12101
+ /**
12102
+ * Second step of an MFA login, after `login()` returned `'mfa_required'`.
12103
+ * Relies on the challenge cookie from that call (`credentials: 'include'`).
12104
+ * 401 `mfa_code_invalid`: wrong or reused code, the user may retry.
12105
+ * 401 `mfa_challenge_invalid`: expired or used up, start again at `login()`.
12106
+ * 429 `mfa_rate_limited`: the body carries `retryAfterSeconds`.
12107
+ */
12108
+ loginMfa(body: MfaProofRequest): Promise<LoginMfaResponse>;
12109
+ /**
12110
+ * End the first-party session. The cached bearer token is dropped even when
12111
+ * the request fails, so a logged-out tab never keeps the previous user's
12112
+ * token.
12113
+ */
10686
12114
  logout(): Promise<LogoutResponse>;
10687
12115
  forgotPassword(body: ForgotPasswordRequest): Promise<ForgotPasswordResponse>;
10688
12116
  resetPassword(body: ResetPasswordRequest): Promise<ResetPasswordResponse>;
@@ -10731,9 +12159,16 @@ declare class WitniumchainClient {
10731
12159
  */
10732
12160
  reissueProvisioningToken(): Promise<ReissueProvisioningTokenResponse>;
10733
12161
  enrollTotp(): Promise<TotpEnrollResponse>;
12162
+ /**
12163
+ * Confirming bumps the user's security epoch server-side, which ends every
12164
+ * session-minted access token. A cached one is dropped so the next bearer
12165
+ * call mints a fresh token.
12166
+ */
10734
12167
  confirmTotp(body: TotpConfirmRequest): Promise<TotpConfirmResponse>;
10735
- disableTotp(): Promise<TotpDisableResponse>;
10736
- regenerateRecoveryCodes(): Promise<RecoveryCodesRegenerateResponse>;
12168
+ /** Step-up: 403 `mfa_step_up_failed` on a wrong proof, 429 `mfa_rate_limited`. */
12169
+ disableTotp(body: MfaProofRequest): Promise<TotpDisableResponse>;
12170
+ /** Step-up: 403 `mfa_step_up_failed` on a wrong proof, 429 `mfa_rate_limited`. */
12171
+ regenerateRecoveryCodes(body: MfaProofRequest): Promise<RecoveryCodesRegenerateResponse>;
10737
12172
  listOauthSessions(): Promise<ListOauthSessionsResponse>;
10738
12173
  revokeOauthSession(jti: string): Promise<void>;
10739
12174
  revokeAllOauthSessions(): Promise<void>;
@@ -10741,10 +12176,19 @@ declare class WitniumchainClient {
10741
12176
  healthReady(): Promise<HealthReadyResponse>;
10742
12177
  getContractInfo(contractAddress: string): Promise<ContractInfoResponse>;
10743
12178
  getContractVerification(contractAddress: string): Promise<VerifyContractResponse>;
10744
- listWitnessesV5(contractAddress: string, params?: {
12179
+ listWitnessesV5(contractAddress: string,
12180
+ /**
12181
+ * One bounded scan window per call. To list everything, call again with
12182
+ * `beforeBlock: res.nextBeforeBlock` and, when not null,
12183
+ * `beforeLogIndex: res.nextBeforeLogIndex` until `res.nextBeforeBlock`
12184
+ * is null; an empty page does not mean the end.
12185
+ */
12186
+ params?: {
10745
12187
  dataId?: string;
10746
12188
  limit?: number;
10747
12189
  offset?: number;
12190
+ beforeBlock?: number;
12191
+ beforeLogIndex?: number;
10748
12192
  }): Promise<ListWitnessesResponse>;
10749
12193
  getWitnessV5(contractAddress: string, witnessId: string): Promise<GetChainWitnessResponse>;
10750
12194
  getContractTransaction(contractAddress: string, txHash: string): Promise<GetContractTransactionResponse>;
@@ -10757,6 +12201,9 @@ declare class WitniumchainClient {
10757
12201
  timeLock?: 'locked' | 'none';
10758
12202
  limit?: number;
10759
12203
  offset?: number;
12204
+ /** Cursor; see listWitnessesV5. */
12205
+ beforeBlock?: number;
12206
+ beforeLogIndex?: number;
10760
12207
  }): Promise<DashboardWitnessesResponse>;
10761
12208
  /**
10762
12209
  * Build the authorization-server URL for the start of an OAuth login flow.
@@ -11014,7 +12461,12 @@ declare class OrgMembers {
11014
12461
  constructor(client: WitniumchainClient);
11015
12462
  /** List the caller's org members (role, suspendedAt, isOwner, keys). */
11016
12463
  list(): Promise<MembersListResponse>;
11017
- /** Invite a member by email (default role `member`). */
12464
+ /**
12465
+ * Invite a member by email (default role `member`). `inviteEmailSent` says
12466
+ * whether the invitation (with the verify link) was mailed; the token is
12467
+ * never returned. A 502 means the membership was recorded but the mail
12468
+ * failed; retry.
12469
+ */
11018
12470
  invite(body: InviteMemberRequest): Promise<InviteMemberResponse>;
11019
12471
  /** Suspend a member (reversible). The owner cannot be suspended. */
11020
12472
  suspend(userId: string): Promise<SuspendMemberResponse>;
@@ -11026,7 +12478,10 @@ declare class OrgMembers {
11026
12478
  setRole(userId: string, role: SetMemberRoleRequest['role']): Promise<SetMemberRoleResponse>;
11027
12479
  /** Remove a member (terminal; revokes their delegated keys). Owner protected. */
11028
12480
  remove(userId: string): Promise<RemoveMemberResponse>;
11029
- /** Re-mint an email-verify token for a pending member. */
12481
+ /**
12482
+ * Re-send the invitation email to a pending member. Returns `{ email }`;
12483
+ * the fresh verify token is mailed, never returned.
12484
+ */
11030
12485
  resendInvite(userId: string): Promise<ResendInviteResponse>;
11031
12486
  }
11032
12487
  declare class MfaTotp {
@@ -11044,11 +12499,15 @@ declare class MfaTotp {
11044
12499
  * Confirm enrolment with the first user-supplied code. Returns the 10
11045
12500
  * single-use recovery codes — show them to the user ONCE; the server never
11046
12501
  * returns them again. Throws `WitniumchainApiError` with status 400 when
11047
- * the code is invalid or the enrolment is already confirmed.
12502
+ * the code is invalid or the enrolment is already confirmed. Signs the
12503
+ * user out of every other device and connected app.
11048
12504
  */
11049
12505
  confirm(code: string): Promise<TotpConfirmResponse>;
11050
- /** Disable TOTP, wiping both the secret and all recovery codes. */
11051
- disable(): Promise<TotpDisableResponse>;
12506
+ /**
12507
+ * Disable TOTP, wiping both the secret and all recovery codes. Requires the
12508
+ * user's current code or a recovery code.
12509
+ */
12510
+ disable(proof: MfaProofRequest): Promise<TotpDisableResponse>;
11052
12511
  }
11053
12512
  declare class MfaRecoveryCodes {
11054
12513
  private readonly client;
@@ -11056,8 +12515,9 @@ declare class MfaRecoveryCodes {
11056
12515
  /**
11057
12516
  * Issue a fresh set of 10 recovery codes, invalidating the prior ones.
11058
12517
  * Same as `confirm` — codes are returned ONCE and never readable again.
12518
+ * Requires the user's current code or a recovery code.
11059
12519
  */
11060
- regenerate(): Promise<RecoveryCodesRegenerateResponse>;
12520
+ regenerate(proof: MfaProofRequest): Promise<RecoveryCodesRegenerateResponse>;
11061
12521
  }
11062
12522
 
11063
12523
  type Body<T> = T extends {
@@ -11250,4 +12710,4 @@ declare function buildRevokeSigningKeyPayload(args: {
11250
12710
  key: string;
11251
12711
  }): string;
11252
12712
 
11253
- export { type AccountResponse, type paths$1 as AccountsPaths, type AddSigningKeyRequest$1 as AddSigningKeyRequest, type AddSigningKeyResponse, type BeginOAuthLoginArgs, type BeginOAuthLoginResult, type paths as ChainPaths, type CheckoutRequest, type CheckoutResponse, type CreateOrgRequest, type CreateOrgResponse, type CreateUserRequest, type CreateUserResponse, DelegatedKeys, type FinalizeWitnessResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetWitnessResponse, type HealthLiveResponse, type HealthReadyResponse, type InviteMemberRequest, type InviteMemberResponse, type LedgerResponse, type ListDelegatedKeysResponse, type ListOauthSessionsResponse, type ListUsersResponse, type LoginRequest, type LoginResponse, type LogoutResponse, type MembersListResponse, MfaNamespace, MfaRecoveryCodes, MfaTotp, type OAuthTokenSnapshot, OWNER_OP, OauthNamespace, OauthSessions, OrgMembers, OrgUsers, type OwnerOpName, type OwnerSigner, type PauseRequest$1 as PauseRequest, type PauseResponse, type PkceVerifierStorage, type PortalResponse, type PrepareDelegatedKeyRequest, type PreparedDelegatedKeyResponse, type ProposeWitnessRequest, type ProposeWitnessResponse, type ProvisionContractRequest, type ProvisionContractResponse, type ProvisionDelegatedKeyArgs, type ProvisionDelegatedKeyResult, type PublicOrgResponse, type RecoveryCodesRegenerateResponse, type ReissueProvisioningTokenResponse, type RemoveMemberResponse, type ResendInviteResponse, type ResetAccountResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDelegatedKeyResponse, type RevokeSigningKeyRequest$1 as RevokeSigningKeyRequest, type RevokeSigningKeyResponse, type RevokeWitnessRequest, type RevokeWitnessResponse, type SetMemberRoleRequest, type SetMemberRoleResponse, type SignRequest, type SignResponse, type SignWitnessRequest, type SignWitnessResponse, type SignedRequestSigner, SigningKeys, type SignupRequest, type SignupResponse, type SubmitDelegatedKeyRequest, type SubmitDelegatedKeyResponse, Subscriptions, type SuspendMemberResponse, type TotpConfirmRequest, type TotpConfirmResponse, type TotpDisableResponse, type TotpEnrollResponse, type UnpauseRequest, type UnpauseResponse, type VerifyEmailResponse, WitniumchainApiError, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, WitniumchainOrgClient, type WitniumchainOrgClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
12713
+ export { type AccountResponse, type paths$1 as AccountsPaths, type AddSigningKeyRequest$1 as AddSigningKeyRequest, type AddSigningKeyResponse, type BeginOAuthLoginArgs, type BeginOAuthLoginResult, type paths as ChainPaths, type CheckoutRequest, type CheckoutResponse, type CreateOrgRequest, type CreateOrgResponse, type CreateUserRequest, type CreateUserResponse, DelegatedKeys, type FinalizeWitnessResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetWitnessResponse, type HealthLiveResponse, type HealthReadyResponse, type InviteMemberRequest, type InviteMemberResponse, type LedgerResponse, type ListDelegatedKeysResponse, type ListOauthSessionsResponse, type ListUsersResponse, type LoginMfaResponse, type LoginRequest, type LoginResponse, type LogoutResponse, type MembersListResponse, MfaNamespace, type MfaProofRequest, MfaRecoveryCodes, MfaTotp, type OAuthTokenSnapshot, OWNER_OP, OauthNamespace, OauthSessions, OrgMembers, OrgUsers, type OwnerOpName, type OwnerSigner, type PauseRequest$1 as PauseRequest, type PauseResponse, type PkceVerifierStorage, type PortalResponse, type PrepareDelegatedKeyRequest, type PreparedDelegatedKeyResponse, type ProposeWitnessRequest, type ProposeWitnessResponse, type ProvisionContractRequest, type ProvisionContractResponse, type ProvisionDelegatedKeyArgs, type ProvisionDelegatedKeyResult, type PublicOrgResponse, type RecoveryCodesRegenerateResponse, type ReissueProvisioningTokenResponse, type RemoveMemberResponse, type ResendInviteResponse, type ResetAccountResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDelegatedKeyResponse, type RevokeSigningKeyRequest$1 as RevokeSigningKeyRequest, type RevokeSigningKeyResponse, type RevokeWitnessRequest, type RevokeWitnessResponse, type SetMemberRoleRequest, type SetMemberRoleResponse, type SignRequest, type SignResponse, type SignWitnessRequest, type SignWitnessResponse, type SignedRequestSigner, SigningKeys, type SignupRequest, type SignupResponse, type SubmitDelegatedKeyRequest, type SubmitDelegatedKeyResponse, Subscriptions, type SuspendMemberResponse, type TotpConfirmRequest, type TotpConfirmResponse, type TotpDisableResponse, type TotpEnrollResponse, type UnpauseRequest, type UnpauseResponse, type VerifyEmailResponse, WitniumchainApiError, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, WitniumchainOrgClient, type WitniumchainOrgClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };