@witnium/witniumchain 0.25.0 → 0.27.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
@@ -1046,7 +1046,7 @@ interface paths$1 {
1046
1046
  put?: never;
1047
1047
  /**
1048
1048
  * Create a Stripe Checkout session
1049
- * @description Self-serve flow for the caller's organisation. Creates the Stripe Customer lazily on first call. Unlimited (flat-fee) orgs are rejected — they bill outside of Checkout.
1049
+ * @description Self-serve flow for the caller's organization, org admins only (403 for a plain or suspended member). Creates the Stripe Customer lazily on first call. Unlimited (flat-fee) orgs are rejected — they bill outside of Checkout.
1050
1050
  */
1051
1051
  post: {
1052
1052
  parameters: {
@@ -1147,6 +1147,31 @@ interface paths$1 {
1147
1147
  };
1148
1148
  };
1149
1149
  };
1150
+ /** @description Forbidden — insufficient permissions or scope */
1151
+ 403: {
1152
+ headers: {
1153
+ [name: string]: unknown;
1154
+ };
1155
+ content: {
1156
+ "application/json": {
1157
+ /**
1158
+ * @description HTTP status code
1159
+ * @example 400
1160
+ */
1161
+ statusCode?: number;
1162
+ /**
1163
+ * @description Short error label
1164
+ * @example Bad Request
1165
+ */
1166
+ error?: string;
1167
+ /**
1168
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
1169
+ * @example Validation failed
1170
+ */
1171
+ message: string | string[];
1172
+ };
1173
+ };
1174
+ };
1150
1175
  /** @description Not Found */
1151
1176
  404: {
1152
1177
  headers: {
@@ -1189,7 +1214,7 @@ interface paths$1 {
1189
1214
  };
1190
1215
  /**
1191
1216
  * Create a Stripe Customer Portal session
1192
- * @description Returns a Stripe-hosted Customer Portal URL for the caller's organisation (payment-method management, invoice history, subscription cancel). Stripe Customer is created lazily if it doesn't exist yet.
1217
+ * @description Returns a Stripe-hosted Customer Portal URL for the caller's organization (payment-method management, invoice history, subscription cancel), org admins only (403 for a plain or suspended member). Stripe Customer is created lazily if it doesn't exist yet.
1193
1218
  */
1194
1219
  get: {
1195
1220
  parameters: {
@@ -1240,6 +1265,31 @@ interface paths$1 {
1240
1265
  };
1241
1266
  };
1242
1267
  };
1268
+ /** @description Forbidden — insufficient permissions or scope */
1269
+ 403: {
1270
+ headers: {
1271
+ [name: string]: unknown;
1272
+ };
1273
+ content: {
1274
+ "application/json": {
1275
+ /**
1276
+ * @description HTTP status code
1277
+ * @example 400
1278
+ */
1279
+ statusCode?: number;
1280
+ /**
1281
+ * @description Short error label
1282
+ * @example Bad Request
1283
+ */
1284
+ error?: string;
1285
+ /**
1286
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
1287
+ * @example Validation failed
1288
+ */
1289
+ message: string | string[];
1290
+ };
1291
+ };
1292
+ };
1243
1293
  /** @description Not Found */
1244
1294
  404: {
1245
1295
  headers: {
@@ -2421,6 +2471,109 @@ interface paths$1 {
2421
2471
  patch?: never;
2422
2472
  trace?: never;
2423
2473
  };
2474
+ "/v1/orgs/me": {
2475
+ parameters: {
2476
+ query?: never;
2477
+ header?: never;
2478
+ path?: never;
2479
+ cookie?: never;
2480
+ };
2481
+ get?: never;
2482
+ put?: never;
2483
+ post?: never;
2484
+ delete?: never;
2485
+ options?: never;
2486
+ head?: never;
2487
+ /**
2488
+ * Rename the caller's org (session-cookie, org-admin only)
2489
+ * @description Changes the display name the dashboard and invitations show. The billing name on invoices is separate: it lives on the Stripe customer and is edited in the billing portal. The current name again is a no-op.
2490
+ */
2491
+ patch: {
2492
+ parameters: {
2493
+ query?: never;
2494
+ header?: never;
2495
+ path?: never;
2496
+ cookie?: never;
2497
+ };
2498
+ requestBody?: {
2499
+ content: {
2500
+ "application/json": {
2501
+ /** @description New display name of the organization. Leading and trailing spaces are dropped. */
2502
+ name: string;
2503
+ };
2504
+ };
2505
+ };
2506
+ responses: {
2507
+ /** @description Success */
2508
+ 200: {
2509
+ headers: {
2510
+ [name: string]: unknown;
2511
+ };
2512
+ content: {
2513
+ "application/json": {
2514
+ /**
2515
+ * @description UUID v4
2516
+ * @example 550e8400-e29b-41d4-a716-446655440000
2517
+ */
2518
+ id: string;
2519
+ name: string;
2520
+ };
2521
+ };
2522
+ };
2523
+ /** @description Bad Request — validation failed */
2524
+ 400: {
2525
+ headers: {
2526
+ [name: string]: unknown;
2527
+ };
2528
+ content: {
2529
+ "application/json": {
2530
+ /**
2531
+ * @description HTTP status code
2532
+ * @example 400
2533
+ */
2534
+ statusCode?: number;
2535
+ /**
2536
+ * @description Short error label
2537
+ * @example Bad Request
2538
+ */
2539
+ error?: string;
2540
+ /**
2541
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
2542
+ * @example Validation failed
2543
+ */
2544
+ message: string | string[];
2545
+ };
2546
+ };
2547
+ };
2548
+ /** @description Forbidden — insufficient permissions or scope */
2549
+ 403: {
2550
+ headers: {
2551
+ [name: string]: unknown;
2552
+ };
2553
+ content: {
2554
+ "application/json": {
2555
+ /**
2556
+ * @description HTTP status code
2557
+ * @example 400
2558
+ */
2559
+ statusCode?: number;
2560
+ /**
2561
+ * @description Short error label
2562
+ * @example Bad Request
2563
+ */
2564
+ error?: string;
2565
+ /**
2566
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
2567
+ * @example Validation failed
2568
+ */
2569
+ message: string | string[];
2570
+ };
2571
+ };
2572
+ };
2573
+ };
2574
+ };
2575
+ trace?: never;
2576
+ };
2424
2577
  "/v1/admin/organizations": {
2425
2578
  parameters: {
2426
2579
  query?: never;
@@ -2474,7 +2627,7 @@ interface paths$1 {
2474
2627
  "application/json": {
2475
2628
  /**
2476
2629
  * PublicOrg
2477
- * @description Publicly safe organisation shape.
2630
+ * @description Publicly safe organization shape.
2478
2631
  */
2479
2632
  organization: {
2480
2633
  /**
@@ -6380,7 +6533,7 @@ interface paths$1 {
6380
6533
  put?: never;
6381
6534
  /**
6382
6535
  * Propose a v5 witness (metered)
6383
- * @description Reserves one credit and forwards to chain-api v5. Auth is an OAuth Bearer token (the URL contract must be the user's) or an org API key (its organization's active contract). 120 proposes per minute per caller. Pass an `Idempotency-Key` HTTP header (the SDK auto-generates one if omitted) so retries dedupe at both the accounts reservation layer and chain-api propose.
6536
+ * @description Proposes the witness of `dataId` in the witness `scope`. Auth is an OAuth Bearer token (the URL contract must be the user's) or an org API key (its organization's active contract). 120 proposes per minute per caller. A scope holds at most one witness per dataId, ever. When it already holds it, the answer is 200 with that witness and `outcome: "existing"`, and nothing is charged. Otherwise one credit is reserved and the answer is 201, an intent to sign and finalize, `outcome: "created"`; a retry while it is in flight gets the same intent, and a failed, cancelled or expired attempt frees the scope. The same scope and dataId with another `userTimestamp`, `revealAfter` or `drandRound` is a 409 (`tlockCiphertext` is not compared: tlock encryption is randomized). Deprecated for one release: no `scope` and an `Idempotency-Key` header instead (per-caller key, no `outcome`).
6384
6537
  */
6385
6538
  post: {
6386
6539
  parameters: {
@@ -6394,6 +6547,8 @@ interface paths$1 {
6394
6547
  requestBody?: {
6395
6548
  content: {
6396
6549
  "application/json": {
6550
+ /** @description The witness scope: the SHA-256 of a key you choose, as 64 hex characters (case-insensitive). A scope holds at most one witness per dataId, ever, shared by every caller on the contract. Hash a date for "once per day", a project id for "once per project", a record id for a pipeline, or 32 random bytes for a new witness. Same scope and dataId: the same witness (`outcome: "existing"`, not charged). Required; for one release a propose without it may still send the deprecated `Idempotency-Key` header instead. */
6551
+ scope?: string;
6397
6552
  /** @description Content hash being witnessed. */
6398
6553
  dataId: string;
6399
6554
  /** @description Ed25519 public keys whose signatures must be collected before finalize. */
@@ -6414,6 +6569,31 @@ interface paths$1 {
6414
6569
  };
6415
6570
  };
6416
6571
  responses: {
6572
+ /** @description Success */
6573
+ 200: {
6574
+ headers: {
6575
+ [name: string]: unknown;
6576
+ };
6577
+ content: {
6578
+ "application/json": {
6579
+ /**
6580
+ * @description The scope already holds the witness for this dataId: this call created nothing and charged nothing.
6581
+ * @enum {string}
6582
+ */
6583
+ outcome: "existing";
6584
+ /**
6585
+ * Format: uuid
6586
+ * @description UUID minted at propose time. Identifies the in-flight v5 witness intent until finalize; once finalized, the intent maps to an on-chain witnessId returned in the finalize response.
6587
+ */
6588
+ intentId: string;
6589
+ /** @description 32-byte hash, lower-case hex without 0x prefix. */
6590
+ witnessId: string;
6591
+ blockNumber: number;
6592
+ /** @description Block timestamp of the block that created the witness (unix seconds): when it was made. */
6593
+ chainTimestamp: number;
6594
+ };
6595
+ };
6596
+ };
6417
6597
  /** @description Created */
6418
6598
  201: {
6419
6599
  headers: {
@@ -6433,6 +6613,11 @@ interface paths$1 {
6433
6613
  /** @description Prepare-record TTL on chain-api. Sign + finalize within this window. */
6434
6614
  expiresInSeconds: number;
6435
6615
  requiredSigners: string[];
6616
+ /**
6617
+ * @description Set on a scoped propose: this intent creates the witness in the scope (sign and finalize it). A retry while the intent is in flight gets the same intent. Absent on the deprecated Idempotency-Key path.
6618
+ * @enum {string}
6619
+ */
6620
+ outcome?: "created";
6436
6621
  };
6437
6622
  };
6438
6623
  };
@@ -6536,6 +6721,41 @@ interface paths$1 {
6536
6721
  };
6537
6722
  };
6538
6723
  };
6724
+ /** @description Conflict */
6725
+ 409: {
6726
+ headers: {
6727
+ [name: string]: unknown;
6728
+ };
6729
+ content: {
6730
+ "application/json": {
6731
+ /**
6732
+ * @description `scope_details_mismatch`: the scope holds (or is creating) the witness for this dataId with another userTimestamp, revealAfter or drandRound (v5). `scope_in_progress`: an attempt this request cannot join is in flight in the scope (another caller, or your own with another body); retry later. `scope_registry_mismatch`: proposed on another registry version.
6733
+ * @enum {string}
6734
+ */
6735
+ code: "scope_details_mismatch" | "scope_in_progress" | "scope_registry_mismatch";
6736
+ message: string;
6737
+ scope: string;
6738
+ /** @description The witness already in the scope (`scope_details_mismatch` once it is mined). */
6739
+ witnessId?: string;
6740
+ } | {
6741
+ /**
6742
+ * @description HTTP status code
6743
+ * @example 400
6744
+ */
6745
+ statusCode?: number;
6746
+ /**
6747
+ * @description Short error label
6748
+ * @example Bad Request
6749
+ */
6750
+ error?: string;
6751
+ /**
6752
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
6753
+ * @example Validation failed
6754
+ */
6755
+ message: string | string[];
6756
+ };
6757
+ };
6758
+ };
6539
6759
  /** @description Too Many Requests */
6540
6760
  429: {
6541
6761
  headers: {
@@ -15593,6 +15813,8 @@ type RemoveContractKeyResponse = Res<'/v1/orgs/me/contract/keys/{publicKey}', 'd
15593
15813
  type ContractActivityResponse = Res<'/v1/orgs/me/owner-operations', 'get'>;
15594
15814
  type CreateOrgRequest = Req<'/v1/orgs', 'post'>;
15595
15815
  type CreateOrgResponse = Res<'/v1/orgs', 'post'>;
15816
+ type RenameOrgRequest = Req<'/v1/orgs/me', 'patch'>;
15817
+ type RenameOrgResponse = Res<'/v1/orgs/me', 'patch'>;
15596
15818
  type MembersListResponse = Res<'/v1/orgs/me/members', 'get'>;
15597
15819
  type InviteMemberRequest = Req<'/v1/orgs/me/members/invite', 'post'>;
15598
15820
  type InviteMemberResponse = Res<'/v1/orgs/me/members/invite', 'post'>;
@@ -15628,7 +15850,40 @@ type RevokeWitnessRequest = Req<'/v1/contracts/{contractAddress}/witnesses/{witn
15628
15850
  type RevokeWitnessResponse = Res<'/v1/contracts/{contractAddress}/witnesses/{witnessId}/revoke', 'post'>;
15629
15851
  type GetWitnessResponse = Res<'/v1/contracts/{contractAddress}/witnesses/{witnessId}', 'get'>;
15630
15852
  type ProposeWitnessV5Request = Req<'/v5/contracts/{contractAddress}/witnesses/propose', 'post'>;
15631
- type ProposeWitnessV5Response = Res<'/v5/contracts/{contractAddress}/witnesses/propose', 'post'>;
15853
+ /** accounts' answer to a v5 propose: 201 (an intent) or 200 (the scope already holds the witness). */
15854
+ type ProposeWitnessV5Answer = Res<'/v5/contracts/{contractAddress}/witnesses/propose', 'post'>;
15855
+ type ProposeWitnessV5Intent = Extract<ProposeWitnessV5Answer, {
15856
+ payloadToSign: string;
15857
+ }>;
15858
+ /**
15859
+ * A scoped propose that created the witness: an intent to sign and
15860
+ * finalize. `scope` is the one the propose ran in (the caller's, or the
15861
+ * one the SDK generated).
15862
+ */
15863
+ type ProposeWitnessV5Created = Omit<ProposeWitnessV5Intent, 'outcome'> & {
15864
+ outcome: 'created';
15865
+ scope: string;
15866
+ };
15867
+ /**
15868
+ * The scope already held the witness for this dataId: nothing was created
15869
+ * or charged, and there is nothing to sign. `witnessId` and
15870
+ * `chainTimestamp` say which witness and when it was made.
15871
+ */
15872
+ type ProposeWitnessV5Existing = Extract<ProposeWitnessV5Answer, {
15873
+ outcome: 'existing';
15874
+ }> & {
15875
+ scope: string;
15876
+ };
15877
+ /** What {@link WitniumchainClient.proposeWitnessV5} resolves to; branch on `outcome`. */
15878
+ type ProposeWitnessV5Result = ProposeWitnessV5Created | ProposeWitnessV5Existing;
15879
+ /** @deprecated The body of a propose on the deprecated `Idempotency-Key` path (no `scope`). */
15880
+ type ProposeWitnessV5LegacyRequest = Omit<ProposeWitnessV5Request, 'scope'>;
15881
+ /** @deprecated The answer on the deprecated `Idempotency-Key` path: an intent, no `outcome`, no `scope`. */
15882
+ type ProposeWitnessV5LegacyResponse = Omit<ProposeWitnessV5Intent, 'outcome'>;
15883
+ /** The `code` of a 409 to a scoped propose, from the spec's 409 body. */
15884
+ type WitnessScopeConflictCode = Extract<JsonBody<paths$1['/v5/contracts/{contractAddress}/witnesses/propose']['post']['responses'][409]>, {
15885
+ code: string;
15886
+ }>['code'];
15632
15887
  type SubmitSignatureV5Request = Req<'/v5/contracts/{contractAddress}/witnesses/{intentId}/sign', 'post'>;
15633
15888
  type SubmitSignatureV5Response = Res<'/v5/contracts/{contractAddress}/witnesses/{intentId}/sign', 'post'>;
15634
15889
  type FinalizeWitnessV5Response = Res<'/v5/contracts/{contractAddress}/witnesses/{intentId}/finalize', 'post'>;
@@ -15936,6 +16191,8 @@ declare class WitniumchainClient {
15936
16191
  readonly recovery: Recovery;
15937
16192
  /** The signed-in user's sign-in methods, behind step-up. `client.security.*`. */
15938
16193
  readonly security: AccountSecurity;
16194
+ /** The signed-in member's org: rename it (org admins). `client.organization.*`. */
16195
+ readonly organization: Organization;
15939
16196
  /** Session-cookie team management (org-admin only). `client.orgUsers.*`. */
15940
16197
  readonly orgUsers: OrgMembers;
15941
16198
  /** The home org's API keys (session; org admins create and revoke). `client.apiKeys.*`. */
@@ -15985,6 +16242,7 @@ declare class WitniumchainClient {
15985
16242
  listApiKeys(): Promise<ListApiKeysResponse>;
15986
16243
  /** Revoke an API key (org admin). It stops working when this returns. */
15987
16244
  revokeApiKey(id: string): Promise<void>;
16245
+ renameOrg(body: RenameOrgRequest): Promise<RenameOrgResponse>;
15988
16246
  listMembers(): Promise<MembersListResponse>;
15989
16247
  inviteMember(body: InviteMemberRequest): Promise<InviteMemberResponse>;
15990
16248
  suspendMember(userId: string): Promise<SuspendMemberResponse>;
@@ -16073,7 +16331,33 @@ declare class WitniumchainClient {
16073
16331
  finalizeWitness(contractAddress: string, witnessId: string): Promise<FinalizeWitnessResponse>;
16074
16332
  revokeWitness(contractAddress: string, witnessId: string, body: RevokeWitnessRequest, idempotencyKey?: string): Promise<RevokeWitnessResponse>;
16075
16333
  getWitness(contractAddress: string, witnessId: string): Promise<GetWitnessResponse>;
16076
- proposeWitnessV5(contractAddress: string, body: ProposeWitnessV5Request, idempotencyKey?: string): Promise<ProposeWitnessV5Response>;
16334
+ /**
16335
+ * Propose the witness of `body.dataId` in the witness scope `body.scope`
16336
+ * (64 hex, the SHA-256 of a key you choose; see {@link witnessScopeFor}).
16337
+ * Without a scope the SDK generates a random one, so the call is a new
16338
+ * witness; the scope comes back in the result and in every error, for a
16339
+ * retry that can never create or charge a second witness.
16340
+ *
16341
+ * - `outcome: "created"`: an intent; sign and finalize it as before.
16342
+ * One credit is reserved.
16343
+ * - `outcome: "existing"`: the scope already held the witness for this
16344
+ * dataId (`witnessId`, `blockNumber`, `chainTimestamp`). Nothing was
16345
+ * created or charged; there is nothing to sign.
16346
+ *
16347
+ * Errors are {@link WitnessProposeError} (with `scope`); a scope 409 is
16348
+ * {@link WitnessScopeConflictError} (with `code` and `witnessId`).
16349
+ */
16350
+ proposeWitnessV5(contractAddress: string, body: ProposeWitnessV5Request): Promise<ProposeWitnessV5Result>;
16351
+ /**
16352
+ * @deprecated The `Idempotency-Key` path for proposes works for one more
16353
+ * release of accounts, then it is removed. Pass a `scope` in the body
16354
+ * instead (`await witnessScopeFor(key)`, or the key itself when it is
16355
+ * already 64 hex). The rule changes with it: a scope holds one witness
16356
+ * per dataId, shared by every caller on the contract, where a key was
16357
+ * one request per caller. The answer here has no `outcome` and no
16358
+ * `scope`; its errors are plain {@link WitniumchainApiError}s.
16359
+ */
16360
+ proposeWitnessV5(contractAddress: string, body: ProposeWitnessV5LegacyRequest, idempotencyKey: string): Promise<ProposeWitnessV5LegacyResponse>;
16077
16361
  /**
16078
16362
  * What happened to an intent whose propose or finalize answer was lost
16079
16363
  * (read-only, the caller's own contract): accounts' stored finalize
@@ -16521,6 +16805,21 @@ declare class OrgApiKeys {
16521
16805
  list(): Promise<ListApiKeysResponse>;
16522
16806
  revoke(id: string): Promise<void>;
16523
16807
  }
16808
+ /**
16809
+ * `client.organization.*`: the signed-in member's org, resolved server-side
16810
+ * from the session (no orgId parameter).
16811
+ */
16812
+ declare class Organization {
16813
+ private readonly client;
16814
+ constructor(client: WitniumchainClient);
16815
+ /**
16816
+ * Rename the org (org admins). This is the display name the dashboard and
16817
+ * invitations show; the billing name on invoices is separate and edited in
16818
+ * the billing portal. Surrounding spaces are dropped; the current name
16819
+ * again is a no-op.
16820
+ */
16821
+ rename(name: string): Promise<RenameOrgResponse>;
16822
+ }
16524
16823
  /**
16525
16824
  * `client.orgUsers.*` — session-cookie team management for the org-admin
16526
16825
  * dashboard. The caller's org + org-admin role are resolved server-side from
@@ -16634,8 +16933,21 @@ declare class WitniumchainApiKeyClient {
16634
16933
  me(): Promise<ApiKeySelfResponse>;
16635
16934
  /** Sign a payload with the key's own signing key (`delegatedKeyId` from {@link me}). */
16636
16935
  sign(body: SignRequest, requestId?: string): Promise<SignResponse>;
16637
- /** Propose a witness on the org's contract; reserves one credit. */
16638
- proposeWitnessV5(contractAddress: string, body: ProposeWitnessV5Request, idempotencyKey?: string): Promise<ProposeWitnessV5Response>;
16936
+ /**
16937
+ * Propose a witness on the org's contract in the witness scope
16938
+ * `body.scope` (generated when absent; returned in the result and in
16939
+ * every error). `outcome: "created"` reserves one credit and is an
16940
+ * intent to sign and finalize; `outcome: "existing"` is the witness the
16941
+ * scope already held, not charged. See
16942
+ * {@link WitniumchainClient.proposeWitnessV5}.
16943
+ */
16944
+ proposeWitnessV5(contractAddress: string, body: ProposeWitnessV5Request): Promise<ProposeWitnessV5Result>;
16945
+ /**
16946
+ * @deprecated The `Idempotency-Key` path for proposes works for one more
16947
+ * release of accounts. Pass a `scope` in the body instead; see
16948
+ * {@link WitniumchainClient.proposeWitnessV5}.
16949
+ */
16950
+ proposeWitnessV5(contractAddress: string, body: ProposeWitnessV5LegacyRequest, idempotencyKey: string): Promise<ProposeWitnessV5LegacyResponse>;
16639
16951
  /** Submit the signature for an intent this key proposed. */
16640
16952
  signWitnessV5(contractAddress: string, intentId: string, body: SubmitSignatureV5Request): Promise<SubmitSignatureV5Response>;
16641
16953
  /** Finalize an intent this key proposed; returns the witness id. */
@@ -16661,6 +16973,61 @@ declare class WitniumchainApiError extends Error {
16661
16973
  body?: unknown;
16662
16974
  });
16663
16975
  }
16976
+ /**
16977
+ * Every error of a scoped witness propose (`proposeWitnessV5` without the
16978
+ * deprecated idempotency key): API errors, network errors and timeouts, a
16979
+ * response that broke off or is malformed. Carries the `scope` the propose
16980
+ * ran in, so the caller can retry in the same scope: a retry can never
16981
+ * create or charge a second witness for the same dataId. `status` is 0 when
16982
+ * there was no HTTP error status; the original error is `cause`.
16983
+ */
16984
+ declare class WitnessProposeError extends WitniumchainApiError {
16985
+ /** The scope of the failed propose (64 lowercase hex). */
16986
+ readonly scope: string;
16987
+ constructor(cause: unknown, scope: string);
16988
+ }
16989
+ /**
16990
+ * A 409 to a scoped propose; branch on `code`:
16991
+ * - `scope_details_mismatch`: the scope holds (or is creating) the witness
16992
+ * for this dataId with another `userTimestamp`, `revealAfter` or
16993
+ * `drandRound`. `witnessId` is that witness once it is mined. Put the
16994
+ * detail into the scope, or use another scope.
16995
+ * - `scope_in_progress`: an attempt in the scope is in flight that this
16996
+ * request cannot join (another caller's, or your own with another body,
16997
+ * e.g. a re-encrypted `tlockCiphertext`: resend the identical body).
16998
+ * Retry later: once it is mined the answer is `existing`; once it failed
16999
+ * or expired the scope is free.
17000
+ * - `scope_registry_mismatch`: the scope's witness was proposed on the
17001
+ * other registry version.
17002
+ */
17003
+ declare class WitnessScopeConflictError extends WitnessProposeError {
17004
+ readonly code: WitnessScopeConflictCode;
17005
+ /** The witness already in the scope (`scope_details_mismatch` once it is mined). */
17006
+ readonly witnessId: string | undefined;
17007
+ constructor(cause: WitniumchainApiError, scope: string, code: WitnessScopeConflictCode, witnessId: string | undefined);
17008
+ }
17009
+
17010
+ /**
17011
+ * Witness scopes. A scope holds at most one witness per content hash
17012
+ * (`dataId`), ever, shared by every caller on the contract. The scope is
17013
+ * the SHA-256 of a key the caller chooses, as 64 hex characters: hash a
17014
+ * date for "once per day", a project id for "once per project", a record id
17015
+ * for a pipeline, or use 32 random bytes for a new witness.
17016
+ *
17017
+ * - Same scope and dataId: the same witness (`outcome: "existing"`, not
17018
+ * charged), whoever proposed it.
17019
+ * - Same scope, another dataId: another witness in that scope.
17020
+ * - Duplicates on purpose: a new random scope.
17021
+ */
17022
+
17023
+ /** A new scope: 32 random bytes as 64 lowercase hex. Every propose in it is a new witness. */
17024
+ declare function randomWitnessScope(): string;
17025
+ /**
17026
+ * The scope of a key you choose: SHA-256 of its UTF-8 bytes, 64 lowercase
17027
+ * hex. Witnium never sees the key itself. `witnessScopeFor('2026-11-06')`
17028
+ * holds one witness per dataId for that day.
17029
+ */
17030
+ declare function witnessScopeFor(key: string): Promise<string>;
16664
17031
 
16665
17032
  /**
16666
17033
  * Canonical owner-operation messages.
@@ -16768,4 +17135,4 @@ declare const ownerKeyFile: {
16768
17135
  sign: typeof signWithOwnerKeyFile;
16769
17136
  };
16770
17137
 
16771
- export { type AcceptInviteResponse, type AccountContractStatusResponse, type AccountResponse, AccountSecurity, type AccountSecurityResponse, type paths$1 as AccountsPaths, type AddContractKeyRequest, type AddPasswordTotpResponse, type AddSigningKeyRequest$1 as AddSigningKeyRequest, type AddSigningKeyResponse, type ApiKeySelfResponse, type ApproveSigningKeyRequest, type BeginOAuthLoginArgs, type BeginOAuthLoginResult, type paths as ChainPaths, type CheckoutRequest, type CheckoutResponse, type ChooseCustodyRequest, type ChooseCustodyResponse, type ContractActivityResponse, type ContractOwnerOpResponse, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateOrgRequest, type CreateOrgResponse, DashboardKey, type DashboardKeyResponse, DelegatedKeys, type DeploySelfCustodyRequest, type DeploySelfCustodyResponse, Enrollment, type EnrollmentCompleteResponse, type EnrollmentStateResponse, type FinalizeWitnessResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetWitnessResponse, type HealthLiveResponse, type HealthReadyResponse, type InviteMemberRequest, type InviteMemberResponse, type LedgerResponse, type ListApiKeysResponse, type ListDelegatedKeysResponse, type ListOauthSessionsResponse, type LoginRequest, type LoginResponse, type LogoutResponse, type MembersListResponse, type MessageResponse, type MfaProofRequest, type OAuthTokenSnapshot, OWNER_KEY_FILE_FORMAT, OWNER_OP, OauthNamespace, OauthSessions, OrgApiKeys, OrgContract, OrgMembers, type OwnerKeyFile, 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, Recovery, type RecoveryCodesResponse, type RecoveryStatusResponse, type ReissueProvisioningTokenResponse, type RemoveContractKeyResponse, type RemoveMemberResponse, type ResendInviteResponse, type ResetAccountResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDelegatedKeyResponse, type RevokeSigningKeyRequest$1 as RevokeSigningKeyRequest, type RevokeSigningKeyResponse, type RevokeWitnessRequest, type RevokeWitnessResponse, type SessionStartedResponse, type SetMemberRoleRequest, type SetMemberRoleResponse, type SignRequest, type SignResponse, type SignWitnessRequest, type SignWitnessResponse, type SignedRequestSigner, type SigningKeyRequestCreate, type SigningKeyRequestView, type SigningKeyRequestsResponse, type SigningKeyView, SigningKeys, type SigningKeysResponse, type SignupRequest, type SignupResponse, type StepUpProof, type SubmitDelegatedKeyRequest, type SubmitDelegatedKeyResponse, Subscriptions, type SuspendMemberResponse, type TotpSetupResponse, type UnpauseRequest, type UnpauseResponse, type VerifySignupRequest, type VerifySignupResponse, type WitnessIntentRecoveryV5, WitniumchainApiError, WitniumchainApiKeyClient, type WitniumchainApiKeyClientConfig, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage, generateOwnerKeyFile, ownerKeyFile, ownerKeyFileName, parseOwnerKeyFile, serializeOwnerKeyFile, signWithOwnerKeyFile };
17138
+ export { type AcceptInviteResponse, type AccountContractStatusResponse, type AccountResponse, AccountSecurity, type AccountSecurityResponse, type paths$1 as AccountsPaths, type AddContractKeyRequest, type AddPasswordTotpResponse, type AddSigningKeyRequest$1 as AddSigningKeyRequest, type AddSigningKeyResponse, type ApiKeySelfResponse, type ApproveSigningKeyRequest, type BeginOAuthLoginArgs, type BeginOAuthLoginResult, type paths as ChainPaths, type CheckoutRequest, type CheckoutResponse, type ChooseCustodyRequest, type ChooseCustodyResponse, type ContractActivityResponse, type ContractOwnerOpResponse, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateOrgRequest, type CreateOrgResponse, DashboardKey, type DashboardKeyResponse, DelegatedKeys, type DeploySelfCustodyRequest, type DeploySelfCustodyResponse, Enrollment, type EnrollmentCompleteResponse, type EnrollmentStateResponse, type FinalizeWitnessResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetWitnessResponse, type HealthLiveResponse, type HealthReadyResponse, type InviteMemberRequest, type InviteMemberResponse, type LedgerResponse, type ListApiKeysResponse, type ListDelegatedKeysResponse, type ListOauthSessionsResponse, type LoginRequest, type LoginResponse, type LogoutResponse, type MembersListResponse, type MessageResponse, type MfaProofRequest, type OAuthTokenSnapshot, OWNER_KEY_FILE_FORMAT, OWNER_OP, OauthNamespace, OauthSessions, OrgApiKeys, OrgContract, OrgMembers, Organization, type OwnerKeyFile, type OwnerOpName, type OwnerSigner, type PauseRequest$1 as PauseRequest, type PauseResponse, type PkceVerifierStorage, type PortalResponse, type PrepareDelegatedKeyRequest, type PreparedDelegatedKeyResponse, type ProposeWitnessRequest, type ProposeWitnessResponse, type ProposeWitnessV5Created, type ProposeWitnessV5Existing, type ProposeWitnessV5LegacyRequest, type ProposeWitnessV5LegacyResponse, type ProposeWitnessV5Request, type ProposeWitnessV5Result, type ProvisionContractRequest, type ProvisionContractResponse, type ProvisionDelegatedKeyArgs, type ProvisionDelegatedKeyResult, Recovery, type RecoveryCodesResponse, type RecoveryStatusResponse, type ReissueProvisioningTokenResponse, type RemoveContractKeyResponse, type RemoveMemberResponse, type RenameOrgRequest, type RenameOrgResponse, type ResendInviteResponse, type ResetAccountResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDelegatedKeyResponse, type RevokeSigningKeyRequest$1 as RevokeSigningKeyRequest, type RevokeSigningKeyResponse, type RevokeWitnessRequest, type RevokeWitnessResponse, type SessionStartedResponse, type SetMemberRoleRequest, type SetMemberRoleResponse, type SignRequest, type SignResponse, type SignWitnessRequest, type SignWitnessResponse, type SignedRequestSigner, type SigningKeyRequestCreate, type SigningKeyRequestView, type SigningKeyRequestsResponse, type SigningKeyView, SigningKeys, type SigningKeysResponse, type SignupRequest, type SignupResponse, type StepUpProof, type SubmitDelegatedKeyRequest, type SubmitDelegatedKeyResponse, Subscriptions, type SuspendMemberResponse, type TotpSetupResponse, type UnpauseRequest, type UnpauseResponse, type VerifySignupRequest, type VerifySignupResponse, type WitnessIntentRecoveryV5, WitnessProposeError, type WitnessScopeConflictCode, WitnessScopeConflictError, WitniumchainApiError, WitniumchainApiKeyClient, type WitniumchainApiKeyClientConfig, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage, generateOwnerKeyFile, ownerKeyFile, ownerKeyFileName, parseOwnerKeyFile, randomWitnessScope, serializeOwnerKeyFile, signWithOwnerKeyFile, witnessScopeFor };