Skip to main content

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) -> str
  • decrypt_text(passphrase, token) -> str
  • encrypt_json(passphrase, value) -> str
  • decrypt_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_json uses Python's json.dumps with compact separators.
  • decrypt_json returns 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wedpy-0.1.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wedpy-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (210.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Hashes for wedpy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a0fa24887437a922516e120ca34c33c82b7162bc5445781a5f1317ed36bb9703
MD5 655444483135401901eb92379d7ae7f4
BLAKE2b-256 df8ce0f21d87a893e9b14c08e423745728336b931b1826377894f3985299aac9

See more details on using hashes here.

File details

Details for the file wedpy-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for wedpy-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 759df4ff99bd61f243e8efcb04a2bd4f142d9113c21c9614d561bdd01ae6cc5c
MD5 4b13e91e6c366f7d5a5ca9a0b4afef62
BLAKE2b-256 19df9caf0e57c20a27c63b7accfa9aafc8bc643e8e3b19a9015b87cd4aa9f8fc

See more details on using hashes here.

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