Encrypted storage with minimal code changes.
fs-encrypted is a PyFilesystem2-compatible file system that transparently encrypts and decrypts files using AES/Fernet. Drop it in where you already use the filesystem — no architecture changes needed.
Installation & usage
Install
pip install fs-encrypted
# or
poetry add fs-encrypted
Minimal integration
Swap your existing file system for an encrypted one. The API is identical — open, read, write — encryption happens transparently.
from fs_encrypted.encrypted_fs import EncryptedFS
import base64
# Generate and store your key securely
key = base64.urlsafe_b64encode(b”Hello I’m a 32bit encoded string”)
fs = EncryptedFS(“./secure_data”, key)
with fs.open(“my_secrets.txt”, “w”) as f:
f.write(b”Top Secret Data!!”)
with fs.open(“my_secrets.txt”, “r”) as f:
data = f.read()
Use cases
Built for sensitive data
PII / PHIPatient records, identity documents, insurance data.
Print billingInvoices and billing data with regulatory storage requirements.
Data transferEncrypted payloads in transit between services.
Secure configDistributed configuration that shouldn’t live in plaintext.
AI pipelinesKeep sensitive training data or model outputs encrypted at rest.
Audit trailsTamper-resistant encrypted logs for compliance.
MIT licensed · Open to contributions
PRs and issues welcome. Encryption algorithm is configurable in future revisions.

