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',
integration_type: 'sdk',
keys: [{
kid: 'agent_underwriter-key-1',
public_key: client.getPublicKey(),
algorithm: 'ed25519',
}],
});
console.log(agent.agent.status); // 'active'Submit an Operation
The SDK signs the record, computes the chain hash, generates the nonce, and sets the TTL.
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 installation across all 15 hook integrations in the AI Agent Integration catalog. Interactive installs collect secrets through echo-disabled prompts; automation uses owner-only secret files. See the integration guide for details.
Interactive install
npx @elydora/sdk install --agent claudecode \
--org_id "your_org_id" --agent_id "your_agent_id" \
--kid "your_key_id" --base_url "https://api.elydora.com"Automation with owner-only secret files
npx @elydora/sdk install --agent claudecode \
--org_id "your_org_id" --agent_id "your_agent_id" \
--kid "your_key_id" --base_url "https://api.elydora.com" \
--private_key_file "/secure/path/private.key" \
--token_file "/secure/path/api.token"Configuration Options
- orgId — Your organization identifier (required)
- agentId — The agent identifier (required)
- privateKey — Base64url-encoded Ed25519 private key seed (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-1)