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.dev50.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.dev50-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev50.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

Hashes for swarmauri_signing_ed25519-0.2.0.dev50.tar.gz
Algorithm Hash digest
SHA256 53c168229518cd6793722f0f79e1114c3c7f8b98ce8027206edcdc50aa594ce9
MD5 68413a8826a2bcf3b7ef879f0ee71bdc
BLAKE2b-256 58c01cc59f3f3486ebcc6986641902f55dbc23bb203fb5c59aac705667dc4f35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev50-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

Hashes for swarmauri_signing_ed25519-0.2.0.dev50-py3-none-any.whl
Algorithm Hash digest
SHA256 0ede2d741f36bd425dbccfe225111910fc8e4e6071100c32eab1cb5a25b7aabe
MD5 b80339249e031cbb8279fb816cc98cc2
BLAKE2b-256 b2039260233c6f4bd4ec8e57c5109d0426a6e4742f936424933abd9da4fd397c

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