Skip to main content

dotmage

Python SDK for dotMage — a self-hosted, end-to-end encrypted .env secret manager.

The dotMage server is a zero-knowledge blob store: it only ever holds opaque encrypted blobs and wrapped keys, and never sees your master password, plaintext secrets, or the account key. This SDK therefore does two things:

  1. Transport — a typed client over the dotMage REST API (/api/v1).
  2. Client-side cryptography — key derivation, key wrapping/unwrapping, blob encryption/decryption, sealed-key team invitations, and key rotation — everything the reference dmage CLI does, so secrets are encrypted and decrypted locally.

Status: alpha, under active development. The cryptographic wire format aims for byte-compatibility with the reference dmage client; see docs/crypto.md and the interop notes before relying on it in production.

Install

pip install dotmage

Quickstart

from dotmage import DotMage

# Create a vault on a fresh server (first device).
dm, recovery_code = DotMage.init_vault(
    "https://secrets.example.com",
    bootstrap_secret="XXXXXXXXXXXX",
    master_password="correct horse battery staple",
)
print("Store this recovery code somewhere safe (shown once):", recovery_code)

dm.create_app("work/api")
dm.create_env("work/api", "prod")
dm.push("work/api", "prod", {"DATABASE_URL": "postgres://...", "STRIPE_KEY": "sk_live_..."})

secrets = dm.pull("work/api", "prod")   # -> dict[str, str], decrypted locally

Async mirror:

import asyncio
from dotmage import AsyncDotMage

async def main() -> None:
    async with AsyncDotMage("https://secrets.example.com") as dm:
        await dm.unlock("correct horse battery staple")
        print(await dm.pull("work/api", "prod"))

asyncio.run(main())

Configuration

The SDK reads configuration from environment variables (prefix DOTMAGE_) via pydantic-settings:

Variable Description
DOTMAGE_SERVER_URL Base URL of the dotMage server
DOTMAGE_DEVICE_TOKEN Device token (dmage_dtok_...)
DOTMAGE_REFRESH_TOKEN Refresh token (dmage_rtok_...)
DOTMAGE_MASTER_PASSWORD Master password (used to unlock; keep it in a secret store)

Documentation

Development

poetry install
./scripts/linters.sh   # ruff + mypy
./scripts/tests.sh     # pytest with a 95% coverage gate

Releasing

CI runs check-version → lint → test → build on every push to main and on pull requests. Publishing to PyPI happens only on a version tag, once PyPI trusted publishing is configured for this repository (a GitHub environment named pypi):

# bump the version in pyproject.toml and update CHANGELOG.md, then:
git tag v0.1.0
git push origin v0.1.0

License

MIT — see LICENSE.

Release files for dotmage 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dotmage 0.1.0
File Size Uploaded
dotmage-0.1.0.tar.gz 28.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dotmage 0.1.0
File Interpreter ABI Platform
dotmage-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 68.9 kB

Release files / dotmage-0.1.0.tar.gz

Download URL dotmage-0.1.0.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e7e36398fa2293febe0cfaef996d5e2c12072eb8a4467ab53f2ade13dd773968
BLAKE2b-256 checksum
How to use checksums
91fc8d4696eca7048f48be24100c1145d8bcd55e2a952fbe25c81ae82574df91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.

Transparency log

Release files / dotmage-0.1.0-py3-none-any.whl

Download URL dotmage-0.1.0-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acb5b8ef8d602c1b6a28fe78eb8d5377a114c39d555f0b3f8dac8d3b0892997b
BLAKE2b-256 checksum
How to use checksums
311ca17bc1471fc5312ab34b96cab5aef1b43b390da6c3f751f3637322427cd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page