Swarmauri ACME Certificate Service
Community plugin providing an ACME (RFC 8555) certificate service built on top of Swarmauri's certificate interfaces.
Features
- Implements
AcmeCertService, a drop-inCertServiceBasecompatible class for Swarmauri workflows. - Supports ACME directory discovery, order creation, finalization, and full chain retrieval.
- Handles RSA and EC key material while exposing capability metadata through
supports(). - Convenience helpers for certificate verification and parsing using
cryptographyprimitives.
Prerequisites
- Python 3.10 or newer.
- Existing ACME account key material (PEM encoded) accessible to your Swarmauri runtime.
- Network access to your chosen ACME directory (defaults to Let's Encrypt production).
- DNS or HTTP challenge automation handled externally; this service focuses on CSR submission and certificate retrieval.
Installation
# pip
pip install swarmauri_certs_acme
# poetry
poetry add swarmauri_certs_acme
# uv (pyproject-based projects)
uv add swarmauri_certs_acme
Quickstart
The snippet below submits a CSR to Let's Encrypt using AcmeCertService and persists the resulting PEM chain.
import asyncio
from pathlib import Path
from swarmauri_certs_acme import AcmeCertService
from swarmauri_core.crypto.types import KeyRef
async def main() -> None:
account_key = KeyRef(material=Path("account-key.pem").read_bytes())
service = AcmeCertService(
account_key=account_key,
contact_emails=["admin@example.com"],
)
csr_bytes = Path("server.csr").read_bytes()
certificate_chain = await service.sign_cert(
csr=csr_bytes,
ca_key=account_key, # required by the CertService interface
)
Path("server-fullchain.pem").write_bytes(certificate_chain)
print("Certificate chain written to server-fullchain.pem")
if __name__ == "__main__":
asyncio.run(main())
CSR Generation Example
AcmeCertService can construct a CSR when provided with private key material and subject metadata:
import asyncio
from pathlib import Path
from swarmauri_certs_acme import AcmeCertService
from swarmauri_core.crypto.types import KeyRef
async def build_csr() -> None:
account_key = KeyRef(material=Path("account-key.pem").read_bytes())
host_key = KeyRef(material=Path("server-key.pem").read_bytes())
service = AcmeCertService(account_key=account_key)
csr_bytes = await service.create_csr(
key=host_key,
subject={"CN": "example.com"},
san={"dns": ["example.com", "www.example.com"]},
)
Path("server.csr").write_bytes(csr_bytes)
if __name__ == "__main__":
asyncio.run(build_csr())
Verification and Parsing
Use the built-in helpers to inspect returned certificates before deployment:
import asyncio
from pathlib import Path
from swarmauri_certs_acme import AcmeCertService
from swarmauri_core.crypto.types import KeyRef
async def inspect() -> None:
account_key = KeyRef(material=Path("account-key.pem").read_bytes())
service = AcmeCertService(account_key=account_key)
pem_chain = Path("server-fullchain.pem").read_bytes()
info = await service.verify_cert(pem_chain)
print("Issuer:", info["issuer"])
print("Valid until:", info["not_after"])
metadata = await service.parse_cert(pem_chain)
print(metadata)
if __name__ == "__main__":
asyncio.run(inspect())
Best Practices
- Rotate account keys periodically and store them in a secure vault (
KeyRefworks with external KMS integrations). - When using Let's Encrypt production, respect rate limits and consider staging endpoints during development.
- Automate DNS/HTTP challenges upstream; this service assumes the order is ready for finalization once the CSR is submitted.
- Cache successful certificate chains and perform proactive renewals before
not_afterto avoid downtime.
Metadata
Release files for swarmauri_certs_acme 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_certs_acme-0.3.3.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_certs_acme-0.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.5 kB
Release files / swarmauri_certs_acme-0.3.3.tar.gz
| Download URL | swarmauri_certs_acme-0.3.3.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa5414624d28c33dde1007476936a2491dda16afbc62e1181ac9da3180dd682e
|
|
BLAKE2b-256 checksum How to use checksums |
2378476e3b011a9dc6c612bf16963d20b26c50528a379bf9d0cbcbb813600596
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / swarmauri_certs_acme-0.3.3-py3-none-any.whl
| Download URL | swarmauri_certs_acme-0.3.3-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
713d23eafe8afc36794f5bbaa4b5e1341074fd765659dc890b03531d096cafd8
|
|
BLAKE2b-256 checksum How to use checksums |
1808ceb6bc18d987ba53b0734e7c3c3dfcd65b7baa5a4a7136c2ba3c3933b41e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|