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.0a5.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.0a5-cp312-cp312-win_amd64.whl (74.7 kB view details)

Uploaded CPython 3.12Windows x86-64

dotenv_webauthn_crypt-0.3.0a5-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.0a5.tar.gz.

File metadata

  • Download URL: dotenv_webauthn_crypt-0.3.0a5.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.0a5.tar.gz
Algorithm Hash digest
SHA256 3c7fbfbb32722dcfc4f0e0c9223162bd2d9f292e300e0cffce409b52ccb5772d
MD5 a2a8fc852c755e28ce0382857a2a74b4
BLAKE2b-256 d50ecc32bffb322f40f8a711c7d585b3222db354f8a27e3aeba4c2c8cf17b131

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotenv_webauthn_crypt-0.3.0a5.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.0a5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for dotenv_webauthn_crypt-0.3.0a5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aeb06343e7165d8b78ab3842db2e205848dbfbcae1e8bb9a9cd97b9159004bb2
MD5 ff71cf9c3b288eb99b19dddbaec9d4f6
BLAKE2b-256 c1c9b894add81e32b837055b05fff956db302e71ce0d22ec6baf4a0fb6ce647f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotenv_webauthn_crypt-0.3.0a5-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.0a5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for dotenv_webauthn_crypt-0.3.0a5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 604fa57e64f61cd580e4743a363288674d26726a9e1ed087b0b101b1731fbfb2
MD5 c319ce9cffe10f261ace024424fdbb41
BLAKE2b-256 d40c0ccd73872996225b1b090d5125333df7dc7bdc799437721cf5c953dd6614

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotenv_webauthn_crypt-0.3.0a5-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