Ed25519-based signer for Swarmauri
Project description
Swarmauri Signing Ed25519
swarmauri_signing_ed25519 provides an Ed25519 implementation of the
ISigning interface for creating detached signatures over byte payloads and
canonicalized envelopes.
Features
- Deterministic JSON canonicalization is always available, ensuring stable digests for dictionary-based envelopes.
- Optional CBOR canonicalization can be enabled with the
[cbor]extra to install thecbor2dependency. - Detached signatures are produced with
cryptography's Ed25519 primitives and returned as sequences so multi-signature workflows remain possible. - Verification accepts multiple public keys via
opts["pubkeys"]and honoursrequire={"min_signers": N}for quorum checks. - Ed25519 private keys can be supplied either as cryptography objects or raw
seed bytes using the
KeyRefhelper structure fromswarmauri_core.
Installation
pip
pip install swarmauri_signing_ed25519
Poetry
poetry add swarmauri_signing_ed25519
uv
uv add swarmauri_signing_ed25519
Install with the [cbor] extra when CBOR canonicalization is required:
pip install "swarmauri_signing_ed25519[cbor]"
poetry add swarmauri_signing_ed25519[cbor]
uv add swarmauri_signing_ed25519[cbor]
Usage
The package exposes a single entry point, Ed25519EnvelopeSigner, implementing
ISigning. The signer reports JSON (and optionally CBOR) support via
supports(), canonicalizes envelopes through canonicalize_envelope, and
produces detached signatures using sign_bytes/sign_envelope. Verification
expects the relevant public keys to be supplied using opts["pubkeys"].
Key references
Ed25519EnvelopeSigner accepts Ed25519 private keys using KeyRef values. The
two supported forms are:
{"kind": "cryptography_obj", "obj": Ed25519PrivateKey}for in-memory cryptography objects.{"kind": "raw_ed25519_sk", "bytes": seed}whereseedis the 32-byte private key seed (or the 64-byte expanded secret key).
Example
The example below signs a JSON envelope and verifies the detached signature with the generated public key.
import asyncio
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from swarmauri_signing_ed25519 import Ed25519EnvelopeSigner
async def main() -> bool:
signer = Ed25519EnvelopeSigner()
private_key = Ed25519PrivateKey.generate()
key_ref = {"kind": "cryptography_obj", "obj": private_key}
envelope = {"subject": "alice", "scope": ["inbox:read"]}
signatures = await signer.sign_envelope(key_ref, envelope)
public_key = private_key.public_key()
verified = await signer.verify_envelope(
envelope,
signatures,
opts={"pubkeys": [public_key]},
)
return verified
verified = asyncio.run(main())
print(f"Signature verified? {verified}")
Entry Point
The signer registers under the swarmauri.signings entry point as
Ed25519EnvelopeSigner.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
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 swarmauri_signing_ed25519-0.2.0.dev45.tar.gz.
File metadata
- Download URL: swarmauri_signing_ed25519-0.2.0.dev45.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd24ebc2f95eb36b269ed0cf76f349031077e5d601ca586d80d8f9c762848f64
|
|
| MD5 |
c9f422151e7cb21bd1f82f728a8afb77
|
|
| BLAKE2b-256 |
1d959be5a7f07608b465e3dedcb41de4362db54cfc5ee4016aa7034f5a176042
|
File details
Details for the file swarmauri_signing_ed25519-0.2.0.dev45-py3-none-any.whl.
File metadata
- Download URL: swarmauri_signing_ed25519-0.2.0.dev45-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6be2e0e0bf898b29e0e796a6e8b43e8bdd737612a8c13321c5fac0acbe9572d3
|
|
| MD5 |
3e0224cb182c9ed019c41f7b6ea46817
|
|
| BLAKE2b-256 |
d2dc79e0a10647ad5e7c85e6561e5e1d59b8bb7263dab2876b7d3011a7b887d6
|