Skip to content

Node.js Client

The official Node.js SDK for VaultSandbox Gateway. It handles quantum-safe encryption automatically, letting you focus on testing email workflows.

  • Automatic Encryption: ML-KEM-768 key encapsulation + AES-256-GCM encryption handled transparently
  • Real-Time Delivery: SSE-based email delivery with smart polling fallback
  • Webhooks: HTTP callbacks for email events with filtering and templates
  • Email Authentication: Built-in SPF/DKIM/DMARC validation helpers
  • Full Email Access: Decrypted content, headers, links, and attachments
  • Chaos Engineering: Simulate SMTP failures, latency, greylisting, and network issues
  • TypeScript Support: Comprehensive type definitions included
  • Node.js 20+ (not supported in browsers or edge runtimes)
  • VaultSandbox Gateway server
  • Valid API key

The SDK connects to a VaultSandbox Gateway - a receive-only SMTP server you self-host. It handles email reception, authentication validation, and encryption. You can run one with Docker in minutes.

See Gateway Overview or jump to Quick Start to deploy one.

import { VaultSandboxClient } from '@vaultsandbox/client';
const client = new VaultSandboxClient({
url: 'https://gateway.example.com',
apiKey: 'your-api-key',
});
// Create inbox (keypair generated automatically)
const inbox = await client.createInbox();
// Send email to inbox.emailAddress from your application...
// Wait for email
const email = await inbox.waitForEmail({ timeout: 30000 });
console.log('Subject:', email.subject);
console.log('Text:', email.text);
// Cleanup
await inbox.delete();