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


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.4.0.dev3.tar.gz (7.9 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.4.0.dev3.tar.gz.

File metadata

  • Download URL: swarmauri_certs_composite-0.4.0.dev3.tar.gz
  • Upload date:
  • Size: 7.9 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_certs_composite-0.4.0.dev3.tar.gz
Algorithm Hash digest
SHA256 36eab94375b0a4b798d0d755450777127df8bdc8159b2618048646de6ed011ce
MD5 f6fdb2ddcf226094ad9145a7cc7b799b
BLAKE2b-256 e9916065b4c17e23c60f86841b13ff3b70396d604a63a15274fc795e418f8759

See more details on using hashes here.

File details

Details for the file swarmauri_certs_composite-0.4.0.dev3-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_certs_composite-0.4.0.dev3-py3-none-any.whl
  • Upload date:
  • Size: 9.1 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_certs_composite-0.4.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 37930bb1fa2c1072b09dfbda50195b22096fd4c8ff0eef8d66c84119263b5c04
MD5 89474c7d7086f42a851efddf7bcea88f
BLAKE2b-256 cf07c6cf5863f1eeaebfd1402da1a812e68ef7e956586884fcc325caf59c04e3

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