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

@aiao/rxdb-adapter-encrypted

v0.0.21

Published

Local field-level **AES-GCM-256** envelope encryption for [`@aiao/rxdb`](../rxdb). Plugs into the SQLite-core / PGlite / wa-sqlite / sqliteai adapters with zero-plaintext-at-rest guarantees on the structural database files, change log, query cache and his

Readme

@aiao/rxdb-adapter-encrypted

Local field-level AES-GCM-256 envelope encryption for @aiao/rxdb. Plugs into the SQLite-core / PGlite / wa-sqlite / sqliteai adapters with zero-plaintext-at-rest guarantees on the structural database files, change log, query cache and history snapshots.


Install

pnpm add @aiao/rxdb-adapter-encrypted

Peer of any local SQLite-family adapter (@aiao/rxdb-adapter-wa-sqlite, @aiao/rxdb-adapter-pglite, @aiao/rxdb-adapter-sqlite-wasm, @aiao/rxdb-adapter-sqliteai). Not needed for Supabase or remote-only adapters.


Quickstart

import { Entity, Property, PropertyType } from '@aiao/rxdb';
import { WaSqliteAdapter } from '@aiao/rxdb-adapter-wa-sqlite';
import { RxDB } from '@aiao/rxdb';

@Entity({ tableName: 'users' })
class User {
  @Property({ primaryKey: true }) id!: string;
  @Property({ propertyType: PropertyType.STRING }) displayName!: string;

  @Property({ propertyType: PropertyType.STRING, encrypted: true })
  email!: string;
}

const adapter = await WaSqliteAdapter.create({ name: 'app.db' });
const db = await RxDB.create({ adapter, entities: [User] });

await adapter.encryption.unlock({
  passphrase: 'correct horse battery staple'
  // idleTimeoutMs: 10 * 60_000  // override default 5-minute auto-lock
  // idleTimeoutMs: 0            // disable auto-lock
});

await db.repository(User).create({
  id: 'u1',
  displayName: 'Ada',
  email: '[email protected]' // encrypted at rest
});

Public API

import {
  // Keyring lifecycle
  Keyring,
  createKeyring,
  type UnlockOptions,
  type PassphraseUnlockOptions,
  type KeyBytesUnlockOptions,
  type CryptoKeyUnlockOptions,
  type KeyProviderUnlockOptions,

  // Envelope codec
  encodeEnvelope,
  decodeEnvelope,
  isEnvelope,
  buildAAD,
  ENVELOPE_VERSION,
  ENVELOPE_ALG,
  type CryptoEnvelope,
  type EnvelopeVersion,

  // Schema + query validators
  validateEncryptedPropertyMetadata,
  validateFTSRegistrationAgainstEncryptedColumns,
  validateQueryAgainstEncryptedColumns,
  type EncryptedAwareEntity,

  // Typed errors
  EncryptedError,
  EncryptedConfigurationError,
  EncryptedDecryptError,
  EncryptedLockedError,
  EncryptedQueryError,
  EncryptedUnlockError,
  type EncryptedErrorCode,
  type EncryptedErrorInit,

  // Keyring persistence binding
  type KeyringRow,
  type KeyringStorageBinding,

  // Verifier sentinel constant
  VERIFIER_SENTINEL
} from '@aiao/rxdb-adapter-encrypted';

import { scanForPlaintext, type ScanHit } from '@aiao/rxdb-adapter-encrypted/testing';

Refer to the TSDoc on each export for its security and lifecycle contract.


Guarantees

| Spec | Guarantee | | ------ | ----------------------------------------------------------------------------------------------------------------------------------- | | FR-001 | Schema validation rejects encrypted PK / FK / index / unique / sortable / FTS / computed columns | | FR-002 | Envelope text form v\|alg\|kid\|iv\|ct\|tag (6 base64url segments) | | FR-003 | AES-GCM-256, unique 96-bit IV per write, AAD joins namespace, tableName, columnName, primaryKey, and kid with byte 0x1F | | FR-004 | unlock() accepts exactly one of passphrase / keyBytes / key / keyProvider | | FR-005 | All encrypted columns are emitted as TEXT regardless of logical type | | FR-006 | Zero plaintext in DB files, rxdb_change patches, query cache, history snapshots | | FR-007 | Filter / order / group / FTS over encrypted column throws EncryptedQueryError before SQL gen | | FR-008 | Locked-state reads throw EncryptedLockedError; idle auto-lock after 5 min (configurable, 0 disables) | | FR-009 | unlock() verifies passphrase against persisted verifier probe; wrong passphrase never retains key |


What this package does NOT do (MVP)

  • No full-database encryption — only declared columns are sealed.
  • No native keychain / passkey / WebAuthn — bring your own passphrase or key bytes.
  • No searchable encryption — where / order / group / FTS on encrypted columns is rejected.
  • No key rotation — single kid per database for the MVP.
  • No audit log — decrypt failures throw, not persisted.
  • No automatic relock on tab visibility — subscribe to document.visibilitychange yourself.

License

MIT