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.dev2.tar.gz (8.0 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.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_certs_composite-0.4.0.dev2.tar.gz
  • Upload date:
  • Size: 8.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_certs_composite-0.4.0.dev2.tar.gz
Algorithm Hash digest
SHA256 c86412f4ccf3a63aafb3de44d5b9a205b228cb96c4e3030bc66c720e1373f823
MD5 854629cf6ace3e261bf3d0fe67258b15
BLAKE2b-256 7d19fcfe472c94339288f4f7069aa2bb0a9c34794cbc63cbf1fd7f17aff9d64c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_certs_composite-0.4.0.dev2-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.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 301a20f282f2cac5e67524ff1edc59bc166aa95d45cfb5921fcd08e546fb9b7d
MD5 04b3d4038c5eb9bcd109c738498a990c
BLAKE2b-256 f910620459edb8d3d6d0392ad096db72a25172ee5237fe6c7e0032e0b328a0c7

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