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.3.0.dev39.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.3.0.dev39.tar.gz.

File metadata

  • Download URL: swarmauri_certs_composite-0.3.0.dev39.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.3.0.dev39.tar.gz
Algorithm Hash digest
SHA256 17555828df2a00889f3a26119be81db9f01bf2b1f2eeb19156813cf40a97999f
MD5 3a8d74e071f36ee7dd3e6e5843ac3f0f
BLAKE2b-256 bf1f13a0ec2d6642a24fb5e85afcf93ff10df07cd6711173317645bcabb029f5

See more details on using hashes here.

File details

Details for the file swarmauri_certs_composite-0.3.0.dev39-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_certs_composite-0.3.0.dev39-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.3.0.dev39-py3-none-any.whl
Algorithm Hash digest
SHA256 440fcf6e6fd5d6b0bd1c02442a8da743058fd252459be0b132f21f65d53d106f
MD5 2d48049487dc6a1d82df5fe3efa19f77
BLAKE2b-256 dc57a0ebd326317161578546862d61f32d4067aad5b36046f75b12b05ee956f7

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