@witnium/witniumchain 0.25.0 → 0.26.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/README.md CHANGED
@@ -63,7 +63,7 @@ throw at call time.
63
63
 
64
64
  | Credential | Header / Cookie | Used by |
65
65
  |---|---|---|
66
- | `sessionCookie` | `Cookie: wac_session=…` | `/v1/auth/logout`, `/v1/account/*`, `/v1/billing/*`, `/v1/keys/*`, `/v1/contracts/{pause,unpause}`, `/v1/oauth/sessions*` |
66
+ | `sessionCookie` | `Cookie: wac_session=…` | `/v1/auth/logout`, `/v1/account/*`, `/v1/billing/*`, `/v1/orgs/me*`, `/v1/keys/*`, `/v1/contracts/{pause,unpause}`, `/v1/oauth/sessions*` |
67
67
  | `accessToken` | `Authorization: Bearer <JWT>` | `/v1/users/me/delegated-keys/*`, `/v1/sign`, **all chain-api reads** |
68
68
  | `apiKey` | `Authorization: Bearer wcak_…` | `/v1/sign`, `/v1/api-key`, v5 witness `propose`/`sign`/`finalize` (via `WitniumchainApiKeyClient`) |
69
69
  | `adminToken` | `Authorization: Bearer <ADMIN_TOKEN>` | `/v1/admin/*` |
@@ -145,7 +145,18 @@ Org admins manage keys with the dashboard session: `client.apiKeys.create({ labe
145
145
  (after a step-up; the secret is returned once), `client.apiKeys.list()`,
146
146
  `client.apiKeys.revoke(id)`.
147
147
 
148
- ### Sysadmin — create an organisation
148
+ ### Org admins: the organization and its team
149
+
150
+ With the dashboard's session cookie, an org admin manages their own org;
151
+ the org comes from the session, never from a parameter.
152
+
153
+ ```ts
154
+ await client.organization.rename('Witnium Newsroom'); // display name; the billing name stays in the billing portal
155
+ await client.orgUsers.invite({ email: 'teammate@example.com', role: 'member' });
156
+ const { members } = await client.orgUsers.list();
157
+ ```
158
+
159
+ ### Sysadmin — create an organization
149
160
 
150
161
  ```ts
151
162
  const sys = new WitniumchainClient({
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
  /**
@@ -15593,6 +15746,8 @@ type RemoveContractKeyResponse = Res<'/v1/orgs/me/contract/keys/{publicKey}', 'd
15593
15746
  type ContractActivityResponse = Res<'/v1/orgs/me/owner-operations', 'get'>;
15594
15747
  type CreateOrgRequest = Req<'/v1/orgs', 'post'>;
15595
15748
  type CreateOrgResponse = Res<'/v1/orgs', 'post'>;
15749
+ type RenameOrgRequest = Req<'/v1/orgs/me', 'patch'>;
15750
+ type RenameOrgResponse = Res<'/v1/orgs/me', 'patch'>;
15596
15751
  type MembersListResponse = Res<'/v1/orgs/me/members', 'get'>;
15597
15752
  type InviteMemberRequest = Req<'/v1/orgs/me/members/invite', 'post'>;
15598
15753
  type InviteMemberResponse = Res<'/v1/orgs/me/members/invite', 'post'>;
@@ -15936,6 +16091,8 @@ declare class WitniumchainClient {
15936
16091
  readonly recovery: Recovery;
15937
16092
  /** The signed-in user's sign-in methods, behind step-up. `client.security.*`. */
15938
16093
  readonly security: AccountSecurity;
16094
+ /** The signed-in member's org: rename it (org admins). `client.organization.*`. */
16095
+ readonly organization: Organization;
15939
16096
  /** Session-cookie team management (org-admin only). `client.orgUsers.*`. */
15940
16097
  readonly orgUsers: OrgMembers;
15941
16098
  /** The home org's API keys (session; org admins create and revoke). `client.apiKeys.*`. */
@@ -15985,6 +16142,7 @@ declare class WitniumchainClient {
15985
16142
  listApiKeys(): Promise<ListApiKeysResponse>;
15986
16143
  /** Revoke an API key (org admin). It stops working when this returns. */
15987
16144
  revokeApiKey(id: string): Promise<void>;
16145
+ renameOrg(body: RenameOrgRequest): Promise<RenameOrgResponse>;
15988
16146
  listMembers(): Promise<MembersListResponse>;
15989
16147
  inviteMember(body: InviteMemberRequest): Promise<InviteMemberResponse>;
15990
16148
  suspendMember(userId: string): Promise<SuspendMemberResponse>;
@@ -16521,6 +16679,21 @@ declare class OrgApiKeys {
16521
16679
  list(): Promise<ListApiKeysResponse>;
16522
16680
  revoke(id: string): Promise<void>;
16523
16681
  }
16682
+ /**
16683
+ * `client.organization.*`: the signed-in member's org, resolved server-side
16684
+ * from the session (no orgId parameter).
16685
+ */
16686
+ declare class Organization {
16687
+ private readonly client;
16688
+ constructor(client: WitniumchainClient);
16689
+ /**
16690
+ * Rename the org (org admins). This is the display name the dashboard and
16691
+ * invitations show; the billing name on invoices is separate and edited in
16692
+ * the billing portal. Surrounding spaces are dropped; the current name
16693
+ * again is a no-op.
16694
+ */
16695
+ rename(name: string): Promise<RenameOrgResponse>;
16696
+ }
16524
16697
  /**
16525
16698
  * `client.orgUsers.*` — session-cookie team management for the org-admin
16526
16699
  * dashboard. The caller's org + org-admin role are resolved server-side from
@@ -16768,4 +16941,4 @@ declare const ownerKeyFile: {
16768
16941
  sign: typeof signWithOwnerKeyFile;
16769
16942
  };
16770
16943
 
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 };
16944
+ 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 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, WitniumchainApiError, WitniumchainApiKeyClient, type WitniumchainApiKeyClientConfig, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage, generateOwnerKeyFile, ownerKeyFile, ownerKeyFileName, parseOwnerKeyFile, serializeOwnerKeyFile, signWithOwnerKeyFile };
package/dist/index.d.ts 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
  /**
@@ -15593,6 +15746,8 @@ type RemoveContractKeyResponse = Res<'/v1/orgs/me/contract/keys/{publicKey}', 'd
15593
15746
  type ContractActivityResponse = Res<'/v1/orgs/me/owner-operations', 'get'>;
15594
15747
  type CreateOrgRequest = Req<'/v1/orgs', 'post'>;
15595
15748
  type CreateOrgResponse = Res<'/v1/orgs', 'post'>;
15749
+ type RenameOrgRequest = Req<'/v1/orgs/me', 'patch'>;
15750
+ type RenameOrgResponse = Res<'/v1/orgs/me', 'patch'>;
15596
15751
  type MembersListResponse = Res<'/v1/orgs/me/members', 'get'>;
15597
15752
  type InviteMemberRequest = Req<'/v1/orgs/me/members/invite', 'post'>;
15598
15753
  type InviteMemberResponse = Res<'/v1/orgs/me/members/invite', 'post'>;
@@ -15936,6 +16091,8 @@ declare class WitniumchainClient {
15936
16091
  readonly recovery: Recovery;
15937
16092
  /** The signed-in user's sign-in methods, behind step-up. `client.security.*`. */
15938
16093
  readonly security: AccountSecurity;
16094
+ /** The signed-in member's org: rename it (org admins). `client.organization.*`. */
16095
+ readonly organization: Organization;
15939
16096
  /** Session-cookie team management (org-admin only). `client.orgUsers.*`. */
15940
16097
  readonly orgUsers: OrgMembers;
15941
16098
  /** The home org's API keys (session; org admins create and revoke). `client.apiKeys.*`. */
@@ -15985,6 +16142,7 @@ declare class WitniumchainClient {
15985
16142
  listApiKeys(): Promise<ListApiKeysResponse>;
15986
16143
  /** Revoke an API key (org admin). It stops working when this returns. */
15987
16144
  revokeApiKey(id: string): Promise<void>;
16145
+ renameOrg(body: RenameOrgRequest): Promise<RenameOrgResponse>;
15988
16146
  listMembers(): Promise<MembersListResponse>;
15989
16147
  inviteMember(body: InviteMemberRequest): Promise<InviteMemberResponse>;
15990
16148
  suspendMember(userId: string): Promise<SuspendMemberResponse>;
@@ -16521,6 +16679,21 @@ declare class OrgApiKeys {
16521
16679
  list(): Promise<ListApiKeysResponse>;
16522
16680
  revoke(id: string): Promise<void>;
16523
16681
  }
16682
+ /**
16683
+ * `client.organization.*`: the signed-in member's org, resolved server-side
16684
+ * from the session (no orgId parameter).
16685
+ */
16686
+ declare class Organization {
16687
+ private readonly client;
16688
+ constructor(client: WitniumchainClient);
16689
+ /**
16690
+ * Rename the org (org admins). This is the display name the dashboard and
16691
+ * invitations show; the billing name on invoices is separate and edited in
16692
+ * the billing portal. Surrounding spaces are dropped; the current name
16693
+ * again is a no-op.
16694
+ */
16695
+ rename(name: string): Promise<RenameOrgResponse>;
16696
+ }
16524
16697
  /**
16525
16698
  * `client.orgUsers.*` — session-cookie team management for the org-admin
16526
16699
  * dashboard. The caller's org + org-admin role are resolved server-side from
@@ -16768,4 +16941,4 @@ declare const ownerKeyFile: {
16768
16941
  sign: typeof signWithOwnerKeyFile;
16769
16942
  };
16770
16943
 
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 };
16944
+ 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 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, WitniumchainApiError, WitniumchainApiKeyClient, type WitniumchainApiKeyClientConfig, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage, generateOwnerKeyFile, ownerKeyFile, ownerKeyFileName, parseOwnerKeyFile, serializeOwnerKeyFile, signWithOwnerKeyFile };
package/dist/index.js CHANGED
@@ -135,6 +135,8 @@ var WitniumchainClient = class {
135
135
  recovery;
136
136
  /** The signed-in user's sign-in methods, behind step-up. `client.security.*`. */
137
137
  security;
138
+ /** The signed-in member's org: rename it (org admins). `client.organization.*`. */
139
+ organization;
138
140
  /** Session-cookie team management (org-admin only). `client.orgUsers.*`. */
139
141
  orgUsers;
140
142
  /** The home org's API keys (session; org admins create and revoke). `client.apiKeys.*`. */
@@ -169,6 +171,7 @@ var WitniumchainClient = class {
169
171
  this.enrollment = new Enrollment(this);
170
172
  this.recovery = new Recovery(this);
171
173
  this.security = new AccountSecurity(this);
174
+ this.organization = new Organization(this);
172
175
  this.orgUsers = new OrgMembers(this);
173
176
  this.apiKeys = new OrgApiKeys(this);
174
177
  this.dashboardKey = new DashboardKey(this);
@@ -251,6 +254,9 @@ var WitniumchainClient = class {
251
254
  expectNoContent: true
252
255
  });
253
256
  }
257
+ renameOrg(body) {
258
+ return this.req("PATCH", "/v1/orgs/me", { auth: "SessionCookie", body });
259
+ }
254
260
  listMembers() {
255
261
  return this.req("GET", "/v1/orgs/me/members", { auth: "SessionCookie" });
256
262
  }
@@ -1708,6 +1714,21 @@ var OrgApiKeys = class {
1708
1714
  return this.client.revokeApiKey(id);
1709
1715
  }
1710
1716
  };
1717
+ var Organization = class {
1718
+ constructor(client) {
1719
+ this.client = client;
1720
+ }
1721
+ client;
1722
+ /**
1723
+ * Rename the org (org admins). This is the display name the dashboard and
1724
+ * invitations show; the billing name on invoices is separate and edited in
1725
+ * the billing portal. Surrounding spaces are dropped; the current name
1726
+ * again is a no-op.
1727
+ */
1728
+ rename(name) {
1729
+ return this.client.renameOrg({ name });
1730
+ }
1731
+ };
1711
1732
  var OrgMembers = class {
1712
1733
  constructor(client) {
1713
1734
  this.client = client;
@@ -2066,6 +2087,7 @@ exports.OauthSessions = OauthSessions;
2066
2087
  exports.OrgApiKeys = OrgApiKeys;
2067
2088
  exports.OrgContract = OrgContract;
2068
2089
  exports.OrgMembers = OrgMembers;
2090
+ exports.Organization = Organization;
2069
2091
  exports.Recovery = Recovery;
2070
2092
  exports.SigningKeys = SigningKeys;
2071
2093
  exports.Subscriptions = Subscriptions;