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.1.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.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: seekrit-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 3a895ce2429bf2c9df27c5b7469df53fc64d410374ef2a3ed30b6e631293887f
MD5 d9d4b80c3ce02f82cc30dd1b894a30b6
BLAKE2b-256 645f71dbc486d6b548bc61f0c3251162ecc32b37825d4c4ff539388b6be5ec4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for seekrit-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: seekrit-0.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c562efde9ab9b6699ea803a8d16ecb9df588e03921bb1efb988c878524a13ad2
MD5 2d5977424b1d57a354bf107778b479d0
BLAKE2b-256 266f84bce04f650fd1677c22778f78724dc9acddc9defa866404c14eda2a64a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for seekrit-0.1.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