← Back to SDKs
Node.js / TypeScript SDK
The official Sirr client for Node.js and TypeScript. First-class type definitions, tree-shakeable, and zero dependencies beyond fetch.
Installation
npm install @sirrvault/sdkOr with your preferred package manager:
yarn add @sirrvault/sdk
pnpm add @sirrvault/sdkQuick Start
import { SirrClient } from "@sirrvault/sdk";
const sirr = new SirrClient({
baseUrl: "https://sirr.example.com",
apiKey: "sirr_lic_...",
});
// Store a secret (expires in 1 hour, max 3 reads)
const { id, expiresAt } = await sirr.create({
content: "database_password=hunter2",
ttl: 3600,
maxReads: 3,
});
console.log("Secret stored:", id);
// Retrieve the secret
const secret = await sirr.get(id);
console.log("Content:", secret.content);
// Delete early
await sirr.delete(id);Try it live
Click Run to execute this example against a real Sirr instance. The secret is created, read, and deleted in real‑time.
TypeScript
import { SirrClient } from "@sirrvault/sdk";
const sirr = new SirrClient({
baseUrl: "https://sirr.secretdrop.app",
});
// Store a secret (expires in 5 min, max 3 reads)
const result = await sirr.create({
content: "Hello from the Sirr sandbox!",
ttl: 300,
maxReads: 3,
});
console.log("Secret stored:", result.id);
// Retrieve the secret
const secret = await sirr.get(result.id);
console.log("Content:", secret.content);
// Delete early
await sirr.delete(result.id);
console.log("Secret deleted");Client-Side Encryption
For high-sensitivity data, enable client-side encryption so the server never sees plaintext. The SDK handles key generation, encryption, and decryption transparently.
import { SirrClient } from "@sirrvault/sdk";
const sirr = new SirrClient({
baseUrl: "https://sirr.example.com",
apiKey: "sirr_lic_...",
encryption: true, // enable client-side encryption
});
// Content is encrypted before leaving your machine
const { id, key } = await sirr.create({
content: "top-secret-value",
ttl: 600,
});
// Share `id` and `key` separately — both are needed to decrypt
const secret = await sirr.get(id, { key });
console.log(secret.content); // "top-secret-value"Requirements
- Node.js 18+ (uses native fetch)
- Also works in Bun and Deno
- TypeScript 5.0+ recommended (full type inference)
Contribute
The Node.js SDK is open source under the MIT license. Bug reports, feature requests, and pull requests are welcome.
github.com/SirrVault/sirr-node →