Install
npm install @vaultgraph/sdk or yarn add @vaultgraph/sdk.
Prerequisites
- Sign up at app.vaultgraph.com and create your organization
- Follow Credentials Setup for credentials setup (API key + public/private key pairs).
- Register at least one Agent and Consumer in the platform or via the API
Quick start
Submit your first signed receipt in under 10 lines:JobReceipt, signs it with your Ed25519 private key, and submits it to VaultGraph — all in one call. Trust scores update on your vendor dashboard automatically.
Step-by-step usage
If you need more control than the one-liner above, you can create, sign, and submit receipts separately:Create + sign without submitting
Verify exported receipts
If you export receipts from the platform as JSON, each item includes the canonicalreceipt payload and its signature. Verify them offline with the vendor’s public key:
Manage agents
Full CRUD for the/api/agents endpoint, plus trust score queries:
Manage consumers
Full CRUD for the/api/consumers endpoint:
API reference
Receipt functions
| Function | Description |
|---|---|
hashContext(value, options?) | SHA-256 hash of canonical JSON/bytes |
createReceipt(input) | Build a normalized JobReceipt |
serializeReceipt(receipt) | Canonical JSON string of a receipt |
signReceipt(options) | Sign a receipt (returns base64 signature) |
verifyReceipt(options) | Verify a receipt signature (returns boolean) |
createSignedReceipt(options) | Create + sign in one step |
submitSignedReceipt(options) | Create + sign + submit in one step |
submitReceipt(options) | POST a signed receipt to /api/receipts |
generateKeyPair() | Generate PEM-encoded Ed25519 keypair |
Client factories
| Function | Description |
|---|---|
createAgentsClient(options) | CRUD for /api/agents + getScores() |
createConsumersClient(options) | CRUD for /api/consumers |
Types
Receipts:CreateReceiptInput, JobReceipt, JobReceiptV0, JobResolution, ReceiptVersion, SubmitReceiptOptions, SubmitReceiptResponse, CreateSignedReceiptOptions, SubmitSignedReceiptOptions
Agents: AgentRecord, AgentCreateInput, AgentUpdateInput, AgentScoresSummary, AgentDailyScore, AgentScoresQueryOptions, AgentsClient, AgentsClientOptions
Consumers: ConsumerRecord, ConsumerCreateInput, ConsumerUpdateInput, ConsumersClient, ConsumersClientOptions
Important notes
- Never send raw context — always hash it with
hashContext()first - Server-side only — keep your private key and API key out of browser/client code
- Receipt version — currently
v0; breaking changes will bump the major SDK version - Ed25519 only — RSA and ECDSA are not supported for receipt signing
Links
- Platform: app.vaultgraph.com
- Docs: vaultgraph.com/docs
- npm: @vaultgraph/sdk