Skip to main content

Python SDK for DS Vault - (envelope pattern)

Project description

DS Vault Python SDK

Features

  • GetSecret
  • TTL + LRD Cache (KEK & records)
  • Psql and Memory repositories

Quickstart

Install

With postgres:

pip install "ds-vault-py-sdk[postgres]"

Memory only:

pip install ds-vault-py-sdk

Usage

Postgres - plain:

from vault import DSVaultClient
from vault.repositories.postgres import PostgresSecretRepository

repo = PostgresSecretRepository(
    dsn="postgresql://user:pass@host:5432/db",
    table="public.secrets",
)

client = DSVaultClient(repository=repo)

secret_bytes = client.get_secret(key=key)
print(secret_bytes.decode())

Managed KMS context:

client = DSVaultClient(
    repository=repo,
    encryption_context_defaults={"app": "payments-api", "env": "prod"},
)

Tests

Execute tests by setting environment variables to manage import paths, and call pytest.

export PYTHONPATH="src"
pipenv run pytest

Environment

Currently support dev and prod environment, defined by setting environment variable BUILDING_MODE, e.g.:

export BUILDING_MODE="dev"

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

ds_vault_py_sdk-1.0.0b1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

ds_vault_py_sdk-1.0.0b1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file ds_vault_py_sdk-1.0.0b1.tar.gz.

File metadata

  • Download URL: ds_vault_py_sdk-1.0.0b1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ds_vault_py_sdk-1.0.0b1.tar.gz
Algorithm Hash digest
SHA256 5d6a899e8fc706d5a9d8ce9a7680b50fe13847686f25f5b15d02b2f73ec6779b
MD5 32c3e86943c30fd634d9a14903c565ca
BLAKE2b-256 dc71663664e0aaa80a21d0d93f1b1873b2aa52c7f4a1b2d0029cc682a1ae348f

See more details on using hashes here.

File details

Details for the file ds_vault_py_sdk-1.0.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for ds_vault_py_sdk-1.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2ea349b55a87cb659173a465931d54a85641e7ddca918e75701012e66d4d6a4
MD5 a5558854808cfdaacf0d7115fbf9501a
BLAKE2b-256 71a3fe3ce6829249a47fe3581bbfb17ea316371be2d2f0cf21bde930284c8ca3

See more details on using hashes here.

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