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

Uploaded Python 3

File details

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

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev46.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.dev46.tar.gz
Algorithm Hash digest
SHA256 5969bab9f71847222e280673ae8aa459e8b9304a8b6eba915cb834140ecc05cd
MD5 18af0cb1e7a2d6350eb59ba67b56693e
BLAKE2b-256 016914b294b0c6b3a1992faa7e86e7265d15878ed42b45fb3c4aff240c72b655

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_signing_ed25519-0.2.0.dev46-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.dev46-py3-none-any.whl
Algorithm Hash digest
SHA256 b973e425f22fe0199d7d638175ea2a78a6ee1a44d838eb0901989eb7b2f0bb4d
MD5 c6614ec9998e50bb13118cb63cb5aa1b
BLAKE2b-256 052fa18bca7181a250025279882d03bd268849cace8e54c26543c3897b374350

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