JavaScript SDK
The official Elydora SDK for Node.js and TypeScript applications. Full TypeScript type definitions included.
Installation
bash
npm install @elydora/sdkQuick Start
typescript
import { ElydoraClient } from '@elydora/sdk';
const client = new ElydoraClient({
orgId: 'org_acme',
agentId: 'agent_underwriter',
privateKey: process.env.ELYDORA_KEY,
});Register an Agent
typescript
const agent = await client.registerAgent({
agent_id: 'agent_underwriter',
display_name: 'Loan Underwriter v2',
responsible_entity: 'Underwriting Team',
keys: [{
kid: 'agent_underwriter-key-1',
public_key: client.getPublicKey(),
algorithm: 'ed25519',
}],
});
console.log(agent.agent.status); // 'active'Submit an Operation
The SDK automatically handles signing, chain-hashing, nonce generation, and TTL computation.
typescript
const record = client.createOperation({
operationType: 'loan.approve',
subject: { id: 'borrower:BRW-2026-0042', type: 'borrower' },
action: { name: 'approve', type: 'decision' },
payload: { loanId: 'LN-2026-001', amount: 50000 },
});
const { receipt } = await client.submitOperation(record);
// receipt is the EAR (Elydora Acknowledgement Receipt)
console.log(receipt.receipt_id); // 'rcpt_xyz789'
console.log(receipt.seq_no); // 42
console.log(receipt.chain_hash); // 'sha256:...'Verify an Operation
typescript
const result = await client.verifyOperation(operationId);
console.log(result.valid); // true
console.log(result.checks.signature); // true
console.log(result.checks.chain); // trueQuery Audit Log
typescript
const results = await client.queryAudit({
agent_id: 'agent_underwriter',
operation_type: 'loan.approve',
start_time: 1738368000000, // 2026-02-01 epoch ms
end_time: 1740873599000, // 2026-02-28 epoch ms
limit: 50,
});
for (const op of results.operations) {
console.log(op.operation_id, op.issued_at);
}Error Handling
typescript
import { ElydoraError } from '@elydora/sdk';
try {
await client.submitOperation(record);
} catch (err) {
if (err instanceof ElydoraError) {
console.error(err.code); // 'AGENT_FROZEN'
console.error(err.message); // 'Agent is frozen...'
}
}CLI Installation
The JavaScript SDK includes a CLI for one-command hook installation in supported AI coding tools (Claude Code, Cursor, Gemini CLI, Kiro CLI, Kiro IDE, OpenCode, Copilot CLI, Letta Code). See the AI Agent Integration guide for details.
bash
npx @elydora/sdk install --agent claudecode \
--org_id "your_org_id" --agent_id "your_agent_id" \
--private_key "your_private_key" --kid "your_key_id" \
--token "your_api_token"Configuration Options
- orgId — Your organization identifier (required)
- agentId — The agent identifier (required)
- privateKey — Ed25519 private key in PEM or base64 format (required)
- baseUrl — API base URL (defaults to production)
- ttlMs — Default TTL in milliseconds (default: 30000)
- maxRetries — Number of retry attempts (default: 3)
- kid — Key ID (defaults to {agentId}-key-v1)