Skip to main content

Read-path SDK for seekrit — resolve and decrypt secrets client-side with a service token.

Project description

seekrit — Python SDK

Read-path SDK for seekrit. Authenticate with a service token, resolve your environment, and get decrypted secrets — the API only ever returns ciphertext; decryption happens in your process.

This repo is a read-only mirror published from seekrit's monorepo so the code that holds your token and decrypts plaintext is auditable. Don't commit here — it's overwritten on each sync. Issues and PRs welcome.

Install

pip install seekrit

Requires Python 3.9+. The only dependency is cryptography.

Usage

import seekrit

client = seekrit.Client()            # token from $SEEKRIT_TOKEN
secrets = client.resolve()           # {"DATABASE_URL": "postgres://…", …}

db_url = client.get("DATABASE_URL")
api_key = client.get("API_KEY", default="")

Load everything into the process environment:

import os, seekrit
seekrit.Client().into_env()          # existing os.environ vars win by default
print(os.environ["DATABASE_URL"])

Configuration

Argument Env var Default
token SEEKRIT_TOKEN — (required)
api_url SEEKRIT_API_URL https://api.seekrit.dev
overrides {}
timeout 30.0 (seconds)

A service token binds to a single app environment (plus its composed group slices). To pull a different environment slice of a composed group, pass overrides (the ?with= override):

seekrit.Client(overrides={"shared": "dev"}).resolve()

Errors

  • SeekritApiError — non-2xx from the API; has .status and .code ("unauthorized", "forbidden", "not_found", …).
  • SeekritCryptoError — a token or ciphertext could not be parsed/decrypted.
  • SeekritError — base class (also covers network failures).

The client is fail-closed: any resolve or decrypt failure raises rather than returning partial results.

Zero-knowledge

GET /v1/resolve returns ciphertext plus a data-encryption key wrapped to your token's public key. This SDK recovers the token's private key, unwraps the DEK (ECDH P-256 → HKDF-SHA256 → AES-256-GCM), and decrypts each secret (AES-256-GCM, AAD-bound to environmentId/NAME) — the exact scheme used by the CLI, seekrit run, and every other seekrit client. See seekrit.dev/docs.

License

MIT

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

seekrit-0.2.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

seekrit-0.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file seekrit-0.2.0.tar.gz.

File metadata

  • Download URL: seekrit-0.2.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for seekrit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f115abbcde4e9cfcb1d946448f0d7e75082c0c922ec7eec53c6673e7acb5a581
MD5 b04426f4bb4d805a759568c4cba0c562
BLAKE2b-256 559d1d6fab901a2fc90f6464737b4f2dfec235ce2ac74da123c9a2492c667a1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for seekrit-0.2.0.tar.gz:

Publisher: publish.yml on seekritdev/python-sdk

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

File details

Details for the file seekrit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: seekrit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for seekrit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8239286739ae86cb4189706cd1df2a7863bd950c85022e7fda401d443f97e782
MD5 c12b0679126022ba78d0927f426cffaa
BLAKE2b-256 4be0a18fc25c3153c72c5d6882f8acae3ed6deeedb4e07ba1ab4e1c9cdcd5d57

See more details on using hashes here.

Provenance

The following attestation bundles were made for seekrit-0.2.0-py3-none-any.whl:

Publisher: publish.yml on seekritdev/python-sdk

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