swarmauri_keyprovider_ssh 0.3.0.dev45__tar.gz → 0.11.0__tar.gz
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.
- swarmauri_keyprovider_ssh-0.11.0/NOTICE +7 -0
- swarmauri_keyprovider_ssh-0.11.0/PKG-INFO +418 -0
- swarmauri_keyprovider_ssh-0.11.0/README.md +389 -0
- {swarmauri_keyprovider_ssh-0.3.0.dev45 → swarmauri_keyprovider_ssh-0.11.0}/pyproject.toml +57 -7
- {swarmauri_keyprovider_ssh-0.3.0.dev45 → swarmauri_keyprovider_ssh-0.11.0}/swarmauri_keyprovider_ssh/SshKeyProvider.py +52 -13
- swarmauri_keyprovider_ssh-0.3.0.dev45/PKG-INFO +0 -130
- swarmauri_keyprovider_ssh-0.3.0.dev45/README.md +0 -103
- {swarmauri_keyprovider_ssh-0.3.0.dev45 → swarmauri_keyprovider_ssh-0.11.0}/LICENSE +0 -0
- {swarmauri_keyprovider_ssh-0.3.0.dev45 → swarmauri_keyprovider_ssh-0.11.0}/swarmauri_keyprovider_ssh/__init__.py +0 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_keyprovider_ssh
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: SSH-based key provider for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: swarmauri,sdk,standards,keyprovider,ssh,key-management
|
|
9
|
+
Author: Jacob Stewart
|
|
10
|
+
Author-email: jacob@swarmauri.com
|
|
11
|
+
Requires-Python: >=3.10,<3.15
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Topic :: Security :: Cryptography
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Requires-Dist: cryptography
|
|
25
|
+
Requires-Dist: swarmauri_base
|
|
26
|
+
Requires-Dist: swarmauri_core
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# swarmauri_keyprovider_ssh
|
|
30
|
+
|
|
31
|
+
<!-- readme-standards:begin branding -->
|
|
32
|
+
<p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
|
|
33
|
+
<p align="center"><strong>swarmauri_keyprovider_ssh</strong></p>
|
|
34
|
+
<p align="center">SSH-based key provider for Swarmauri</p>
|
|
35
|
+
<p align="center">
|
|
36
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img alt="pypi: swarmauri_keyprovider_ssh" src="https://img.shields.io/pypi/v/swarmauri_keyprovider_ssh?labelColor=1E293B&color=1D4ED8"></a>
|
|
37
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&message=0.11.0&labelColor=1E293B&color=4338CA"></a>
|
|
38
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml"><img alt="Python: >=3.10,<3.15" src="https://img.shields.io/static/v1?label=Python&message=%3E%3D3.10%2C%3C3.15&labelColor=1E293B&color=0F766E"></a>
|
|
39
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&message=standards&labelColor=1E293B&color=6D28D9"></a>
|
|
40
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&message=active&labelColor=1E293B&color=166534"></a>
|
|
41
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&labelColor=1E293B&color=86198F"></a>
|
|
42
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
43
|
+
</p>
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img alt="Monthly PyPI downloads: swarmauri_keyprovider_ssh" src="https://img.shields.io/pypi/dm/swarmauri_keyprovider_ssh?labelColor=1E293B&color=0E7490"></a>
|
|
46
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md"><img alt="README hits: swarmauri_keyprovider_ssh" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
47
|
+
</p>
|
|
48
|
+
<p align="center">
|
|
49
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&message=CI%20gate&labelColor=1E293B&color=1D4ED8"></a>
|
|
50
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&message=example%20source&labelColor=1E293B&color=0F766E"></a>
|
|
51
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&message=not%20certified&labelColor=1E293B&color=92400E"></a>
|
|
52
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&message=repository%20policy&labelColor=1E293B&color=4338CA"></a>
|
|
53
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&message=source%20and%20CI&labelColor=1E293B&color=6D28D9"></a>
|
|
54
|
+
</p>
|
|
55
|
+
<p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
|
|
56
|
+
<!-- readme-standards:end branding -->
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Overview
|
|
61
|
+
|
|
62
|
+
### Summary
|
|
63
|
+
|
|
64
|
+
An asynchronous `KeyProviderBase` implementation that keeps SSH key material in
|
|
65
|
+
memory and bridges it to Swarmauri's signing abstractions.
|
|
66
|
+
|
|
67
|
+
### Why This Package
|
|
68
|
+
|
|
69
|
+
`swarmauri_keyprovider_ssh` isolates this responsibility: SSH-based key provider for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) exposes `SshKeyProvider`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
|
|
70
|
+
|
|
71
|
+
### When to Use
|
|
72
|
+
|
|
73
|
+
Choose `swarmauri_keyprovider_ssh` when your integration needs sSH-based key provider for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
74
|
+
|
|
75
|
+
### Features
|
|
76
|
+
|
|
77
|
+
- Generate new Ed25519, RSA-PSS (SHA-256), or ECDSA P-256 key pairs on demand.
|
|
78
|
+
- Import existing private keys (PEM) or public keys (OpenSSH) while respecting
|
|
79
|
+
each key's `ExportPolicy`.
|
|
80
|
+
- Rotate keys, enumerate versions, and optionally destroy specific versions or
|
|
81
|
+
entire key identifiers.
|
|
82
|
+
- Export public keys as RFC 7517-compliant JWKs/JWKS with OpenSSH fingerprints
|
|
83
|
+
embedded in the `tags` metadata.
|
|
84
|
+
- Produce random bytes and derive keying material using the HKDF construction
|
|
85
|
+
(RFC 5869).
|
|
86
|
+
|
|
87
|
+
### Non-Goals
|
|
88
|
+
|
|
89
|
+
`swarmauri_keyprovider_ssh` owns sSH-based key provider for Swarmauri. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Getting Started
|
|
94
|
+
|
|
95
|
+
### Prerequisites
|
|
96
|
+
|
|
97
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `cryptography`. Read the example’s inputs and service requirements before execution.
|
|
98
|
+
|
|
99
|
+
### Installation
|
|
100
|
+
|
|
101
|
+
Choose the tool that matches your workflow:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# pip
|
|
105
|
+
pip install swarmauri_keyprovider_ssh
|
|
106
|
+
|
|
107
|
+
# Poetry
|
|
108
|
+
poetry add swarmauri_keyprovider_ssh
|
|
109
|
+
|
|
110
|
+
# uv
|
|
111
|
+
uv add swarmauri_keyprovider_ssh
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### uv
|
|
115
|
+
|
|
116
|
+
<!-- readme-standards:begin installation.uv -->
|
|
117
|
+
```bash
|
|
118
|
+
uv add swarmauri_keyprovider_ssh
|
|
119
|
+
```
|
|
120
|
+
<!-- readme-standards:end installation.uv -->
|
|
121
|
+
|
|
122
|
+
#### pip
|
|
123
|
+
|
|
124
|
+
<!-- readme-standards:begin installation.pip -->
|
|
125
|
+
```bash
|
|
126
|
+
python -m pip install swarmauri_keyprovider_ssh
|
|
127
|
+
```
|
|
128
|
+
<!-- readme-standards:end installation.pip -->
|
|
129
|
+
|
|
130
|
+
#### Poetry
|
|
131
|
+
|
|
132
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
133
|
+
```bash
|
|
134
|
+
poetry add swarmauri_keyprovider_ssh
|
|
135
|
+
```
|
|
136
|
+
<!-- readme-standards:end installation.poetry -->
|
|
137
|
+
|
|
138
|
+
### Quick Start
|
|
139
|
+
|
|
140
|
+
#### Example
|
|
141
|
+
|
|
142
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
143
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/docs/readme/quick_start.py).
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
import asyncio
|
|
147
|
+
from swarmauri_keyprovider_ssh import SshKeyProvider
|
|
148
|
+
from swarmauri_core.key_providers.types import (
|
|
149
|
+
KeySpec,
|
|
150
|
+
KeyAlg,
|
|
151
|
+
KeyClass,
|
|
152
|
+
ExportPolicy,
|
|
153
|
+
KeyUse,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
async def main() -> None:
|
|
158
|
+
provider = SshKeyProvider()
|
|
159
|
+
spec = KeySpec(
|
|
160
|
+
klass=KeyClass.asymmetric,
|
|
161
|
+
alg=KeyAlg.ED25519,
|
|
162
|
+
uses=(KeyUse.SIGN, KeyUse.VERIFY),
|
|
163
|
+
export_policy=ExportPolicy.PUBLIC_ONLY,
|
|
164
|
+
)
|
|
165
|
+
ref = await provider.create_key(spec)
|
|
166
|
+
jwk = await provider.get_public_jwk(ref.kid)
|
|
167
|
+
print(jwk)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
asyncio.run(main())
|
|
171
|
+
```
|
|
172
|
+
<!-- readme-standards:end example.quick-start -->
|
|
173
|
+
|
|
174
|
+
#### Expected Result
|
|
175
|
+
|
|
176
|
+
The example demonstrates the documented `swarmauri_keyprovider_ssh` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Usage
|
|
181
|
+
|
|
182
|
+
### Common Workflows
|
|
183
|
+
|
|
184
|
+
<!-- readme-standards:begin example.usage -->
|
|
185
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/docs/readme/usage.py).
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
import asyncio
|
|
189
|
+
from swarmauri_keyprovider_ssh import SshKeyProvider
|
|
190
|
+
from swarmauri_core.key_providers.types import (
|
|
191
|
+
KeySpec,
|
|
192
|
+
KeyAlg,
|
|
193
|
+
KeyClass,
|
|
194
|
+
ExportPolicy,
|
|
195
|
+
KeyUse,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
async def main() -> None:
|
|
200
|
+
provider = SshKeyProvider()
|
|
201
|
+
spec = KeySpec(
|
|
202
|
+
klass=KeyClass.asymmetric,
|
|
203
|
+
alg=KeyAlg.ED25519,
|
|
204
|
+
uses=(KeyUse.SIGN, KeyUse.VERIFY),
|
|
205
|
+
export_policy=ExportPolicy.PUBLIC_ONLY,
|
|
206
|
+
)
|
|
207
|
+
ref = await provider.create_key(spec)
|
|
208
|
+
jwk = await provider.get_public_jwk(ref.kid)
|
|
209
|
+
print(jwk)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
asyncio.run(main())
|
|
213
|
+
```
|
|
214
|
+
<!-- readme-standards:end example.usage -->
|
|
215
|
+
|
|
216
|
+
The provider exposes an asynchronous interface for creating and managing
|
|
217
|
+
SSH-based signing keys. The snippet below creates a new Ed25519 key and
|
|
218
|
+
exports its public component as a JSON Web Key (JWK):
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
Keys can also be rotated, and the provider will track key versions:
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
ref = await provider.create_key(spec)
|
|
225
|
+
await provider.rotate_key(ref.kid)
|
|
226
|
+
assert await provider.list_versions(ref.kid) == (1, 2)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Use `destroy_key()` to remove an entire key identifier or just a single
|
|
230
|
+
version, and `jwks(prefix_kids=...)` when you need to emit a filtered JWKS for
|
|
231
|
+
downstream consumers.
|
|
232
|
+
|
|
233
|
+
Existing keys can be imported from PEM or OpenSSH data and exposed via JWKS:
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
from pathlib import Path
|
|
237
|
+
|
|
238
|
+
pem = Path("id_ed25519").read_bytes()
|
|
239
|
+
ref = await provider.import_key(spec, pem)
|
|
240
|
+
jwks = await provider.jwks()
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Configuration
|
|
244
|
+
|
|
245
|
+
Configure `swarmauri_keyprovider_ssh` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
246
|
+
|
|
247
|
+
### Error Handling
|
|
248
|
+
|
|
249
|
+
The inspected `swarmauri_keyprovider_ssh` source raises `KeyError`, `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
250
|
+
|
|
251
|
+
### Best Practices
|
|
252
|
+
|
|
253
|
+
Use the explicit `swarmauri_keyprovider_ssh` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `SshKeyProvider`; an import or successful installation alone does not establish its runtime guarantees.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Package Boundary
|
|
258
|
+
|
|
259
|
+
### What It Owns
|
|
260
|
+
|
|
261
|
+
`swarmauri_keyprovider_ssh` is located in `standards` and owns sSH-based key provider for Swarmauri. Source-declared APIs include `SshKeyProvider`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) records its direct dependency boundary.
|
|
262
|
+
|
|
263
|
+
### Public API and Import Surfaces
|
|
264
|
+
|
|
265
|
+
Import namespace: `swarmauri_keyprovider_ssh`.
|
|
266
|
+
|
|
267
|
+
Source-declared exports or types: `SshKeyProvider`.
|
|
268
|
+
|
|
269
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
270
|
+
|
|
271
|
+
### Entry Points
|
|
272
|
+
|
|
273
|
+
<!-- readme-standards:begin entry-points -->
|
|
274
|
+
- `peagen.plugins.key_providers` → `ssh` → `swarmauri_keyprovider_ssh.SshKeyProvider:SshKeyProvider`
|
|
275
|
+
- `swarmauri.key_providers` → `SshKeyProvider` → `swarmauri_keyprovider_ssh.SshKeyProvider:SshKeyProvider`
|
|
276
|
+
<!-- readme-standards:end entry-points -->
|
|
277
|
+
|
|
278
|
+
### Injected Dependencies
|
|
279
|
+
|
|
280
|
+
The direct installation dependencies of `swarmauri_keyprovider_ssh` are `swarmauri-core`, `swarmauri-base`, `cryptography`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py).
|
|
281
|
+
|
|
282
|
+
### Protocol Consumers
|
|
283
|
+
|
|
284
|
+
No direct package-manifest dependency on `swarmauri_keyprovider_ssh` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
|
|
285
|
+
|
|
286
|
+
### Extensions
|
|
287
|
+
|
|
288
|
+
For `swarmauri_keyprovider_ssh`, use the source-declared public interfaces (`SshKeyProvider`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Operations and Readiness
|
|
293
|
+
|
|
294
|
+
### Operational Requirements
|
|
295
|
+
|
|
296
|
+
Operate `swarmauri_keyprovider_ssh` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
297
|
+
|
|
298
|
+
### Health and Observability
|
|
299
|
+
|
|
300
|
+
This README does not establish a standalone health endpoint for `swarmauri_keyprovider_ssh`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
|
|
301
|
+
|
|
302
|
+
### Security and Resource Limits
|
|
303
|
+
|
|
304
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py). The `swarmauri_keyprovider_ssh` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
305
|
+
|
|
306
|
+
### Compatibility
|
|
307
|
+
|
|
308
|
+
This source version of `swarmauri_keyprovider_ssh` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Verification
|
|
313
|
+
|
|
314
|
+
### Tests
|
|
315
|
+
|
|
316
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_keyprovider_ssh` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
317
|
+
|
|
318
|
+
- [tests/functional/test_ssh_provider_functional.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/functional/test_ssh_provider_functional.py)
|
|
319
|
+
- [tests/perf/test_ssh_provider_perf.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/perf/test_ssh_provider_perf.py)
|
|
320
|
+
- [tests/unit/test_readme_examples.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_readme_examples.py)
|
|
321
|
+
- [tests/unit/test_rfc5869_hkdf.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_rfc5869_hkdf.py)
|
|
322
|
+
- [tests/unit/test_rfc7517_jwk.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_rfc7517_jwk.py)
|
|
323
|
+
|
|
324
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
325
|
+
|
|
326
|
+
### Certification Status
|
|
327
|
+
|
|
328
|
+
No external certification is asserted for `swarmauri_keyprovider_ssh` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
329
|
+
|
|
330
|
+
### Evidence
|
|
331
|
+
|
|
332
|
+
The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## FAQ
|
|
337
|
+
|
|
338
|
+
### Why
|
|
339
|
+
|
|
340
|
+
**Why select this package?** `swarmauri_keyprovider_ssh` provides sSH-based key provider for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
341
|
+
|
|
342
|
+
### How
|
|
343
|
+
|
|
344
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_keyprovider_ssh`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) for the exact types and signatures involved.
|
|
345
|
+
|
|
346
|
+
### When
|
|
347
|
+
|
|
348
|
+
**When should I validate an upgrade?** Recheck `swarmauri_keyprovider_ssh` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Documentation and Related Packages
|
|
353
|
+
|
|
354
|
+
### More Documentation
|
|
355
|
+
|
|
356
|
+
The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) provide the supporting context for `swarmauri_keyprovider_ssh`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
357
|
+
|
|
358
|
+
### Related Packages
|
|
359
|
+
|
|
360
|
+
- [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
|
|
361
|
+
- [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
|
|
362
|
+
|
|
363
|
+
### Project Links
|
|
364
|
+
|
|
365
|
+
<!-- readme-standards:begin project-links -->
|
|
366
|
+
- [pypi: swarmauri_keyprovider_ssh](https://pypi.org/project/swarmauri_keyprovider_ssh/)
|
|
367
|
+
<!-- readme-standards:end project-links -->
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Contributing
|
|
372
|
+
|
|
373
|
+
### How to Contribute
|
|
374
|
+
|
|
375
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
376
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
377
|
+
that will help you get started.
|
|
378
|
+
|
|
379
|
+
### Development Setup
|
|
380
|
+
|
|
381
|
+
Work from the `pkgs/40-standards/swarmauri_keyprovider_ssh` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
|
|
382
|
+
|
|
383
|
+
### Notes for Maintainers
|
|
384
|
+
|
|
385
|
+
Edit authored prose directly in this `swarmauri_keyprovider_ssh` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Governance
|
|
390
|
+
|
|
391
|
+
### Ownership and Decision Making
|
|
392
|
+
|
|
393
|
+
Changes to `swarmauri_keyprovider_ssh` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
394
|
+
|
|
395
|
+
### Standards and Policies
|
|
396
|
+
|
|
397
|
+
`swarmauri_keyprovider_ssh` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
|
|
398
|
+
|
|
399
|
+
### Lifecycle and Migration
|
|
400
|
+
|
|
401
|
+
The `swarmauri_keyprovider_ssh` source version is `0.11.0`.
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## License and Attribution
|
|
406
|
+
|
|
407
|
+
### License
|
|
408
|
+
|
|
409
|
+
<!-- readme-standards:begin license -->
|
|
410
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/LICENSE).
|
|
411
|
+
<!-- readme-standards:end license -->
|
|
412
|
+
|
|
413
|
+
### Notices
|
|
414
|
+
|
|
415
|
+
<!-- readme-standards:begin notices -->
|
|
416
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/NOTICE) for attribution.
|
|
417
|
+
<!-- readme-standards:end notices -->
|
|
418
|
+
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# swarmauri_keyprovider_ssh
|
|
2
|
+
|
|
3
|
+
<!-- readme-standards:begin branding -->
|
|
4
|
+
<p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
|
|
5
|
+
<p align="center"><strong>swarmauri_keyprovider_ssh</strong></p>
|
|
6
|
+
<p align="center">SSH-based key provider for Swarmauri</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img alt="pypi: swarmauri_keyprovider_ssh" src="https://img.shields.io/pypi/v/swarmauri_keyprovider_ssh?labelColor=1E293B&color=1D4ED8"></a>
|
|
9
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&message=0.11.0&labelColor=1E293B&color=4338CA"></a>
|
|
10
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml"><img alt="Python: >=3.10,<3.15" src="https://img.shields.io/static/v1?label=Python&message=%3E%3D3.10%2C%3C3.15&labelColor=1E293B&color=0F766E"></a>
|
|
11
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&message=standards&labelColor=1E293B&color=6D28D9"></a>
|
|
12
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&message=active&labelColor=1E293B&color=166534"></a>
|
|
13
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&labelColor=1E293B&color=86198F"></a>
|
|
14
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
15
|
+
</p>
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img alt="Monthly PyPI downloads: swarmauri_keyprovider_ssh" src="https://img.shields.io/pypi/dm/swarmauri_keyprovider_ssh?labelColor=1E293B&color=0E7490"></a>
|
|
18
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md"><img alt="README hits: swarmauri_keyprovider_ssh" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
19
|
+
</p>
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&message=CI%20gate&labelColor=1E293B&color=1D4ED8"></a>
|
|
22
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&message=example%20source&labelColor=1E293B&color=0F766E"></a>
|
|
23
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&message=not%20certified&labelColor=1E293B&color=92400E"></a>
|
|
24
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&message=repository%20policy&labelColor=1E293B&color=4338CA"></a>
|
|
25
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&message=source%20and%20CI&labelColor=1E293B&color=6D28D9"></a>
|
|
26
|
+
</p>
|
|
27
|
+
<p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
|
|
28
|
+
<!-- readme-standards:end branding -->
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Overview
|
|
33
|
+
|
|
34
|
+
### Summary
|
|
35
|
+
|
|
36
|
+
An asynchronous `KeyProviderBase` implementation that keeps SSH key material in
|
|
37
|
+
memory and bridges it to Swarmauri's signing abstractions.
|
|
38
|
+
|
|
39
|
+
### Why This Package
|
|
40
|
+
|
|
41
|
+
`swarmauri_keyprovider_ssh` isolates this responsibility: SSH-based key provider for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) exposes `SshKeyProvider`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
|
|
42
|
+
|
|
43
|
+
### When to Use
|
|
44
|
+
|
|
45
|
+
Choose `swarmauri_keyprovider_ssh` when your integration needs sSH-based key provider for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
- Generate new Ed25519, RSA-PSS (SHA-256), or ECDSA P-256 key pairs on demand.
|
|
50
|
+
- Import existing private keys (PEM) or public keys (OpenSSH) while respecting
|
|
51
|
+
each key's `ExportPolicy`.
|
|
52
|
+
- Rotate keys, enumerate versions, and optionally destroy specific versions or
|
|
53
|
+
entire key identifiers.
|
|
54
|
+
- Export public keys as RFC 7517-compliant JWKs/JWKS with OpenSSH fingerprints
|
|
55
|
+
embedded in the `tags` metadata.
|
|
56
|
+
- Produce random bytes and derive keying material using the HKDF construction
|
|
57
|
+
(RFC 5869).
|
|
58
|
+
|
|
59
|
+
### Non-Goals
|
|
60
|
+
|
|
61
|
+
`swarmauri_keyprovider_ssh` owns sSH-based key provider for Swarmauri. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Getting Started
|
|
66
|
+
|
|
67
|
+
### Prerequisites
|
|
68
|
+
|
|
69
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `cryptography`. Read the example’s inputs and service requirements before execution.
|
|
70
|
+
|
|
71
|
+
### Installation
|
|
72
|
+
|
|
73
|
+
Choose the tool that matches your workflow:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# pip
|
|
77
|
+
pip install swarmauri_keyprovider_ssh
|
|
78
|
+
|
|
79
|
+
# Poetry
|
|
80
|
+
poetry add swarmauri_keyprovider_ssh
|
|
81
|
+
|
|
82
|
+
# uv
|
|
83
|
+
uv add swarmauri_keyprovider_ssh
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### uv
|
|
87
|
+
|
|
88
|
+
<!-- readme-standards:begin installation.uv -->
|
|
89
|
+
```bash
|
|
90
|
+
uv add swarmauri_keyprovider_ssh
|
|
91
|
+
```
|
|
92
|
+
<!-- readme-standards:end installation.uv -->
|
|
93
|
+
|
|
94
|
+
#### pip
|
|
95
|
+
|
|
96
|
+
<!-- readme-standards:begin installation.pip -->
|
|
97
|
+
```bash
|
|
98
|
+
python -m pip install swarmauri_keyprovider_ssh
|
|
99
|
+
```
|
|
100
|
+
<!-- readme-standards:end installation.pip -->
|
|
101
|
+
|
|
102
|
+
#### Poetry
|
|
103
|
+
|
|
104
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
105
|
+
```bash
|
|
106
|
+
poetry add swarmauri_keyprovider_ssh
|
|
107
|
+
```
|
|
108
|
+
<!-- readme-standards:end installation.poetry -->
|
|
109
|
+
|
|
110
|
+
### Quick Start
|
|
111
|
+
|
|
112
|
+
#### Example
|
|
113
|
+
|
|
114
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
115
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/docs/readme/quick_start.py).
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import asyncio
|
|
119
|
+
from swarmauri_keyprovider_ssh import SshKeyProvider
|
|
120
|
+
from swarmauri_core.key_providers.types import (
|
|
121
|
+
KeySpec,
|
|
122
|
+
KeyAlg,
|
|
123
|
+
KeyClass,
|
|
124
|
+
ExportPolicy,
|
|
125
|
+
KeyUse,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async def main() -> None:
|
|
130
|
+
provider = SshKeyProvider()
|
|
131
|
+
spec = KeySpec(
|
|
132
|
+
klass=KeyClass.asymmetric,
|
|
133
|
+
alg=KeyAlg.ED25519,
|
|
134
|
+
uses=(KeyUse.SIGN, KeyUse.VERIFY),
|
|
135
|
+
export_policy=ExportPolicy.PUBLIC_ONLY,
|
|
136
|
+
)
|
|
137
|
+
ref = await provider.create_key(spec)
|
|
138
|
+
jwk = await provider.get_public_jwk(ref.kid)
|
|
139
|
+
print(jwk)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
asyncio.run(main())
|
|
143
|
+
```
|
|
144
|
+
<!-- readme-standards:end example.quick-start -->
|
|
145
|
+
|
|
146
|
+
#### Expected Result
|
|
147
|
+
|
|
148
|
+
The example demonstrates the documented `swarmauri_keyprovider_ssh` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Usage
|
|
153
|
+
|
|
154
|
+
### Common Workflows
|
|
155
|
+
|
|
156
|
+
<!-- readme-standards:begin example.usage -->
|
|
157
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/docs/readme/usage.py).
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
import asyncio
|
|
161
|
+
from swarmauri_keyprovider_ssh import SshKeyProvider
|
|
162
|
+
from swarmauri_core.key_providers.types import (
|
|
163
|
+
KeySpec,
|
|
164
|
+
KeyAlg,
|
|
165
|
+
KeyClass,
|
|
166
|
+
ExportPolicy,
|
|
167
|
+
KeyUse,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
async def main() -> None:
|
|
172
|
+
provider = SshKeyProvider()
|
|
173
|
+
spec = KeySpec(
|
|
174
|
+
klass=KeyClass.asymmetric,
|
|
175
|
+
alg=KeyAlg.ED25519,
|
|
176
|
+
uses=(KeyUse.SIGN, KeyUse.VERIFY),
|
|
177
|
+
export_policy=ExportPolicy.PUBLIC_ONLY,
|
|
178
|
+
)
|
|
179
|
+
ref = await provider.create_key(spec)
|
|
180
|
+
jwk = await provider.get_public_jwk(ref.kid)
|
|
181
|
+
print(jwk)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
asyncio.run(main())
|
|
185
|
+
```
|
|
186
|
+
<!-- readme-standards:end example.usage -->
|
|
187
|
+
|
|
188
|
+
The provider exposes an asynchronous interface for creating and managing
|
|
189
|
+
SSH-based signing keys. The snippet below creates a new Ed25519 key and
|
|
190
|
+
exports its public component as a JSON Web Key (JWK):
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
Keys can also be rotated, and the provider will track key versions:
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
ref = await provider.create_key(spec)
|
|
197
|
+
await provider.rotate_key(ref.kid)
|
|
198
|
+
assert await provider.list_versions(ref.kid) == (1, 2)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Use `destroy_key()` to remove an entire key identifier or just a single
|
|
202
|
+
version, and `jwks(prefix_kids=...)` when you need to emit a filtered JWKS for
|
|
203
|
+
downstream consumers.
|
|
204
|
+
|
|
205
|
+
Existing keys can be imported from PEM or OpenSSH data and exposed via JWKS:
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
from pathlib import Path
|
|
209
|
+
|
|
210
|
+
pem = Path("id_ed25519").read_bytes()
|
|
211
|
+
ref = await provider.import_key(spec, pem)
|
|
212
|
+
jwks = await provider.jwks()
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Configuration
|
|
216
|
+
|
|
217
|
+
Configure `swarmauri_keyprovider_ssh` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
218
|
+
|
|
219
|
+
### Error Handling
|
|
220
|
+
|
|
221
|
+
The inspected `swarmauri_keyprovider_ssh` source raises `KeyError`, `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
222
|
+
|
|
223
|
+
### Best Practices
|
|
224
|
+
|
|
225
|
+
Use the explicit `swarmauri_keyprovider_ssh` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `SshKeyProvider`; an import or successful installation alone does not establish its runtime guarantees.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Package Boundary
|
|
230
|
+
|
|
231
|
+
### What It Owns
|
|
232
|
+
|
|
233
|
+
`swarmauri_keyprovider_ssh` is located in `standards` and owns sSH-based key provider for Swarmauri. Source-declared APIs include `SshKeyProvider`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) records its direct dependency boundary.
|
|
234
|
+
|
|
235
|
+
### Public API and Import Surfaces
|
|
236
|
+
|
|
237
|
+
Import namespace: `swarmauri_keyprovider_ssh`.
|
|
238
|
+
|
|
239
|
+
Source-declared exports or types: `SshKeyProvider`.
|
|
240
|
+
|
|
241
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
242
|
+
|
|
243
|
+
### Entry Points
|
|
244
|
+
|
|
245
|
+
<!-- readme-standards:begin entry-points -->
|
|
246
|
+
- `peagen.plugins.key_providers` → `ssh` → `swarmauri_keyprovider_ssh.SshKeyProvider:SshKeyProvider`
|
|
247
|
+
- `swarmauri.key_providers` → `SshKeyProvider` → `swarmauri_keyprovider_ssh.SshKeyProvider:SshKeyProvider`
|
|
248
|
+
<!-- readme-standards:end entry-points -->
|
|
249
|
+
|
|
250
|
+
### Injected Dependencies
|
|
251
|
+
|
|
252
|
+
The direct installation dependencies of `swarmauri_keyprovider_ssh` are `swarmauri-core`, `swarmauri-base`, `cryptography`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py).
|
|
253
|
+
|
|
254
|
+
### Protocol Consumers
|
|
255
|
+
|
|
256
|
+
No direct package-manifest dependency on `swarmauri_keyprovider_ssh` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
|
|
257
|
+
|
|
258
|
+
### Extensions
|
|
259
|
+
|
|
260
|
+
For `swarmauri_keyprovider_ssh`, use the source-declared public interfaces (`SshKeyProvider`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Operations and Readiness
|
|
265
|
+
|
|
266
|
+
### Operational Requirements
|
|
267
|
+
|
|
268
|
+
Operate `swarmauri_keyprovider_ssh` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
269
|
+
|
|
270
|
+
### Health and Observability
|
|
271
|
+
|
|
272
|
+
This README does not establish a standalone health endpoint for `swarmauri_keyprovider_ssh`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
|
|
273
|
+
|
|
274
|
+
### Security and Resource Limits
|
|
275
|
+
|
|
276
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py). The `swarmauri_keyprovider_ssh` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
277
|
+
|
|
278
|
+
### Compatibility
|
|
279
|
+
|
|
280
|
+
This source version of `swarmauri_keyprovider_ssh` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Verification
|
|
285
|
+
|
|
286
|
+
### Tests
|
|
287
|
+
|
|
288
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_keyprovider_ssh` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
289
|
+
|
|
290
|
+
- [tests/functional/test_ssh_provider_functional.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/functional/test_ssh_provider_functional.py)
|
|
291
|
+
- [tests/perf/test_ssh_provider_perf.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/perf/test_ssh_provider_perf.py)
|
|
292
|
+
- [tests/unit/test_readme_examples.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_readme_examples.py)
|
|
293
|
+
- [tests/unit/test_rfc5869_hkdf.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_rfc5869_hkdf.py)
|
|
294
|
+
- [tests/unit/test_rfc7517_jwk.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_rfc7517_jwk.py)
|
|
295
|
+
|
|
296
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
297
|
+
|
|
298
|
+
### Certification Status
|
|
299
|
+
|
|
300
|
+
No external certification is asserted for `swarmauri_keyprovider_ssh` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
301
|
+
|
|
302
|
+
### Evidence
|
|
303
|
+
|
|
304
|
+
The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## FAQ
|
|
309
|
+
|
|
310
|
+
### Why
|
|
311
|
+
|
|
312
|
+
**Why select this package?** `swarmauri_keyprovider_ssh` provides sSH-based key provider for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
313
|
+
|
|
314
|
+
### How
|
|
315
|
+
|
|
316
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_keyprovider_ssh`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py) for the exact types and signatures involved.
|
|
317
|
+
|
|
318
|
+
### When
|
|
319
|
+
|
|
320
|
+
**When should I validate an upgrade?** Recheck `swarmauri_keyprovider_ssh` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Documentation and Related Packages
|
|
325
|
+
|
|
326
|
+
### More Documentation
|
|
327
|
+
|
|
328
|
+
The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/swarmauri_keyprovider_ssh/SshKeyProvider.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml) provide the supporting context for `swarmauri_keyprovider_ssh`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
329
|
+
|
|
330
|
+
### Related Packages
|
|
331
|
+
|
|
332
|
+
- [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
|
|
333
|
+
- [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
|
|
334
|
+
|
|
335
|
+
### Project Links
|
|
336
|
+
|
|
337
|
+
<!-- readme-standards:begin project-links -->
|
|
338
|
+
- [pypi: swarmauri_keyprovider_ssh](https://pypi.org/project/swarmauri_keyprovider_ssh/)
|
|
339
|
+
<!-- readme-standards:end project-links -->
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Contributing
|
|
344
|
+
|
|
345
|
+
### How to Contribute
|
|
346
|
+
|
|
347
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
348
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
349
|
+
that will help you get started.
|
|
350
|
+
|
|
351
|
+
### Development Setup
|
|
352
|
+
|
|
353
|
+
Work from the `pkgs/40-standards/swarmauri_keyprovider_ssh` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
|
|
354
|
+
|
|
355
|
+
### Notes for Maintainers
|
|
356
|
+
|
|
357
|
+
Edit authored prose directly in this `swarmauri_keyprovider_ssh` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Governance
|
|
362
|
+
|
|
363
|
+
### Ownership and Decision Making
|
|
364
|
+
|
|
365
|
+
Changes to `swarmauri_keyprovider_ssh` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
366
|
+
|
|
367
|
+
### Standards and Policies
|
|
368
|
+
|
|
369
|
+
`swarmauri_keyprovider_ssh` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
|
|
370
|
+
|
|
371
|
+
### Lifecycle and Migration
|
|
372
|
+
|
|
373
|
+
The `swarmauri_keyprovider_ssh` source version is `0.11.0`.
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## License and Attribution
|
|
378
|
+
|
|
379
|
+
### License
|
|
380
|
+
|
|
381
|
+
<!-- readme-standards:begin license -->
|
|
382
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/LICENSE).
|
|
383
|
+
<!-- readme-standards:end license -->
|
|
384
|
+
|
|
385
|
+
### Notices
|
|
386
|
+
|
|
387
|
+
<!-- readme-standards:begin notices -->
|
|
388
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/NOTICE) for attribution.
|
|
389
|
+
<!-- readme-standards:end notices -->
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_keyprovider_ssh"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0"
|
|
4
4
|
description = "SSH-based key provider for Swarmauri"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
7
|
-
requires-python = ">=3.10,<3.
|
|
7
|
+
requires-python = ">=3.10,<3.15"
|
|
8
8
|
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
9
9
|
classifiers = [
|
|
10
|
-
"License :: OSI Approved :: Apache Software License",
|
|
11
10
|
"Natural Language :: English",
|
|
12
|
-
"Programming Language :: Python :: 3.10",
|
|
13
|
-
"Programming Language :: Python :: 3.11",
|
|
14
|
-
"Programming Language :: Python :: 3.12",
|
|
15
|
-
"Programming Language :: Python :: 3.13",
|
|
16
11
|
"Development Status :: 3 - Alpha",
|
|
17
12
|
"Topic :: Security :: Cryptography",
|
|
18
13
|
"Intended Audience :: Developers",
|
|
19
14
|
"Programming Language :: Python",
|
|
20
15
|
"Programming Language :: Python :: 3",
|
|
21
16
|
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
22
|
]
|
|
23
23
|
dependencies = [
|
|
24
24
|
"swarmauri_core",
|
|
@@ -33,6 +33,7 @@ keywords = [
|
|
|
33
33
|
'ssh',
|
|
34
34
|
'key-management',
|
|
35
35
|
]
|
|
36
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
36
37
|
|
|
37
38
|
[tool.uv.sources]
|
|
38
39
|
swarmauri_core = { workspace = true }
|
|
@@ -56,6 +57,54 @@ log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
|
|
|
56
57
|
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
57
58
|
asyncio_default_fixture_loop_scope = "function"
|
|
58
59
|
|
|
60
|
+
[tool.readme_standards]
|
|
61
|
+
policy = "package-guide-v1"
|
|
62
|
+
readme = "README.md"
|
|
63
|
+
brand = "swarmauri"
|
|
64
|
+
brand_catalog = "../../../tools/readme/brands.toml"
|
|
65
|
+
repository = "https://github.com/swarmauri/swarmauri-sdk"
|
|
66
|
+
ref = "master"
|
|
67
|
+
package_path = "pkgs/40-standards/swarmauri_keyprovider_ssh"
|
|
68
|
+
layer = "standards"
|
|
69
|
+
lifecycle = "active"
|
|
70
|
+
license_file = "LICENSE"
|
|
71
|
+
notice_file = "NOTICE"
|
|
72
|
+
|
|
73
|
+
[tool.readme_standards.distributions.pypi]
|
|
74
|
+
name = "swarmauri_keyprovider_ssh"
|
|
75
|
+
published = true
|
|
76
|
+
|
|
77
|
+
[tool.readme_standards.examples.quick_start]
|
|
78
|
+
source = "docs/readme/quick_start.py"
|
|
79
|
+
test = "tests/unit/test_readme_sources.py"
|
|
80
|
+
language = "python"
|
|
81
|
+
expected_exit_code = 0
|
|
82
|
+
|
|
83
|
+
[tool.readme_standards.examples.usage]
|
|
84
|
+
source = "docs/readme/usage.py"
|
|
85
|
+
test = "tests/unit/test_readme_sources.py"
|
|
86
|
+
language = "python"
|
|
87
|
+
expected_exit_code = 0
|
|
88
|
+
|
|
89
|
+
[tool.readme_standards.statuses.readme]
|
|
90
|
+
label = "CI gate"
|
|
91
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
|
|
92
|
+
|
|
93
|
+
[tool.readme_standards.statuses.tests]
|
|
94
|
+
label = "example source"
|
|
95
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/tests/unit/test_readme_sources.py"
|
|
96
|
+
|
|
97
|
+
[tool.readme_standards.statuses.certification]
|
|
98
|
+
label = "not certified"
|
|
99
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_ssh/README.md#certification-status"
|
|
100
|
+
|
|
101
|
+
[tool.readme_standards.statuses.governance]
|
|
102
|
+
label = "repository policy"
|
|
103
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"
|
|
104
|
+
|
|
105
|
+
[tool.readme_standards.statuses.evidence]
|
|
106
|
+
label = "source and CI"
|
|
107
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
|
|
59
108
|
[dependency-groups]
|
|
60
109
|
dev = [
|
|
61
110
|
"pytest>=8.0",
|
|
@@ -65,6 +114,7 @@ dev = [
|
|
|
65
114
|
"pytest-timeout>=2.3.1",
|
|
66
115
|
"pytest-benchmark>=4.0.0",
|
|
67
116
|
"ruff>=0.9.9",
|
|
117
|
+
"readme-standards==0.1.3; python_version >= \"3.11\"",
|
|
68
118
|
]
|
|
69
119
|
|
|
70
120
|
[build-system]
|
|
@@ -23,7 +23,12 @@ from cryptography.hazmat.primitives.serialization import (
|
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
from swarmauri_base.key_providers.KeyProviderBase import KeyProviderBase
|
|
26
|
-
from swarmauri_core.key_providers.types import
|
|
26
|
+
from swarmauri_core.key_providers.types import (
|
|
27
|
+
KeySpec,
|
|
28
|
+
KeyAlg,
|
|
29
|
+
KeyClass,
|
|
30
|
+
ExportPolicy,
|
|
31
|
+
)
|
|
27
32
|
from swarmauri_core.crypto.types import KeyRef
|
|
28
33
|
|
|
29
34
|
|
|
@@ -54,7 +59,9 @@ def _pem_priv(priv) -> bytes:
|
|
|
54
59
|
RETURNS (bytes): PKCS#8 encoded PEM bytes.
|
|
55
60
|
"""
|
|
56
61
|
|
|
57
|
-
return priv.private_bytes(
|
|
62
|
+
return priv.private_bytes(
|
|
63
|
+
Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()
|
|
64
|
+
)
|
|
58
65
|
|
|
59
66
|
|
|
60
67
|
def _fingerprint(ssh_pub: bytes) -> str:
|
|
@@ -95,8 +102,19 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
95
102
|
def supports(self) -> Mapping[str, Iterable[str]]:
|
|
96
103
|
return {
|
|
97
104
|
"class": ("asym",),
|
|
98
|
-
"algs": (
|
|
99
|
-
|
|
105
|
+
"algs": (
|
|
106
|
+
KeyAlg.ED25519,
|
|
107
|
+
KeyAlg.RSA_PSS_SHA256,
|
|
108
|
+
KeyAlg.ECDSA_P256_SHA256,
|
|
109
|
+
),
|
|
110
|
+
"features": (
|
|
111
|
+
"create",
|
|
112
|
+
"rotate",
|
|
113
|
+
"import",
|
|
114
|
+
"jwks",
|
|
115
|
+
"hkdf",
|
|
116
|
+
"random",
|
|
117
|
+
),
|
|
100
118
|
}
|
|
101
119
|
|
|
102
120
|
async def create_key(self, spec: KeySpec) -> KeyRef:
|
|
@@ -125,7 +143,9 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
125
143
|
uses=spec.uses,
|
|
126
144
|
export_policy=spec.export_policy,
|
|
127
145
|
public=ssh_pub,
|
|
128
|
-
material=(
|
|
146
|
+
material=(
|
|
147
|
+
pem if spec.export_policy != ExportPolicy.NONE else None
|
|
148
|
+
),
|
|
129
149
|
tags={
|
|
130
150
|
"label": spec.label,
|
|
131
151
|
"alg": spec.alg.value,
|
|
@@ -139,7 +159,9 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
139
159
|
async def import_key(
|
|
140
160
|
self, spec: KeySpec, material: bytes, *, public: Optional[bytes] = None
|
|
141
161
|
) -> KeyRef:
|
|
142
|
-
kid = hashlib.sha256(
|
|
162
|
+
kid = hashlib.sha256(
|
|
163
|
+
material if material else (public or b"")
|
|
164
|
+
).hexdigest()[:16]
|
|
143
165
|
if material:
|
|
144
166
|
sk = serialization.load_pem_private_key(material, password=None)
|
|
145
167
|
ssh_pub = _ssh_pub_bytes(sk.public_key())
|
|
@@ -147,7 +169,10 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
147
169
|
ssh_pub = public
|
|
148
170
|
else:
|
|
149
171
|
raise ValueError(
|
|
150
|
-
|
|
172
|
+
(
|
|
173
|
+
"Provide either PEM private in 'material' or OpenSSH public " # noqa: E501
|
|
174
|
+
"in 'public'"
|
|
175
|
+
)
|
|
151
176
|
)
|
|
152
177
|
|
|
153
178
|
ref = KeyRef(
|
|
@@ -157,7 +182,9 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
157
182
|
uses=spec.uses,
|
|
158
183
|
export_policy=spec.export_policy,
|
|
159
184
|
public=ssh_pub,
|
|
160
|
-
material=(
|
|
185
|
+
material=(
|
|
186
|
+
material if spec.export_policy != ExportPolicy.NONE else None
|
|
187
|
+
),
|
|
161
188
|
tags={
|
|
162
189
|
"label": spec.label,
|
|
163
190
|
"alg": spec.alg.value,
|
|
@@ -187,11 +214,15 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
187
214
|
tags=base.tags,
|
|
188
215
|
)
|
|
189
216
|
new = await self.create_key(spec)
|
|
190
|
-
new = new.__class__(
|
|
217
|
+
new = new.__class__(
|
|
218
|
+
**{**new.__dict__, "kid": kid, "version": latest + 1}
|
|
219
|
+
)
|
|
191
220
|
self._store[kid][latest + 1] = new
|
|
192
221
|
return new
|
|
193
222
|
|
|
194
|
-
async def destroy_key(
|
|
223
|
+
async def destroy_key(
|
|
224
|
+
self, kid: str, version: Optional[int] = None
|
|
225
|
+
) -> bool:
|
|
195
226
|
if kid not in self._store:
|
|
196
227
|
return False
|
|
197
228
|
if version is None:
|
|
@@ -203,7 +234,11 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
203
234
|
return True
|
|
204
235
|
|
|
205
236
|
async def get_key(
|
|
206
|
-
self,
|
|
237
|
+
self,
|
|
238
|
+
kid: str,
|
|
239
|
+
version: Optional[int] = None,
|
|
240
|
+
*,
|
|
241
|
+
include_secret: bool = False,
|
|
207
242
|
) -> KeyRef:
|
|
208
243
|
bucket = self._store[kid]
|
|
209
244
|
v = version or max(bucket)
|
|
@@ -212,7 +247,9 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
212
247
|
async def list_versions(self, kid: str) -> Tuple[int, ...]:
|
|
213
248
|
return tuple(sorted(self._store[kid].keys()))
|
|
214
249
|
|
|
215
|
-
async def get_public_jwk(
|
|
250
|
+
async def get_public_jwk(
|
|
251
|
+
self, kid: str, version: Optional[int] = None
|
|
252
|
+
) -> dict:
|
|
216
253
|
ref = await self.get_key(kid, version)
|
|
217
254
|
alg = KeyAlg(ref.tags["alg"])
|
|
218
255
|
pk = serialization.load_ssh_public_key(ref.public)
|
|
@@ -259,7 +296,9 @@ class SshKeyProvider(KeyProviderBase):
|
|
|
259
296
|
async def random_bytes(self, n: int) -> bytes:
|
|
260
297
|
return secrets.token_bytes(n)
|
|
261
298
|
|
|
262
|
-
async def hkdf(
|
|
299
|
+
async def hkdf(
|
|
300
|
+
self, ikm: bytes, *, salt: bytes, info: bytes, length: int
|
|
301
|
+
) -> bytes:
|
|
263
302
|
return HKDF(
|
|
264
303
|
algorithm=hashes.SHA256(), length=length, salt=salt, info=info
|
|
265
304
|
).derive(ikm)
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: swarmauri_keyprovider_ssh
|
|
3
|
-
Version: 0.3.0.dev45
|
|
4
|
-
Summary: SSH-based key provider for Swarmauri
|
|
5
|
-
License-Expression: Apache-2.0
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Keywords: swarmauri,sdk,standards,keyprovider,ssh,key-management
|
|
8
|
-
Author: Jacob Stewart
|
|
9
|
-
Author-email: jacob@swarmauri.com
|
|
10
|
-
Requires-Python: >=3.10,<3.13
|
|
11
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
-
Classifier: Natural Language :: English
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
Classifier: Development Status :: 3 - Alpha
|
|
18
|
-
Classifier: Topic :: Security :: Cryptography
|
|
19
|
-
Classifier: Intended Audience :: Developers
|
|
20
|
-
Classifier: Programming Language :: Python
|
|
21
|
-
Classifier: Programming Language :: Python :: 3
|
|
22
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
-
Requires-Dist: cryptography
|
|
24
|
-
Requires-Dist: swarmauri_base
|
|
25
|
-
Requires-Dist: swarmauri_core
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
|
|
28
|
-

|
|
29
|
-
|
|
30
|
-
<p align="center">
|
|
31
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/dm/swarmauri_keyprovider_ssh" alt="PyPI - Downloads"/></a>
|
|
32
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh/"><img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh.svg"/></a>
|
|
33
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/pyversions/swarmauri_keyprovider_ssh" alt="PyPI - Python Version"/></a>
|
|
34
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/l/swarmauri_keyprovider_ssh" alt="PyPI - License"/></a>
|
|
35
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/v/swarmauri_keyprovider_ssh?label=swarmauri_keyprovider_ssh&color=green" alt="PyPI - swarmauri_keyprovider_ssh"/></a>
|
|
36
|
-
</p>
|
|
37
|
-
|
|
38
|
-
# Swarmauri SSH Key Provider
|
|
39
|
-
|
|
40
|
-
An asynchronous `KeyProviderBase` implementation that keeps SSH key material in
|
|
41
|
-
memory and bridges it to Swarmauri's signing abstractions.
|
|
42
|
-
|
|
43
|
-
## Features
|
|
44
|
-
|
|
45
|
-
- Generate new Ed25519, RSA-PSS (SHA-256), or ECDSA P-256 key pairs on demand.
|
|
46
|
-
- Import existing private keys (PEM) or public keys (OpenSSH) while respecting
|
|
47
|
-
each key's `ExportPolicy`.
|
|
48
|
-
- Rotate keys, enumerate versions, and optionally destroy specific versions or
|
|
49
|
-
entire key identifiers.
|
|
50
|
-
- Export public keys as RFC 7517-compliant JWKs/JWKS with OpenSSH fingerprints
|
|
51
|
-
embedded in the `tags` metadata.
|
|
52
|
-
- Produce random bytes and derive keying material using the HKDF construction
|
|
53
|
-
(RFC 5869).
|
|
54
|
-
|
|
55
|
-
## Installation
|
|
56
|
-
|
|
57
|
-
Choose the tool that matches your workflow:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# pip
|
|
61
|
-
pip install swarmauri_keyprovider_ssh
|
|
62
|
-
|
|
63
|
-
# Poetry
|
|
64
|
-
poetry add swarmauri_keyprovider_ssh
|
|
65
|
-
|
|
66
|
-
# uv
|
|
67
|
-
uv add swarmauri_keyprovider_ssh
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Usage
|
|
71
|
-
|
|
72
|
-
The provider exposes an asynchronous interface for creating and managing
|
|
73
|
-
SSH-based signing keys. The snippet below creates a new Ed25519 key and
|
|
74
|
-
exports its public component as a JSON Web Key (JWK):
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
import asyncio
|
|
78
|
-
from swarmauri_keyprovider_ssh import SshKeyProvider
|
|
79
|
-
from swarmauri_core.key_providers.types import (
|
|
80
|
-
KeySpec,
|
|
81
|
-
KeyAlg,
|
|
82
|
-
KeyClass,
|
|
83
|
-
ExportPolicy,
|
|
84
|
-
KeyUse,
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
async def main() -> None:
|
|
89
|
-
provider = SshKeyProvider()
|
|
90
|
-
spec = KeySpec(
|
|
91
|
-
klass=KeyClass.asymmetric,
|
|
92
|
-
alg=KeyAlg.ED25519,
|
|
93
|
-
uses=(KeyUse.SIGN, KeyUse.VERIFY),
|
|
94
|
-
export_policy=ExportPolicy.PUBLIC_ONLY,
|
|
95
|
-
)
|
|
96
|
-
ref = await provider.create_key(spec)
|
|
97
|
-
jwk = await provider.get_public_jwk(ref.kid)
|
|
98
|
-
print(jwk)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
asyncio.run(main())
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Keys can also be rotated, and the provider will track key versions:
|
|
105
|
-
|
|
106
|
-
```python
|
|
107
|
-
ref = await provider.create_key(spec)
|
|
108
|
-
await provider.rotate_key(ref.kid)
|
|
109
|
-
assert await provider.list_versions(ref.kid) == (1, 2)
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Use `destroy_key()` to remove an entire key identifier or just a single
|
|
113
|
-
version, and `jwks(prefix_kids=...)` when you need to emit a filtered JWKS for
|
|
114
|
-
downstream consumers.
|
|
115
|
-
|
|
116
|
-
Existing keys can be imported from PEM or OpenSSH data and exposed via JWKS:
|
|
117
|
-
|
|
118
|
-
```python
|
|
119
|
-
from pathlib import Path
|
|
120
|
-
|
|
121
|
-
pem = Path("id_ed25519").read_bytes()
|
|
122
|
-
ref = await provider.import_key(spec, pem)
|
|
123
|
-
jwks = await provider.jwks()
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Want to help?
|
|
127
|
-
|
|
128
|
-
If you want to contribute to swarmauri-sdk, read up on our
|
|
129
|
-
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
130
|
-
that will help you get started.
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/dm/swarmauri_keyprovider_ssh" alt="PyPI - Downloads"/></a>
|
|
5
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh/"><img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh.svg"/></a>
|
|
6
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/pyversions/swarmauri_keyprovider_ssh" alt="PyPI - Python Version"/></a>
|
|
7
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/l/swarmauri_keyprovider_ssh" alt="PyPI - License"/></a>
|
|
8
|
-
<a href="https://pypi.org/project/swarmauri_keyprovider_ssh/"><img src="https://img.shields.io/pypi/v/swarmauri_keyprovider_ssh?label=swarmauri_keyprovider_ssh&color=green" alt="PyPI - swarmauri_keyprovider_ssh"/></a>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
# Swarmauri SSH Key Provider
|
|
12
|
-
|
|
13
|
-
An asynchronous `KeyProviderBase` implementation that keeps SSH key material in
|
|
14
|
-
memory and bridges it to Swarmauri's signing abstractions.
|
|
15
|
-
|
|
16
|
-
## Features
|
|
17
|
-
|
|
18
|
-
- Generate new Ed25519, RSA-PSS (SHA-256), or ECDSA P-256 key pairs on demand.
|
|
19
|
-
- Import existing private keys (PEM) or public keys (OpenSSH) while respecting
|
|
20
|
-
each key's `ExportPolicy`.
|
|
21
|
-
- Rotate keys, enumerate versions, and optionally destroy specific versions or
|
|
22
|
-
entire key identifiers.
|
|
23
|
-
- Export public keys as RFC 7517-compliant JWKs/JWKS with OpenSSH fingerprints
|
|
24
|
-
embedded in the `tags` metadata.
|
|
25
|
-
- Produce random bytes and derive keying material using the HKDF construction
|
|
26
|
-
(RFC 5869).
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
Choose the tool that matches your workflow:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# pip
|
|
34
|
-
pip install swarmauri_keyprovider_ssh
|
|
35
|
-
|
|
36
|
-
# Poetry
|
|
37
|
-
poetry add swarmauri_keyprovider_ssh
|
|
38
|
-
|
|
39
|
-
# uv
|
|
40
|
-
uv add swarmauri_keyprovider_ssh
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Usage
|
|
44
|
-
|
|
45
|
-
The provider exposes an asynchronous interface for creating and managing
|
|
46
|
-
SSH-based signing keys. The snippet below creates a new Ed25519 key and
|
|
47
|
-
exports its public component as a JSON Web Key (JWK):
|
|
48
|
-
|
|
49
|
-
```python
|
|
50
|
-
import asyncio
|
|
51
|
-
from swarmauri_keyprovider_ssh import SshKeyProvider
|
|
52
|
-
from swarmauri_core.key_providers.types import (
|
|
53
|
-
KeySpec,
|
|
54
|
-
KeyAlg,
|
|
55
|
-
KeyClass,
|
|
56
|
-
ExportPolicy,
|
|
57
|
-
KeyUse,
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
async def main() -> None:
|
|
62
|
-
provider = SshKeyProvider()
|
|
63
|
-
spec = KeySpec(
|
|
64
|
-
klass=KeyClass.asymmetric,
|
|
65
|
-
alg=KeyAlg.ED25519,
|
|
66
|
-
uses=(KeyUse.SIGN, KeyUse.VERIFY),
|
|
67
|
-
export_policy=ExportPolicy.PUBLIC_ONLY,
|
|
68
|
-
)
|
|
69
|
-
ref = await provider.create_key(spec)
|
|
70
|
-
jwk = await provider.get_public_jwk(ref.kid)
|
|
71
|
-
print(jwk)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
asyncio.run(main())
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Keys can also be rotated, and the provider will track key versions:
|
|
78
|
-
|
|
79
|
-
```python
|
|
80
|
-
ref = await provider.create_key(spec)
|
|
81
|
-
await provider.rotate_key(ref.kid)
|
|
82
|
-
assert await provider.list_versions(ref.kid) == (1, 2)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Use `destroy_key()` to remove an entire key identifier or just a single
|
|
86
|
-
version, and `jwks(prefix_kids=...)` when you need to emit a filtered JWKS for
|
|
87
|
-
downstream consumers.
|
|
88
|
-
|
|
89
|
-
Existing keys can be imported from PEM or OpenSSH data and exposed via JWKS:
|
|
90
|
-
|
|
91
|
-
```python
|
|
92
|
-
from pathlib import Path
|
|
93
|
-
|
|
94
|
-
pem = Path("id_ed25519").read_bytes()
|
|
95
|
-
ref = await provider.import_key(spec, pem)
|
|
96
|
-
jwks = await provider.jwks()
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Want to help?
|
|
100
|
-
|
|
101
|
-
If you want to contribute to swarmauri-sdk, read up on our
|
|
102
|
-
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
103
|
-
that will help you get started.
|
|
File without changes
|
|
File without changes
|