AuthStorage

The core engine persists users, sessions, password resets, and signing keys through an AuthStorage interface. The interface defines full CRUD for each record, plus session cleanup and signing-key management. Any storage backend that implements it works; the contract is covered by the same tests across adapters.

Adapters

PackageUse for
@palmshed/auth-storage-postgresProduction. Runs schema creation via migrate()
@palmshed/auth-storage-sqliteLocal development and small deployments
@palmshed/auth-storage-redisDistributed rate-limit counters (with the core engine)
MemoryStorage (in core)Tests and ephemeral use; data is lost on restart

Postgres

import { PostgresStorage } from "@palmshed/auth-storage-postgres";

const storage = new PostgresStorage(process.env.DATABASE_URL);
await storage.migrate();  // creates the schema if needed

Tables live in a dedicated auth schema. Sessions and password resets cascade when a user is deleted. Signing keys are stored in the database so token verification works across restarts and instances.

Signing keys

Session tokens are HMAC-signed with a signing key held in storage. The manager rotates keys automatically, keeps several active keys for verification, and retires old keys after a grace period. This is what makes tokens survive a restart and multiple instances.