@terminal3/t3n-sdk 4.26.0 → 4.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.ts CHANGED
@@ -3315,6 +3315,67 @@ interface DataListResponse {
3315
3315
  }
3316
3316
  /** Shallow runtime guard for {@link DataListResponse}. */
3317
3317
  declare function isDataListResponse(value: unknown): value is DataListResponse;
3318
+ /** Secret shape discriminator (mirrors the contract `SecretKind`). */
3319
+ type SecretKind = "single_value" | "json";
3320
+ /** Metadata common to every {@link SecretView} entry. */
3321
+ interface SecretViewBase {
3322
+ /** Secret name (the `(org, name)` key tail). */
3323
+ name: string;
3324
+ /** Monotonic version, bumped on each value rotation and ACL edit. */
3325
+ version: number;
3326
+ /** Unix seconds of the most recent write. */
3327
+ updated_at_secs: number;
3328
+ }
3329
+ /**
3330
+ * The redacted per-secret summary `org-secret-list` returns — a discriminated
3331
+ * union on `kind`. The value is NEVER present: a single-value exposes only its
3332
+ * last four characters and a json secret only its sorted top-level field names.
3333
+ */
3334
+ type SecretView = (SecretViewBase & {
3335
+ kind: "single_value";
3336
+ /** Last four characters of the value (whole value when ≤ 4 chars). */
3337
+ last4: string;
3338
+ }) | (SecretViewBase & {
3339
+ kind: "json";
3340
+ /** Sorted top-level object field names (keys only, no values). */
3341
+ field_names: string[];
3342
+ });
3343
+ /** Shallow runtime guard for {@link SecretView}. */
3344
+ declare function isSecretView(value: unknown): value is SecretView;
3345
+ /**
3346
+ * Full secret record returned by `org-secret-get` — the value IS included
3347
+ * (the deliberate read-back path the READ axis exists for), along with all
3348
+ * three ACLs.
3349
+ */
3350
+ interface SecretRecord {
3351
+ name: string;
3352
+ kind: SecretKind;
3353
+ /** The value as text: the scalar for a single-value, canonical JSON object for a json secret. */
3354
+ value: string;
3355
+ version: number;
3356
+ /** READ axis — DIDs allowed to read the value back. */
3357
+ reader_dids: string[];
3358
+ /** READ axis — role ids allowed to read the value back. */
3359
+ reader_roles: string[];
3360
+ /** MANAGE axis — DIDs allowed to rotate the value. */
3361
+ manager_dids: string[];
3362
+ /** MANAGE axis — role ids allowed to rotate the value. */
3363
+ manager_roles: string[];
3364
+ /** USE axis — canonical contract ids allowed to have the value injected. */
3365
+ contract_allowlist: string[];
3366
+ created_at_secs: number;
3367
+ updated_at_secs: number;
3368
+ /** DID of the caller who last wrote the record. */
3369
+ updated_by: string;
3370
+ }
3371
+ /** Shallow runtime guard for {@link SecretRecord}. */
3372
+ declare function isSecretRecord(value: unknown): value is SecretRecord;
3373
+ /** Response for `org-secret-list`: redacted per-kind views, no values. */
3374
+ interface SecretListResponse {
3375
+ secrets: SecretView[];
3376
+ }
3377
+ /** Shallow runtime guard for {@link SecretListResponse}. */
3378
+ declare function isSecretListResponse(value: unknown): value is SecretListResponse;
3318
3379
  /** Response for `org-data-get`. */
3319
3380
  interface DataGetResponse {
3320
3381
  entry_id: string;
@@ -3436,6 +3497,47 @@ interface DeleteGrantsInput {
3436
3497
  orgDid: string;
3437
3498
  contractId: string;
3438
3499
  }
3500
+ /**
3501
+ * Create or replace a secret and its three ACLs (org-admin only). `value` is
3502
+ * optional on a replace — omitting it preserves the stored bytes so an admin
3503
+ * can edit the ACLs without handling the secret; it is required on first
3504
+ * create. `contractAllowlist` is the USE axis: canonical contract ids allowed
3505
+ * to have the value injected into an outbound call.
3506
+ */
3507
+ interface SecretWriteInput {
3508
+ orgDid: string;
3509
+ name: string;
3510
+ kind: SecretKind;
3511
+ /** The value (scalar for `single_value`; JSON object text for `json`). */
3512
+ value?: string;
3513
+ readerDids?: string[];
3514
+ readerRoles?: string[];
3515
+ managerDids?: string[];
3516
+ managerRoles?: string[];
3517
+ contractAllowlist?: string[];
3518
+ }
3519
+ /** Rotate a secret's value only (manager-gated; ACLs untouched). */
3520
+ interface SecretSetValueInput {
3521
+ orgDid: string;
3522
+ name: string;
3523
+ value: string;
3524
+ }
3525
+ /** Read (`org-secret-get`) or delete (`org-secret-delete`) a secret by name. */
3526
+ interface SecretNameInput {
3527
+ orgDid: string;
3528
+ name: string;
3529
+ }
3530
+ /** List an org's secrets (`org-secret-list`). */
3531
+ interface SecretListInput {
3532
+ orgDid: string;
3533
+ }
3534
+ /**
3535
+ * Build the snake_case `org-secret-write` wire body from the camelCase input:
3536
+ * the value is omitted on an ACL-only replace (so the contract preserves the
3537
+ * stored bytes), and each ACL / allowlist list defaults to empty. Exported so
3538
+ * the input-shape test can assert the mapping directly.
3539
+ */
3540
+ declare function buildSecretWriteArgs(input: SecretWriteInput): Record<string, unknown>;
3439
3541
  interface SetRoleInput {
3440
3542
  orgDid: string;
3441
3543
  role: RoleDefinition;
@@ -3636,6 +3738,20 @@ declare class OrgDataClient {
3636
3738
  * Scope names are canonicalised to lowercase before storage.
3637
3739
  */
3638
3740
  setWriters(input: SetWritersInput): Promise<MutationResponse>;
3741
+ /**
3742
+ * Create or replace an org secret and its three ACLs (org-admin only). Omit
3743
+ * `value` on a replace to edit the ACLs without handling the secret; it is
3744
+ * required on first create.
3745
+ */
3746
+ secretWrite(input: SecretWriteInput): Promise<MutationResponse>;
3747
+ /** Rotate a secret's value only (manager-gated; ACLs untouched). */
3748
+ secretSetValue(input: SecretSetValueInput): Promise<MutationResponse>;
3749
+ /** Read a secret's value and metadata (reader-gated). */
3750
+ secretGet(input: SecretNameInput): Promise<SecretRecord>;
3751
+ /** List the org's secrets as redacted per-kind views (no values). */
3752
+ secretList(input: SecretListInput): Promise<SecretView[]>;
3753
+ /** Delete a secret entirely (org-admin only). */
3754
+ secretDelete(input: SecretNameInput): Promise<MutationResponse>;
3639
3755
  /**
3640
3756
  * Full replacement of the user-grant list for a contract.
3641
3757
  *
@@ -3817,6 +3933,16 @@ declare class SessionOrgDataClient {
3817
3933
  updateMeta(input: UpdateMetaInput): Promise<MutationResponse>;
3818
3934
  /** Mirrors {@link OrgDataClient.setWriters}. */
3819
3935
  setWriters(input: SetWritersInput): Promise<MutationResponse>;
3936
+ /** Mirrors {@link OrgDataClient.secretWrite}. */
3937
+ secretWrite(input: SecretWriteInput): Promise<MutationResponse>;
3938
+ /** Mirrors {@link OrgDataClient.secretSetValue}. */
3939
+ secretSetValue(input: SecretSetValueInput): Promise<MutationResponse>;
3940
+ /** Mirrors {@link OrgDataClient.secretGet}. */
3941
+ secretGet(input: SecretNameInput): Promise<SecretRecord>;
3942
+ /** Mirrors {@link OrgDataClient.secretList}. */
3943
+ secretList(input: SecretListInput): Promise<SecretView[]>;
3944
+ /** Mirrors {@link OrgDataClient.secretDelete}. */
3945
+ secretDelete(input: SecretNameInput): Promise<MutationResponse>;
3820
3946
  /** Mirrors {@link OrgDataClient.setGrants}. */
3821
3947
  setGrants(input: SetGrantsInput): Promise<MutationResponse>;
3822
3948
  /** Mirrors {@link OrgDataClient.deleteGrants}. */
@@ -4803,5 +4929,5 @@ declare function tenantDidHex(tenantDid: string): string;
4803
4929
  declare function validateTail(tail: string): string;
4804
4930
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
4805
4931
 
4806
- export { AGENT_CARDS_SCOPE, AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_ENVIRONMENT, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, HandshakeError, HttpTransport, InvokeError, KycStatusTimeoutError, LogLevel, MockTransport, NODE_URLS, OrgDataClient, OtpRateLimitedError, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, SessionUsageReportClient, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TOKEN_DECIMALS, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, WasmError, WireEncodingError, Z_PAYROLL_AUDIT_READ_FUNCTIONS, Z_PAYROLL_RUN_FUNCTIONS, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, bytesToString, canonicalTenantName, clearKeyCache, clearManifestVersionFloor, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, createUsageReportClientFromSession, createWorkloadAuthInput, decodeWasmErrorMessage, deriveAgentCardEntryId, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, fetchTrustedManifest, formatTokens, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, invoke, isAgentCardResponse, isDataGetResponse, isDataListResponse, isListAgentsResponse, isMutationResponse, isObject, isOrgAdminStatus, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgUsageReport, isOrgWriters, isRoleAssignmentsResponse, isRoleGetResponse, isUnsafeTrustServer, loadConfig, loadWasmComponent, manifestToTrustAnchor, maskKeyMaterial, mergeAgentAuthEntries, mergeDiscoverDids, metamask_get_address, metamask_sign, parseAgentAuthGet, parseAgentAuthPolicy, parseContractResponse, redactSecrets, redactSecretsFromJson, requestToWire, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, tenantDidHex, toAgentAuthUpdateWire, toBaseUnits, validateConfig, validateTail, verifyDkgAttestation, verifyManifestSignature, verifyTdxQuote };
4807
- export type { ActivityCallerType, ActivityEntry, ActivityOutcome, ActivityReport, AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AgentSummary, AssignRolesInput, AuthInput, BalanceRow, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractKind, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, FetchTrustedManifestOptions, GetActivityLogOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GranteeInput, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, InvokeOptions, InvokeRequest, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListAgentsInput, ListAgentsResponse, ListContractsParams, ListContractsResult, ListContractsScope, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, PurgeOrgInput, QuoteVerifyResult, ReaderSet, RemoveMemberGrantsInput, RoleAssignments, RoleAssignmentsResponse, RoleDefinition, RoleGetResponse, RoleGrant, RoleIdInput, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetRoleInput, SetWritersInput, SignedTrustManifest, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, TrustManifestPayload, UnassignRolesInput, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };
4932
+ export { AGENT_CARDS_SCOPE, AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_ENVIRONMENT, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, HandshakeError, HttpTransport, InvokeError, KycStatusTimeoutError, LogLevel, MockTransport, NODE_URLS, OrgDataClient, OtpRateLimitedError, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, SessionUsageReportClient, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TOKEN_DECIMALS, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, WasmError, WireEncodingError, Z_PAYROLL_AUDIT_READ_FUNCTIONS, Z_PAYROLL_RUN_FUNCTIONS, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, buildSecretWriteArgs, bytesToString, canonicalTenantName, clearKeyCache, clearManifestVersionFloor, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, createUsageReportClientFromSession, createWorkloadAuthInput, decodeWasmErrorMessage, deriveAgentCardEntryId, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, fetchTrustedManifest, formatTokens, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, invoke, isAgentCardResponse, isDataGetResponse, isDataListResponse, isListAgentsResponse, isMutationResponse, isObject, isOrgAdminStatus, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgUsageReport, isOrgWriters, isRoleAssignmentsResponse, isRoleGetResponse, isSecretListResponse, isSecretRecord, isSecretView, isUnsafeTrustServer, loadConfig, loadWasmComponent, manifestToTrustAnchor, maskKeyMaterial, mergeAgentAuthEntries, mergeDiscoverDids, metamask_get_address, metamask_sign, parseAgentAuthGet, parseAgentAuthPolicy, parseContractResponse, redactSecrets, redactSecretsFromJson, requestToWire, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, tenantDidHex, toAgentAuthUpdateWire, toBaseUnits, validateConfig, validateTail, verifyDkgAttestation, verifyManifestSignature, verifyTdxQuote };
4933
+ export type { ActivityCallerType, ActivityEntry, ActivityOutcome, ActivityReport, AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AgentSummary, AssignRolesInput, AuthInput, BalanceRow, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractKind, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, FetchTrustedManifestOptions, GetActivityLogOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GranteeInput, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, InvokeOptions, InvokeRequest, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListAgentsInput, ListAgentsResponse, ListContractsParams, ListContractsResult, ListContractsScope, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, PurgeOrgInput, QuoteVerifyResult, ReaderSet, RemoveMemberGrantsInput, RoleAssignments, RoleAssignmentsResponse, RoleDefinition, RoleGetResponse, RoleGrant, RoleIdInput, SdkConfig, SecretKind, SecretListInput, SecretListResponse, SecretNameInput, SecretRecord, SecretSetValueInput, SecretView, SecretWriteInput, SessionCrypto, SessionId, SetGrantsInput, SetRoleInput, SetWritersInput, SignedTrustManifest, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, TrustManifestPayload, UnassignRolesInput, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };