swarmauri_crypto_composite 0.3.0.dev5__tar.gz → 0.11.0.dev2__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_crypto_composite-0.3.0.dev5 → swarmauri_crypto_composite-0.11.0.dev2}/PKG-INFO +22 -13
- {swarmauri_crypto_composite-0.3.0.dev5 → swarmauri_crypto_composite-0.11.0.dev2}/README.md +15 -8
- {swarmauri_crypto_composite-0.3.0.dev5 → swarmauri_crypto_composite-0.11.0.dev2}/pyproject.toml +7 -6
- {swarmauri_crypto_composite-0.3.0.dev5 → swarmauri_crypto_composite-0.11.0.dev2}/swarmauri_crypto_composite/CompositeCrypto.py +39 -7
- {swarmauri_crypto_composite-0.3.0.dev5 → swarmauri_crypto_composite-0.11.0.dev2}/LICENSE +0 -0
- {swarmauri_crypto_composite-0.3.0.dev5 → swarmauri_crypto_composite-0.11.0.dev2}/swarmauri_crypto_composite/__init__.py +0 -0
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri_crypto_composite
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev2
|
|
4
4
|
Summary: Algorithm-routing crypto provider for Swarmauri
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Keywords: swarmauri,sdk,standards,crypto,composite,cryptography
|
|
8
8
|
Author: Jacob Stewart
|
|
9
9
|
Author-email: jacob@swarmauri.com
|
|
10
|
-
Requires-Python: >=3.10,<3.
|
|
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: swarmauri_base
|
|
24
25
|
Requires-Dist: swarmauri_core
|
|
25
26
|
Description-Content-Type: text/markdown
|
|
26
27
|
|
|
27
|
-

|
|
28
29
|
|
|
29
30
|
<p align="center">
|
|
30
|
-
<a href="https://
|
|
31
|
-
<img src="https://
|
|
31
|
+
<a href="https://pepy.tech/project/swarmauri_crypto_composite/">
|
|
32
|
+
<img src="https://static.pepy.tech/badge/swarmauri_crypto_composite/month" alt="PyPI - Downloads"/></a>
|
|
32
33
|
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_composite/">
|
|
33
34
|
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_composite.svg"/></a>
|
|
34
35
|
<a href="https://pypi.org/project/swarmauri_crypto_composite/">
|
|
35
|
-
<img src="https://img.shields.io/
|
|
36
|
+
<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>
|
|
36
37
|
<a href="https://pypi.org/project/swarmauri_crypto_composite/">
|
|
37
38
|
<img src="https://img.shields.io/pypi/l/swarmauri_crypto_composite" alt="PyPI - License"/></a>
|
|
38
39
|
<a href="https://pypi.org/project/swarmauri_crypto_composite/">
|
|
39
40
|
<img src="https://img.shields.io/pypi/v/swarmauri_crypto_composite?label=swarmauri_crypto_composite&color=green" alt="PyPI - swarmauri_crypto_composite"/></a>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
---
|
|
41
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
42
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
43
43
|
|
|
44
44
|
## Swarmauri Crypto Composite
|
|
45
45
|
|
|
@@ -118,6 +118,12 @@ class DummyCrypto(ICrypto):
|
|
|
118
118
|
async def unseal(self, recipient_priv, sealed, *, alg=None): # pragma: no cover - demo only
|
|
119
119
|
raise NotImplementedError
|
|
120
120
|
|
|
121
|
+
async def encaps(self, recipient, *, alg=None): # pragma: no cover - demo only
|
|
122
|
+
raise NotImplementedError
|
|
123
|
+
|
|
124
|
+
async def decaps(self, recipient_priv, encapsulated_key, *, alg=None): # pragma: no cover - demo only
|
|
125
|
+
raise NotImplementedError
|
|
126
|
+
|
|
121
127
|
|
|
122
128
|
async def main() -> None:
|
|
123
129
|
# Compose two providers that advertise different algorithms.
|
|
@@ -151,3 +157,6 @@ The provider is registered under the `swarmauri.cryptos` entry-point as `Composi
|
|
|
151
157
|
If you want to contribute to swarmauri-sdk, read up on our
|
|
152
158
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
153
159
|
that will help you get started.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://
|
|
5
|
-
<img src="https://
|
|
4
|
+
<a href="https://pepy.tech/project/swarmauri_crypto_composite/">
|
|
5
|
+
<img src="https://static.pepy.tech/badge/swarmauri_crypto_composite/month" alt="PyPI - Downloads"/></a>
|
|
6
6
|
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_composite/">
|
|
7
7
|
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_crypto_composite.svg"/></a>
|
|
8
8
|
<a href="https://pypi.org/project/swarmauri_crypto_composite/">
|
|
9
|
-
<img src="https://img.shields.io/
|
|
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
10
|
<a href="https://pypi.org/project/swarmauri_crypto_composite/">
|
|
11
11
|
<img src="https://img.shields.io/pypi/l/swarmauri_crypto_composite" alt="PyPI - License"/></a>
|
|
12
12
|
<a href="https://pypi.org/project/swarmauri_crypto_composite/">
|
|
13
13
|
<img src="https://img.shields.io/pypi/v/swarmauri_crypto_composite?label=swarmauri_crypto_composite&color=green" alt="PyPI - swarmauri_crypto_composite"/></a>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
---
|
|
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>
|
|
17
16
|
|
|
18
17
|
## Swarmauri Crypto Composite
|
|
19
18
|
|
|
@@ -92,6 +91,12 @@ class DummyCrypto(ICrypto):
|
|
|
92
91
|
async def unseal(self, recipient_priv, sealed, *, alg=None): # pragma: no cover - demo only
|
|
93
92
|
raise NotImplementedError
|
|
94
93
|
|
|
94
|
+
async def encaps(self, recipient, *, alg=None): # pragma: no cover - demo only
|
|
95
|
+
raise NotImplementedError
|
|
96
|
+
|
|
97
|
+
async def decaps(self, recipient_priv, encapsulated_key, *, alg=None): # pragma: no cover - demo only
|
|
98
|
+
raise NotImplementedError
|
|
99
|
+
|
|
95
100
|
|
|
96
101
|
async def main() -> None:
|
|
97
102
|
# Compose two providers that advertise different algorithms.
|
|
@@ -124,4 +129,6 @@ The provider is registered under the `swarmauri.cryptos` entry-point as `Composi
|
|
|
124
129
|
|
|
125
130
|
If you want to contribute to swarmauri-sdk, read up on our
|
|
126
131
|
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
127
|
-
that will help you get started.
|
|
132
|
+
that will help you get started.
|
|
133
|
+
|
|
134
|
+
|
{swarmauri_crypto_composite-0.3.0.dev5 → swarmauri_crypto_composite-0.11.0.dev2}/pyproject.toml
RENAMED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_crypto_composite"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev2"
|
|
4
4
|
description = "Algorithm-routing crypto 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
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",
|
|
@@ -24,7 +24,8 @@ def _norm_alg(a: Optional[Alg]) -> Optional[Alg]:
|
|
|
24
24
|
class CompositeCrypto(ICrypto, ComponentBase):
|
|
25
25
|
"""Algorithm-routing crypto provider.
|
|
26
26
|
|
|
27
|
-
Delegates to the first child that advertises support for the requested
|
|
27
|
+
Delegates to the first child that advertises support for the requested
|
|
28
|
+
algorithm.
|
|
28
29
|
"""
|
|
29
30
|
|
|
30
31
|
def __init__(self, providers: Sequence[ICrypto]) -> None:
|
|
@@ -47,7 +48,8 @@ class CompositeCrypto(ICrypto, ComponentBase):
|
|
|
47
48
|
# -------- routing helpers --------
|
|
48
49
|
def _pick(self, area: str, alg: Optional[Alg]) -> ICrypto:
|
|
49
50
|
alg_n = _norm_alg(alg)
|
|
50
|
-
# If caller passed None for the algorithm, we let providers apply their
|
|
51
|
+
# If caller passed None for the algorithm, we let providers apply their
|
|
52
|
+
# own default;
|
|
51
53
|
# pick the first provider advertising *any* alg for that area.
|
|
52
54
|
for p in self._providers:
|
|
53
55
|
caps = p.supports()
|
|
@@ -60,7 +62,9 @@ class CompositeCrypto(ICrypto, ComponentBase):
|
|
|
60
62
|
else:
|
|
61
63
|
if any(_norm_alg(a) == alg_n for a in caps[area]):
|
|
62
64
|
return p
|
|
63
|
-
raise UnsupportedAlgorithm(
|
|
65
|
+
raise UnsupportedAlgorithm(
|
|
66
|
+
f"No provider supports {area} with alg={alg_n!r}"
|
|
67
|
+
)
|
|
64
68
|
|
|
65
69
|
# -------- AEAD --------
|
|
66
70
|
async def encrypt(
|
|
@@ -99,7 +103,9 @@ class CompositeCrypto(ICrypto, ComponentBase):
|
|
|
99
103
|
)
|
|
100
104
|
|
|
101
105
|
async def unwrap(self, kek: KeyRef, wrapped: WrappedKey) -> bytes:
|
|
102
|
-
return await self._pick("unwrap", wrapped.wrap_alg).unwrap(
|
|
106
|
+
return await self._pick("unwrap", wrapped.wrap_alg).unwrap(
|
|
107
|
+
kek, wrapped
|
|
108
|
+
)
|
|
103
109
|
|
|
104
110
|
# -------- for-many --------
|
|
105
111
|
async def encrypt_for_many(
|
|
@@ -112,7 +118,8 @@ class CompositeCrypto(ICrypto, ComponentBase):
|
|
|
112
118
|
aad: Optional[bytes] = None,
|
|
113
119
|
nonce: Optional[bytes] = None,
|
|
114
120
|
) -> MultiRecipientEnvelope:
|
|
115
|
-
# Route primarily by enc_alg; if None, pick a provider that supports
|
|
121
|
+
# Route primarily by enc_alg; if None, pick a provider that supports
|
|
122
|
+
# "encrypt" and has for_many.
|
|
116
123
|
return await self._pick("encrypt", enc_alg).encrypt_for_many(
|
|
117
124
|
recipients,
|
|
118
125
|
pt,
|
|
@@ -135,5 +142,30 @@ class CompositeCrypto(ICrypto, ComponentBase):
|
|
|
135
142
|
*,
|
|
136
143
|
alg: Optional[Alg] = None,
|
|
137
144
|
) -> bytes:
|
|
138
|
-
# Some providers embed alg tag in sealed blob; we still require alg for
|
|
139
|
-
|
|
145
|
+
# Some providers embed alg tag in sealed blob; we still require alg for
|
|
146
|
+
# routing clarity.
|
|
147
|
+
return await self._pick("unseal", alg).unseal(
|
|
148
|
+
recipient_priv, sealed, alg=alg
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# -------- encaps / decaps --------
|
|
152
|
+
async def encaps(
|
|
153
|
+
self,
|
|
154
|
+
recipient: KeyRef,
|
|
155
|
+
*,
|
|
156
|
+
alg: Optional[Alg] = None,
|
|
157
|
+
) -> Tuple[bytes, bytes]:
|
|
158
|
+
return await self._pick("encaps", alg).encaps(recipient, alg=alg)
|
|
159
|
+
|
|
160
|
+
async def decaps(
|
|
161
|
+
self,
|
|
162
|
+
recipient_priv: KeyRef,
|
|
163
|
+
encapsulated_key: bytes,
|
|
164
|
+
*,
|
|
165
|
+
alg: Optional[Alg] = None,
|
|
166
|
+
) -> bytes:
|
|
167
|
+
return await self._pick("decaps", alg).decaps(
|
|
168
|
+
recipient_priv,
|
|
169
|
+
encapsulated_key,
|
|
170
|
+
alg=alg,
|
|
171
|
+
)
|
|
File without changes
|