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

Uploaded Python 3

File details

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

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev47.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.dev47.tar.gz
Algorithm Hash digest
SHA256 540485a9e51dc45177a273b5e5752c2ea085e065b491d48f2a9c9ea5adc24e57
MD5 bd62e3a33150844e9cf3d25667985503
BLAKE2b-256 9884fffe004ad79047c3f6d0e735fb37f19888eb132d5d979ff3c43e2096f6ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev47-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.dev47-py3-none-any.whl
Algorithm Hash digest
SHA256 a00d5986880583705cb8d43e272c6e489704c70d69f794f6f24c526733173b85
MD5 634a080702807bbfe62f14101427c404
BLAKE2b-256 862b244362a696a462e78cd81caa5c631ca9051ef88a5dba08036feefbd59e28

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