Crypted Mail
Crypted Mail is a Python library for encrypting text with a shared passphrase and sending the encrypted payload through Gmail from scripts or Jupyter notebooks.
Install
pip install crypted-mail
Quick Start
from crypted_mail import CryptedMailClient
client = CryptedMailClient()
# Run once to open the Google OAuth browser flow.
credentials_json = client.connect_gmail_oauth("client_secret.json")
payload = client.encrypt_with_passphrase(
plaintext="hello secure world",
passphrase="correct horse battery staple",
sender_hint="alice@example.com",
note="Use the passphrase we agreed on by phone.",
)
message_id = client.send_encrypted_email(
sender="alice@example.com",
recipient_email="bob@example.com",
subject="Encrypted message",
armored_payload=payload,
credentials_or_token=credentials_json,
)
print(message_id)
Reuse Saved Credentials
from crypted_mail import CryptedMailClient
client = CryptedMailClient()
with open("gmail-token.json", "r", encoding="utf-8") as handle:
credentials_json = handle.read()
plaintext = client.decrypt_with_passphrase(
armored_text="cm1:...",
passphrase="correct horse battery staple",
)
connect_gmail_oauth() returns serialized credentials JSON so you can store it wherever your notebook or script prefers.
Development
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -U pip build twine
pip install -e .[dev]
pytest
python -m build
python -m twine check dist/*
Publish To PyPI
python -m twine upload --repository testpypi dist/*
python -m twine upload dist/*
After publishing, create a fresh virtual environment, install the package from PyPI, and run the Quick Start example as a smoke test.
Metadata
Release files for crypted-mail 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crypted_mail-0.1.0.tar.gz | 8.6 kB | Without provenance | Details for crypted_mail-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crypted_mail-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for crypted_mail-0.1.0-py3-none-any.whl |
Total release size: 16.6 kB
Release files / crypted_mail-0.1.0.tar.gz
| Download URL | crypted_mail-0.1.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc741e9c166d9b745114337764798432d5d0b5b11a8d47a28c8e49d854bbb488
|
|
BLAKE2b-256 checksum How to use checksums |
ac09d31264f0639d9ec029f7698fae58f002cfa095787ae4d036655d6711bbea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / crypted_mail-0.1.0-py3-none-any.whl
| Download URL | crypted_mail-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bff61b901ee46409f813d22d2b38cf2dc81293b0983f74aa2a5eb6a6a0b724f1
|
|
BLAKE2b-256 checksum How to use checksums |
89d73ccf3cabde57d5fab48b35b4185d515374ef95893eeefbfc5faffea187c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for crypted-mail 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.