Skip to main content

dworshak-access 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-access

dworshak-access is a light-weight library for local credential access. By adding dworshak-access 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.

Migration

dworshak-access is now referred to as dworshak-secret.

https://github.com/City-of-Memphis-Wastewater/dworshak-secret


Functions exposed in dworshak-access:

  • initialize_vault() -> VaultStatus – 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-access[crypto]"
from dworshak_access 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}")

Cryptography Library (When Building dworshak-access 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dworshak_access-1.2.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dworshak_access-1.2.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file dworshak_access-1.2.1.tar.gz.

File metadata

  • Download URL: dworshak_access-1.2.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dworshak_access-1.2.1.tar.gz
Algorithm Hash digest
SHA256 0f1fb8e369cea0ddddaf004c55193ec1041f8d9fffbd9c72c3e9fe33174fc288
MD5 5284ae838db8874917a7e1116809844e
BLAKE2b-256 fa123905c69c98b596c4f8ece54aede5ae40edd1438eb671ab115f2f27cb36e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for dworshak_access-1.2.1.tar.gz:

Publisher: publish.yml on City-of-Memphis-Wastewater/dworshak-access

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dworshak_access-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dworshak_access-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89b0ff8ac4ef60ac15729cbea476d79da5382db888cefb5230e957ea31ada5ab
MD5 7af22f875e8b0b8c4fcd0a2868968b5b
BLAKE2b-256 8354918d75f194ece7d82bee201439944c6dc726d87f11f4788a80314f8d8e38

See more details on using hashes here.

Provenance

The following attestation bundles were made for dworshak_access-1.2.1-py3-none-any.whl:

Publisher: publish.yml on City-of-Memphis-Wastewater/dworshak-access

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page