Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_mre_crypto_age Discord

Swarmauri MRE Crypto Age

Age-based multi-recipient encryption provider implementing the IMreCrypto contract.

  • Sealed-per-recipient X25519 stanzas (mode="sealed_per_recipient" and recipient_alg="X25519-SEAL")
  • ChaCha20-Poly1305 payload encryption for each recipient header
  • Deterministic recipient identifiers via SHA-256 public key fingerprints
  • Rewrapping support for adding or removing recipients when provided the original plaintext or an opening identity

Installation

Choose the installer that matches your project workflow:

# pip
pip install swarmauri_mre_crypto_age

# Poetry
poetry add swarmauri_mre_crypto_age

# uv
uv add swarmauri_mre_crypto_age

Usage

The provider exposes asynchronous helpers for encrypting data to many recipients and decrypting it for a specific private key. The example below walks through a complete round trip.

  1. Create the crypto provider.
  2. Generate key pairs for two recipients.
  3. Encrypt a payload for both recipients.
  4. Decrypt the payload for one recipient.
from swarmauri_mre_crypto_age import AgeMreCrypto
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey

crypto = AgeMreCrypto()

# generate key pairs for each participant
sk1 = X25519PrivateKey.generate()
pk1 = sk1.public_key()
sk2 = X25519PrivateKey.generate()
pk2 = sk2.public_key()

recipients = [
    {"kind": "cryptography_obj", "obj": pk1},
    {"kind": "cryptography_obj", "obj": pk2},
]

env = await crypto.encrypt_for_many(recipients, b"secret")
pt = await crypto.open_for({"kind": "cryptography_obj", "obj": sk1}, env)
assert pt == b"secret"

The helper accepts multiple KeyRef formats, including dictionaries with kind="cryptography_obj" (for X25519PublicKey / X25519PrivateKey objects) and raw byte references such as kind="raw_x25519_pk" or kind="age_x25519_pk". When rewrapping an existing envelope to add recipients, pass the plaintext via opts["pt"] or provide an identity through opts["open_with"] so the payload can be resealed for the new recipients.

Entry point

The provider is registered under the swarmauri.mre_cryptos entry-point as AgeMreCrypto.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

Metadata

Release files for swarmauri_mre_crypto_age 0.11.0.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swarmauri_mre_crypto_age 0.11.0.dev1
File Size Uploaded
swarmauri_mre_crypto_age-0.11.0.dev1.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_mre_crypto_age 0.11.0.dev1
File Interpreter ABI Platform
swarmauri_mre_crypto_age-0.11.0.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / swarmauri_mre_crypto_age-0.11.0.dev1.tar.gz

Download URL swarmauri_mre_crypto_age-0.11.0.dev1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
47c970d13c61290de3fb504b59870845f18a40499d41d68ea12c2b459d887a00
BLAKE2b-256 checksum
How to use checksums
1dd2b0e238cc0eeca8267828acc31d0741868df62ba12f3631620269014d4fdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / swarmauri_mre_crypto_age-0.11.0.dev1-py3-none-any.whl

Download URL swarmauri_mre_crypto_age-0.11.0.dev1-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8c73a3314edd9d07b1a7966dda01d0338697cef8cb968930b2f0e9019474dba
BLAKE2b-256 checksum
How to use checksums
2e31de0f6ff83608695fd8fa2bc271668bdb8141c3a462791ccdbadf0158cd6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page