@1auth/store-postgres
PostgreSQL storage implementation.
Install
npm i @1auth/store-postgres Peer dependencies
npm i pg Usage
import * as store from '@1auth/store-postgres'
store.default({
client: pgPool
}) Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
client | object | required | PostgreSQL client with a query method — see the client contract below |
timeToLiveExpireOffset | number | 864000 | TTL offset in seconds |
timeToLiveKey | string | "remove" | Column name for TTL |
Client contract
client.query(sql, parameters) // => { rows } query resolves pg’s result object, and the store reads its rows. A pg Pool or Client works as the client as is. A wrapper that resolves a bare array of rows no longer works; return the result object instead.
API
Implements the store interface using parameterized SQL queries with $ placeholders. Built on @1auth/store-sql.
All values are bound as parameters. Column names are checked against ^[A-Za-z_][A-Za-z0-9_]*$ before they’re quoted, so a key can’t inject SQL. See @1auth/store-sql for the filter rules.
Post-quantum
Performs no cryptography. Values arrive already encrypted and digested, so a stolen database exposes only quantum-resistant ciphertexts and digests. See the full assessment in Post-quantum.