@terminal3/t3n-sdk 4.26.0 → 4.28.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
@@ -1681,6 +1681,15 @@ interface ActivityEntry {
1681
1681
  function: string;
1682
1682
  /** success / denied / error — host-stamped from the dispatch result. */
1683
1683
  outcome: ActivityOutcome;
1684
+ /**
1685
+ * Role ids the acting authority carried at call time: the actor's role in
1686
+ * the organisation on a self-call, the roles the owner granted the agent on
1687
+ * a delegated call. Omitted when the authority carried no role (direct
1688
+ * grants, an individual, or an entry recorded before roles were captured).
1689
+ * On a `denied` entry this is the caller's *claimed* authority, not a
1690
+ * validated one.
1691
+ */
1692
+ roles?: string[];
1684
1693
  }
1685
1694
  /**
1686
1695
  * One page of the organisation's activity report — **newest first**, i.e.
@@ -3315,6 +3324,67 @@ interface DataListResponse {
3315
3324
  }
3316
3325
  /** Shallow runtime guard for {@link DataListResponse}. */
3317
3326
  declare function isDataListResponse(value: unknown): value is DataListResponse;
3327
+ /** Secret shape discriminator (mirrors the contract `SecretKind`). */
3328
+ type SecretKind = "single_value" | "json";
3329
+ /** Metadata common to every {@link SecretView} entry. */
3330
+ interface SecretViewBase {
3331
+ /** Secret name (the `(org, name)` key tail). */
3332
+ name: string;
3333
+ /** Monotonic version, bumped on each value rotation and ACL edit. */
3334
+ version: number;
3335
+ /** Unix seconds of the most recent write. */
3336
+ updated_at_secs: number;
3337
+ }
3338
+ /**
3339
+ * The redacted per-secret summary `org-secret-list` returns — a discriminated
3340
+ * union on `kind`. The value is NEVER present: a single-value exposes only its
3341
+ * last four characters and a json secret only its sorted top-level field names.
3342
+ */
3343
+ type SecretView = (SecretViewBase & {
3344
+ kind: "single_value";
3345
+ /** Last four characters of the value (whole value when ≤ 4 chars). */
3346
+ last4: string;
3347
+ }) | (SecretViewBase & {
3348
+ kind: "json";
3349
+ /** Sorted top-level object field names (keys only, no values). */
3350
+ field_names: string[];
3351
+ });
3352
+ /** Shallow runtime guard for {@link SecretView}. */
3353
+ declare function isSecretView(value: unknown): value is SecretView;
3354
+ /**
3355
+ * Full secret record returned by `org-secret-get` — the value IS included
3356
+ * (the deliberate read-back path the READ axis exists for), along with all
3357
+ * three ACLs.
3358
+ */
3359
+ interface SecretRecord {
3360
+ name: string;
3361
+ kind: SecretKind;
3362
+ /** The value as text: the scalar for a single-value, canonical JSON object for a json secret. */
3363
+ value: string;
3364
+ version: number;
3365
+ /** READ axis — DIDs allowed to read the value back. */
3366
+ reader_dids: string[];
3367
+ /** READ axis — role ids allowed to read the value back. */
3368
+ reader_roles: string[];
3369
+ /** MANAGE axis — DIDs allowed to rotate the value. */
3370
+ manager_dids: string[];
3371
+ /** MANAGE axis — role ids allowed to rotate the value. */
3372
+ manager_roles: string[];
3373
+ /** USE axis — canonical contract ids allowed to have the value injected. */
3374
+ contract_allowlist: string[];
3375
+ created_at_secs: number;
3376
+ updated_at_secs: number;
3377
+ /** DID of the caller who last wrote the record. */
3378
+ updated_by: string;
3379
+ }
3380
+ /** Shallow runtime guard for {@link SecretRecord}. */
3381
+ declare function isSecretRecord(value: unknown): value is SecretRecord;
3382
+ /** Response for `org-secret-list`: redacted per-kind views, no values. */
3383
+ interface SecretListResponse {
3384
+ secrets: SecretView[];
3385
+ }
3386
+ /** Shallow runtime guard for {@link SecretListResponse}. */
3387
+ declare function isSecretListResponse(value: unknown): value is SecretListResponse;
3318
3388
  /** Response for `org-data-get`. */
3319
3389
  interface DataGetResponse {
3320
3390
  entry_id: string;
@@ -3436,6 +3506,47 @@ interface DeleteGrantsInput {
3436
3506
  orgDid: string;
3437
3507
  contractId: string;
3438
3508
  }
3509
+ /**
3510
+ * Create or replace a secret and its three ACLs (org-admin only). `value` is
3511
+ * optional on a replace — omitting it preserves the stored bytes so an admin
3512
+ * can edit the ACLs without handling the secret; it is required on first
3513
+ * create. `contractAllowlist` is the USE axis: canonical contract ids allowed
3514
+ * to have the value injected into an outbound call.
3515
+ */
3516
+ interface SecretWriteInput {
3517
+ orgDid: string;
3518
+ name: string;
3519
+ kind: SecretKind;
3520
+ /** The value (scalar for `single_value`; JSON object text for `json`). */
3521
+ value?: string;
3522
+ readerDids?: string[];
3523
+ readerRoles?: string[];
3524
+ managerDids?: string[];
3525
+ managerRoles?: string[];
3526
+ contractAllowlist?: string[];
3527
+ }
3528
+ /** Rotate a secret's value only (manager-gated; ACLs untouched). */
3529
+ interface SecretSetValueInput {
3530
+ orgDid: string;
3531
+ name: string;
3532
+ value: string;
3533
+ }
3534
+ /** Read (`org-secret-get`) or delete (`org-secret-delete`) a secret by name. */
3535
+ interface SecretNameInput {
3536
+ orgDid: string;
3537
+ name: string;
3538
+ }
3539
+ /** List an org's secrets (`org-secret-list`). */
3540
+ interface SecretListInput {
3541
+ orgDid: string;
3542
+ }
3543
+ /**
3544
+ * Build the snake_case `org-secret-write` wire body from the camelCase input:
3545
+ * the value is omitted on an ACL-only replace (so the contract preserves the
3546
+ * stored bytes), and each ACL / allowlist list defaults to empty. Exported so
3547
+ * the input-shape test can assert the mapping directly.
3548
+ */
3549
+ declare function buildSecretWriteArgs(input: SecretWriteInput): Record<string, unknown>;
3439
3550
  interface SetRoleInput {
3440
3551
  orgDid: string;
3441
3552
  role: RoleDefinition;
@@ -3636,6 +3747,20 @@ declare class OrgDataClient {
3636
3747
  * Scope names are canonicalised to lowercase before storage.
3637
3748
  */
3638
3749
  setWriters(input: SetWritersInput): Promise<MutationResponse>;
3750
+ /**
3751
+ * Create or replace an org secret and its three ACLs (org-admin only). Omit
3752
+ * `value` on a replace to edit the ACLs without handling the secret; it is
3753
+ * required on first create.
3754
+ */
3755
+ secretWrite(input: SecretWriteInput): Promise<MutationResponse>;
3756
+ /** Rotate a secret's value only (manager-gated; ACLs untouched). */
3757
+ secretSetValue(input: SecretSetValueInput): Promise<MutationResponse>;
3758
+ /** Read a secret's value and metadata (reader-gated). */
3759
+ secretGet(input: SecretNameInput): Promise<SecretRecord>;
3760
+ /** List the org's secrets as redacted per-kind views (no values). */
3761
+ secretList(input: SecretListInput): Promise<SecretView[]>;
3762
+ /** Delete a secret entirely (org-admin only). */
3763
+ secretDelete(input: SecretNameInput): Promise<MutationResponse>;
3639
3764
  /**
3640
3765
  * Full replacement of the user-grant list for a contract.
3641
3766
  *
@@ -3817,6 +3942,16 @@ declare class SessionOrgDataClient {
3817
3942
  updateMeta(input: UpdateMetaInput): Promise<MutationResponse>;
3818
3943
  /** Mirrors {@link OrgDataClient.setWriters}. */
3819
3944
  setWriters(input: SetWritersInput): Promise<MutationResponse>;
3945
+ /** Mirrors {@link OrgDataClient.secretWrite}. */
3946
+ secretWrite(input: SecretWriteInput): Promise<MutationResponse>;
3947
+ /** Mirrors {@link OrgDataClient.secretSetValue}. */
3948
+ secretSetValue(input: SecretSetValueInput): Promise<MutationResponse>;
3949
+ /** Mirrors {@link OrgDataClient.secretGet}. */
3950
+ secretGet(input: SecretNameInput): Promise<SecretRecord>;
3951
+ /** Mirrors {@link OrgDataClient.secretList}. */
3952
+ secretList(input: SecretListInput): Promise<SecretView[]>;
3953
+ /** Mirrors {@link OrgDataClient.secretDelete}. */
3954
+ secretDelete(input: SecretNameInput): Promise<MutationResponse>;
3820
3955
  /** Mirrors {@link OrgDataClient.setGrants}. */
3821
3956
  setGrants(input: SetGrantsInput): Promise<MutationResponse>;
3822
3957
  /** Mirrors {@link OrgDataClient.deleteGrants}. */
@@ -4803,5 +4938,5 @@ declare function tenantDidHex(tenantDid: string): string;
4803
4938
  declare function validateTail(tail: string): string;
4804
4939
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
4805
4940
 
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 };
4941
+ 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 };
4942
+ 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 };