@trust-os-sdk/trust-os-sdk
v1.1.0
Published
JavaScript SDK for the Trust OS decision verification API
Maintainers
Readme
Trust OS SDK
JavaScript SDK for the Trust OS decision verification API.
What is Trust OS?
Trust OS verifies high-impact decisions before execution.
Most systems execute first and explain later.
Trust OS flips that model:
Verify before execution.
Installation
npm install trust-os-sdkQuick Start
const { TrustOSClient } = require("trust-os-sdk");
const client = new TrustOSClient({
apiKey: process.env.TRUST_OS_API_KEY
});
const result = await client.verifyDecision({
transaction_id: "txn_001",
action: "transfer",
amount: 50000,
currency: "USDC",
destination: "wallet_0xabcdef",
timestamp: new Date().toISOString()
});
console.log(result);
// { decision_id: "dec_xxx", recommendation: "APPROVE", risk_level: "LOW", ... }Production API
https://trustos-core-gateway-v2-7jm9owrs.an.gateway.devThis is the default endpoint. No configuration required unless you are using a private deployment.
Authentication
All requests require an API key passed via the x-api-key header.
const client = new TrustOSClient({
apiKey: process.env.TRUST_OS_API_KEY
});API keys are provisioned during onboarding. Request early access at trust-os.io.
SDK Usage
verifyDecision(payload)
Submit a decision payload for verification. Returns a recommendation and risk assessment.
const result = await client.verifyDecision({
transaction_id: "txn_001",
action: "transfer",
amount: 50000,
currency: "USDC",
destination: "wallet_0xabcdef",
timestamp: new Date().toISOString()
});verify(payload)
Alias for verifyDecision().
const result = await client.verify(payload);REST API Example
curl -X POST https://trustos-core-gateway-v2-7jm9owrs.an.gateway.dev/v1/decision/verify \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"transaction_id": "txn_001",
"action": "transfer",
"amount": 50000,
"currency": "USDC",
"destination": "wallet_0xabcdef",
"timestamp": "2024-01-01T00:00:00.000Z"
}'Response Example
{
"decision_id": "dec_a1b2c3d4",
"recommendation": "APPROVE",
"risk_level": "LOW",
"verified": true,
"latency_ms": 142,
"timestamp": "2024-01-01T00:00:00.000Z"
}Possible recommendation values: APPROVE, REVIEW, BLOCK, ESCALATE
Error Handling
try {
const result = await client.verifyDecision(payload);
} catch (err) {
console.error(err.message); // "HTTP 401: Unauthorized"
console.error(err.status); // 401
console.error(err.body); // parsed response body (if available)
}Errors include:
err.message— description with HTTP statuserr.status— HTTP status codeerr.body— parsed response body (when available)
Requests time out after 10 seconds by default. Configure with timeout:
const client = new TrustOSClient({
apiKey: process.env.TRUST_OS_API_KEY,
timeout: 5000
});Use Cases
Stablecoin payment verification
Verify cross-border stablecoin transfers against compliance and risk policy before on-chain execution.
AI agent action verification
Gate high-impact agent tool use — database writes, API calls, code execution — with a pre-execution decision check.
DAO treasury verification
Validate governance parameters (quorum, timelock, multisig) before treasury disbursements.
Compliance workflow approval
Route decisions through policy evaluation for regulated industries: finance, healthcare, legal.
Examples
examples/basic.js— minimal integrationexamples/stablecoin-payment.js— cross-border stablecoin transferexamples/ai-agent-action.js— AI agent high-impact action gateexamples/dao-treasury.js— DAO treasury disbursement
Run an example:
TRUST_OS_API_KEY=your_key node examples/basic.jsEarly Access
Trust OS is in private beta. API keys are provisioned by invitation.
Contact: [email protected]
Links
- Operational Demo: ops.trust-os.io
- Developer Demo: demo.trust-os.io
- npm: npmjs.com/package/trust-os-sdk
- GitHub: github.com/trustos-trustfolio/trustos-sdk
