Python bindings for the WED Rust crypto core
Project description
wedpy
wedpy is the Python package for the WED symmetric encryption protocol.
It is implemented as a native Python extension backed by the shared Rust core in crypto-core.
Install
From PyPI:
pip install wedpy
From this repository for local development:
python3 -m venv /tmp/wed-venv
source /tmp/wed-venv/bin/activate
python -m pip install pytest maturin
maturin develop --manifest-path crates/crypto-python/Cargo.toml
API
The package exports:
encrypt_text(passphrase, plaintext) -> strdecrypt_text(passphrase, token) -> strencrypt_json(passphrase, value) -> strdecrypt_json(passphrase, token) -> Any
Text example:
from wedpy import decrypt_text, encrypt_text
token = encrypt_text("shared-passphrase", "hello")
plaintext = decrypt_text("shared-passphrase", token)
JSON example:
from wedpy import decrypt_json, encrypt_json
token = encrypt_json("shared-passphrase", {"message": "hello"})
payload = decrypt_json("shared-passphrase", token)
Notes
encrypt_jsonuses Python'sjson.dumpswith compact separators.decrypt_jsonreturns the deserialized Python object.- Errors are surfaced as
ValueError.
Test
Run the package tests:
source /tmp/wed-venv/bin/activate
pytest crates/crypto-python/tests/test_crypto.py -q
Run the runnable example:
bash examples/python/run_example_test.sh
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 Distribution
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 wedpy-0.1.1.tar.gz.
File metadata
- Download URL: wedpy-0.1.1.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0fa24887437a922516e120ca34c33c82b7162bc5445781a5f1317ed36bb9703
|
|
| MD5 |
655444483135401901eb92379d7ae7f4
|
|
| BLAKE2b-256 |
df8ce0f21d87a893e9b14c08e423745728336b931b1826377894f3985299aac9
|
File details
Details for the file wedpy-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: wedpy-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 210.7 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
759df4ff99bd61f243e8efcb04a2bd4f142d9113c21c9614d561bdd01ae6cc5c
|
|
| MD5 |
4b13e91e6c366f7d5a5ca9a0b4afef62
|
|
| BLAKE2b-256 |
19df9caf0e57c20a27c63b7accfa9aafc8bc643e8e3b19a9015b87cd4aa9f8fc
|