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
.envfile 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
- Registration:
initcreates a non-resident public/private key pair in the TPM. TheCredentialIDis saved locally. - Encryption: A
VaultKeyis derived using HKDF from a TPM-backed signature and the file's canonical path. - Loading:
load_dotenvdetectsENC:prefixes, triggers Windows Hello to get a fresh signature, re-derives theVaultKey, and decrypts the values intoos.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
rekeycommand to migrate between hardware credentials.
License
Distributed under the MIT License. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c7fbfbb32722dcfc4f0e0c9223162bd2d9f292e300e0cffce409b52ccb5772d
|
|
| MD5 |
a2a8fc852c755e28ce0382857a2a74b4
|
|
| BLAKE2b-256 |
d50ecc32bffb322f40f8a711c7d585b3222db354f8a27e3aeba4c2c8cf17b131
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dotenv_webauthn_crypt-0.3.0a5.tar.gz -
Subject digest:
3c7fbfbb32722dcfc4f0e0c9223162bd2d9f292e300e0cffce409b52ccb5772d - Sigstore transparency entry: 1191411595
- Sigstore integration time:
-
Permalink:
joseluu/dotenv-webauthn-crypt@52eadfed2ccb21ea7df6507a3e57e4de8f2e3d3b -
Branch / Tag:
refs/tags/v0.3.0a5 - Owner: https://github.com/joseluu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@52eadfed2ccb21ea7df6507a3e57e4de8f2e3d3b -
Trigger Event:
release
-
Statement type:
File details
Details for the file dotenv_webauthn_crypt-0.3.0a5-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: dotenv_webauthn_crypt-0.3.0a5-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 74.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeb06343e7165d8b78ab3842db2e205848dbfbcae1e8bb9a9cd97b9159004bb2
|
|
| MD5 |
ff71cf9c3b288eb99b19dddbaec9d4f6
|
|
| BLAKE2b-256 |
c1c9b894add81e32b837055b05fff956db302e71ce0d22ec6baf4a0fb6ce647f
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dotenv_webauthn_crypt-0.3.0a5-cp312-cp312-win_amd64.whl -
Subject digest:
aeb06343e7165d8b78ab3842db2e205848dbfbcae1e8bb9a9cd97b9159004bb2 - Sigstore transparency entry: 1191411599
- Sigstore integration time:
-
Permalink:
joseluu/dotenv-webauthn-crypt@52eadfed2ccb21ea7df6507a3e57e4de8f2e3d3b -
Branch / Tag:
refs/tags/v0.3.0a5 - Owner: https://github.com/joseluu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@52eadfed2ccb21ea7df6507a3e57e4de8f2e3d3b -
Trigger Event:
release
-
Statement type:
File details
Details for the file dotenv_webauthn_crypt-0.3.0a5-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: dotenv_webauthn_crypt-0.3.0a5-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 73.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
604fa57e64f61cd580e4743a363288674d26726a9e1ed087b0b101b1731fbfb2
|
|
| MD5 |
c319ce9cffe10f261ace024424fdbb41
|
|
| BLAKE2b-256 |
d40c0ccd73872996225b1b090d5125333df7dc7bdc799437721cf5c953dd6614
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dotenv_webauthn_crypt-0.3.0a5-cp311-cp311-win_amd64.whl -
Subject digest:
604fa57e64f61cd580e4743a363288674d26726a9e1ed087b0b101b1731fbfb2 - Sigstore transparency entry: 1191411596
- Sigstore integration time:
-
Permalink:
joseluu/dotenv-webauthn-crypt@52eadfed2ccb21ea7df6507a3e57e4de8f2e3d3b -
Branch / Tag:
refs/tags/v0.3.0a5 - Owner: https://github.com/joseluu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@52eadfed2ccb21ea7df6507a3e57e4de8f2e3d3b -
Trigger Event:
release
-
Statement type: