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.dev4.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.dev4.tar.gz.

File metadata

  • Download URL: swarmauri_certs_composite-0.4.0.dev4.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.dev4.tar.gz
Algorithm Hash digest
SHA256 5875acfe365c6ca35c8ac5dd6ab6cd10974f1a1a5485c9d28287896cce38ff4f
MD5 3bc1ce43c3335b4ea88299d98fd157d1
BLAKE2b-256 b82581c128ec9973aa270d45f56ee46c18bc445f2fdacbf4a733edb7a0937757

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_certs_composite-0.4.0.dev4-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.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 cf14196abe3c47b20171cc8a1f36c66cc29ba208deb6d81e5fcca548980f9590
MD5 ca45a5a4cadd32d900faf6cf4a772ac5
BLAKE2b-256 413315e8325ed57a1edab5b07a3faba9dff25409f4f1694227585da3bbae4aac

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