tiny-ca-gateway 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: tiny-ca-gateway
3
+ Version: 0.1.0
4
+ Summary: Framework-agnostic REST API routes for tiny-ca — supports FastAPI, Flask, aiohttp and Django Ninja
5
+ Author-email: Denis Shchutskyi <denisshchutskyi@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Shchusia/tiny-ca-gateway
8
+ Project-URL: Documentation, https://github.com/Shchusia/tiny-ca-gateway/blob/master/README.md
9
+ Project-URL: Bug Tracker, https://github.com/Shchusia/tiny-ca-gateway/issues
10
+ Project-URL: Changelog, https://github.com/Shchusia/tiny-ca-gateway/blob/master/CHANGELOG.md
11
+ Keywords: certificate-authority,pki,ca,tls,ssl,fastapi,flask,aiohttp,django,rest,api
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
19
+ Classifier: Topic :: Security :: Cryptography
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Framework :: FastAPI
22
+ Classifier: Framework :: Flask
23
+ Classifier: Framework :: Django
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.12
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: gunicorn>=26.0.0
29
+ Requires-Dist: pydantic>=2.13.3
30
+ Requires-Dist: pydantic-settings>=2.14.0
31
+ Requires-Dist: tiny-ca[async]>=0.2.0
32
+ Requires-Dist: aiofiles>=23.0.0
33
+ Requires-Dist: cryptography>=42.0.0
34
+ Provides-Extra: fastapi
35
+ Requires-Dist: fastapi>=0.136.1; extra == "fastapi"
36
+ Requires-Dist: uvicorn[standard]>=0.29.0; extra == "fastapi"
37
+ Provides-Extra: django
38
+ Requires-Dist: django>=6.0.5; extra == "django"
39
+ Requires-Dist: django-ninja>=1.6.2; extra == "django"
40
+ Provides-Extra: flask
41
+ Requires-Dist: flask>=3.1.3; extra == "flask"
42
+ Provides-Extra: aiohttp
43
+ Requires-Dist: aiohttp>=3.13.5; extra == "aiohttp"
44
+ Provides-Extra: all
45
+ Requires-Dist: fastapi>=0.136.1; extra == "all"
46
+ Requires-Dist: uvicorn[standard]>=0.29.0; extra == "all"
47
+ Requires-Dist: django>=6.0.5; extra == "all"
48
+ Requires-Dist: django-ninja>=1.6.2; extra == "all"
49
+ Requires-Dist: flask>=3.1.3; extra == "all"
50
+ Requires-Dist: aiohttp>=3.13.5; extra == "all"
51
+ Dynamic: license-file
52
+
53
+ # tiny-ca-gateway
54
+
55
+ [![PyPI](https://img.shields.io/pypi/v/tiny-ca-gateway)](https://pypi.org/project/tiny-ca-gateway/)
56
+ [![Python](https://img.shields.io/pypi/pyversions/tiny-ca-gateway)](https://pypi.org/project/tiny-ca-gateway/)
57
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
58
+
59
+ **tiny-ca-gateway** provides ready-to-use REST API routes for [tiny-ca](https://github.com/Shchusia/tiny_ca) — a lightweight Python Certificate Authority library. Mount a full-featured CA HTTP API into any of your existing applications in minutes.
60
+
61
+ > **Built on top of [tiny-ca](https://github.com/Shchusia/tiny_ca).** This package only provides the HTTP layer. For CA internals, certificate issuance logic, and database models, see the [tiny-ca documentation](https://github.com/Shchusia/tiny_ca).
62
+
63
+ ---
64
+
65
+ ## Features
66
+
67
+ - **22 REST endpoints** — issue, revoke, renew, rotate, verify, download certificates and more
68
+ - **4 framework adapters** — drop into an existing app without rewriting anything
69
+ - **Shared core** — identical behaviour across all frameworks; integration tests run against all of them
70
+ - **Bearer token auth** — optional, zero-config when `CA_API_TOKEN` is empty
71
+ - **OpenAPI / Swagger UI** — built-in for FastAPI & Django Ninja; CDN-based for Flask & aiohttp
72
+ - **Async-native** — FastAPI, aiohttp and Django (ASGI) run fully async; Flask uses an asyncio bridge
73
+
74
+ ---
75
+
76
+ ## Supported frameworks
77
+
78
+ | Framework | Adapter | Integration guide |
79
+ |-----------|---------|------------------|
80
+ | **FastAPI** | `tiny_ca_gateway.fastapi` | [docs/fastapi.md](docs/fastapi.md) |
81
+ | **Flask** | `tiny_ca_gateway.flask` | [docs/flask.md](docs/flask.md) |
82
+ | **aiohttp** | `tiny_ca_gateway.aiohttp` | [docs/aiohttp.md](docs/aiohttp.md) |
83
+ | **Django Ninja** | `tiny_ca_gateway.django` | [docs/django.md](docs/django.md) |
84
+
85
+ ---
86
+
87
+ ## Quick install
88
+
89
+ Install only what you need:
90
+
91
+ ```bash
92
+ # FastAPI
93
+ pip install "tiny-ca-gateway[fastapi]"
94
+
95
+ # Flask
96
+ pip install "tiny-ca-gateway[flask]"
97
+
98
+ # aiohttp
99
+ pip install "tiny-ca-gateway[aiohttp]"
100
+
101
+ # Django + Django Ninja
102
+ pip install "tiny-ca-gateway[django]"
103
+
104
+ # Everything
105
+ pip install "tiny-ca-gateway[all]"
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 60-second example
111
+
112
+ ### FastAPI
113
+
114
+ ```python
115
+ from fastapi import FastAPI
116
+ from contextlib import asynccontextmanager
117
+ from tiny_ca_gateway.fastapi.lifespan.manager import FastAPILifespanManager
118
+ from tiny_ca_gateway.fastapi.api.v1.ca_routes import router
119
+
120
+ @asynccontextmanager
121
+ async def lifespan(app: FastAPI):
122
+ await FastAPILifespanManager(common_name="My CA").on_startup()
123
+ yield
124
+
125
+ app = FastAPI(lifespan=lifespan)
126
+ app.include_router(router, prefix="/api/v1")
127
+ ```
128
+
129
+ ### Flask
130
+
131
+ ```python
132
+ from flask import Flask
133
+ from tiny_ca_gateway.flask.lifespan.manager import FlaskCAManager
134
+ from tiny_ca_gateway.flask.api.v1.ca_blueprint import ca_bp
135
+
136
+ def create_app():
137
+ app = Flask(__name__)
138
+ FlaskCAManager(common_name="My CA").init_sync()
139
+ app.register_blueprint(ca_bp, url_prefix="/api/v1/ca")
140
+ return app
141
+ ```
142
+
143
+ ### aiohttp
144
+
145
+ ```python
146
+ from aiohttp import web
147
+ from tiny_ca_gateway.aiohttp.lifespan.manager import AiohttpCAManager
148
+ from tiny_ca_gateway.aiohttp.api.v1.ca_routes import routes
149
+
150
+ async def lifespan(app):
151
+ await AiohttpCAManager(common_name="My CA").on_startup()
152
+ yield
153
+
154
+ app = web.Application()
155
+ app.cleanup_ctx.append(lifespan)
156
+ app.add_subapp("/api/v1/ca", web.Application())
157
+ app.router.add_routes(routes)
158
+ ```
159
+
160
+ ### Django Ninja
161
+
162
+ ```python
163
+ # urls.py
164
+ from ninja import NinjaAPI
165
+ from tiny_ca_gateway.django.api.v1.ca_router import ca_router
166
+
167
+ api = NinjaAPI()
168
+ api.add_router("/ca", ca_router)
169
+
170
+ urlpatterns = [path("api/v1/", api.urls)]
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Environment variables
176
+
177
+ | Variable | Default | Description |
178
+ |----------|---------|-------------|
179
+ | `CA_CERT_PATH` | `certs/ca.pem` | Path to the CA certificate |
180
+ | `CA_KEY_PATH` | `certs/ca.key` | Path to the CA private key |
181
+ | `CA_CRL_PATH` | `certs/crl.pem` | Path to the CRL file |
182
+ | `CA_CERTS_DIR` | `certs/` | Directory for issued certificates |
183
+ | `CA_DB_URL` | `sqlite+aiosqlite:///ca.db` | SQLAlchemy async database URL |
184
+ | `CA_API_TOKEN` | `""` | Bearer token — empty = open access |
185
+
186
+ ---
187
+
188
+ ## API reference
189
+
190
+ All adapters expose the same 22 endpoints under the configured prefix:
191
+
192
+ | Method | Path | Auth | Description |
193
+ |--------|------|------|-------------|
194
+ | `GET` | `/cert` | ✗ | Download CA public certificate |
195
+ | `GET` | `/crl` | ✗ | Download CRL (DER or `?pem=true`) |
196
+ | `GET` | `/` | ✓ | List certificates |
197
+ | `GET` | `/expiring` | ✓ | Certificates expiring soon |
198
+ | `POST` | `/root` | ✓ | Bootstrap / replace root CA |
199
+ | `POST` | `/intermediate` | ✓ | Issue intermediate CA |
200
+ | `POST` | `/issue` | ✓ | Issue leaf certificate |
201
+ | `POST` | `/maintenance/expire` | ✓ | Mark expired certificates |
202
+ | `POST` | `/crl/refresh` | ✓ | Regenerate CRL |
203
+ | `POST` | `/crl/verify` | ✓ | Verify a CRL |
204
+ | `POST` | `/verify` | ✓ | Verify a certificate |
205
+ | `POST` | `/cosign` | ✓ | Co-sign an external certificate |
206
+ | `POST` | `/export-p12/{serial}` | ✓ | Export PKCS#12 bundle |
207
+ | `PATCH` | `/revoke` | ✓ | Revoke a certificate |
208
+ | `POST` | `/rotate/{serial}` | ✓ | Rotate (new key) |
209
+ | `POST` | `/renew/{serial}` | ✓ | Renew (same key, new validity) |
210
+ | `DELETE` | `/{serial}` | ✓ | Hard-delete certificate |
211
+ | `GET` | `/status/{serial}` | ✓ | Lifecycle status |
212
+ | `GET` | `/inspect/{serial}` | ✓ | Structured details |
213
+ | `GET` | `/chain/{serial}` | ✓ | Full PEM chain |
214
+ | `GET` | `/stream/{uuid}` | ✓ | Stream artefact (pem / key / csr) |
215
+ | `GET` | `/{uuid}` | ✓ | Download artefact |
216
+
217
+ ---
218
+
219
+ ## Running the integration tests
220
+
221
+ ```bash
222
+ # Start any backend first, then:
223
+ python tests/ca_integration_test.py --base-url http://localhost:8000
224
+
225
+ # Run against all frameworks automatically:
226
+ task run-all-tests TOKEN=mysecret
227
+ ```
228
+
229
+ ---
230
+
231
+ ## License
232
+
233
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,29 @@
1
+ tiny_ca_gateway/db.py,sha256=lZ4YFu2Ei7mMcbSRsCV6DXVWfYh8lBykHCC9DGCoow4,1984
2
+ tiny_ca_gateway/models.py,sha256=RgFuJK0yrYtD1j2hsE-jcVSIOPJX2O0EK6BddvY-Bjs,2911
3
+ tiny_ca_gateway/openapi.py,sha256=zYuOBerAcqA4pvjVWc87r875eTKa5fjsszvgE9YauPk,18229
4
+ tiny_ca_gateway/aiohttp/api/v1/ca_routes.py,sha256=nVSX_e3P_NR05C0ccRcGMwrqBpQSsVK_EqppXSyNFZA,18651
5
+ tiny_ca_gateway/aiohttp/lifespan/manager.py,sha256=axNxwv1-Fbd8xDUdIWU1GQgKDvacEn_kL3wZyqMq1ZE,256
6
+ tiny_ca_gateway/core/__init__.py,sha256=lIbk0t8YVkcs2pnxdw97YkO9vUVvpDDjgx5SkjFSmUA,1567
7
+ tiny_ca_gateway/core/auth.py,sha256=XuTtK1Gntjo8R9xM0pNFQOmToqZBOfMQkt7Ec4RCrdY,631
8
+ tiny_ca_gateway/core/base_manager.py,sha256=wxv_XiY2fTiwyUlDohsd8uALqJs4mT7AmJB5Umh3Rco,5383
9
+ tiny_ca_gateway/core/helpers.py,sha256=_BhlJBUZLsZM8H8XhY3UdZ-cctESqmBvJXYR7ioHPTE,3742
10
+ tiny_ca_gateway/core/routes.py,sha256=zkz921O4rn8pk8lMuQFijMWiQrDmVKfQijOOJ1Eks6g,868
11
+ tiny_ca_gateway/core/schemas.py,sha256=0mjvssddoyXdHLzpJ6qTc44KwM-I4XitiSrwcFLJTLg,4507
12
+ tiny_ca_gateway/core/summary.py,sha256=SG42l6ecgrZPr3nCsyq6L8OpBxuOW0O4eyKoF5j-8S4,1233
13
+ tiny_ca_gateway/django/api/v1/ca_router.py,sha256=xZwRgIbXKFg5O1BWHPj3__hN68VryDPL1V_deWRYA_Y,19143
14
+ tiny_ca_gateway/django/lifespan/manager.py,sha256=ahFwYC9Qqnu6XyXi-cxV-Hj4P5wmn4y5k6jKzG47cJM,139
15
+ tiny_ca_gateway/fastapi/api/v1/__init__.py,sha256=d2WCFBVl291z2qmpANoutgaxMlCZfP7eSWccklgikmw,43
16
+ tiny_ca_gateway/fastapi/api/v1/ca_routes.py,sha256=qsaep-Z7pBPUi9iSRgP9b59N6M1Q7DMd0ZXomhZ_Ycg,18621
17
+ tiny_ca_gateway/fastapi/api/v1/utils.py,sha256=JTFKurgtpsxSUQ9RAaU9q6faU1YUV0Yt9LZkDgEGfTU,2811
18
+ tiny_ca_gateway/fastapi/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ tiny_ca_gateway/fastapi/auth/verify.py,sha256=UofOmt1K2A0wIb-ndGD680PnJiylqfF-C2UON_em2sA,1848
20
+ tiny_ca_gateway/fastapi/lifespan/__init__.py,sha256=49vRUSo_vF3rIBfIZL4pCDSCzIIBoPRBl8pPNG4uThg,82
21
+ tiny_ca_gateway/fastapi/lifespan/manager.py,sha256=wjcgEaMxtwajRU2iOlM7UcdoPZa6qtsqd2ZVhqvOC58,168
22
+ tiny_ca_gateway/flask/api/v1/ca_blueprint.py,sha256=NOgsBoiRQ8-0gYDIPFWYR7_CgfSudDAN0O1tMFMBzQU,20522
23
+ tiny_ca_gateway/flask/lifespan/manager.py,sha256=zB7dd2Sov0aZECYlLi7jkWhxY5qQ9cfHnbFV5pDpyMs,129
24
+ tiny_ca_gateway/utils/singleton.py,sha256=U17sIw4oXT5rVYqz0dC4gbIu0hPGU6Lyg_VyqTDdELg,724
25
+ tiny_ca_gateway-0.1.0.dist-info/licenses/LICENSE,sha256=RGm3PdoD3Sw_w98TQD5lKNlhgGDIrtS91SJ9HuS6f-8,2365
26
+ tiny_ca_gateway-0.1.0.dist-info/METADATA,sha256=iYnukmiIGPloQCup4K3pas5ML4QMtQUIvhdHETRBHwE,8128
27
+ tiny_ca_gateway-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
28
+ tiny_ca_gateway-0.1.0.dist-info/top_level.txt,sha256=uFx57SlqSGYCT0aJL2CK0N1erZVw9qXa-EyQ1b17v1A,16
29
+ tiny_ca_gateway-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,54 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Denis Shchutskyi (Shchusia)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ## Dependency Notice
26
+
27
+ This package is built on top of **tiny-ca** by Denis Shchutskyi (Shchusia),
28
+ also distributed under the MIT License.
29
+ See: https://github.com/Shchusia/tiny_ca
30
+
31
+ ---
32
+
33
+ ## Third-Party Licenses
34
+
35
+ This software uses the following open source dependencies:
36
+
37
+ ### Core
38
+ - **tiny-ca** (MIT) - https://github.com/Shchusia/tiny_ca
39
+ - **cryptography** (BSD 3-Clause) - https://github.com/pyca/cryptography
40
+ - **SQLAlchemy** (MIT) - https://github.com/sqlalchemy/sqlalchemy
41
+ - **Pydantic** (MIT) - https://github.com/pydantic/pydantic
42
+ - **aiosqlite** (MIT) - https://github.com/omnilib/aiosqlite
43
+ - **aiofiles** (Apache 2.0) - https://github.com/Tinche/aiofiles
44
+
45
+ ### Optional framework dependencies
46
+ - **FastAPI** (MIT) - https://github.com/tiangolo/fastapi
47
+ - **Starlette** (BSD 3-Clause) - https://github.com/encode/starlette
48
+ - **Uvicorn** (BSD 3-Clause) - https://github.com/encode/uvicorn
49
+ - **Flask** (BSD 3-Clause) - https://github.com/pallets/flask
50
+ - **Werkzeug** (BSD 3-Clause) - https://github.com/pallets/werkzeug
51
+ - **aiohttp** (Apache 2.0) - https://github.com/aio-libs/aiohttp
52
+ - **Django** (BSD 3-Clause) - https://github.com/django/django
53
+ - **django-ninja** (MIT) - https://github.com/vitalik/django-ninja
54
+ - **Gunicorn** (MIT) - https://github.com/benoitc/gunicorn
@@ -0,0 +1 @@
1
+ tiny_ca_gateway