MediaSigner 0.6.6.dev1__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.
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0}/MediaSigner/_signer.py +20 -5
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0}/MediaSigner/cli.py +24 -8
- mediasigner-0.11.0/NOTICE +7 -0
- mediasigner-0.11.0/PKG-INFO +490 -0
- mediasigner-0.11.0/README.md +438 -0
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0}/pyproject.toml +54 -5
- mediasigner-0.6.6.dev1/PKG-INFO +0 -208
- mediasigner-0.6.6.dev1/README.md +0 -156
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0}/LICENSE +0 -0
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0}/MediaSigner/__init__.py +0 -0
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import (
|
|
6
|
+
AsyncIterable,
|
|
7
|
+
Iterable,
|
|
8
|
+
Mapping,
|
|
9
|
+
MutableMapping,
|
|
10
|
+
Optional,
|
|
11
|
+
Sequence,
|
|
12
|
+
)
|
|
6
13
|
|
|
7
14
|
from swarmauri_base.ComponentBase import ComponentBase, ResourceTypes
|
|
8
15
|
from swarmauri_base.signing.SigningBase import SigningBase
|
|
@@ -39,7 +46,9 @@ except Exception: # pragma: no cover - plugin optional
|
|
|
39
46
|
|
|
40
47
|
|
|
41
48
|
class MediaSigner(ComponentBase):
|
|
42
|
-
"""
|
|
49
|
+
"""
|
|
50
|
+
High-level async facade that routes signing calls to registered plugins.
|
|
51
|
+
"""
|
|
43
52
|
|
|
44
53
|
resource: Optional[str] = ResourceTypes.SIGNING.value
|
|
45
54
|
type: str = "MediaSigner"
|
|
@@ -88,7 +97,9 @@ class MediaSigner(ComponentBase):
|
|
|
88
97
|
alg: Optional[Alg] = None,
|
|
89
98
|
opts: Optional[Mapping[str, object]] = None,
|
|
90
99
|
) -> Sequence[Signature]:
|
|
91
|
-
return await self._resolve(fmt).sign_bytes(
|
|
100
|
+
return await self._resolve(fmt).sign_bytes(
|
|
101
|
+
key, payload, alg=alg, opts=opts
|
|
102
|
+
)
|
|
92
103
|
|
|
93
104
|
async def sign_digest(
|
|
94
105
|
self,
|
|
@@ -99,7 +110,9 @@ class MediaSigner(ComponentBase):
|
|
|
99
110
|
alg: Optional[Alg] = None,
|
|
100
111
|
opts: Optional[Mapping[str, object]] = None,
|
|
101
112
|
) -> Sequence[Signature]:
|
|
102
|
-
return await self._resolve(fmt).sign_digest(
|
|
113
|
+
return await self._resolve(fmt).sign_digest(
|
|
114
|
+
key, digest, alg=alg, opts=opts
|
|
115
|
+
)
|
|
103
116
|
|
|
104
117
|
async def verify_bytes(
|
|
105
118
|
self,
|
|
@@ -162,7 +175,9 @@ class MediaSigner(ComponentBase):
|
|
|
162
175
|
alg: Optional[Alg] = None,
|
|
163
176
|
opts: Optional[Mapping[str, object]] = None,
|
|
164
177
|
) -> Sequence[Signature]:
|
|
165
|
-
return await self._resolve(fmt).sign_stream(
|
|
178
|
+
return await self._resolve(fmt).sign_stream(
|
|
179
|
+
key, payload, alg=alg, opts=opts
|
|
180
|
+
)
|
|
166
181
|
|
|
167
182
|
async def verify_envelope(
|
|
168
183
|
self,
|
|
@@ -69,7 +69,9 @@ def _signature_from_json(data: Mapping[str, Any]) -> MutableMapping[str, Any]:
|
|
|
69
69
|
and isinstance(value[0], Mapping)
|
|
70
70
|
and "b64" in value[0]
|
|
71
71
|
):
|
|
72
|
-
result[key] = tuple(
|
|
72
|
+
result[key] = tuple(
|
|
73
|
+
base64.b64decode(str(entry["b64"])) for entry in value
|
|
74
|
+
)
|
|
73
75
|
else:
|
|
74
76
|
result[key] = value
|
|
75
77
|
return result
|
|
@@ -81,13 +83,17 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
81
83
|
)
|
|
82
84
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
83
85
|
|
|
84
|
-
list_parser = subparsers.add_parser(
|
|
86
|
+
list_parser = subparsers.add_parser(
|
|
87
|
+
"list", help="List discovered signing formats"
|
|
88
|
+
)
|
|
85
89
|
list_parser.set_defaults(func=_cmd_list)
|
|
86
90
|
|
|
87
91
|
supports_parser = subparsers.add_parser(
|
|
88
92
|
"supports", help="Describe plugin capabilities"
|
|
89
93
|
)
|
|
90
|
-
supports_parser.add_argument(
|
|
94
|
+
supports_parser.add_argument(
|
|
95
|
+
"format", help="Format token, e.g. jws or cms"
|
|
96
|
+
)
|
|
91
97
|
supports_parser.add_argument(
|
|
92
98
|
"--key-ref", dest="key_ref", help="Optional key reference string"
|
|
93
99
|
)
|
|
@@ -97,15 +103,23 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
97
103
|
"sign-bytes", help="Sign raw bytes using a plugin"
|
|
98
104
|
)
|
|
99
105
|
sign_parser.add_argument("format", help="Format token")
|
|
100
|
-
sign_parser.add_argument("--alg", dest="alg", help="Algorithm hint for the signer")
|
|
101
106
|
sign_parser.add_argument(
|
|
102
|
-
"--
|
|
107
|
+
"--alg", dest="alg", help="Algorithm hint for the signer"
|
|
108
|
+
)
|
|
109
|
+
sign_parser.add_argument(
|
|
110
|
+
"--key",
|
|
111
|
+
required=True,
|
|
112
|
+
help="Path to a JSON file describing the KeyRef",
|
|
113
|
+
)
|
|
114
|
+
sign_parser.add_argument(
|
|
115
|
+
"--input", required=True, help="Payload file to sign"
|
|
103
116
|
)
|
|
104
|
-
sign_parser.add_argument("--input", required=True, help="Payload file to sign")
|
|
105
117
|
sign_parser.add_argument(
|
|
106
118
|
"--output", help="Write signatures to this file (defaults to stdout)"
|
|
107
119
|
)
|
|
108
|
-
sign_parser.add_argument(
|
|
120
|
+
sign_parser.add_argument(
|
|
121
|
+
"--opts", help="Path to JSON options passed to the signer"
|
|
122
|
+
)
|
|
109
123
|
sign_parser.set_defaults(func=_cmd_sign_bytes)
|
|
110
124
|
|
|
111
125
|
verify_parser = subparsers.add_parser(
|
|
@@ -163,7 +177,9 @@ async def _cmd_verify_bytes(args: argparse.Namespace) -> int:
|
|
|
163
177
|
if not isinstance(sig_payload, list):
|
|
164
178
|
raise SystemExit("--sigs must point to a JSON array")
|
|
165
179
|
signature_payloads = [_signature_from_json(entry) for entry in sig_payload]
|
|
166
|
-
signature_entries = [
|
|
180
|
+
signature_entries = [
|
|
181
|
+
Signature(**dict(entry)) for entry in signature_payloads
|
|
182
|
+
]
|
|
167
183
|
opts = _load_json_file(args.opts)
|
|
168
184
|
require = _load_json_file(args.require)
|
|
169
185
|
ok = await signer.verify_bytes(
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MediaSigner
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: Swarmauri signing facade plugin that aggregates registered SigningBase providers.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: swarmauri,digital-signatures,media,cryptography,plugin,orchestration,asyncio,signature-aggregation,workflow-automation,key-management,verification,digital-asset-security,media-compliance,cms,pkcs7,cades,jws,openpgp,pdf-signatures,xmldsig
|
|
9
|
+
Author: Jacob Stewart
|
|
10
|
+
Author-email: jacob@swarmauri.com
|
|
11
|
+
Requires-Python: >=3.10,<3.15
|
|
12
|
+
Classifier: Development Status :: 1 - Planning
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Framework :: AsyncIO
|
|
16
|
+
Classifier: Topic :: Security :: Cryptography
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
19
|
+
Classifier: Topic :: Multimedia :: Video
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Programming Language :: Python
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
29
|
+
Provides-Extra: plugins
|
|
30
|
+
Requires-Dist: cryptography (>=42.0.0)
|
|
31
|
+
Requires-Dist: swarmauri_base
|
|
32
|
+
Requires-Dist: swarmauri_core
|
|
33
|
+
Requires-Dist: swarmauri_keyprovider_inmemory
|
|
34
|
+
Requires-Dist: swarmauri_signing_cms
|
|
35
|
+
Requires-Dist: swarmauri_signing_cms ; extra == "plugins"
|
|
36
|
+
Requires-Dist: swarmauri_signing_jws
|
|
37
|
+
Requires-Dist: swarmauri_signing_jws ; extra == "plugins"
|
|
38
|
+
Requires-Dist: swarmauri_signing_openpgp
|
|
39
|
+
Requires-Dist: swarmauri_signing_openpgp ; extra == "plugins"
|
|
40
|
+
Requires-Dist: swarmauri_signing_pdf
|
|
41
|
+
Requires-Dist: swarmauri_signing_pdf ; extra == "plugins"
|
|
42
|
+
Requires-Dist: swarmauri_signing_xmld
|
|
43
|
+
Requires-Dist: swarmauri_signing_xmld ; extra == "plugins"
|
|
44
|
+
Project-URL: Changelog, https://github.com/swarmauri/swarmauri-sdk/releases
|
|
45
|
+
Project-URL: Documentation, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/60-plugins/media_signer#readme
|
|
46
|
+
Project-URL: Discussions, https://github.com/orgs/swarmauri/discussions
|
|
47
|
+
Project-URL: Homepage, https://github.com/swarmauri/swarmauri-sdk
|
|
48
|
+
Project-URL: Issues, https://github.com/swarmauri/swarmauri-sdk/issues
|
|
49
|
+
Project-URL: Source, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/60-plugins/media_signer
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
# MediaSigner
|
|
53
|
+
|
|
54
|
+
<!-- readme-standards:begin branding -->
|
|
55
|
+
<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>
|
|
56
|
+
<p align="center"><strong>MediaSigner</strong></p>
|
|
57
|
+
<p align="center">Swarmauri signing facade plugin that aggregates registered SigningBase providers.</p>
|
|
58
|
+
<p align="center">
|
|
59
|
+
<a href="https://pypi.org/project/MediaSigner/"><img alt="pypi: MediaSigner" src="https://img.shields.io/pypi/v/MediaSigner?labelColor=1E293B&color=1D4ED8"></a>
|
|
60
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/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>
|
|
61
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/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>
|
|
62
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/pyproject.toml"><img alt="Layer: plugins" src="https://img.shields.io/static/v1?label=Layer&message=plugins&labelColor=1E293B&color=6D28D9"></a>
|
|
63
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/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>
|
|
64
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/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>
|
|
65
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
66
|
+
</p>
|
|
67
|
+
<p align="center">
|
|
68
|
+
<a href="https://pypi.org/project/MediaSigner/"><img alt="Monthly PyPI downloads: MediaSigner" src="https://img.shields.io/pypi/dm/MediaSigner?labelColor=1E293B&color=0E7490"></a>
|
|
69
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/README.md"><img alt="README hits: MediaSigner" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/60-plugins/media_signer/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
70
|
+
</p>
|
|
71
|
+
<p align="center">
|
|
72
|
+
<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>
|
|
73
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/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>
|
|
74
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/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>
|
|
75
|
+
<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>
|
|
76
|
+
<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>
|
|
77
|
+
</p>
|
|
78
|
+
<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>
|
|
79
|
+
<!-- readme-standards:end branding -->
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Overview
|
|
84
|
+
|
|
85
|
+
### Summary
|
|
86
|
+
|
|
87
|
+
MediaSigner packages the asynchronous `Signer` facade that orchestrates registered
|
|
88
|
+
`SigningBase` providers. Moving the facade into a standalone plugin keeps the
|
|
89
|
+
core standards library lightweight while still enabling drop-in discovery of
|
|
90
|
+
specialised signers such as CMS, JWS, OpenPGP, PDF, and XMLDSig providers.
|
|
91
|
+
|
|
92
|
+
### Why This Package
|
|
93
|
+
|
|
94
|
+
* **Separation of concerns** ? standards remain focused on common abstractions
|
|
95
|
+
while the plugin encapsulates optional dependencies.
|
|
96
|
+
* **Explicit opt-in** ? downstream projects can install only the signing stacks
|
|
97
|
+
they need via the curated extras.
|
|
98
|
+
* **Consistent ergonomics** ? usage matches the historical
|
|
99
|
+
`swarmauri_standard.signing.Signer` import, preserving existing tutorials and
|
|
100
|
+
code samples.
|
|
101
|
+
|
|
102
|
+
### When to Use
|
|
103
|
+
|
|
104
|
+
Choose `MediaSigner` when your integration needs swarmauri signing facade plugin that aggregates registered SigningBase providers. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
105
|
+
|
|
106
|
+
### Features
|
|
107
|
+
|
|
108
|
+
- **Unified signing façade** ? talk to every installed `SigningBase` through a
|
|
109
|
+
single async API that automatically discovers entry-point contributions.
|
|
110
|
+
- **Format-aware routing** ? delegates signing and verification to the provider
|
|
111
|
+
registered for a format token such as `jws`, `pdf`, or `xmld`.
|
|
112
|
+
- **Optional plugin bundles** ? install curated extras (e.g. `[plugins]`) to
|
|
113
|
+
bring in all available signer backends in one step.
|
|
114
|
+
- **Key-provider integration** ? share Swarmauri key providers with the facade
|
|
115
|
+
so opaque key references resolve before signature creation.
|
|
116
|
+
- **Production-ready CLI** ? inspect capabilities, sign payloads, and verify
|
|
117
|
+
results directly from the command line for fast automation.
|
|
118
|
+
|
|
119
|
+
### Non-Goals
|
|
120
|
+
|
|
121
|
+
`MediaSigner` owns swarmauri signing facade plugin that aggregates registered SigningBase providers. 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.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Getting Started
|
|
126
|
+
|
|
127
|
+
### Prerequisites
|
|
128
|
+
|
|
129
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `swarmauri-keyprovider-inmemory`, `cryptography`, `swarmauri-signing-cms`, `swarmauri-signing-jws`, `swarmauri-signing-openpgp`, `swarmauri-signing-pdf`, `swarmauri-signing-xmld`. Read the example’s inputs and service requirements before execution.
|
|
130
|
+
|
|
131
|
+
### Installation
|
|
132
|
+
|
|
133
|
+
**Using uv**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
uv add MediaSigner
|
|
137
|
+
|
|
138
|
+
# install every optional backend
|
|
139
|
+
uv add "MediaSigner[plugins]"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The `[plugins]` extra pulls in CMS, JWS, OpenPGP, PDF, and XMLDSig signers.
|
|
143
|
+
|
|
144
|
+
**Using pip**
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
pip install MediaSigner
|
|
148
|
+
|
|
149
|
+
# with every optional backend
|
|
150
|
+
pip install "MediaSigner[plugins]"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### uv
|
|
154
|
+
|
|
155
|
+
<!-- readme-standards:begin installation.uv -->
|
|
156
|
+
```bash
|
|
157
|
+
uv add MediaSigner
|
|
158
|
+
```
|
|
159
|
+
<!-- readme-standards:end installation.uv -->
|
|
160
|
+
|
|
161
|
+
#### pip
|
|
162
|
+
|
|
163
|
+
<!-- readme-standards:begin installation.pip -->
|
|
164
|
+
```bash
|
|
165
|
+
python -m pip install MediaSigner
|
|
166
|
+
```
|
|
167
|
+
<!-- readme-standards:end installation.pip -->
|
|
168
|
+
|
|
169
|
+
#### Poetry
|
|
170
|
+
|
|
171
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
172
|
+
```bash
|
|
173
|
+
poetry add MediaSigner
|
|
174
|
+
```
|
|
175
|
+
<!-- readme-standards:end installation.poetry -->
|
|
176
|
+
|
|
177
|
+
### Quick Start
|
|
178
|
+
|
|
179
|
+
#### Example
|
|
180
|
+
|
|
181
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
182
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/docs/readme/quick_start.py).
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
import asyncio
|
|
186
|
+
|
|
187
|
+
from MediaSigner import MediaSigner
|
|
188
|
+
from swarmauri_core.key_providers.IKeyProvider import IKeyProvider
|
|
189
|
+
|
|
190
|
+
# Optionally pass a key provider so plugins receive a shared source for
|
|
191
|
+
# retrieving signing material.
|
|
192
|
+
key_provider: IKeyProvider | None = None
|
|
193
|
+
signer = MediaSigner(key_provider=key_provider)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
async def sign_payload(payload: bytes) -> None:
|
|
197
|
+
signatures = await signer.sign_bytes("jws", key="my-key", payload=payload)
|
|
198
|
+
assert signatures, "At least one signature should be returned"
|
|
199
|
+
print(signer.supports("jws"))
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
asyncio.run(sign_payload(b"payload"))
|
|
203
|
+
```
|
|
204
|
+
<!-- readme-standards:end example.quick-start -->
|
|
205
|
+
|
|
206
|
+
#### Expected Result
|
|
207
|
+
|
|
208
|
+
The example demonstrates the documented `MediaSigner` 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.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Usage
|
|
213
|
+
|
|
214
|
+
### Common Workflows
|
|
215
|
+
|
|
216
|
+
<!-- readme-standards:begin example.usage -->
|
|
217
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/docs/readme/usage.py).
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
import asyncio
|
|
221
|
+
|
|
222
|
+
from MediaSigner import MediaSigner
|
|
223
|
+
from swarmauri_core.key_providers.IKeyProvider import IKeyProvider
|
|
224
|
+
|
|
225
|
+
# Optionally pass a key provider so plugins receive a shared source for
|
|
226
|
+
# retrieving signing material.
|
|
227
|
+
key_provider: IKeyProvider | None = None
|
|
228
|
+
signer = MediaSigner(key_provider=key_provider)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
async def sign_payload(payload: bytes) -> None:
|
|
232
|
+
signatures = await signer.sign_bytes("jws", key="my-key", payload=payload)
|
|
233
|
+
assert signatures, "At least one signature should be returned"
|
|
234
|
+
print(signer.supports("jws"))
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
asyncio.run(sign_payload(b"payload"))
|
|
238
|
+
```
|
|
239
|
+
<!-- readme-standards:end example.usage -->
|
|
240
|
+
|
|
241
|
+
**Integrating a key provider**
|
|
242
|
+
|
|
243
|
+
Any Swarmauri key provider can be shared with the facade so backends receive
|
|
244
|
+
ready-to-use key material:
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
import asyncio
|
|
248
|
+
|
|
249
|
+
from MediaSigner import MediaSigner
|
|
250
|
+
from swarmauri_keyprovider_inmemory import InMemoryKeyProvider
|
|
251
|
+
|
|
252
|
+
provider = InMemoryKeyProvider(keys={"local://demo": b"secret"})
|
|
253
|
+
signer = MediaSigner(key_provider=provider)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
async def main() -> None:
|
|
257
|
+
signatures = await signer.sign_bytes(
|
|
258
|
+
"jws",
|
|
259
|
+
key="local://demo",
|
|
260
|
+
payload=b"demo",
|
|
261
|
+
alg="HS256",
|
|
262
|
+
opts={"kid": "demo"},
|
|
263
|
+
)
|
|
264
|
+
print(signatures[0].mode)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
asyncio.run(main())
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Discover installed plugins**
|
|
271
|
+
|
|
272
|
+
Use the facade to list installed signers and inspect their capabilities:
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
for format_name in signer.supported_formats():
|
|
276
|
+
capabilities = signer.supports(format_name)
|
|
277
|
+
print(format_name, list(capabilities))
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Configuration
|
|
281
|
+
|
|
282
|
+
Configure `MediaSigner` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/MediaSigner/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
283
|
+
|
|
284
|
+
### Error Handling
|
|
285
|
+
|
|
286
|
+
The inspected `MediaSigner` source raises `SystemExit`, `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
287
|
+
|
|
288
|
+
### Best Practices
|
|
289
|
+
|
|
290
|
+
Use the explicit `MediaSigner` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `MediaSigner`; an import or successful installation alone does not establish its runtime guarantees.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Package Boundary
|
|
295
|
+
|
|
296
|
+
### What It Owns
|
|
297
|
+
|
|
298
|
+
`MediaSigner` is located in `plugins` and owns swarmauri signing facade plugin that aggregates registered SigningBase providers. Source-declared APIs include `MediaSigner`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/pyproject.toml) records its direct dependency boundary.
|
|
299
|
+
|
|
300
|
+
### Public API and Import Surfaces
|
|
301
|
+
|
|
302
|
+
Import namespace: `MediaSigner`.
|
|
303
|
+
|
|
304
|
+
Source-declared exports or types: `MediaSigner`.
|
|
305
|
+
|
|
306
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/MediaSigner/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
307
|
+
|
|
308
|
+
### Entry Points
|
|
309
|
+
|
|
310
|
+
<!-- readme-standards:begin entry-points -->
|
|
311
|
+
- `console_scripts` → `media-signer` → `MediaSigner.cli:main`
|
|
312
|
+
<!-- readme-standards:end entry-points -->
|
|
313
|
+
|
|
314
|
+
### Injected Dependencies
|
|
315
|
+
|
|
316
|
+
The direct installation dependencies of `MediaSigner` are `swarmauri-core`, `swarmauri-base`, `swarmauri-keyprovider-inmemory`, `cryptography`, `swarmauri-signing-cms`, `swarmauri-signing-jws`, `swarmauri-signing-openpgp`, `swarmauri-signing-pdf`, `swarmauri-signing-xmld`. 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/60-plugins/media_signer/MediaSigner/__init__.py).
|
|
317
|
+
|
|
318
|
+
### Protocol Consumers
|
|
319
|
+
|
|
320
|
+
Direct consumers in this checkout’s package manifests include `EmbeddedSigner`. These edges describe declared dependencies, not protocol-conformance evidence.
|
|
321
|
+
|
|
322
|
+
### Extensions
|
|
323
|
+
|
|
324
|
+
For `MediaSigner`, use the source-declared public interfaces (`MediaSigner`) 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.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Operations and Readiness
|
|
329
|
+
|
|
330
|
+
### Operational Requirements
|
|
331
|
+
|
|
332
|
+
Operate `MediaSigner` 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/60-plugins/media_signer/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
333
|
+
|
|
334
|
+
### Health and Observability
|
|
335
|
+
|
|
336
|
+
This README does not establish a standalone health endpoint for `MediaSigner`. 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.
|
|
337
|
+
|
|
338
|
+
### Security and Resource Limits
|
|
339
|
+
|
|
340
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/MediaSigner/__init__.py). The `MediaSigner` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
341
|
+
|
|
342
|
+
### Compatibility
|
|
343
|
+
|
|
344
|
+
This source version of `MediaSigner` 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.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Verification
|
|
349
|
+
|
|
350
|
+
### Tests
|
|
351
|
+
|
|
352
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `MediaSigner` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
353
|
+
|
|
354
|
+
- [tests/test_media_signer_cli.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/tests/test_media_signer_cli.py)
|
|
355
|
+
- [tests/test_media_signer_cms.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/tests/test_media_signer_cms.py)
|
|
356
|
+
- [tests/test_media_signer_jws.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/tests/test_media_signer_jws.py)
|
|
357
|
+
- [tests/test_media_signer_openpgp.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/tests/test_media_signer_openpgp.py)
|
|
358
|
+
- [tests/test_media_signer_pdf.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/tests/test_media_signer_pdf.py)
|
|
359
|
+
|
|
360
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
361
|
+
|
|
362
|
+
### Certification Status
|
|
363
|
+
|
|
364
|
+
No external certification is asserted for `MediaSigner` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
365
|
+
|
|
366
|
+
### Evidence
|
|
367
|
+
|
|
368
|
+
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/60-plugins/media_signer/MediaSigner/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## FAQ
|
|
373
|
+
|
|
374
|
+
### Why
|
|
375
|
+
|
|
376
|
+
**Why select this package?** `MediaSigner` provides swarmauri signing facade plugin that aggregates registered SigningBase providers; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
377
|
+
|
|
378
|
+
### How
|
|
379
|
+
|
|
380
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `MediaSigner`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/MediaSigner/__init__.py) for the exact types and signatures involved.
|
|
381
|
+
|
|
382
|
+
### When
|
|
383
|
+
|
|
384
|
+
**When should I validate an upgrade?** Recheck `MediaSigner` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Documentation and Related Packages
|
|
389
|
+
|
|
390
|
+
### More Documentation
|
|
391
|
+
|
|
392
|
+
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/60-plugins/media_signer/MediaSigner/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/pyproject.toml) provide the supporting context for `MediaSigner`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
393
|
+
|
|
394
|
+
### Related Packages
|
|
395
|
+
|
|
396
|
+
- [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.
|
|
397
|
+
- [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.
|
|
398
|
+
- [swarmauri_keyprovider_inmemory](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_keyprovider_inmemory/README.md): In-memory key provider for Swarmauri
|
|
399
|
+
- [swarmauri_signing_cms](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_signing_cms/README.md): CMS signer stub registered on the Swarmauri SigningBase registry
|
|
400
|
+
- [swarmauri_signing_jws](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_signing_jws/README.md): Composite JWS signer/verifier for Swarmauri
|
|
401
|
+
- [swarmauri_signing_openpgp](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_signing_openpgp/README.md): OpenPGP signer stub registered on the Swarmauri SigningBase registry
|
|
402
|
+
- [swarmauri_signing_pdf](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_signing_pdf/README.md): PDF signer built atop the Swarmauri CMS implementation
|
|
403
|
+
- [swarmauri_signing_xmld](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_signing_xmld/README.md): XML Digital Signature implementation for the Swarmauri SigningBase registry
|
|
404
|
+
|
|
405
|
+
### Project Links
|
|
406
|
+
|
|
407
|
+
<!-- readme-standards:begin project-links -->
|
|
408
|
+
- [Changelog](https://github.com/swarmauri/swarmauri-sdk/releases)
|
|
409
|
+
- [Discussions](https://github.com/orgs/swarmauri/discussions)
|
|
410
|
+
- [Documentation](https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/60-plugins/media_signer#readme)
|
|
411
|
+
- [Homepage](https://github.com/swarmauri/swarmauri-sdk)
|
|
412
|
+
- [Issues](https://github.com/swarmauri/swarmauri-sdk/issues)
|
|
413
|
+
- [Source](https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/60-plugins/media_signer)
|
|
414
|
+
- [pypi: MediaSigner](https://pypi.org/project/MediaSigner/)
|
|
415
|
+
<!-- readme-standards:end project-links -->
|
|
416
|
+
|
|
417
|
+
- Source: <https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/60-plugins/media_signer>
|
|
418
|
+
- Documentation: <https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/60-plugins/media_signer#readme>
|
|
419
|
+
- Issues: <https://github.com/swarmauri/swarmauri-sdk/issues>
|
|
420
|
+
- Releases: <https://github.com/swarmauri/swarmauri-sdk/releases>
|
|
421
|
+
- Discussions: <https://github.com/orgs/swarmauri/discussions>
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Contributing
|
|
426
|
+
|
|
427
|
+
### How to Contribute
|
|
428
|
+
|
|
429
|
+
Follow the [contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) and include a focused example or regression for changes to `MediaSigner`. Keep package behavior, its documented boundary, and its tests aligned.
|
|
430
|
+
|
|
431
|
+
### Development Setup
|
|
432
|
+
|
|
433
|
+
Work from the `pkgs/60-plugins/media_signer` 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.
|
|
434
|
+
|
|
435
|
+
### Notes for Maintainers
|
|
436
|
+
|
|
437
|
+
**Command line utility**
|
|
438
|
+
|
|
439
|
+
MediaSigner ships a small CLI for quick inspection and automation:
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
media-signer list # List available formats
|
|
443
|
+
media-signer supports jws # Show capability metadata
|
|
444
|
+
media-signer sign-bytes jws \
|
|
445
|
+
--alg HS256 \
|
|
446
|
+
--key key.json \
|
|
447
|
+
--input payload.bin \
|
|
448
|
+
--output signatures.json
|
|
449
|
+
|
|
450
|
+
media-signer verify-bytes jws \
|
|
451
|
+
--input payload.bin \
|
|
452
|
+
--sigs signatures.json \
|
|
453
|
+
--opts verify-keys.json
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
The CLI expects JSON files describing `KeyRef` objects and verification
|
|
457
|
+
materials matching the selected plugin.
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## Governance
|
|
462
|
+
|
|
463
|
+
### Ownership and Decision Making
|
|
464
|
+
|
|
465
|
+
Changes to `MediaSigner` 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/60-plugins/media_signer/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
466
|
+
|
|
467
|
+
### Standards and Policies
|
|
468
|
+
|
|
469
|
+
`MediaSigner` 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.
|
|
470
|
+
|
|
471
|
+
### Lifecycle and Migration
|
|
472
|
+
|
|
473
|
+
The `MediaSigner` source version is `0.11.0`.
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## License and Attribution
|
|
478
|
+
|
|
479
|
+
### License
|
|
480
|
+
|
|
481
|
+
<!-- readme-standards:begin license -->
|
|
482
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/LICENSE).
|
|
483
|
+
<!-- readme-standards:end license -->
|
|
484
|
+
|
|
485
|
+
### Notices
|
|
486
|
+
|
|
487
|
+
<!-- readme-standards:begin notices -->
|
|
488
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/media_signer/NOTICE) for attribution.
|
|
489
|
+
<!-- readme-standards:end notices -->
|
|
490
|
+
|