dworshak-secret is a light-weight library for local credential access. It exposes the get_secret() function, to allow a program to leverage credentials that have been established using the Drowshak CLI tool, which is a separate package.
Project description
dworshak-secret is a light-weight library for local credential access. By adding dworshak-secret as a dependency to your Python project, you enable your program or script to leverage credentials that have been established using the sister package, the Dworshak CLI tool.
Functions exposed in dworshak-secret:
initialize_vault() -> VaultResponse– Create the vault directory, encryption key, and SQLite database. Safe to call multiple times.check_vault() -> VaultStatus– Check the health of the vault.store_secret(service: str, item: str, plaintext: str)– Encrypt and store a credential in the vault.get_secret(service: str, item: str) -> str | None– Retrieve and decrypt a credential.remove_secret(service: str, item: str) -> bool– Remove a credential from the vault.list_credentials() -> list[tuple[str, str]]– List all stored service/item pairs.export_vault(output_path: Path | str | None = None) -> str | None- Export vault to JSON file.
All secrets are stored Fernet-encrypted in the database under the secret column. No opaque blobs — every entry is meaningful and decryptable via the library.
Example
uv add "dworshak-secret[crypto]"
from dworshak_secret import initialize_vault, store_secret, get_secret, list_credentials
# Initialize the vault (create key and DB if missing)
initialize_vault()
# Store credentials
store_secret("rjn_api", "username", "admin")
store_secret("rjn_api", "password", "s3cr3t")
# Retrieve credentials
username = get_secret("rjn_api", "username")
password = get_secret("rjn_api", "password")
# List stored items
for service, item in list_credentials():
print(f"{service}/{item}")
Include Cryptography Library
(When Building dworshak-secret From Source or When Using It A Dependency in Your Project)
The only external Python library used is cryptography, for the Fernet class.
On a Termux system, cryptography can (B) be built from source or (A) the precompiled python-cryptography dedicated Termux package can be used.
Termux Installation
A. Use python-cryptography (This is faster but pollutes your local venv with other system site packages.)
pkg install python-cryptography
uv venv --system-site-packages
uv sync
uv venv --system-site-packages is a modern,faster alternative to python -m venv .venv --system-site-packages.
Because uv manages the build-time dependencies (setuptools-rust and cffi) in an isolated environment and coordinates the hand-off to the Rust compiler more robustly than pip, it is the recommended way to install cryptography from source on Termux.
B. Allow cryptography to build from source (uv is better at this compared to using pip)
pkg install rust binutils
uv sync --extra crypto # standard for any environment.
Sister Project:
CLI: Dworshak
GitHub: https://github.com/City-of-Memphis-Wastewater/dworshak
PyPI: https://pypi.org/project/dworshak/
pipx install dworshak
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dworshak_secret-1.2.5.tar.gz.
File metadata
- Download URL: dworshak_secret-1.2.5.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac004fda607f99c7c9ce3893eabfd46fd1ac5ca3fc426f654be3458de1ea93df
|
|
| MD5 |
e721432f878b2984548ff56ae605d793
|
|
| BLAKE2b-256 |
ce03758f21c7cce3526913cd1b49aa74dd1763d320cf8cd4b36432af6deac41c
|
Provenance
The following attestation bundles were made for dworshak_secret-1.2.5.tar.gz:
Publisher:
publish.yml on City-of-Memphis-Wastewater/dworshak-secret
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dworshak_secret-1.2.5.tar.gz -
Subject digest:
ac004fda607f99c7c9ce3893eabfd46fd1ac5ca3fc426f654be3458de1ea93df - Sigstore transparency entry: 952354617
- Sigstore integration time:
-
Permalink:
City-of-Memphis-Wastewater/dworshak-secret@4ac66dd7e0f689a269842a597819e8eb8d281397 -
Branch / Tag:
refs/tags/v1.2.5 - Owner: https://github.com/City-of-Memphis-Wastewater
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4ac66dd7e0f689a269842a597819e8eb8d281397 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dworshak_secret-1.2.5-py3-none-any.whl.
File metadata
- Download URL: dworshak_secret-1.2.5-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0851066161f4f00f032da9cdfd63c3a2390480f88c8c75f14af09f355580bbb3
|
|
| MD5 |
c492835c413d9a79816cd9255f259712
|
|
| BLAKE2b-256 |
216381b2fb8accf5269d36e9c58ef1111910e673ac04df81b221eda94df3b473
|
Provenance
The following attestation bundles were made for dworshak_secret-1.2.5-py3-none-any.whl:
Publisher:
publish.yml on City-of-Memphis-Wastewater/dworshak-secret
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dworshak_secret-1.2.5-py3-none-any.whl -
Subject digest:
0851066161f4f00f032da9cdfd63c3a2390480f88c8c75f14af09f355580bbb3 - Sigstore transparency entry: 952354618
- Sigstore integration time:
-
Permalink:
City-of-Memphis-Wastewater/dworshak-secret@4ac66dd7e0f689a269842a597819e8eb8d281397 -
Branch / Tag:
refs/tags/v1.2.5 - Owner: https://github.com/City-of-Memphis-Wastewater
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4ac66dd7e0f689a269842a597819e8eb8d281397 -
Trigger Event:
release
-
Statement type: