@witnium/witniumchain 0.28.0 → 0.28.1

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
@@ -669,7 +669,7 @@ interface paths$1 {
669
669
  put?: never;
670
670
  /**
671
671
  * Open a re-enrollment link
672
- * @description Opens the link a sysadmin had emailed (plan §9.9; any browser: the link proves the mailbox). Consumes it and sets the `wac_enroll` cookie (30 minutes): add a passkey, or a password + authenticator app, with the enrollment endpoints, without the recovery wait. The account's other methods stay. One use, 72 hours; a newer link ends it (400). An account with an authenticator app proves a current code first.
672
+ * @description Opens the link a sysadmin had emailed (plan §9.9; any browser: the link proves the mailbox) and sets the `wac_enroll` cookie (30 minutes): add a passkey, or a password + authenticator app, with the enrollment endpoints, without the recovery wait. The account's other methods stay. Opening does not use the link up: saving the method does, in the same transaction, so a link opened and not finished still works, in this browser or another; opening it again ends the enrollment opened before. One completed use, 72 hours; a newer link or any security change ends it (400, and its open enrollment ends). An account with an authenticator app proves a current code first.
673
673
  */
674
674
  post: {
675
675
  parameters: {
@@ -699,6 +699,8 @@ interface paths$1 {
699
699
  * @enum {string}
700
700
  */
701
701
  next: "secure-account";
702
+ /** @description The account the link is for, as `GET /v1/auth/enrollment` shows it too. The app compares it with a signed-in session to offer signing out first when that is another account. */
703
+ email: string;
702
704
  };
703
705
  };
704
706
  };
@@ -9415,6 +9417,11 @@ interface paths$1 {
9415
9417
  };
9416
9418
  content: {
9417
9419
  "application/json": {
9420
+ /**
9421
+ * Format: uuid
9422
+ * @description This enrollment. Every enrollment submission names it in `X-Enrollment-Id`.
9423
+ */
9424
+ id: string;
9418
9425
  email: string;
9419
9426
  /** @enum {string} */
9420
9427
  purpose: "signup" | "recovery" | "recovery_code" | "reenroll";
@@ -9477,7 +9484,9 @@ interface paths$1 {
9477
9484
  post: {
9478
9485
  parameters: {
9479
9486
  query?: never;
9480
- header?: never;
9487
+ header: {
9488
+ "x-enrollment-id": string;
9489
+ };
9481
9490
  path?: never;
9482
9491
  cookie?: never;
9483
9492
  };
@@ -9500,6 +9509,31 @@ interface paths$1 {
9500
9509
  };
9501
9510
  };
9502
9511
  };
9512
+ /** @description Bad Request — validation failed */
9513
+ 400: {
9514
+ headers: {
9515
+ [name: string]: unknown;
9516
+ };
9517
+ content: {
9518
+ "application/json": {
9519
+ /**
9520
+ * @description HTTP status code
9521
+ * @example 400
9522
+ */
9523
+ statusCode?: number;
9524
+ /**
9525
+ * @description Short error label
9526
+ * @example Bad Request
9527
+ */
9528
+ error?: string;
9529
+ /**
9530
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
9531
+ * @example Validation failed
9532
+ */
9533
+ message: string | string[];
9534
+ };
9535
+ };
9536
+ };
9503
9537
  /** @description Unauthorized — authentication required or invalid */
9504
9538
  401: {
9505
9539
  headers: {
@@ -9550,6 +9584,31 @@ interface paths$1 {
9550
9584
  };
9551
9585
  };
9552
9586
  };
9587
+ /** @description Conflict */
9588
+ 409: {
9589
+ headers: {
9590
+ [name: string]: unknown;
9591
+ };
9592
+ content: {
9593
+ "application/json": {
9594
+ /**
9595
+ * @description HTTP status code
9596
+ * @example 400
9597
+ */
9598
+ statusCode?: number;
9599
+ /**
9600
+ * @description Short error label
9601
+ * @example Bad Request
9602
+ */
9603
+ error?: string;
9604
+ /**
9605
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
9606
+ * @example Validation failed
9607
+ */
9608
+ message: string | string[];
9609
+ };
9610
+ };
9611
+ };
9553
9612
  };
9554
9613
  };
9555
9614
  delete?: never;
@@ -9574,7 +9633,9 @@ interface paths$1 {
9574
9633
  post: {
9575
9634
  parameters: {
9576
9635
  query?: never;
9577
- header?: never;
9636
+ header: {
9637
+ "x-enrollment-id": string;
9638
+ };
9578
9639
  path?: never;
9579
9640
  cookie?: never;
9580
9641
  };
@@ -9591,6 +9652,31 @@ interface paths$1 {
9591
9652
  };
9592
9653
  };
9593
9654
  };
9655
+ /** @description Bad Request — validation failed */
9656
+ 400: {
9657
+ headers: {
9658
+ [name: string]: unknown;
9659
+ };
9660
+ content: {
9661
+ "application/json": {
9662
+ /**
9663
+ * @description HTTP status code
9664
+ * @example 400
9665
+ */
9666
+ statusCode?: number;
9667
+ /**
9668
+ * @description Short error label
9669
+ * @example Bad Request
9670
+ */
9671
+ error?: string;
9672
+ /**
9673
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
9674
+ * @example Validation failed
9675
+ */
9676
+ message: string | string[];
9677
+ };
9678
+ };
9679
+ };
9594
9680
  /** @description Unauthorized — authentication required or invalid */
9595
9681
  401: {
9596
9682
  headers: {
@@ -9641,6 +9727,31 @@ interface paths$1 {
9641
9727
  };
9642
9728
  };
9643
9729
  };
9730
+ /** @description Conflict */
9731
+ 409: {
9732
+ headers: {
9733
+ [name: string]: unknown;
9734
+ };
9735
+ content: {
9736
+ "application/json": {
9737
+ /**
9738
+ * @description HTTP status code
9739
+ * @example 400
9740
+ */
9741
+ statusCode?: number;
9742
+ /**
9743
+ * @description Short error label
9744
+ * @example Bad Request
9745
+ */
9746
+ error?: string;
9747
+ /**
9748
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
9749
+ * @example Validation failed
9750
+ */
9751
+ message: string | string[];
9752
+ };
9753
+ };
9754
+ };
9644
9755
  };
9645
9756
  };
9646
9757
  delete?: never;
@@ -9665,7 +9776,9 @@ interface paths$1 {
9665
9776
  post: {
9666
9777
  parameters: {
9667
9778
  query?: never;
9668
- header?: never;
9779
+ header: {
9780
+ "x-enrollment-id": string;
9781
+ };
9669
9782
  path?: never;
9670
9783
  cookie?: never;
9671
9784
  };
@@ -9819,7 +9932,9 @@ interface paths$1 {
9819
9932
  post: {
9820
9933
  parameters: {
9821
9934
  query?: never;
9822
- header?: never;
9935
+ header: {
9936
+ "x-enrollment-id": string;
9937
+ };
9823
9938
  path?: never;
9824
9939
  cookie?: never;
9825
9940
  };
@@ -9896,6 +10011,31 @@ interface paths$1 {
9896
10011
  };
9897
10012
  };
9898
10013
  };
10014
+ /** @description Conflict */
10015
+ 409: {
10016
+ headers: {
10017
+ [name: string]: unknown;
10018
+ };
10019
+ content: {
10020
+ "application/json": {
10021
+ /**
10022
+ * @description HTTP status code
10023
+ * @example 400
10024
+ */
10025
+ statusCode?: number;
10026
+ /**
10027
+ * @description Short error label
10028
+ * @example Bad Request
10029
+ */
10030
+ error?: string;
10031
+ /**
10032
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
10033
+ * @example Validation failed
10034
+ */
10035
+ message: string | string[];
10036
+ };
10037
+ };
10038
+ };
9899
10039
  /** @description Service Unavailable */
9900
10040
  503: {
9901
10041
  headers: {
@@ -9945,7 +10085,9 @@ interface paths$1 {
9945
10085
  post: {
9946
10086
  parameters: {
9947
10087
  query?: never;
9948
- header?: never;
10088
+ header: {
10089
+ "x-enrollment-id": string;
10090
+ };
9949
10091
  path?: never;
9950
10092
  cookie?: never;
9951
10093
  };
@@ -13398,7 +13540,7 @@ interface paths$1 {
13398
13540
  put?: never;
13399
13541
  /**
13400
13542
  * Add a key you hold to the managed contract
13401
- * @description Plan §17.7. Org admins, after a step-up. Witnium signs the add with the managed owner key; the key counts once the op confirms (`status`), and the admins are emailed. 409 owner_op_settling while another change settles.
13543
+ * @description Plan §17.7. Org admins, after a step-up. Witnium signs the add with the managed owner key; the key counts once the op confirms (`status`), and the admins are emailed. 409 owner_op_settling while another change settles. With a bearer token, the step-up is an `auth_time` in the last 5 minutes (authorize with `max_age=0` first).
13402
13544
  */
13403
13545
  post: {
13404
13546
  parameters: {
@@ -13768,6 +13910,8 @@ interface paths$1 {
13768
13910
  } | null;
13769
13911
  firstParty: boolean;
13770
13912
  };
13913
+ /** @description Consent prompt only (always there): whether `/switch-account` is still possible. False once consent was given in this interaction (then switching answers 409 `already_confirmed`). */
13914
+ canSwitchAccount?: boolean;
13771
13915
  /** @description Consent prompt only: the requested scopes the provider serves. */
13772
13916
  scopes?: {
13773
13917
  name: string;
@@ -13790,7 +13934,7 @@ interface paths$1 {
13790
13934
  * @enum {boolean}
13791
13935
  */
13792
13936
  reauth?: true;
13793
- /** @description With `reauth`: the account of the current session. */
13937
+ /** @description The signed-in account: with `reauth`, the account of the current session; in a consent prompt (always), the account consent is asked of. Show it with a way to switch account (`/switch-account`). */
13794
13938
  email?: string;
13795
13939
  };
13796
13940
  };
@@ -14158,6 +14302,158 @@ interface paths$1 {
14158
14302
  patch?: never;
14159
14303
  trace?: never;
14160
14304
  };
14305
+ "/interaction/{uid}/switch-account": {
14306
+ parameters: {
14307
+ query?: never;
14308
+ header?: never;
14309
+ path?: never;
14310
+ cookie?: never;
14311
+ };
14312
+ get?: never;
14313
+ put?: never;
14314
+ /**
14315
+ * Switch account
14316
+ * @description Before consent is given only. Signs this browser out of the Witnium Account (`wac_session` revoked and cleared, the provider session destroyed and `_session` cleared) without ending the authorization request: navigate to `redirectTo` (the provider's resume), which continues the same request with a login prompt, i.e. at the account app's `/signin?interaction=<uid>` with the new interaction id. The account that signs in next answers the request; nothing is granted to the signed-out one. Once consent was given in this interaction (`canSwitchAccount: false` in /details): 409 `already_confirmed` and nothing changes, with `redirectTo` (the resume) once that consent finished, or with its `state` while its signing key is being set up or failed (stay on the consent page). Serialized with /confirm, /abort and the resume. Any prompt. Allowed Origin only. Needs the provider's `_interaction` cookie (path `/interaction/<uid>`), which the browser holds from /auth.
14317
+ */
14318
+ post: {
14319
+ parameters: {
14320
+ query?: never;
14321
+ header?: never;
14322
+ path: {
14323
+ uid: string;
14324
+ };
14325
+ cookie?: never;
14326
+ };
14327
+ requestBody?: never;
14328
+ responses: {
14329
+ /** @description Success */
14330
+ 200: {
14331
+ headers: {
14332
+ [name: string]: unknown;
14333
+ };
14334
+ content: {
14335
+ "application/json": {
14336
+ /**
14337
+ * Format: uri
14338
+ * @description Navigate the browser here (the provider's resume).
14339
+ */
14340
+ redirectTo: string;
14341
+ };
14342
+ };
14343
+ };
14344
+ /** @description Bad Request — validation failed */
14345
+ 400: {
14346
+ headers: {
14347
+ [name: string]: unknown;
14348
+ };
14349
+ content: {
14350
+ "application/json": {
14351
+ /**
14352
+ * @description HTTP status code
14353
+ * @example 400
14354
+ */
14355
+ statusCode?: number;
14356
+ /**
14357
+ * @description Short error label
14358
+ * @example Bad Request
14359
+ */
14360
+ error?: string;
14361
+ /**
14362
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
14363
+ * @example Validation failed
14364
+ */
14365
+ message: string | string[];
14366
+ };
14367
+ };
14368
+ };
14369
+ /** @description Forbidden — insufficient permissions or scope */
14370
+ 403: {
14371
+ headers: {
14372
+ [name: string]: unknown;
14373
+ };
14374
+ content: {
14375
+ "application/json": {
14376
+ /**
14377
+ * @description HTTP status code
14378
+ * @example 400
14379
+ */
14380
+ statusCode?: number;
14381
+ /**
14382
+ * @description Short error label
14383
+ * @example Bad Request
14384
+ */
14385
+ error?: string;
14386
+ /**
14387
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
14388
+ * @example Validation failed
14389
+ */
14390
+ message: string | string[];
14391
+ };
14392
+ };
14393
+ };
14394
+ /** @description Conflict */
14395
+ 409: {
14396
+ headers: {
14397
+ [name: string]: unknown;
14398
+ };
14399
+ content: {
14400
+ "application/json": {
14401
+ /** @enum {number} */
14402
+ statusCode: 409;
14403
+ /** @enum {string} */
14404
+ error: "already_confirmed" | "interaction_busy";
14405
+ message: string;
14406
+ /**
14407
+ * Format: uri
14408
+ * @description With `already_confirmed` once the consent finished: the resume; navigate there to continue the ordinary way.
14409
+ */
14410
+ redirectTo?: string;
14411
+ /**
14412
+ * @description With `already_confirmed` while the consent has not finished (its signing key is being set up, or that failed): where it stands, as /details reports it. Stay on the consent page.
14413
+ * @enum {string}
14414
+ */
14415
+ state?: "ready" | "provisioning" | "no_contract" | "refused";
14416
+ /**
14417
+ * @description `self_custody`: the app signs witnesses, and the org holds its own keys. `suspended`: the membership is suspended. `not_home`: a signing app can only connect for your own organization. `connection_ended`: the connection was ended while it was being set up. `key_add_failed`: adding the signing key to the contract failed. `contract_busy`: another change to the contract was still settling. `key_rate_limited`: the contract's daily key-change budget is used up. Except for the first three, start connecting again from the app.
14418
+ * @enum {string}
14419
+ */
14420
+ refusal?: "self_custody" | "suspended" | "not_home" | "connection_ended" | "key_add_failed" | "contract_busy" | "key_rate_limited";
14421
+ };
14422
+ };
14423
+ };
14424
+ /** @description Gone */
14425
+ 410: {
14426
+ headers: {
14427
+ [name: string]: unknown;
14428
+ };
14429
+ content: {
14430
+ "application/json": {
14431
+ /**
14432
+ * @description HTTP status code
14433
+ * @example 400
14434
+ */
14435
+ statusCode?: number;
14436
+ /**
14437
+ * @description Short error label
14438
+ * @example Bad Request
14439
+ */
14440
+ error?: string;
14441
+ /**
14442
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
14443
+ * @example Validation failed
14444
+ */
14445
+ message: string | string[];
14446
+ };
14447
+ };
14448
+ };
14449
+ };
14450
+ };
14451
+ delete?: never;
14452
+ options?: never;
14453
+ head?: never;
14454
+ patch?: never;
14455
+ trace?: never;
14456
+ };
14161
14457
  }
14162
14458
 
14163
14459
  /**
@@ -17336,7 +17632,7 @@ declare class WitniumchainClient {
17336
17632
  readonly apiKeys: OrgApiKeys;
17337
17633
  /** The signed-in member's dashboard signing key on a managed contract. `client.dashboardKey.*`. */
17338
17634
  readonly dashboardKey: DashboardKey;
17339
- /** The home org's managed contract: pause, resume, activity. `client.orgContract.*`. */
17635
+ /** The home org's managed contract: pause, resume, activity, keys you hold. `client.orgContract.*`. */
17340
17636
  readonly orgContract: OrgContract;
17341
17637
  readonly keyRequests: SigningKeyRequests;
17342
17638
  constructor(config: WitniumchainClientConfig);
@@ -17365,8 +17661,8 @@ declare class WitniumchainClient {
17365
17661
  pauseOrgContract(): Promise<ContractOwnerOpResponse>;
17366
17662
  /**
17367
17663
  * Add a key you hold to the org's managed contract (plan §17.7): org
17368
- * admins, after a step-up. Witnium signs the add; the key counts once
17369
- * the returned op confirms.
17664
+ * admins, after a step-up (a bearer token needs a fresh `auth_time`).
17665
+ * Witnium signs the add; the key counts once the returned op confirms.
17370
17666
  */
17371
17667
  addOrgContractKey(body: AddContractKeyRequest): Promise<ContractOwnerOpResponse>;
17372
17668
  /** Revoke a key added with {@link addOrgContractKey} (org admins). */