wauth.vault module¶
Persistent storage layer for encrypted secrets using wsqlite.
- class wauth.vault.SecretModel(*, key, value, type='text', created_at=0.0, updated_at=0.0, ttl=None)[source]¶
Bases:
BaseModelPydantic model representing a stored secret.
- Variables:
key (str) – Primary key — unique name of the secret.
value (str) – Encrypted ciphertext of the secret.
type (str) – Secret type, either
"text"or"file".created_at (float) – Unix timestamp when the secret was first stored.
updated_at (float) – Unix timestamp of the last modification.
ttl (float | None) – Optional time-to-live in seconds.
Nonemeans no expiration.
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class wauth.vault.Vault(db_path='~/.wisrovi/wauth.db')[source]¶
Bases:
objectEncrypted secret storage backed by a SQLite database.
- Parameters:
db_path (str) – Path to the SQLite database file. Defaults to
~/.wisrovi/wauth.db.
- db: WSQLite¶
- save(key, encrypted_value, val_type='text', ttl=None)[source]¶
Save or update an encrypted secret in the vault.
Uses
INSERT OR REPLACEsemantics to upsert the secret by key. Timestamps are automatically managed.
- delete(key)[source]¶
Delete a secret from the vault.
- Parameters:
key (str) – Unique identifier for the secret to remove.
- Raises:
KeyNotFoundError – If the key does not exist.
VaultError – If the delete operation fails.