Skip to main content

Feature-routing certificate service for Swarmauri

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_certs_composite Discord

Swarmauri Certs Composite

CompositeCertService is a lightweight router that coordinates multiple certificate providers behind a single facade. Configure it with the services you already have (self-signed, ACME, Vault, PKCS#11, etc.) and the composite chooses the right backend based on the feature you request.

Highlights

  • Compose any ICertService implementations into one entry point.
  • Route automatically by declared capability or override explicitly per call.
  • Inspect supported features at runtime to drive UI/UX decisions.
  • Ship as the default swarmauri.certs plugin named CompositeCertService.

Installation

Choose the tool that matches your workflow:

# pip
pip install swarmauri_certs_composite

# Poetry
poetry add swarmauri_certs_composite

# uv
uv add swarmauri_certs_composite

Quickstart

The composite accepts a sequence of certificate service implementations and routes each call to the first provider that advertises a matching capability. Below is a self-contained example that you can run with python quickstart.py.

import asyncio

from swarmauri_certs_composite import CompositeCertService
from swarmauri_base.certs.CertServiceBase import CertServiceBase


class SelfSignedOnly(CertServiceBase):
    def supports(self):
        return {"features": ("self_signed",)}

    async def create_self_signed(self, key, subject, **kw):
        return b"self-signed-cert"


class PrimaryCSR(CertServiceBase):
    def supports(self):
        return {"features": ("csr",)}

    async def create_csr(self, key, subject, **kw):
        return b"primary-csr"


class SecondaryCSR(CertServiceBase):
    def supports(self):
        return {"features": ("csr",)}

    async def create_csr(self, key, subject, **kw):
        return b"secondary-csr"


async def main():
    svc = CompositeCertService([SelfSignedOnly(), PrimaryCSR(), SecondaryCSR()])

    features = svc.supports()["features"]
    print("Advertised features:", sorted(features))

    cert = await svc.create_self_signed("key", {"CN": "example"})
    print("Self-signed cert:", cert)

    csr = await svc.create_csr("key", {"CN": "example"})
    print("CSR from primary provider:", csr)

    csr_override = await svc.create_csr(
        "key", {"CN": "example"}, opts={"backend": "SecondaryCSR"}
    )
    print("CSR via explicit backend override:", csr_override)


if __name__ == "__main__":
    asyncio.run(main())

supports() aggregates the advertised features of all child providers so callers can inspect available capabilities before invoking them. Passing opts={"backend": "ProviderType"} overrides the automatic routing when you need to target a specific provider.

For Contributors

If you want to contribute to swarmauri_certs_composite, please read our guidelines for contributing and style guide to get started.

License

swarmauri_certs_composite is licensed under the Apache License 2.0. See the LICENSE file for details.

Entry point

The provider is registered under the swarmauri.certs entry-point as CompositeCertService.

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_certs_composite-0.11.0.dev1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file swarmauri_certs_composite-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_certs_composite-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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_certs_composite-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 0e540e15b100e09091c31d448dafd1ac825d9175c9dd8779f75de456575af552
MD5 36424e78d317b06588bad776ef16f261
BLAKE2b-256 3e5af54fef5afa2a72e5875018fdee0f7f07a8f19f317dbbce1e88afd09a6104

See more details on using hashes here.

File details

Details for the file swarmauri_certs_composite-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_certs_composite-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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_certs_composite-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 82457cc24fb9a828c4f5fac503e98e20f268f5a393085340f6113fb4b5e6a76f
MD5 4d38f0dec23dc3645f1595851f1f1422
BLAKE2b-256 90758e4df45937208a1144cc8ae32959bdb0a25684ea9e168b4a27c5c99bfc25

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