@terminal3/t3n-sdk 2.5.0 → 2.7.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 +42 -36
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/client/org-data.d.ts +43 -49
- package/dist/src/types/org-data.d.ts +5 -5
- package/package.json +2 -10
package/dist/index.d.ts
CHANGED
|
@@ -730,17 +730,17 @@ interface DataGetResponse {
|
|
|
730
730
|
payload_hex: string;
|
|
731
731
|
}
|
|
732
732
|
/**
|
|
733
|
-
*
|
|
733
|
+
* Legacy direct-route org-data envelope shape retained for compatibility.
|
|
734
734
|
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
735
|
+
* This mirrors the removed `/api/user-contract/execute` body format from
|
|
736
|
+
* the transitional transport. New callers should use `OrgDataClient`,
|
|
737
|
+
* which now dispatches through authenticated `/api/rpc` +
|
|
738
|
+
* `action.execute` instead.
|
|
738
739
|
*/
|
|
739
740
|
interface OrgDataActionWire {
|
|
740
741
|
nonce: string;
|
|
741
742
|
user_did: string;
|
|
742
743
|
authenticator_id: string;
|
|
743
|
-
org_did: string;
|
|
744
744
|
contract_id: string;
|
|
745
745
|
function: string;
|
|
746
746
|
args_hash: string;
|
|
@@ -1918,31 +1918,22 @@ interface BuildPayrollInvocationOpts {
|
|
|
1918
1918
|
declare function buildPayrollInvocation(opts: BuildPayrollInvocationOpts): PayrollInvocation;
|
|
1919
1919
|
|
|
1920
1920
|
/**
|
|
1921
|
-
* OrgDataClient —
|
|
1922
|
-
*
|
|
1923
|
-
* Implements the two-step flow that `node/service/src/org_data.rs`
|
|
1924
|
-
* defines:
|
|
1921
|
+
* OrgDataClient — typed wrapper over the existing authenticated
|
|
1922
|
+
* `/api/rpc` + `action.execute` pipeline.
|
|
1925
1923
|
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
* EIP-191 signature covers the canonical JSON of the eight
|
|
1929
|
-
* `SignableEnvelope` fields, in the exact field-declaration order
|
|
1930
|
-
* used by the Rust struct (see `org_data.rs` lines 104–117).
|
|
1924
|
+
* Unlike the removed direct `/api/user-contract/*` transport, this
|
|
1925
|
+
* client reuses Trinity's normal session-backed ETH auth flow:
|
|
1931
1926
|
*
|
|
1932
|
-
*
|
|
1933
|
-
*
|
|
1927
|
+
* 1. `auth.handshake`
|
|
1928
|
+
* 2. `auth.authenticate`
|
|
1929
|
+
* 3. `action.execute`
|
|
1934
1930
|
*
|
|
1935
|
-
*
|
|
1936
|
-
*
|
|
1931
|
+
* The class keeps its public constructor stable for callers that
|
|
1932
|
+
* already have an ETH secret key and expected DID, but internally it
|
|
1933
|
+
* owns a lazily-authenticated `T3nClient` instance rather than
|
|
1934
|
+
* constructing one-shot signed HTTP envelopes per call.
|
|
1937
1935
|
*/
|
|
1938
1936
|
|
|
1939
|
-
/**
|
|
1940
|
-
* Options accepted by {@link executeOrgDataAction}.
|
|
1941
|
-
*/
|
|
1942
|
-
interface ExecuteOrgDataActionOptions {
|
|
1943
|
-
/** Envelope TTL in seconds. Defaults to {@link DEFAULT_ENVELOPE_TTL_SECS}. */
|
|
1944
|
-
ttlSecs?: number;
|
|
1945
|
-
}
|
|
1946
1937
|
interface CreatePolicyInput {
|
|
1947
1938
|
orgDid: string;
|
|
1948
1939
|
initialAdminDid: string;
|
|
@@ -2009,31 +2000,46 @@ interface DataGetInput {
|
|
|
2009
2000
|
/** Hex-encoded entry ID (32 hex chars). */
|
|
2010
2001
|
entryId: string;
|
|
2011
2002
|
}
|
|
2003
|
+
interface ExecuteOrgDataActionOptions {
|
|
2004
|
+
/**
|
|
2005
|
+
* Deprecated. The direct signed-envelope transport used this as the
|
|
2006
|
+
* envelope expiry window; the session-backed RPC path ignores it.
|
|
2007
|
+
*/
|
|
2008
|
+
ttlSecs?: number;
|
|
2009
|
+
}
|
|
2012
2010
|
/**
|
|
2013
2011
|
* Options used when constructing an {@link OrgDataClient}.
|
|
2014
2012
|
*/
|
|
2015
|
-
interface OrgDataClientOptions {
|
|
2016
|
-
/**
|
|
2017
|
-
|
|
2013
|
+
interface OrgDataClientOptions extends ExecuteOrgDataActionOptions {
|
|
2014
|
+
/** Optional preloaded WASM component for tests or shared callers. */
|
|
2015
|
+
wasmComponent?: WasmComponent;
|
|
2016
|
+
/** Optional transport override, primarily for tests. */
|
|
2017
|
+
transport?: Transport;
|
|
2018
|
+
/**
|
|
2019
|
+
* Optional handler overrides. If `EthSign` is omitted, the client
|
|
2020
|
+
* uses the supplied `ethSecret` to satisfy Trinity's existing ETH
|
|
2021
|
+
* auth challenge flow automatically.
|
|
2022
|
+
*/
|
|
2023
|
+
handlers?: GuestToHostHandlers;
|
|
2018
2024
|
}
|
|
2019
2025
|
/**
|
|
2020
|
-
* Client for
|
|
2026
|
+
* Client for session-authenticated org-data contract execution.
|
|
2021
2027
|
*
|
|
2022
2028
|
* Constructed with the node's base URL, the caller's 32-byte ETH secret
|
|
2023
|
-
* key, and the caller's DID (`did:t3n:<40-hex>`).
|
|
2024
|
-
*
|
|
2025
|
-
* and
|
|
2026
|
-
*
|
|
2027
|
-
* The signing key must be the same key registered as an authenticator
|
|
2028
|
-
* (`eth:0x<addr>`) for `userDid` in the DID registry — the service
|
|
2029
|
-
* verifies this binding before dispatching any contract call.
|
|
2029
|
+
* key, and the caller's DID (`did:t3n:<40-hex>`). The first method call
|
|
2030
|
+
* lazily creates a `T3nClient`, completes ETH session auth, verifies that
|
|
2031
|
+
* the authenticated DID matches `userDid`, and then reuses that session for
|
|
2032
|
+
* subsequent contract calls.
|
|
2030
2033
|
*/
|
|
2031
2034
|
declare class OrgDataClient {
|
|
2032
2035
|
private readonly baseUrl;
|
|
2033
2036
|
private readonly ethSecret;
|
|
2034
2037
|
private readonly userDid;
|
|
2035
2038
|
private readonly opts;
|
|
2039
|
+
private clientPromise;
|
|
2036
2040
|
constructor(baseUrl: string, ethSecret: Uint8Array, userDid: string, opts?: OrgDataClientOptions);
|
|
2041
|
+
private getAuthenticatedClient;
|
|
2042
|
+
private initialiseClient;
|
|
2037
2043
|
private call;
|
|
2038
2044
|
/**
|
|
2039
2045
|
* Initialise the data-tier policy for an existing organisation.
|