Feature-routing certificate service for Swarmauri
Project description
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
ICertServiceimplementations 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.certsplugin namedCompositeCertService.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_certs_composite-0.3.0.dev33.tar.gz.
File metadata
- Download URL: swarmauri_certs_composite-0.3.0.dev33.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c341f96bf0c46c74df16deea3c2b69fce44d7369325f29f10d0f201d660018b4
|
|
| MD5 |
3ad3a4cec33712d0f50c764e837c7d6e
|
|
| BLAKE2b-256 |
540869e16562829454391b70831d2322b723ae4053e2618ea5ab4adc40ecceee
|
File details
Details for the file swarmauri_certs_composite-0.3.0.dev33-py3-none-any.whl.
File metadata
- Download URL: swarmauri_certs_composite-0.3.0.dev33-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b9bffd3ef070168254c24756e52c0c928dc9045914ce1f3e1c9e75b422257a8
|
|
| MD5 |
f2f565afc2c57178d0b66241ef09bf5a
|
|
| BLAKE2b-256 |
d4cfccbd6ff5a031bded319d751c0f23ab3a0c7032383027a2c88a62b676d18a
|