db-keystore
SQLite-backed credential store for the keyring-core API, built on Turso.
It implements CredentialStoreApi and CredentialApi, so it can be used
anywhere a keyring_core::api::CredentialStore is accepted (including
use_named_store_with_modifiers).
Features
- File-backed SQLite storage with optional encryption.
- WAL + busy timeout for safety in multi-process environments.
- Optional uniqueness enforcement on
(service, user). - UUID and optional
commentattributes exposed via the credential API. - Search with regex filters over
service,user,uuid, andcomment.
Configuration
You can configure the store either with DbKeyStoreConfig or with modifiers.
DbKeyStoreConfig
use ;
let config = DbKeyStoreConfig ;
let store = new.expect;
With encryption:
use ;
let config = DbKeyStoreConfig ;
let store = new.expect;
Modifiers
DbKeyStore::new_with_modifiers supports the following keys:
path(required): path to the SQLite database file.encryption-cipherorcipher: cipher name (requiresencryption-hexkey).encryption-hexkeyorhexkey: encryption key as hex (requirescipher).allow-ambiguityorallow_ambiguity:"true"or"false"(defaultfalse).vfs: VFS selection ("memory","io_uring", or"syscall").
use HashMap;
use DbKeyStore;
let modifiers = from;
let store = new_with_modifiers.expect;
Search
Search expects a map of regex filters. Supported keys: service, user,
uuid, comment. If comment is provided, results must have a matching
comment; otherwise it is ignored.
use HashMap;
let spec = from;
let entries = store.search.expect;
Notes
- Secrets are stored as UTF-8 text and limited to 8KB each. Service and user names limited to 128 chars each. These are somewhat arbitrary, to prevent accidental blow-up of the database.
allow_ambiguity = falseenforces a unique index on(service, user)and uses UPSERT forset_secret.- When ambiguity is allowed, operations may return
Error::Ambiguousif multiple credentials match a single(service, user)pair.
License
MIT OR Apache-2.0