MediaSigner 0.6.6.dev1__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.
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0.dev1}/MediaSigner/_signer.py +20 -5
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0.dev1}/MediaSigner/cli.py +24 -8
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0.dev1}/PKG-INFO +13 -10
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0.dev1}/README.md +12 -9
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0.dev1}/pyproject.toml +2 -2
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0.dev1}/LICENSE +0 -0
- {mediasigner-0.6.6.dev1 → mediasigner-0.11.0.dev1}/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(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MediaSigner
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev1
|
|
4
4
|
Summary: Swarmauri signing facade plugin that aggregates registered SigningBase providers.
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -62,7 +62,8 @@ Description-Content-Type: text/markdown
|
|
|
62
62
|
<img src="https://img.shields.io/pypi/l/MediaSigner" alt="PyPI - License"/></a>
|
|
63
63
|
<a href="https://pypi.org/project/MediaSigner/">
|
|
64
64
|
<img src="https://img.shields.io/pypi/v/MediaSigner?label=MediaSigner&color=green" alt="PyPI - MediaSigner"/></a>
|
|
65
|
-
|
|
65
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
66
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
66
67
|
|
|
67
68
|
MediaSigner packages the asynchronous `Signer` facade that orchestrates registered
|
|
68
69
|
`SigningBase` providers. Moving the facade into a standalone plugin keeps the
|
|
@@ -71,15 +72,15 @@ specialised signers such as CMS, JWS, OpenPGP, PDF, and XMLDSig providers.
|
|
|
71
72
|
|
|
72
73
|
## Features
|
|
73
74
|
|
|
74
|
-
- **Unified signing façade**
|
|
75
|
+
- **Unified signing façade** ? talk to every installed `SigningBase` through a
|
|
75
76
|
single async API that automatically discovers entry-point contributions.
|
|
76
|
-
- **Format-aware routing**
|
|
77
|
+
- **Format-aware routing** ? delegates signing and verification to the provider
|
|
77
78
|
registered for a format token such as `jws`, `pdf`, or `xmld`.
|
|
78
|
-
- **Optional plugin bundles**
|
|
79
|
+
- **Optional plugin bundles** ? install curated extras (e.g. `[plugins]`) to
|
|
79
80
|
bring in all available signer backends in one step.
|
|
80
|
-
- **Key-provider integration**
|
|
81
|
+
- **Key-provider integration** ? share Swarmauri key providers with the facade
|
|
81
82
|
so opaque key references resolve before signature creation.
|
|
82
|
-
- **Production-ready CLI**
|
|
83
|
+
- **Production-ready CLI** ? inspect capabilities, sign payloads, and verify
|
|
83
84
|
results directly from the command line for fast automation.
|
|
84
85
|
|
|
85
86
|
## Installation
|
|
@@ -168,11 +169,11 @@ for format_name in signer.supported_formats():
|
|
|
168
169
|
|
|
169
170
|
### Why this structure?
|
|
170
171
|
|
|
171
|
-
* **Separation of concerns**
|
|
172
|
+
* **Separation of concerns** ? standards remain focused on common abstractions
|
|
172
173
|
while the plugin encapsulates optional dependencies.
|
|
173
|
-
* **Explicit opt-in**
|
|
174
|
+
* **Explicit opt-in** ? downstream projects can install only the signing stacks
|
|
174
175
|
they need via the curated extras.
|
|
175
|
-
* **Consistent ergonomics**
|
|
176
|
+
* **Consistent ergonomics** ? usage matches the historical
|
|
176
177
|
`swarmauri_standard.signing.Signer` import, preserving existing tutorials and
|
|
177
178
|
code samples.
|
|
178
179
|
|
|
@@ -206,3 +207,5 @@ materials matching the selected plugin.
|
|
|
206
207
|
- Releases: <https://github.com/swarmauri/swarmauri-sdk/releases>
|
|
207
208
|
- Discussions: <https://github.com/orgs/swarmauri/discussions>
|
|
208
209
|
|
|
210
|
+
|
|
211
|
+
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
<img src="https://img.shields.io/pypi/l/MediaSigner" alt="PyPI - License"/></a>
|
|
12
12
|
<a href="https://pypi.org/project/MediaSigner/">
|
|
13
13
|
<img src="https://img.shields.io/pypi/v/MediaSigner?label=MediaSigner&color=green" alt="PyPI - MediaSigner"/></a>
|
|
14
|
-
|
|
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>
|
|
15
16
|
|
|
16
17
|
MediaSigner packages the asynchronous `Signer` facade that orchestrates registered
|
|
17
18
|
`SigningBase` providers. Moving the facade into a standalone plugin keeps the
|
|
@@ -20,15 +21,15 @@ specialised signers such as CMS, JWS, OpenPGP, PDF, and XMLDSig providers.
|
|
|
20
21
|
|
|
21
22
|
## Features
|
|
22
23
|
|
|
23
|
-
- **Unified signing façade**
|
|
24
|
+
- **Unified signing façade** ? talk to every installed `SigningBase` through a
|
|
24
25
|
single async API that automatically discovers entry-point contributions.
|
|
25
|
-
- **Format-aware routing**
|
|
26
|
+
- **Format-aware routing** ? delegates signing and verification to the provider
|
|
26
27
|
registered for a format token such as `jws`, `pdf`, or `xmld`.
|
|
27
|
-
- **Optional plugin bundles**
|
|
28
|
+
- **Optional plugin bundles** ? install curated extras (e.g. `[plugins]`) to
|
|
28
29
|
bring in all available signer backends in one step.
|
|
29
|
-
- **Key-provider integration**
|
|
30
|
+
- **Key-provider integration** ? share Swarmauri key providers with the facade
|
|
30
31
|
so opaque key references resolve before signature creation.
|
|
31
|
-
- **Production-ready CLI**
|
|
32
|
+
- **Production-ready CLI** ? inspect capabilities, sign payloads, and verify
|
|
32
33
|
results directly from the command line for fast automation.
|
|
33
34
|
|
|
34
35
|
## Installation
|
|
@@ -117,11 +118,11 @@ for format_name in signer.supported_formats():
|
|
|
117
118
|
|
|
118
119
|
### Why this structure?
|
|
119
120
|
|
|
120
|
-
* **Separation of concerns**
|
|
121
|
+
* **Separation of concerns** ? standards remain focused on common abstractions
|
|
121
122
|
while the plugin encapsulates optional dependencies.
|
|
122
|
-
* **Explicit opt-in**
|
|
123
|
+
* **Explicit opt-in** ? downstream projects can install only the signing stacks
|
|
123
124
|
they need via the curated extras.
|
|
124
|
-
* **Consistent ergonomics**
|
|
125
|
+
* **Consistent ergonomics** ? usage matches the historical
|
|
125
126
|
`swarmauri_standard.signing.Signer` import, preserving existing tutorials and
|
|
126
127
|
code samples.
|
|
127
128
|
|
|
@@ -154,3 +155,5 @@ materials matching the selected plugin.
|
|
|
154
155
|
- Issues: <https://github.com/swarmauri/swarmauri-sdk/issues>
|
|
155
156
|
- Releases: <https://github.com/swarmauri/swarmauri-sdk/releases>
|
|
156
157
|
- Discussions: <https://github.com/orgs/swarmauri/discussions>
|
|
158
|
+
|
|
159
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "MediaSigner"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev1"
|
|
4
4
|
description = "Swarmauri signing facade plugin that aggregates registered SigningBase providers."
|
|
5
5
|
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -112,7 +112,7 @@ log_cli_level = "INFO"
|
|
|
112
112
|
log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
|
|
113
113
|
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
114
114
|
asyncio_default_fixture_loop_scope = "function"
|
|
115
|
-
addopts = "--pylicense-package=MediaSigner --pylicense-mode=parameterized --pylicense-accept-deps=cffi,
|
|
115
|
+
addopts = "--pylicense-package=MediaSigner --pylicense-mode=parameterized --pylicense-accept-deps=cffi,standard-imghdr"
|
|
116
116
|
|
|
117
117
|
[build-system]
|
|
118
118
|
requires = ["poetry-core>=1.0.0"]
|
|
File without changes
|
|
File without changes
|