@1auth/store-sqlite

SQLite storage implementation for embedded and local development use.

Install

npm i @1auth/store-sqlite

Usage

import * as store from '@1auth/store-sqlite'

store.default({
  client: sqliteDb
})

Configuration options

OptionTypeDefaultDescription
clientobjectrequiredSQLite client with a query method — see the client contract below
timeToLiveExpireOffsetnumber864000TTL offset in seconds
timeToLiveKeystring"remove"Column name for TTL

Client contract

client.query(sql, parameters) // => rows[]

query always resolves to an array of rows, including for INSERT, UPDATE and DELETE. Statements that return nothing resolve to []. Writes use RETURNING id, so insert reads rows[0].id and remove checks rows[0].

API

Implements the store interface using parameterized SQL queries with ? placeholders. Built on @1auth/store-sql, whose identifier and filter rules apply here too.

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.