Skip to main content

Ed25519-based signer for Swarmauri

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_signing_ed25519


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 the cbor2 dependency.
  • 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 honours require={"min_signers": N} for quorum checks.
  • Ed25519 private keys can be supplied either as cryptography objects or raw seed bytes using the KeyRef helper structure from swarmauri_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} where seed is 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


Download files

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

Source Distribution

swarmauri_signing_ed25519-0.2.0.dev31.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_signing_ed25519-0.2.0.dev31-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_signing_ed25519-0.2.0.dev31.tar.gz.

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev31.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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

Hashes for swarmauri_signing_ed25519-0.2.0.dev31.tar.gz
Algorithm Hash digest
SHA256 c32cef963714ff27271e5f1efcdc781d2f2fba2d58ca939ed82773235b3ab009
MD5 df37822753c24e47f42e32937aa6b008
BLAKE2b-256 69337264c4bcf260049fc29da869afd52e3bc5671448f77107bf09a593bd8c28

See more details on using hashes here.

File details

Details for the file swarmauri_signing_ed25519-0.2.0.dev31-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev31-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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

Hashes for swarmauri_signing_ed25519-0.2.0.dev31-py3-none-any.whl
Algorithm Hash digest
SHA256 d423d976ae3a7a4591e385b124036c89272b2530662c076dc2535b4f4bb7bbeb
MD5 49c5b358d2625b64dba02a7102738420
BLAKE2b-256 066578fe7311320b3b2bed64cbad16a5f3f613b8cf7f6f0e82ed3ab64e66a447

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