swarmauri_cipher_suite_pep458 0.1.0.dev25__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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2025] [Jacob Stewart @ Swarmauri]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_cipher_suite_pep458
3
+ Version: 0.1.0.dev25
4
+ Summary: PEP 458 policy and algorithm definitions for Swarmauri cipher suites
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: supply-chain,tuf,pep458,policy,cipher-suite,swarmauri,sdk,standards,cipher,suite,cryptography,PEP 458,TUF 1.x,The Update Framework,Ed25519,RSA-PSS-SHA256,RFC 8032,RFC 8017
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.13
11
+ Classifier: Development Status :: 1 - Planning
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Security :: Cryptography
20
+ Classifier: Intended Audience :: Developers
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Requires-Dist: swarmauri_base
23
+ Requires-Dist: swarmauri_core
24
+ Project-URL: Documentation, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_cipher_suite_pep458#readme
25
+ Project-URL: Homepage, https://github.com/swarmauri/swarmauri-sdk
26
+ Project-URL: Source, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_cipher_suite_pep458
27
+ Description-Content-Type: text/markdown
28
+
29
+ ![Swarmauri Brand Theme](https://github.com/swarmauri/swarmauri-sdk/blob/main/assets/swarmauri.brand.theme.svg)
30
+
31
+ <p align="center">
32
+ <a href="https://pypi.org/project/swarmauri_cipher_suite_pep458/">
33
+ <img src="https://img.shields.io/badge/status-planning-blueviolet" alt="Development status" />
34
+ </a>
35
+ <a href="https://pypi.org/project/swarmauri_cipher_suite_pep458/">
36
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_cipher_suite_pep458.svg" alt="Python versions" />
37
+ </a>
38
+ <a href="https://pypi.org/project/swarmauri_cipher_suite_pep458/">
39
+ <img src="https://img.shields.io/badge/canonicalization-tuf--json-brightgreen" alt="Canonicalization" />
40
+ </a>
41
+ <a href="https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_cipher_suite_pep458">
42
+ <img src="https://img.shields.io/badge/pep%20458-policy-blue" alt="PEP 458 policy" />
43
+ </a>
44
+ </p>
45
+
46
+ ---
47
+
48
+ # swarmauri_cipher_suite_pep458
49
+
50
+ `swarmauri_cipher_suite_pep458` captures the policy surface and algorithm registry
51
+ that [PEP 458](https://peps.python.org/pep-0458/) describes for securing Python
52
+ package repositories. The suite models canonicalization, allowed algorithms, role
53
+ thresholds, and metadata lifetimes so Swarmauri services can negotiate the same
54
+ expectations when they sign or verify TUF metadata.
55
+
56
+ ## Highlights
57
+
58
+ - **Explicit role policies** – Encodes recommended thresholds, expiration windows,
59
+ and algorithm selections for the canonical `root`, `targets`, `snapshot`, and
60
+ `timestamp` metadata roles.
61
+ - **Deterministic defaults** – Advertises TUF canonical JSON (`tuf-json`) as the
62
+ canonicalization format and returns Ed25519 as the default online algorithm while
63
+ still supporting RSA-PSS-SHA256 for offline roots.
64
+ - **Descriptor normalization** – Produces rich normalized descriptors containing the
65
+ signer implementation hint (`swarmauri_signing_pep458.Pep458Signer`), canonical
66
+ preferences, and caller-specified policy overrides.
67
+ - **Compliance metadata** – Surfaces machine readable notes indicating PEP 458 and
68
+ TUF compatibility, enabling automated linting and negotiation between components.
69
+
70
+ ## Installation
71
+
72
+ ### Using `uv`
73
+
74
+ ```bash
75
+ uv add swarmauri_cipher_suite_pep458
76
+ ```
77
+
78
+ ### Using `pip`
79
+
80
+ ```bash
81
+ pip install swarmauri_cipher_suite_pep458
82
+ ```
83
+
84
+ ## Quick Usage
85
+
86
+ ```python
87
+ from swarmauri_cipher_suite_pep458 import Pep458CipherSuite
88
+
89
+ suite = Pep458CipherSuite()
90
+
91
+ print(suite.features())
92
+ # {'suite': 'pep458', 'version': 1, ...}
93
+
94
+ descriptor = suite.normalize(op="sign", params={"role": "targets", "threshold": 2})
95
+ print(descriptor["mapped"]["provider"]["signer"])
96
+ # 'swarmauri_signing_pep458.Pep458Signer'
97
+ ```
98
+
99
+ Combine the descriptor with instances of `Pep458Signer` to build automated
100
+ pipelines that enforce PEP 458's online/offline separation.
101
+
102
+ ## Role Guidance
103
+
104
+ | Role | Default Alg | Threshold | Recommended Expiration |
105
+ |------------|--------------------|-----------|------------------------|
106
+ | `root` | `RSA-PSS-SHA256` | 2 | `P365D` |
107
+ | `targets` | `Ed25519` | 1 | `P90D` |
108
+ | `snapshot` | `Ed25519` | 1 | `P14D` |
109
+ | `timestamp`| `Ed25519` | 1 | `P1D` |
110
+
111
+ These defaults mirror the best practices described in PEP 458, but you can
112
+ override them by passing parameters to `normalize` or adjusting the resulting
113
+ policy document.
114
+
115
+ ## Relationship to the Signer
116
+
117
+ This package pairs with `swarmauri_signing_pep458`, which implements the detached
118
+ signature algorithm itself. The cipher suite surfaces metadata while the signer
119
+ performs the cryptographic operations.
120
+
121
+ ## Development
122
+
123
+ - Format the code with `ruff format .` and lint with `ruff check . --fix`.
124
+ - Add or update unit tests alongside policy changes to validate normalization and
125
+ feature reporting.
126
+ - Document any new role guidance in both the README and the `policy()` payload so
127
+ downstream systems stay synchronized.
128
+
129
+ ## License
130
+
131
+ This project is licensed under the [Apache License 2.0](LICENSE).
132
+
@@ -0,0 +1,103 @@
1
+ ![Swarmauri Brand Theme](https://github.com/swarmauri/swarmauri-sdk/blob/main/assets/swarmauri.brand.theme.svg)
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.org/project/swarmauri_cipher_suite_pep458/">
5
+ <img src="https://img.shields.io/badge/status-planning-blueviolet" alt="Development status" />
6
+ </a>
7
+ <a href="https://pypi.org/project/swarmauri_cipher_suite_pep458/">
8
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_cipher_suite_pep458.svg" alt="Python versions" />
9
+ </a>
10
+ <a href="https://pypi.org/project/swarmauri_cipher_suite_pep458/">
11
+ <img src="https://img.shields.io/badge/canonicalization-tuf--json-brightgreen" alt="Canonicalization" />
12
+ </a>
13
+ <a href="https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_cipher_suite_pep458">
14
+ <img src="https://img.shields.io/badge/pep%20458-policy-blue" alt="PEP 458 policy" />
15
+ </a>
16
+ </p>
17
+
18
+ ---
19
+
20
+ # swarmauri_cipher_suite_pep458
21
+
22
+ `swarmauri_cipher_suite_pep458` captures the policy surface and algorithm registry
23
+ that [PEP 458](https://peps.python.org/pep-0458/) describes for securing Python
24
+ package repositories. The suite models canonicalization, allowed algorithms, role
25
+ thresholds, and metadata lifetimes so Swarmauri services can negotiate the same
26
+ expectations when they sign or verify TUF metadata.
27
+
28
+ ## Highlights
29
+
30
+ - **Explicit role policies** – Encodes recommended thresholds, expiration windows,
31
+ and algorithm selections for the canonical `root`, `targets`, `snapshot`, and
32
+ `timestamp` metadata roles.
33
+ - **Deterministic defaults** – Advertises TUF canonical JSON (`tuf-json`) as the
34
+ canonicalization format and returns Ed25519 as the default online algorithm while
35
+ still supporting RSA-PSS-SHA256 for offline roots.
36
+ - **Descriptor normalization** – Produces rich normalized descriptors containing the
37
+ signer implementation hint (`swarmauri_signing_pep458.Pep458Signer`), canonical
38
+ preferences, and caller-specified policy overrides.
39
+ - **Compliance metadata** – Surfaces machine readable notes indicating PEP 458 and
40
+ TUF compatibility, enabling automated linting and negotiation between components.
41
+
42
+ ## Installation
43
+
44
+ ### Using `uv`
45
+
46
+ ```bash
47
+ uv add swarmauri_cipher_suite_pep458
48
+ ```
49
+
50
+ ### Using `pip`
51
+
52
+ ```bash
53
+ pip install swarmauri_cipher_suite_pep458
54
+ ```
55
+
56
+ ## Quick Usage
57
+
58
+ ```python
59
+ from swarmauri_cipher_suite_pep458 import Pep458CipherSuite
60
+
61
+ suite = Pep458CipherSuite()
62
+
63
+ print(suite.features())
64
+ # {'suite': 'pep458', 'version': 1, ...}
65
+
66
+ descriptor = suite.normalize(op="sign", params={"role": "targets", "threshold": 2})
67
+ print(descriptor["mapped"]["provider"]["signer"])
68
+ # 'swarmauri_signing_pep458.Pep458Signer'
69
+ ```
70
+
71
+ Combine the descriptor with instances of `Pep458Signer` to build automated
72
+ pipelines that enforce PEP 458's online/offline separation.
73
+
74
+ ## Role Guidance
75
+
76
+ | Role | Default Alg | Threshold | Recommended Expiration |
77
+ |------------|--------------------|-----------|------------------------|
78
+ | `root` | `RSA-PSS-SHA256` | 2 | `P365D` |
79
+ | `targets` | `Ed25519` | 1 | `P90D` |
80
+ | `snapshot` | `Ed25519` | 1 | `P14D` |
81
+ | `timestamp`| `Ed25519` | 1 | `P1D` |
82
+
83
+ These defaults mirror the best practices described in PEP 458, but you can
84
+ override them by passing parameters to `normalize` or adjusting the resulting
85
+ policy document.
86
+
87
+ ## Relationship to the Signer
88
+
89
+ This package pairs with `swarmauri_signing_pep458`, which implements the detached
90
+ signature algorithm itself. The cipher suite surfaces metadata while the signer
91
+ performs the cryptographic operations.
92
+
93
+ ## Development
94
+
95
+ - Format the code with `ruff format .` and lint with `ruff check . --fix`.
96
+ - Add or update unit tests alongside policy changes to validate normalization and
97
+ feature reporting.
98
+ - Document any new role guidance in both the README and the `policy()` payload so
99
+ downstream systems stay synchronized.
100
+
101
+ ## License
102
+
103
+ This project is licensed under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,84 @@
1
+ [project]
2
+ name = "swarmauri_cipher_suite_pep458"
3
+ version = "0.1.0.dev25"
4
+ description = "PEP 458 policy and algorithm definitions for Swarmauri cipher suites"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10,<3.13"
7
+ license = "Apache-2.0"
8
+ keywords = [
9
+ "supply-chain",
10
+ "tuf",
11
+ "pep458",
12
+ "policy",
13
+ "cipher-suite",
14
+ "swarmauri",
15
+ "sdk",
16
+ "standards",
17
+ "cipher",
18
+ "suite",
19
+ "cryptography",
20
+ "PEP 458",
21
+ "TUF 1.x",
22
+ "The Update Framework",
23
+ "Ed25519",
24
+ "RSA-PSS-SHA256",
25
+ "RFC 8032",
26
+ "RFC 8017",
27
+ ]
28
+ authors = [
29
+ { name = "Jacob Stewart", email = "jacob@swarmauri.com" },
30
+ ]
31
+ classifiers = [
32
+ "Development Status :: 1 - Planning",
33
+ "License :: OSI Approved :: Apache Software License",
34
+ "Natural Language :: English",
35
+ "Programming Language :: Python",
36
+ "Programming Language :: Python :: 3",
37
+ "Programming Language :: Python :: 3.10",
38
+ "Programming Language :: Python :: 3.11",
39
+ "Programming Language :: Python :: 3.12",
40
+ "Topic :: Security :: Cryptography",
41
+ "Intended Audience :: Developers",
42
+ "Programming Language :: Python :: 3 :: Only",
43
+ ]
44
+ dependencies = [
45
+ "swarmauri_core",
46
+ "swarmauri_base",
47
+ ]
48
+
49
+ [project.urls]
50
+ "Homepage" = "https://github.com/swarmauri/swarmauri-sdk"
51
+ "Source" = "https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_cipher_suite_pep458"
52
+ "Documentation" = "https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_cipher_suite_pep458#readme"
53
+
54
+ [tool.uv.sources]
55
+ swarmauri_core = { workspace = true }
56
+ swarmauri_base = { workspace = true }
57
+
58
+ [tool.pytest.ini_options]
59
+ log_cli = true
60
+ log_cli_level = "INFO"
61
+ log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
62
+ log_cli_date_format = "%Y-%m-%d %H:%M:%S"
63
+ markers = [
64
+ "test: standard test",
65
+ "unit: Unit tests",
66
+ "i9n: Integration tests",
67
+ "r8n: Regression tests",
68
+ "timeout: mark test to timeout after X seconds",
69
+ "acceptance: Acceptance tests",
70
+ "perf: Performance tests",
71
+ ]
72
+
73
+ [dependency-groups]
74
+ dev = [
75
+ "pytest>=8.0",
76
+ "pytest-asyncio>=0.24.0",
77
+ "pytest-timeout>=2.3.1",
78
+ "pytest-xdist>=3.6.1",
79
+ "ruff>=0.9.9",
80
+ ]
81
+
82
+ [build-system]
83
+ requires = ["poetry-core>=1.0.0"]
84
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,143 @@
1
+ """Cipher suite describing the PEP 458 signing policy surface."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, Iterable, Mapping, Optional
6
+
7
+ from swarmauri_base.cipher_suites import CipherSuiteBase
8
+ from swarmauri_base.ComponentBase import ComponentBase
9
+ from swarmauri_core.cipher_suites import (
10
+ Alg,
11
+ CipherOp,
12
+ Features,
13
+ KeyRef,
14
+ NormalizedDescriptor,
15
+ ParamMapping,
16
+ )
17
+
18
+ _PEP458_ALGS: tuple[Alg, ...] = ("Ed25519", "RSA-PSS-SHA256")
19
+ _DEFAULT_CANON = "tuf-json"
20
+
21
+
22
+ def _infer_alg_from_key(key: Optional[KeyRef]) -> Optional[Alg]:
23
+ if not key:
24
+ return None
25
+ kty = key.get("kty")
26
+ if not kty:
27
+ return None
28
+ lowered = str(kty).lower()
29
+ if lowered in {"rsa"}:
30
+ return "RSA-PSS-SHA256"
31
+ if lowered in {"ed25519", "okp"}:
32
+ return "Ed25519"
33
+ return None
34
+
35
+
36
+ @ComponentBase.register_type(CipherSuiteBase, "Pep458CipherSuite")
37
+ class Pep458CipherSuite(CipherSuiteBase):
38
+ """Metadata policy and algorithm registry for PEP 458 repositories."""
39
+
40
+ def suite_id(self) -> str:
41
+ return "pep458"
42
+
43
+ def supports(self) -> Mapping[CipherOp, Iterable[Alg]]:
44
+ return {"sign": _PEP458_ALGS, "verify": _PEP458_ALGS}
45
+
46
+ def default_alg(self, op: CipherOp, *, for_key: Optional[KeyRef] = None) -> Alg:
47
+ inferred = _infer_alg_from_key(for_key)
48
+ if inferred:
49
+ return inferred
50
+ return "Ed25519"
51
+
52
+ def features(self) -> Features:
53
+ return {
54
+ "suite": "pep458",
55
+ "version": 1,
56
+ "dialects": {"provider": ["pep458"], "sigstore": []},
57
+ "ops": {
58
+ "sign": {"default": "Ed25519", "allowed": list(_PEP458_ALGS)},
59
+ "verify": {"default": "Ed25519", "allowed": list(_PEP458_ALGS)},
60
+ },
61
+ "constraints": {
62
+ "canonicalization": _DEFAULT_CANON,
63
+ "signature_format": "detached",
64
+ "min_threshold": 1,
65
+ },
66
+ "compliance": {"pep458": True, "tuf": "1.x"},
67
+ "notes": [
68
+ "Implements offline root and online timestamp role separation per PEP 458.",
69
+ "Pair with swarmauri_signing_pep458.Pep458Signer for signature production.",
70
+ ],
71
+ }
72
+
73
+ def policy(self) -> Mapping[str, Any]:
74
+ return {
75
+ "canonicalization": _DEFAULT_CANON,
76
+ "signature": {
77
+ "format": "tuf/pep458",
78
+ "allowed_algs": list(_PEP458_ALGS),
79
+ "detached": True,
80
+ "keyid_hash": "sha256",
81
+ },
82
+ "roles": {
83
+ "root": {"threshold": 2, "expires": "P365D", "alg": "RSA-PSS-SHA256"},
84
+ "targets": {"threshold": 1, "expires": "P90D", "alg": "Ed25519"},
85
+ "snapshot": {"threshold": 1, "expires": "P14D", "alg": "Ed25519"},
86
+ "timestamp": {"threshold": 1, "expires": "P1D", "alg": "Ed25519"},
87
+ },
88
+ }
89
+
90
+ def normalize(
91
+ self,
92
+ *,
93
+ op: CipherOp,
94
+ alg: Optional[Alg] = None,
95
+ key: Optional[KeyRef] = None,
96
+ params: Optional[ParamMapping] = None,
97
+ dialect: Optional[str] = None,
98
+ ) -> NormalizedDescriptor:
99
+ allowed = set(self.supports().get(op, ()))
100
+ chosen_alg = alg or self.default_alg(op, for_key=key)
101
+ if chosen_alg not in allowed:
102
+ raise ValueError(f"{chosen_alg} not supported for operation {op}")
103
+
104
+ resolved_params: Dict[str, Any] = dict(params or {})
105
+ canon = resolved_params.pop("canon", _DEFAULT_CANON)
106
+ role = resolved_params.pop("role", resolved_params.pop("tuf_role", "generic"))
107
+ threshold = int(resolved_params.pop("threshold", 1))
108
+
109
+ mapped = {
110
+ "provider": {
111
+ "suite": "pep458",
112
+ "signer": "swarmauri_signing_pep458.Pep458Signer",
113
+ "alg": chosen_alg,
114
+ "canon": canon,
115
+ "role": role,
116
+ }
117
+ }
118
+
119
+ params_out = {
120
+ "canon": canon,
121
+ "role": role,
122
+ "threshold": threshold,
123
+ }
124
+ if resolved_params:
125
+ params_out.update(resolved_params)
126
+
127
+ constraints = {
128
+ "threshold": threshold,
129
+ "detached": True,
130
+ }
131
+
132
+ return {
133
+ "op": op,
134
+ "alg": chosen_alg,
135
+ "dialect": "provider" if dialect is None else dialect,
136
+ "mapped": mapped,
137
+ "params": params_out,
138
+ "constraints": constraints,
139
+ "policy": self.policy(),
140
+ }
141
+
142
+
143
+ __all__ = ["Pep458CipherSuite"]
@@ -0,0 +1,5 @@
1
+ """PEP 458 cipher suite exports."""
2
+
3
+ from .Pep458CipherSuite import Pep458CipherSuite
4
+
5
+ __all__ = ["Pep458CipherSuite"]