swarmauri_keyprovider_ssh 0.3.0.dev45__tar.gz → 0.11.0.dev1__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.
@@ -1,39 +1,46 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: swarmauri_keyprovider_ssh
3
- Version: 0.3.0.dev45
3
+ Version: 0.11.0.dev1
4
4
  Summary: SSH-based key provider for Swarmauri
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
7
7
  Keywords: swarmauri,sdk,standards,keyprovider,ssh,key-management
8
8
  Author: Jacob Stewart
9
9
  Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.13
10
+ Requires-Python: >=3.10,<3.15
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
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
13
  Classifier: Development Status :: 3 - Alpha
18
14
  Classifier: Topic :: Security :: Cryptography
19
15
  Classifier: Intended Audience :: Developers
20
16
  Classifier: Programming Language :: Python
21
17
  Classifier: Programming Language :: Python :: 3
22
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
23
24
  Requires-Dist: cryptography
24
25
  Requires-Dist: swarmauri_base
25
26
  Requires-Dist: swarmauri_core
26
27
  Description-Content-Type: text/markdown
27
28
 
28
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
29
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
29
30
 
30
31
  <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>
32
+ <a href="https://pepy.tech/project/swarmauri_keyprovider_ssh/">
33
+ <img src="https://static.pepy.tech/badge/swarmauri_keyprovider_ssh/month" alt="PyPI - Downloads"/></a>
34
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh/">
35
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh.svg"/></a>
36
+ <a href="https://pypi.org/project/swarmauri_keyprovider_ssh/">
37
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
38
+ <a href="https://pypi.org/project/swarmauri_keyprovider_ssh/">
39
+ <img src="https://img.shields.io/pypi/l/swarmauri_keyprovider_ssh" alt="PyPI - License"/></a>
40
+ <a href="https://pypi.org/project/swarmauri_keyprovider_ssh/">
41
+ <img src="https://img.shields.io/pypi/v/swarmauri_keyprovider_ssh?label=swarmauri_keyprovider_ssh&color=green" alt="PyPI - swarmauri_keyprovider_ssh"/></a>
42
+ <a href="https://discord.gg/N4UpBuQv8T">
43
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
37
44
 
38
45
  # Swarmauri SSH Key Provider
39
46
 
@@ -128,3 +135,5 @@ jwks = await provider.jwks()
128
135
  If you want to contribute to swarmauri-sdk, read up on our
129
136
  [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
130
137
  that will help you get started.
138
+
139
+
@@ -1,12 +1,18 @@
1
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
1
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
2
 
3
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>
4
+ <a href="https://pepy.tech/project/swarmauri_keyprovider_ssh/">
5
+ <img src="https://static.pepy.tech/badge/swarmauri_keyprovider_ssh/month" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_ssh.svg"/></a>
8
+ <a href="https://pypi.org/project/swarmauri_keyprovider_ssh/">
9
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
10
+ <a href="https://pypi.org/project/swarmauri_keyprovider_ssh/">
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_keyprovider_ssh" alt="PyPI - License"/></a>
12
+ <a href="https://pypi.org/project/swarmauri_keyprovider_ssh/">
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_keyprovider_ssh?label=swarmauri_keyprovider_ssh&color=green" alt="PyPI - swarmauri_keyprovider_ssh"/></a>
14
+ <a href="https://discord.gg/N4UpBuQv8T">
15
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
10
16
 
11
17
  # Swarmauri SSH Key Provider
12
18
 
@@ -100,4 +106,5 @@ jwks = await provider.jwks()
100
106
 
101
107
  If you want to contribute to swarmauri-sdk, read up on our
102
108
  [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
103
- that will help you get started.
109
+ that will help you get started.
110
+
@@ -1,24 +1,25 @@
1
1
  [project]
2
2
  name = "swarmauri_keyprovider_ssh"
3
- version = "0.3.0.dev45"
3
+ version = "0.11.0.dev1"
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.13"
7
+ requires-python = ">=3.10,<3.15"
8
8
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
9
9
  classifiers = [
10
10
  "License :: OSI Approved :: Apache Software License",
11
11
  "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
12
  "Development Status :: 3 - Alpha",
17
13
  "Topic :: Security :: Cryptography",
18
14
  "Intended Audience :: Developers",
19
15
  "Programming Language :: Python",
20
16
  "Programming Language :: Python :: 3",
21
17
  "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
22
23
  ]
23
24
  dependencies = [
24
25
  "swarmauri_core",
@@ -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 KeySpec, KeyAlg, KeyClass, ExportPolicy
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(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption())
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": (KeyAlg.ED25519, KeyAlg.RSA_PSS_SHA256, KeyAlg.ECDSA_P256_SHA256),
99
- "features": ("create", "rotate", "import", "jwks", "hkdf", "random"),
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=(pem if spec.export_policy != ExportPolicy.NONE else None),
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(material if material else (public or b"")).hexdigest()[:16]
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
- "Provide either PEM private in 'material' or OpenSSH public in 'public'"
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=(material if spec.export_policy != ExportPolicy.NONE else None),
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__(**{**new.__dict__, "kid": kid, "version": latest + 1})
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(self, kid: str, version: Optional[int] = None) -> bool:
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, kid: str, version: Optional[int] = None, *, include_secret: bool = False
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(self, kid: str, version: Optional[int] = None) -> dict:
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(self, ikm: bytes, *, salt: bytes, info: bytes, length: int) -> bytes:
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)