npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vanar/veil-capsule

v0.1.2

Published

End-to-end encryption and tamper-proof audit trails for AI agents

Readme

@vanar/veil-capsule

End-to-end encryption and tamper-proof audit trails for AI agents.

Cryptography

  • X25519 ECDH for key agreement
  • XSalsa20-Poly1305 for authenticated encryption
  • Ed25519 for digital signatures

All backed by TweetNaCl (audited NaCl implementation).

Install

npm install @vanar/veil-capsule

Quick Start

Encrypt / Decrypt

import { VeilClient } from '@vanar/veil-capsule';

const alice = new VeilClient();
const bob = new VeilClient();

// Alice encrypts for Bob
const encrypted = await alice.encrypt('secret message', bob.publicKey);

// Bob decrypts
const plaintext = await bob.decrypt(encrypted);
// => "secret message"

// Encrypt to self (for storage)
const selfEncrypted = await alice.encrypt('my data');
const selfDecrypted = await alice.decrypt(selfEncrypted);

Sign / Verify

import { VeilClient } from '@vanar/veil-capsule';

const signingKeys = VeilClient.generateSigningKeyPair();

const signature = VeilClient.sign('important data', signingKeys.secretKey);
const valid = VeilClient.verify('important data', signature, signingKeys.publicKey);
// => true

VeilCapsule (Encrypted + Signed + Searchable Memory)

import {
  VeilClient,
  VeilCapsule,
  InMemoryCapsuleBackend,
} from '@vanar/veil-capsule';

const capsule = new VeilCapsule({
  veil: new VeilClient(),
  memory: new InMemoryCapsuleBackend(),
  signingKeyPair: VeilClient.generateSigningKeyPair(),
});

const userId = 'alice';

// Store: content is encrypted, metadata stays searchable
const entry = await capsule.store(
  'sensitive agent memory',
  { topic: 'user preferences', agent: 'assistant-v2' },
  userId,
);

// Search: keyword/relevance match on metadata, decrypt matching entries
const results = await capsule.search('preferences', userId);
console.log(results[0].decryptedContent);
// => "sensitive agent memory"

// Verify: check Ed25519 signature for tamper detection
const isValid = capsule.verify(entry);
// => true

Bundled backends

| Backend | Ships in | Use case | |---|---|---| | InMemoryCapsuleBackend | core, zero deps | tests, demos, ephemeral agents, edge runtimes | | PgCapsuleBackend | core, requires pg | production - records survive restarts, full-text search via tsvector |

import { PgCapsuleBackend, VEIL_CAPSULE_PG_SCHEMA } from '@vanar/veil-capsule';
import { Pool } from 'pg';

const capsule = new VeilCapsule({
  veil: new VeilClient(),
  memory: new PgCapsuleBackend({ pool: new Pool(), autoMigrate: true }),
  signingKeyPair: VeilClient.generateSigningKeyPair(),
});

MemoryBackend Interface

Implement this interface to plug VeilCapsule into any data store (Mongo, Redis, Supabase, your warehouse, anything):

interface MemoryBackend {
  store(input: {
    content: string;
    metadata?: Record<string, unknown>;
    externalUserId: string;
  }): Promise<{ id: string }>;

  query(input: {
    prompt: string;
    topK?: number;
    externalUserId: string;
  }): Promise<Array<{
    id: string;
    content: string;
    metadata: Record<string, unknown>;
    relevance: number;
    createdAt: number;
  }>>;
}

externalUserId is required, non-empty - the backend uses it to isolate records per user/agent. Any custom backend must round-trip the metadata dict losslessly (VeilCapsule writes encrypted ciphertext and signatures into reserved _* keys and reads them back at query time).

Why VeilCapsule?

| Feature | Plain storage | VeilCapsule | |---------|--------------|-------------| | Encrypted at rest | No | Yes (XSalsa20-Poly1305) | | Tamper-proof | No | Yes (Ed25519 signatures) | | Semantic search | Depends | Yes (via MemoryBackend) | | Audit trail | No | Yes (signed entries) | | Backend agnostic | N/A | Yes (any MemoryBackend) |

License

Apache-2.0