Skip to main content

Drop-in dotenv replacement with Windows Hello encryption.

Project description

dotenv-webauthn-crypt

Transparent, Windows Hello-backed encryption for your .env files.

dotenv-webauthn-crypt is a drop-in replacement for python-dotenv that keeps your secrets encrypted at rest and gates access behind WebAuthn (Biometrics/PIN). It, ensuring that your Master Key never exists in plaintext on disk.

Features

  • Seamless Integration: Use load_dotenv() just like you always have.
  • Hardware Security: Private keys stay in the TPM.
  • Biometric Decryption: Prompts for Fingerprint/PIN when loading secrets.
  • Strong Cryptography: Uses AES-256-GCM for encryption and HKDF-SHA256 for key derivation.
  • Vault Isolation: Each .env file has its own unique derived vault key.

Installation

Prerequisites

  • Windows 10/11 with Windows Hello enabled.
  • Visual Studio 2022 Build Tools (only if building from source).
pip install dotenv-webauthn-crypt

Usage

1. Initialize your machine

Create your machine-specific root credential in the TPM:

dotenv-webauthn-crypt-cli init --user MyWindowsUser

2. Encrypt an existing .env file

This will replace plaintext values with encrypted ENC:... blobs:

dotenv-webauthn-crypt-cli encrypt .env

3. Load in your Python code

from dotenv_webauthn_crypt import load_dotenv

# This will trigger a Windows Hello prompt if encrypted values are detected
load_dotenv()

import os
print(os.environ.get("MY_SECRET_KEY"))

Architecture

  1. Registration: init creates a non-resident public/private key pair in the TPM. The CredentialID is saved locally.
  2. Encryption: A VaultKey is derived using HKDF from a TPM-backed signature and the file's canonical path.
  3. Loading: load_dotenv detects ENC: prefixes, triggers Windows Hello to get a fresh signature, re-derives the VaultKey, and decrypts the values into os.environ.

TODO / Roadmap

  • Usage of Windows Hello as it uses the TPM (Trusted Platform Module) to sign challenges
  • Linux Support: Implement a Linux backend using the TPM2-TSS or libfido2 for similar biometric/hardware protection.
  • macOS Support: Implement a macOS backend using Secure Enclave / Touch ID.
  • Credential Rotation: Add rekey command to migrate between hardware credentials.

License

Distributed under the MIT License. See LICENSE for more information.

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

dotenv_webauthn_crypt-0.3.0a3.tar.gz (10.0 kB view details)

Uploaded Source

Built Distributions

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

dotenv_webauthn_crypt-0.3.0a3-cp312-cp312-win_amd64.whl (74.7 kB view details)

Uploaded CPython 3.12Windows x86-64

dotenv_webauthn_crypt-0.3.0a3-cp311-cp311-win_amd64.whl (73.8 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file dotenv_webauthn_crypt-0.3.0a3.tar.gz.

File metadata

  • Download URL: dotenv_webauthn_crypt-0.3.0a3.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dotenv_webauthn_crypt-0.3.0a3.tar.gz
Algorithm Hash digest
SHA256 37eb55d02ce7d75cfcc05ecdd4f484013fcb7fa1f7cacfac2c2a7c9bed01b143
MD5 4a452dbd3a98d2c70324895c0a884c35
BLAKE2b-256 f3335f13e419652393baa5493a706884e1e5ad0d68317e7297ea3b7088f18da6

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotenv_webauthn_crypt-0.3.0a3.tar.gz:

Publisher: build_wheels.yml on joseluu/dotenv-webauthn-crypt

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

File details

Details for the file dotenv_webauthn_crypt-0.3.0a3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for dotenv_webauthn_crypt-0.3.0a3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9a7c0ab2555c016f074b6e51b35ec0ca691b23ab5af32cd233622fed830f59a3
MD5 6ba22f74f79abbc385c7e2de8716fa13
BLAKE2b-256 89b75d846689a2a52e2dd1f0fc9c6dcc27b7256384a3131d5433e85c18d5eacc

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotenv_webauthn_crypt-0.3.0a3-cp312-cp312-win_amd64.whl:

Publisher: build_wheels.yml on joseluu/dotenv-webauthn-crypt

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

File details

Details for the file dotenv_webauthn_crypt-0.3.0a3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for dotenv_webauthn_crypt-0.3.0a3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 486b51700df03a9805c06782667149554520e4d0a1d6209bccde6816eb5473a9
MD5 77eca6edc10a017f0410c7fd24b24fb5
BLAKE2b-256 c2d35f9ebaa8ffb3219862fcf81c7a3ea6e9d113e3fa9310db546a6604b74239

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotenv_webauthn_crypt-0.3.0a3-cp311-cp311-win_amd64.whl:

Publisher: build_wheels.yml on joseluu/dotenv-webauthn-crypt

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