@witnium-tech/witniumchain 0.10.0 → 0.11.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
@@ -242,6 +242,76 @@ interface paths$1 {
242
242
  patch?: never;
243
243
  trace?: never;
244
244
  };
245
+ "/v1/auth/access-token": {
246
+ parameters: {
247
+ query?: never;
248
+ header?: never;
249
+ path?: never;
250
+ cookie?: never;
251
+ };
252
+ get?: never;
253
+ put?: never;
254
+ /**
255
+ * Exchange the session cookie for a bearer access token
256
+ * @description A logged-in (wac_session) user mints a short-lived OAuth-equivalent access token to call the bearer-only operational API (delegated keys, witness writes, chain reads). Keeps those endpoints off the ambient cookie (no CSRF surface). Same claim shape as an OAuth user token.
257
+ */
258
+ post: {
259
+ parameters: {
260
+ query?: never;
261
+ header?: never;
262
+ path?: never;
263
+ cookie?: never;
264
+ };
265
+ requestBody?: never;
266
+ responses: {
267
+ /** @description Success */
268
+ 200: {
269
+ headers: {
270
+ [name: string]: unknown;
271
+ };
272
+ content: {
273
+ "application/json": {
274
+ accessToken: string;
275
+ /** @enum {string} */
276
+ tokenType: "Bearer";
277
+ expiresIn: number;
278
+ expiresAt: string;
279
+ };
280
+ };
281
+ };
282
+ /** @description Unauthorized — authentication required or invalid */
283
+ 401: {
284
+ headers: {
285
+ [name: string]: unknown;
286
+ };
287
+ content: {
288
+ "application/json": {
289
+ /**
290
+ * @description HTTP status code
291
+ * @example 400
292
+ */
293
+ statusCode?: number;
294
+ /**
295
+ * @description Short error label
296
+ * @example Bad Request
297
+ */
298
+ error?: string;
299
+ /**
300
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
301
+ * @example Validation failed
302
+ */
303
+ message: string | string[];
304
+ };
305
+ };
306
+ };
307
+ };
308
+ };
309
+ delete?: never;
310
+ options?: never;
311
+ head?: never;
312
+ patch?: never;
313
+ trace?: never;
314
+ };
245
315
  "/v1/auth/login": {
246
316
  parameters: {
247
317
  query?: never;
@@ -10296,14 +10366,6 @@ type SetMemberRoleRequest = Req<'/v1/orgs/me/members/{userId}/role', 'put'>;
10296
10366
  type SetMemberRoleResponse = Res<'/v1/orgs/me/members/{userId}/role', 'put'>;
10297
10367
  type RemoveMemberResponse = Res<'/v1/orgs/me/members/{userId}', 'delete'>;
10298
10368
  type ResendInviteResponse = Res<'/v1/orgs/me/members/{userId}/resend-invite', 'post'>;
10299
- type CreateOrganizationRequest = Req<'/v1/admin/organizations', 'post'>;
10300
- type CreateOrganizationResponse = Res<'/v1/admin/organizations', 'post'>;
10301
- type SetAccountTypeRequest = Req<'/v1/admin/organizations/{id}/account-type', 'patch'>;
10302
- type SetAccountTypeResponse = Res<'/v1/admin/organizations/{id}/account-type', 'patch'>;
10303
- type VerifyOrganizationResponse = Res<'/v1/admin/organizations/{id}/verify', 'patch'>;
10304
- type RotateApiKeyResponse = Res<'/v1/admin/organizations/{id}/rotate-key', 'post'>;
10305
- type AdjustCreditsRequest = Req<'/v1/admin/organizations/{id}/adjust-credits', 'post'>;
10306
- type AdjustCreditsResponse = Res<'/v1/admin/organizations/{id}/adjust-credits', 'post'>;
10307
10369
  type ListDelegatedKeysResponse = Res<'/v1/users/me/delegated-keys', 'get'>;
10308
10370
  type PrepareDelegatedKeyRequest = Req<'/v1/users/me/delegated-keys', 'post'>;
10309
10371
  type PreparedDelegatedKeyResponse = Res<'/v1/users/me/delegated-keys', 'post'>;
@@ -10364,10 +10426,11 @@ type DashboardWitnessesResponse = ChainRes<'/v5/dashboard/witnesses', 'get'>;
10364
10426
  *
10365
10427
  * Covers both accounts (identity / billing / OAuth / delegated keys / witness
10366
10428
  * writes via the metered v5 proxy) and chain-api read surfaces (contract
10367
- * info / witness lookup / wallet balance / dashboards). Three convenience
10368
- * clients layer on top — `WitniumchainClient` (end-user),
10369
- * `WitniumchainOrgClient` (org admin), `WitniumchainAdminClient` (sysadmin) —
10370
- * with helpers for signup, subscriptions, and delegated-key provisioning.
10429
+ * info / witness lookup / wallet balance / dashboards). Two convenience
10430
+ * clients layer on top — `WitniumchainClient` (end-user) and
10431
+ * `WitniumchainOrgClient` (org admin) — with helpers for signup,
10432
+ * subscriptions, and delegated-key provisioning. The sysadmin surface lives in
10433
+ * the separate PRIVATE `@witnium/chain-admin-sdk` package, not here.
10371
10434
  *
10372
10435
  * Stripe surface is intentionally Checkout + Customer Portal ONLY. Witnium is
10373
10436
  * not a marketplace, so there is no Stripe Connect onboarding.
@@ -10379,7 +10442,6 @@ type DashboardWitnessesResponse = ChainRes<'/v5/dashboard/witnesses', 'get'>;
10379
10442
  * - sessionCookie — `wac_session` value for browser-cookie routes.
10380
10443
  * - accessToken — OAuth Bearer JWT for end-user API.
10381
10444
  * - orgApiKey — `wcorg_live_…` for org admin.
10382
- * - adminToken — sysadmin token.
10383
10445
  * - signedRequest — Ed25519 signer for SDK signed-request routes
10384
10446
  * (witnesses propose/sign/finalize/revoke). The SDK
10385
10447
  * does the canonical-message construction; you supply
@@ -10505,8 +10567,6 @@ interface WitniumchainClientConfig {
10505
10567
  verifierStorage?: PkceVerifierStorage;
10506
10568
  /** Organisation API key (`wcorg_live_…`). */
10507
10569
  orgApiKey?: string;
10508
- /** System-admin token (`Authorization: Bearer <ADMIN_TOKEN>`). */
10509
- adminToken?: string;
10510
10570
  /** Ed25519 signer for SDK signed-request routes (witness write ops). */
10511
10571
  signedRequest?: SignedRequestSigner;
10512
10572
  /** Per-request timeout in milliseconds. Default 30000. */
@@ -10631,11 +10691,6 @@ declare class WitniumchainClient {
10631
10691
  getMyOrg(): Promise<PublicOrgResponse>;
10632
10692
  createOrgUser(body: CreateUserRequest): Promise<CreateUserResponse>;
10633
10693
  listOrgUsers(): Promise<ListUsersResponse>;
10634
- createOrganization(body: CreateOrganizationRequest): Promise<CreateOrganizationResponse>;
10635
- setOrgAccountType(id: string, body: SetAccountTypeRequest): Promise<SetAccountTypeResponse>;
10636
- verifyOrganization(id: string): Promise<VerifyOrganizationResponse>;
10637
- rotateOrgApiKey(id: string): Promise<RotateApiKeyResponse>;
10638
- adjustOrgCredits(id: string, body: AdjustCreditsRequest): Promise<AdjustCreditsResponse>;
10639
10694
  listDelegatedKeys(query?: {
10640
10695
  contractAddress?: string;
10641
10696
  active?: 'true' | 'false';
@@ -11005,50 +11060,6 @@ declare class MfaRecoveryCodes {
11005
11060
  regenerate(): Promise<RecoveryCodesRegenerateResponse>;
11006
11061
  }
11007
11062
 
11008
- interface WitniumchainAdminClientConfig {
11009
- /** Base URL, e.g. `https://auth.witniumchain.com`. Trailing slash optional. */
11010
- baseUrl: string;
11011
- /** System-admin token (`Authorization: Bearer <ADMIN_TOKEN>`). */
11012
- adminToken: string;
11013
- /** Per-request timeout in milliseconds. Default 30000. */
11014
- timeout?: number;
11015
- /** Alternate fetch implementation (e.g. for tests). Default `globalThis.fetch`. */
11016
- fetch?: typeof fetch;
11017
- }
11018
- type AccountType = 'metered' | 'unlimited';
11019
- declare class WitniumchainAdminClient {
11020
- private readonly inner;
11021
- constructor(config: WitniumchainAdminClientConfig);
11022
- /**
11023
- * Mint a new organisation. The returned `apiKey` is shown ONCE — the server
11024
- * only retains its SHA-256 hash. Persist it before the response leaves
11025
- * scope; there is no recovery path.
11026
- *
11027
- * @param body Organisation seed: name, email, optional accountType and
11028
- * signup credit grant, optional skip-email-verification flag.
11029
- */
11030
- createOrganization(body: CreateOrganizationRequest): Promise<CreateOrganizationResponse>;
11031
- /** Flip an org between `metered` (Stripe checkout + credit ledger) and `unlimited` (flat-fee). */
11032
- setAccountType(orgId: string, accountType: AccountType): Promise<SetAccountTypeResponse>;
11033
- /** Mark an org's email as verified. Prerequisite for the org to create users. */
11034
- verifyEmail(orgId: string): Promise<VerifyOrganizationResponse>;
11035
- /**
11036
- * Rotate the org's API key. The previous `wcorg_live_…` is invalidated and
11037
- * the new key is returned ONCE — same one-time-secret semantics as
11038
- * {@link createOrganization}.
11039
- */
11040
- rotateApiKey(orgId: string): Promise<RotateApiKeyResponse>;
11041
- /**
11042
- * Apply a signed credit delta to an org's ledger. Positive `delta` grants
11043
- * credits (goodwill, migration backfill); negative claws them back.
11044
- * Recorded as `reason: adjustment` with the supplied `note`.
11045
- *
11046
- * Use sparingly — this bypasses Stripe and should be auditable from the
11047
- * `note` alone.
11048
- */
11049
- adjustCredits(orgId: string, delta: number, note?: string): Promise<AdjustCreditsResponse>;
11050
- }
11051
-
11052
11063
  type Body<T> = T extends {
11053
11064
  content: {
11054
11065
  'application/json': infer J;
@@ -11115,13 +11126,13 @@ declare class WitniumchainChainAdminClient {
11115
11126
  * Wraps the three `/v1/orgs/me/*` routes that org admins use to read their
11116
11127
  * own org profile and manage their users. This is the client B2B2C apps and
11117
11128
  * customer-admin dashboards consume — auth is the `wcorg_live_…` API key
11118
- * minted via `WitniumchainAdminClient.createOrganization` or returned by
11119
- * a subsequent `rotateApiKey`.
11129
+ * minted by the sysadmin admin SDK or returned by a subsequent `rotateApiKey`.
11120
11130
  *
11121
11131
  * The surface is intentionally minimal — the underlying API only exposes
11122
11132
  * profile read + user create + user list. Anything more powerful (provision
11123
11133
  * credits, change account type, verify email) requires the sysadmin
11124
- * `AdminToken` and therefore lives on `WitniumchainAdminClient`.
11134
+ * `ADMIN_TOKEN` and lives in the PRIVATE `@witnium/chain-admin-sdk` package,
11135
+ * never in this public SDK.
11125
11136
  */
11126
11137
 
11127
11138
  interface WitniumchainOrgClientConfig {
@@ -11239,4 +11250,4 @@ declare function buildRevokeSigningKeyPayload(args: {
11239
11250
  key: string;
11240
11251
  }): string;
11241
11252
 
11242
- export { type AccountResponse, type AccountType, type paths$1 as AccountsPaths, type AddSigningKeyRequest$1 as AddSigningKeyRequest, type AddSigningKeyResponse, type AdjustCreditsRequest, type AdjustCreditsResponse, type BeginOAuthLoginArgs, type BeginOAuthLoginResult, type paths as ChainPaths, type CheckoutRequest, type CheckoutResponse, type CreateOrgRequest, type CreateOrgResponse, type CreateOrganizationRequest, type CreateOrganizationResponse, 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 RotateApiKeyResponse, type SetAccountTypeRequest, type SetAccountTypeResponse, 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, type VerifyOrganizationResponse, WitniumchainAdminClient, type WitniumchainAdminClientConfig, WitniumchainApiError, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, WitniumchainOrgClient, type WitniumchainOrgClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
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 };
package/dist/index.d.ts CHANGED
@@ -242,6 +242,76 @@ interface paths$1 {
242
242
  patch?: never;
243
243
  trace?: never;
244
244
  };
245
+ "/v1/auth/access-token": {
246
+ parameters: {
247
+ query?: never;
248
+ header?: never;
249
+ path?: never;
250
+ cookie?: never;
251
+ };
252
+ get?: never;
253
+ put?: never;
254
+ /**
255
+ * Exchange the session cookie for a bearer access token
256
+ * @description A logged-in (wac_session) user mints a short-lived OAuth-equivalent access token to call the bearer-only operational API (delegated keys, witness writes, chain reads). Keeps those endpoints off the ambient cookie (no CSRF surface). Same claim shape as an OAuth user token.
257
+ */
258
+ post: {
259
+ parameters: {
260
+ query?: never;
261
+ header?: never;
262
+ path?: never;
263
+ cookie?: never;
264
+ };
265
+ requestBody?: never;
266
+ responses: {
267
+ /** @description Success */
268
+ 200: {
269
+ headers: {
270
+ [name: string]: unknown;
271
+ };
272
+ content: {
273
+ "application/json": {
274
+ accessToken: string;
275
+ /** @enum {string} */
276
+ tokenType: "Bearer";
277
+ expiresIn: number;
278
+ expiresAt: string;
279
+ };
280
+ };
281
+ };
282
+ /** @description Unauthorized — authentication required or invalid */
283
+ 401: {
284
+ headers: {
285
+ [name: string]: unknown;
286
+ };
287
+ content: {
288
+ "application/json": {
289
+ /**
290
+ * @description HTTP status code
291
+ * @example 400
292
+ */
293
+ statusCode?: number;
294
+ /**
295
+ * @description Short error label
296
+ * @example Bad Request
297
+ */
298
+ error?: string;
299
+ /**
300
+ * @description Human-readable error message. Validation errors from `ZodError.flatten()` may be returned as an array.
301
+ * @example Validation failed
302
+ */
303
+ message: string | string[];
304
+ };
305
+ };
306
+ };
307
+ };
308
+ };
309
+ delete?: never;
310
+ options?: never;
311
+ head?: never;
312
+ patch?: never;
313
+ trace?: never;
314
+ };
245
315
  "/v1/auth/login": {
246
316
  parameters: {
247
317
  query?: never;
@@ -10296,14 +10366,6 @@ type SetMemberRoleRequest = Req<'/v1/orgs/me/members/{userId}/role', 'put'>;
10296
10366
  type SetMemberRoleResponse = Res<'/v1/orgs/me/members/{userId}/role', 'put'>;
10297
10367
  type RemoveMemberResponse = Res<'/v1/orgs/me/members/{userId}', 'delete'>;
10298
10368
  type ResendInviteResponse = Res<'/v1/orgs/me/members/{userId}/resend-invite', 'post'>;
10299
- type CreateOrganizationRequest = Req<'/v1/admin/organizations', 'post'>;
10300
- type CreateOrganizationResponse = Res<'/v1/admin/organizations', 'post'>;
10301
- type SetAccountTypeRequest = Req<'/v1/admin/organizations/{id}/account-type', 'patch'>;
10302
- type SetAccountTypeResponse = Res<'/v1/admin/organizations/{id}/account-type', 'patch'>;
10303
- type VerifyOrganizationResponse = Res<'/v1/admin/organizations/{id}/verify', 'patch'>;
10304
- type RotateApiKeyResponse = Res<'/v1/admin/organizations/{id}/rotate-key', 'post'>;
10305
- type AdjustCreditsRequest = Req<'/v1/admin/organizations/{id}/adjust-credits', 'post'>;
10306
- type AdjustCreditsResponse = Res<'/v1/admin/organizations/{id}/adjust-credits', 'post'>;
10307
10369
  type ListDelegatedKeysResponse = Res<'/v1/users/me/delegated-keys', 'get'>;
10308
10370
  type PrepareDelegatedKeyRequest = Req<'/v1/users/me/delegated-keys', 'post'>;
10309
10371
  type PreparedDelegatedKeyResponse = Res<'/v1/users/me/delegated-keys', 'post'>;
@@ -10364,10 +10426,11 @@ type DashboardWitnessesResponse = ChainRes<'/v5/dashboard/witnesses', 'get'>;
10364
10426
  *
10365
10427
  * Covers both accounts (identity / billing / OAuth / delegated keys / witness
10366
10428
  * writes via the metered v5 proxy) and chain-api read surfaces (contract
10367
- * info / witness lookup / wallet balance / dashboards). Three convenience
10368
- * clients layer on top — `WitniumchainClient` (end-user),
10369
- * `WitniumchainOrgClient` (org admin), `WitniumchainAdminClient` (sysadmin) —
10370
- * with helpers for signup, subscriptions, and delegated-key provisioning.
10429
+ * info / witness lookup / wallet balance / dashboards). Two convenience
10430
+ * clients layer on top — `WitniumchainClient` (end-user) and
10431
+ * `WitniumchainOrgClient` (org admin) — with helpers for signup,
10432
+ * subscriptions, and delegated-key provisioning. The sysadmin surface lives in
10433
+ * the separate PRIVATE `@witnium/chain-admin-sdk` package, not here.
10371
10434
  *
10372
10435
  * Stripe surface is intentionally Checkout + Customer Portal ONLY. Witnium is
10373
10436
  * not a marketplace, so there is no Stripe Connect onboarding.
@@ -10379,7 +10442,6 @@ type DashboardWitnessesResponse = ChainRes<'/v5/dashboard/witnesses', 'get'>;
10379
10442
  * - sessionCookie — `wac_session` value for browser-cookie routes.
10380
10443
  * - accessToken — OAuth Bearer JWT for end-user API.
10381
10444
  * - orgApiKey — `wcorg_live_…` for org admin.
10382
- * - adminToken — sysadmin token.
10383
10445
  * - signedRequest — Ed25519 signer for SDK signed-request routes
10384
10446
  * (witnesses propose/sign/finalize/revoke). The SDK
10385
10447
  * does the canonical-message construction; you supply
@@ -10505,8 +10567,6 @@ interface WitniumchainClientConfig {
10505
10567
  verifierStorage?: PkceVerifierStorage;
10506
10568
  /** Organisation API key (`wcorg_live_…`). */
10507
10569
  orgApiKey?: string;
10508
- /** System-admin token (`Authorization: Bearer <ADMIN_TOKEN>`). */
10509
- adminToken?: string;
10510
10570
  /** Ed25519 signer for SDK signed-request routes (witness write ops). */
10511
10571
  signedRequest?: SignedRequestSigner;
10512
10572
  /** Per-request timeout in milliseconds. Default 30000. */
@@ -10631,11 +10691,6 @@ declare class WitniumchainClient {
10631
10691
  getMyOrg(): Promise<PublicOrgResponse>;
10632
10692
  createOrgUser(body: CreateUserRequest): Promise<CreateUserResponse>;
10633
10693
  listOrgUsers(): Promise<ListUsersResponse>;
10634
- createOrganization(body: CreateOrganizationRequest): Promise<CreateOrganizationResponse>;
10635
- setOrgAccountType(id: string, body: SetAccountTypeRequest): Promise<SetAccountTypeResponse>;
10636
- verifyOrganization(id: string): Promise<VerifyOrganizationResponse>;
10637
- rotateOrgApiKey(id: string): Promise<RotateApiKeyResponse>;
10638
- adjustOrgCredits(id: string, body: AdjustCreditsRequest): Promise<AdjustCreditsResponse>;
10639
10694
  listDelegatedKeys(query?: {
10640
10695
  contractAddress?: string;
10641
10696
  active?: 'true' | 'false';
@@ -11005,50 +11060,6 @@ declare class MfaRecoveryCodes {
11005
11060
  regenerate(): Promise<RecoveryCodesRegenerateResponse>;
11006
11061
  }
11007
11062
 
11008
- interface WitniumchainAdminClientConfig {
11009
- /** Base URL, e.g. `https://auth.witniumchain.com`. Trailing slash optional. */
11010
- baseUrl: string;
11011
- /** System-admin token (`Authorization: Bearer <ADMIN_TOKEN>`). */
11012
- adminToken: string;
11013
- /** Per-request timeout in milliseconds. Default 30000. */
11014
- timeout?: number;
11015
- /** Alternate fetch implementation (e.g. for tests). Default `globalThis.fetch`. */
11016
- fetch?: typeof fetch;
11017
- }
11018
- type AccountType = 'metered' | 'unlimited';
11019
- declare class WitniumchainAdminClient {
11020
- private readonly inner;
11021
- constructor(config: WitniumchainAdminClientConfig);
11022
- /**
11023
- * Mint a new organisation. The returned `apiKey` is shown ONCE — the server
11024
- * only retains its SHA-256 hash. Persist it before the response leaves
11025
- * scope; there is no recovery path.
11026
- *
11027
- * @param body Organisation seed: name, email, optional accountType and
11028
- * signup credit grant, optional skip-email-verification flag.
11029
- */
11030
- createOrganization(body: CreateOrganizationRequest): Promise<CreateOrganizationResponse>;
11031
- /** Flip an org between `metered` (Stripe checkout + credit ledger) and `unlimited` (flat-fee). */
11032
- setAccountType(orgId: string, accountType: AccountType): Promise<SetAccountTypeResponse>;
11033
- /** Mark an org's email as verified. Prerequisite for the org to create users. */
11034
- verifyEmail(orgId: string): Promise<VerifyOrganizationResponse>;
11035
- /**
11036
- * Rotate the org's API key. The previous `wcorg_live_…` is invalidated and
11037
- * the new key is returned ONCE — same one-time-secret semantics as
11038
- * {@link createOrganization}.
11039
- */
11040
- rotateApiKey(orgId: string): Promise<RotateApiKeyResponse>;
11041
- /**
11042
- * Apply a signed credit delta to an org's ledger. Positive `delta` grants
11043
- * credits (goodwill, migration backfill); negative claws them back.
11044
- * Recorded as `reason: adjustment` with the supplied `note`.
11045
- *
11046
- * Use sparingly — this bypasses Stripe and should be auditable from the
11047
- * `note` alone.
11048
- */
11049
- adjustCredits(orgId: string, delta: number, note?: string): Promise<AdjustCreditsResponse>;
11050
- }
11051
-
11052
11063
  type Body<T> = T extends {
11053
11064
  content: {
11054
11065
  'application/json': infer J;
@@ -11115,13 +11126,13 @@ declare class WitniumchainChainAdminClient {
11115
11126
  * Wraps the three `/v1/orgs/me/*` routes that org admins use to read their
11116
11127
  * own org profile and manage their users. This is the client B2B2C apps and
11117
11128
  * customer-admin dashboards consume — auth is the `wcorg_live_…` API key
11118
- * minted via `WitniumchainAdminClient.createOrganization` or returned by
11119
- * a subsequent `rotateApiKey`.
11129
+ * minted by the sysadmin admin SDK or returned by a subsequent `rotateApiKey`.
11120
11130
  *
11121
11131
  * The surface is intentionally minimal — the underlying API only exposes
11122
11132
  * profile read + user create + user list. Anything more powerful (provision
11123
11133
  * credits, change account type, verify email) requires the sysadmin
11124
- * `AdminToken` and therefore lives on `WitniumchainAdminClient`.
11134
+ * `ADMIN_TOKEN` and lives in the PRIVATE `@witnium/chain-admin-sdk` package,
11135
+ * never in this public SDK.
11125
11136
  */
11126
11137
 
11127
11138
  interface WitniumchainOrgClientConfig {
@@ -11239,4 +11250,4 @@ declare function buildRevokeSigningKeyPayload(args: {
11239
11250
  key: string;
11240
11251
  }): string;
11241
11252
 
11242
- export { type AccountResponse, type AccountType, type paths$1 as AccountsPaths, type AddSigningKeyRequest$1 as AddSigningKeyRequest, type AddSigningKeyResponse, type AdjustCreditsRequest, type AdjustCreditsResponse, type BeginOAuthLoginArgs, type BeginOAuthLoginResult, type paths as ChainPaths, type CheckoutRequest, type CheckoutResponse, type CreateOrgRequest, type CreateOrgResponse, type CreateOrganizationRequest, type CreateOrganizationResponse, 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 RotateApiKeyResponse, type SetAccountTypeRequest, type SetAccountTypeResponse, 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, type VerifyOrganizationResponse, WitniumchainAdminClient, type WitniumchainAdminClientConfig, WitniumchainApiError, WitniumchainChainAdminClient, type WitniumchainChainAdminClientConfig, WitniumchainClient, type WitniumchainClientConfig, WitniumchainOrgClient, type WitniumchainOrgClientConfig, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
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 };
package/dist/index.js CHANGED
@@ -275,43 +275,6 @@ var WitniumchainClient = class {
275
275
  return this.req("GET", "/v1/orgs/me/users", { auth: "OrgApiKey" });
276
276
  }
277
277
  // ────────────────────────────────────────────────────────────────────────
278
- // Admin (/v1/admin/organizations/*)
279
- // ────────────────────────────────────────────────────────────────────────
280
- createOrganization(body) {
281
- return this.req("POST", "/v1/admin/organizations", {
282
- auth: "AdminToken",
283
- body
284
- });
285
- }
286
- setOrgAccountType(id, body) {
287
- return this.req(
288
- "PATCH",
289
- `/v1/admin/organizations/${encodeURIComponent(id)}/account-type`,
290
- { auth: "AdminToken", body }
291
- );
292
- }
293
- verifyOrganization(id) {
294
- return this.req(
295
- "PATCH",
296
- `/v1/admin/organizations/${encodeURIComponent(id)}/verify`,
297
- { auth: "AdminToken" }
298
- );
299
- }
300
- rotateOrgApiKey(id) {
301
- return this.req(
302
- "POST",
303
- `/v1/admin/organizations/${encodeURIComponent(id)}/rotate-key`,
304
- { auth: "AdminToken" }
305
- );
306
- }
307
- adjustOrgCredits(id, body) {
308
- return this.req(
309
- "POST",
310
- `/v1/admin/organizations/${encodeURIComponent(id)}/adjust-credits`,
311
- { auth: "AdminToken", body }
312
- );
313
- }
314
- // ────────────────────────────────────────────────────────────────────────
315
278
  // Delegated keys (/v1/users/me/delegated-keys/*)
316
279
  // ────────────────────────────────────────────────────────────────────────
317
280
  listDelegatedKeys(query) {
@@ -1201,15 +1164,6 @@ var WitniumchainClient = class {
1201
1164
  headers["authorization"] = `Bearer ${this.cfg.orgApiKey}`;
1202
1165
  return;
1203
1166
  }
1204
- case "AdminToken": {
1205
- if (!this.cfg.adminToken) {
1206
- throw new Error(
1207
- `WitniumchainClient: ${method} ${path} requires an admin token. Pass \`adminToken\` to the constructor.`
1208
- );
1209
- }
1210
- headers["authorization"] = `Bearer ${this.cfg.adminToken}`;
1211
- return;
1212
- }
1213
1167
  case "SignedRequest": {
1214
1168
  if (!this.cfg.signedRequest) {
1215
1169
  throw new Error(
@@ -1496,60 +1450,6 @@ async function sha256Hex(input) {
1496
1450
  return out;
1497
1451
  }
1498
1452
 
1499
- // src/admin-client.ts
1500
- var WitniumchainAdminClient = class {
1501
- inner;
1502
- constructor(config) {
1503
- if (!config.adminToken) {
1504
- throw new Error("WitniumchainAdminClient: adminToken is required");
1505
- }
1506
- this.inner = new WitniumchainClient({
1507
- baseUrl: config.baseUrl,
1508
- adminToken: config.adminToken,
1509
- timeout: config.timeout,
1510
- fetch: config.fetch
1511
- });
1512
- }
1513
- /**
1514
- * Mint a new organisation. The returned `apiKey` is shown ONCE — the server
1515
- * only retains its SHA-256 hash. Persist it before the response leaves
1516
- * scope; there is no recovery path.
1517
- *
1518
- * @param body Organisation seed: name, email, optional accountType and
1519
- * signup credit grant, optional skip-email-verification flag.
1520
- */
1521
- createOrganization(body) {
1522
- return this.inner.createOrganization(body);
1523
- }
1524
- /** Flip an org between `metered` (Stripe checkout + credit ledger) and `unlimited` (flat-fee). */
1525
- setAccountType(orgId, accountType) {
1526
- return this.inner.setOrgAccountType(orgId, { accountType });
1527
- }
1528
- /** Mark an org's email as verified. Prerequisite for the org to create users. */
1529
- verifyEmail(orgId) {
1530
- return this.inner.verifyOrganization(orgId);
1531
- }
1532
- /**
1533
- * Rotate the org's API key. The previous `wcorg_live_…` is invalidated and
1534
- * the new key is returned ONCE — same one-time-secret semantics as
1535
- * {@link createOrganization}.
1536
- */
1537
- rotateApiKey(orgId) {
1538
- return this.inner.rotateOrgApiKey(orgId);
1539
- }
1540
- /**
1541
- * Apply a signed credit delta to an org's ledger. Positive `delta` grants
1542
- * credits (goodwill, migration backfill); negative claws them back.
1543
- * Recorded as `reason: adjustment` with the supplied `note`.
1544
- *
1545
- * Use sparingly — this bypasses Stripe and should be auditable from the
1546
- * `note` alone.
1547
- */
1548
- adjustCredits(orgId, delta, note) {
1549
- return this.inner.adjustOrgCredits(orgId, { delta, note });
1550
- }
1551
- };
1552
-
1553
1453
  // src/chain-admin-client.ts
1554
1454
  var WitniumchainChainAdminClient = class {
1555
1455
  baseUrl;
@@ -1751,7 +1651,6 @@ exports.OrgMembers = OrgMembers;
1751
1651
  exports.OrgUsers = OrgUsers;
1752
1652
  exports.SigningKeys = SigningKeys;
1753
1653
  exports.Subscriptions = Subscriptions;
1754
- exports.WitniumchainAdminClient = WitniumchainAdminClient;
1755
1654
  exports.WitniumchainApiError = WitniumchainApiError;
1756
1655
  exports.WitniumchainChainAdminClient = WitniumchainChainAdminClient;
1757
1656
  exports.WitniumchainClient = WitniumchainClient;