MediaSigner 0.6.2__py3-none-any.whl

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,7 @@
1
+ """Swarmauri signing facade plugin that re-exports the :class:`MediaSigner`."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from ._signer import MediaSigner
6
+
7
+ __all__ = ["MediaSigner"]
MediaSigner/_signer.py ADDED
@@ -0,0 +1,207 @@
1
+ """Facade that discovers and dispatches to registered signing plugins."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import AsyncIterable, Iterable, Mapping, MutableMapping, Optional, Sequence
6
+
7
+ from swarmauri_base.ComponentBase import ComponentBase, ResourceTypes
8
+ from swarmauri_base.signing.SigningBase import SigningBase
9
+ from swarmauri_core.crypto.types import Alg, KeyRef
10
+ from swarmauri_core.key_providers.IKeyProvider import IKeyProvider
11
+ from swarmauri_core.signing.types import Signature
12
+
13
+ StreamPayload = AsyncIterable[bytes] | Iterable[bytes]
14
+
15
+ try: # Pragmatic optional imports so plugins self-register when available.
16
+ import swarmauri_signing_cms # noqa: F401
17
+ except Exception: # pragma: no cover - plugin optional
18
+ pass
19
+
20
+ try:
21
+ import swarmauri_signing_jws # noqa: F401
22
+ except Exception: # pragma: no cover - plugin optional
23
+ pass
24
+
25
+ try:
26
+ import swarmauri_signing_openpgp # noqa: F401
27
+ except Exception: # pragma: no cover - plugin optional
28
+ pass
29
+
30
+ try:
31
+ import swarmauri_signing_pdf # noqa: F401
32
+ except Exception: # pragma: no cover - plugin optional
33
+ pass
34
+
35
+ try:
36
+ import swarmauri_signing_xmld # noqa: F401
37
+ except Exception: # pragma: no cover - plugin optional
38
+ pass
39
+
40
+
41
+ class MediaSigner(ComponentBase):
42
+ """High-level async facade that routes signing calls to registered plugins."""
43
+
44
+ resource: Optional[str] = ResourceTypes.SIGNING.value
45
+ type: str = "MediaSigner"
46
+
47
+ def __init__(self, key_provider: Optional[IKeyProvider] = None) -> None:
48
+ super().__init__()
49
+ self._key_provider = key_provider
50
+ self._plugins: MutableMapping[str, SigningBase] = {}
51
+ self._load_plugins()
52
+
53
+ # ------------------------------------------------------------------
54
+ def _load_plugins(self) -> None:
55
+ registry_entry = self.__class__._registry.get("SigningBase", {})
56
+ subtypes = registry_entry.get("subtypes", {})
57
+ for type_name, cls in subtypes.items():
58
+ if type_name in self._plugins:
59
+ continue
60
+ plugin = self._instantiate(cls)
61
+ if plugin is not None:
62
+ self._plugins[type_name] = plugin
63
+
64
+ def _instantiate(self, cls: type[SigningBase]) -> Optional[SigningBase]:
65
+ try:
66
+ plugin = cls(key_provider=self._key_provider)
67
+ except TypeError:
68
+ plugin = cls() # type: ignore[call-arg]
69
+ if self._key_provider and hasattr(plugin, "set_key_provider"):
70
+ plugin.set_key_provider(self._key_provider)
71
+ return plugin
72
+
73
+ def _resolve(self, fmt: str) -> SigningBase:
74
+ try:
75
+ return self._plugins[fmt]
76
+ except KeyError as exc: # pragma: no cover - error path
77
+ raise ValueError(
78
+ f"No signing plugin registered for format '{fmt}'"
79
+ ) from exc
80
+
81
+ # ------------------------------------------------------------------
82
+ async def sign_bytes(
83
+ self,
84
+ fmt: str,
85
+ key: KeyRef,
86
+ payload: bytes,
87
+ *,
88
+ alg: Optional[Alg] = None,
89
+ opts: Optional[Mapping[str, object]] = None,
90
+ ) -> Sequence[Signature]:
91
+ return await self._resolve(fmt).sign_bytes(key, payload, alg=alg, opts=opts)
92
+
93
+ async def sign_digest(
94
+ self,
95
+ fmt: str,
96
+ key: KeyRef,
97
+ digest: bytes,
98
+ *,
99
+ alg: Optional[Alg] = None,
100
+ opts: Optional[Mapping[str, object]] = None,
101
+ ) -> Sequence[Signature]:
102
+ return await self._resolve(fmt).sign_digest(key, digest, alg=alg, opts=opts)
103
+
104
+ async def verify_bytes(
105
+ self,
106
+ fmt: str,
107
+ payload: bytes,
108
+ signatures: Sequence[Signature],
109
+ *,
110
+ require: Optional[Mapping[str, object]] = None,
111
+ opts: Optional[Mapping[str, object]] = None,
112
+ ) -> bool:
113
+ return await self._resolve(fmt).verify_bytes(
114
+ payload, signatures, require=require, opts=opts
115
+ )
116
+
117
+ async def verify_digest(
118
+ self,
119
+ fmt: str,
120
+ digest: bytes,
121
+ signatures: Sequence[Signature],
122
+ *,
123
+ require: Optional[Mapping[str, object]] = None,
124
+ opts: Optional[Mapping[str, object]] = None,
125
+ ) -> bool:
126
+ return await self._resolve(fmt).verify_digest(
127
+ digest, signatures, require=require, opts=opts
128
+ )
129
+
130
+ async def canonicalize_envelope(
131
+ self,
132
+ fmt: str,
133
+ env,
134
+ *,
135
+ canon: Optional[str] = None,
136
+ opts: Optional[Mapping[str, object]] = None,
137
+ ) -> bytes:
138
+ return await self._resolve(fmt).canonicalize_envelope(
139
+ env, canon=canon, opts=opts
140
+ )
141
+
142
+ async def sign_envelope(
143
+ self,
144
+ fmt: str,
145
+ key: KeyRef,
146
+ env,
147
+ *,
148
+ alg: Optional[Alg] = None,
149
+ canon: Optional[str] = None,
150
+ opts: Optional[Mapping[str, object]] = None,
151
+ ) -> Sequence[Signature]:
152
+ return await self._resolve(fmt).sign_envelope(
153
+ key, env, alg=alg, canon=canon, opts=opts
154
+ )
155
+
156
+ async def sign_stream(
157
+ self,
158
+ fmt: str,
159
+ key: KeyRef,
160
+ payload: StreamPayload,
161
+ *,
162
+ alg: Optional[Alg] = None,
163
+ opts: Optional[Mapping[str, object]] = None,
164
+ ) -> Sequence[Signature]:
165
+ return await self._resolve(fmt).sign_stream(key, payload, alg=alg, opts=opts)
166
+
167
+ async def verify_envelope(
168
+ self,
169
+ fmt: str,
170
+ env,
171
+ signatures: Sequence[Signature],
172
+ *,
173
+ canon: Optional[str] = None,
174
+ require: Optional[Mapping[str, object]] = None,
175
+ opts: Optional[Mapping[str, object]] = None,
176
+ ) -> bool:
177
+ return await self._resolve(fmt).verify_envelope(
178
+ env, signatures, canon=canon, require=require, opts=opts
179
+ )
180
+
181
+ async def verify_stream(
182
+ self,
183
+ fmt: str,
184
+ payload: StreamPayload,
185
+ signatures: Sequence[Signature],
186
+ *,
187
+ require: Optional[Mapping[str, object]] = None,
188
+ opts: Optional[Mapping[str, object]] = None,
189
+ ) -> bool:
190
+ return await self._resolve(fmt).verify_stream(
191
+ payload, signatures, require=require, opts=opts
192
+ )
193
+
194
+ # ------------------------------------------------------------------
195
+ def supported_formats(self) -> Iterable[str]:
196
+ return tuple(self._plugins.keys())
197
+
198
+ def supports(
199
+ self, fmt: str, *, key_ref: Optional[str] = None
200
+ ) -> Mapping[str, Iterable[str]]:
201
+ plugin = self._resolve(fmt)
202
+ if key_ref is not None:
203
+ try:
204
+ return plugin.supports(key_ref) # type: ignore[arg-type]
205
+ except TypeError:
206
+ pass
207
+ return plugin.supports()
MediaSigner/cli.py ADDED
@@ -0,0 +1,187 @@
1
+ """Command line utility for interacting with the MediaSigner facade."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import asyncio
7
+ import base64
8
+ import json
9
+ import sys
10
+ from pathlib import Path
11
+ from typing import Any, Mapping, MutableMapping, Sequence
12
+
13
+ from . import MediaSigner
14
+ from swarmauri_core.signing.types import Signature
15
+
16
+ BytesLike = bytes | bytearray
17
+
18
+
19
+ def _read_bytes(path: str | None) -> bytes:
20
+ if path is None or path == "-":
21
+ return sys.stdin.buffer.read()
22
+ return Path(path).read_bytes()
23
+
24
+
25
+ def _write_text(path: str | None, content: str) -> None:
26
+ if path is None or path == "-":
27
+ sys.stdout.write(content)
28
+ if not content.endswith("\n"):
29
+ sys.stdout.write("\n")
30
+ return
31
+ Path(path).write_text(content)
32
+
33
+
34
+ def _load_json_file(path: str | None) -> Any:
35
+ if path is None:
36
+ return None
37
+ data = Path(path).read_text()
38
+ return json.loads(data)
39
+
40
+
41
+ def _bytes_field(value: BytesLike) -> dict[str, str]:
42
+ return {"b64": base64.b64encode(bytes(value)).decode("ascii")}
43
+
44
+
45
+ def _signature_to_json(signature: Mapping[str, Any]) -> dict[str, Any]:
46
+ record: dict[str, Any] = {}
47
+ for key, value in signature.items():
48
+ if isinstance(value, (bytes, bytearray)):
49
+ record[key] = _bytes_field(value)
50
+ elif (
51
+ isinstance(value, tuple)
52
+ and value
53
+ and isinstance(value[0], (bytes, bytearray))
54
+ ):
55
+ record[key] = [_bytes_field(item) for item in value] # type: ignore[arg-type]
56
+ else:
57
+ record[key] = value
58
+ return record
59
+
60
+
61
+ def _signature_from_json(data: Mapping[str, Any]) -> MutableMapping[str, Any]:
62
+ result: MutableMapping[str, Any] = {}
63
+ for key, value in data.items():
64
+ if isinstance(value, Mapping) and "b64" in value:
65
+ result[key] = base64.b64decode(str(value["b64"]))
66
+ elif (
67
+ isinstance(value, list)
68
+ and value
69
+ and isinstance(value[0], Mapping)
70
+ and "b64" in value[0]
71
+ ):
72
+ result[key] = tuple(base64.b64decode(str(entry["b64"])) for entry in value)
73
+ else:
74
+ result[key] = value
75
+ return result
76
+
77
+
78
+ def _build_parser() -> argparse.ArgumentParser:
79
+ parser = argparse.ArgumentParser(
80
+ description="Interact with Swarmauri signing plugins"
81
+ )
82
+ subparsers = parser.add_subparsers(dest="command", required=True)
83
+
84
+ list_parser = subparsers.add_parser("list", help="List discovered signing formats")
85
+ list_parser.set_defaults(func=_cmd_list)
86
+
87
+ supports_parser = subparsers.add_parser(
88
+ "supports", help="Describe plugin capabilities"
89
+ )
90
+ supports_parser.add_argument("format", help="Format token, e.g. jws or cms")
91
+ supports_parser.add_argument(
92
+ "--key-ref", dest="key_ref", help="Optional key reference string"
93
+ )
94
+ supports_parser.set_defaults(func=_cmd_supports)
95
+
96
+ sign_parser = subparsers.add_parser(
97
+ "sign-bytes", help="Sign raw bytes using a plugin"
98
+ )
99
+ sign_parser.add_argument("format", help="Format token")
100
+ sign_parser.add_argument("--alg", dest="alg", help="Algorithm hint for the signer")
101
+ sign_parser.add_argument(
102
+ "--key", required=True, help="Path to a JSON file describing the KeyRef"
103
+ )
104
+ sign_parser.add_argument("--input", required=True, help="Payload file to sign")
105
+ sign_parser.add_argument(
106
+ "--output", help="Write signatures to this file (defaults to stdout)"
107
+ )
108
+ sign_parser.add_argument("--opts", help="Path to JSON options passed to the signer")
109
+ sign_parser.set_defaults(func=_cmd_sign_bytes)
110
+
111
+ verify_parser = subparsers.add_parser(
112
+ "verify-bytes", help="Verify signatures over raw bytes"
113
+ )
114
+ verify_parser.add_argument("format", help="Format token")
115
+ verify_parser.add_argument("--input", required=True, help="Payload file")
116
+ verify_parser.add_argument(
117
+ "--sigs", required=True, help="JSON file produced by sign-bytes"
118
+ )
119
+ verify_parser.add_argument(
120
+ "--opts", help="JSON file providing verification options"
121
+ )
122
+ verify_parser.add_argument(
123
+ "--require", help="JSON file describing verification policy"
124
+ )
125
+ verify_parser.set_defaults(func=_cmd_verify_bytes)
126
+
127
+ return parser
128
+
129
+
130
+ async def _cmd_list(args: argparse.Namespace) -> int:
131
+ signer = MediaSigner()
132
+ for fmt in sorted(signer.supported_formats()):
133
+ print(fmt)
134
+ return 0
135
+
136
+
137
+ async def _cmd_supports(args: argparse.Namespace) -> int:
138
+ signer = MediaSigner()
139
+ info = signer.supports(args.format, key_ref=args.key_ref)
140
+ print(json.dumps(info, indent=2, sort_keys=True))
141
+ return 0
142
+
143
+
144
+ async def _cmd_sign_bytes(args: argparse.Namespace) -> int:
145
+ signer = MediaSigner()
146
+ key_data = _load_json_file(args.key)
147
+ if not isinstance(key_data, Mapping):
148
+ raise SystemExit("--key must reference a JSON object")
149
+ payload = _read_bytes(args.input)
150
+ opts = _load_json_file(args.opts)
151
+ signatures = await signer.sign_bytes(
152
+ args.format, key_data, payload, alg=args.alg, opts=opts
153
+ )
154
+ json_out = [_signature_to_json(dict(sig)) for sig in signatures]
155
+ _write_text(args.output, json.dumps(json_out, indent=2))
156
+ return 0
157
+
158
+
159
+ async def _cmd_verify_bytes(args: argparse.Namespace) -> int:
160
+ signer = MediaSigner()
161
+ payload = _read_bytes(args.input)
162
+ sig_payload = _load_json_file(args.sigs)
163
+ if not isinstance(sig_payload, list):
164
+ raise SystemExit("--sigs must point to a JSON array")
165
+ signature_payloads = [_signature_from_json(entry) for entry in sig_payload]
166
+ signature_entries = [Signature(**dict(entry)) for entry in signature_payloads]
167
+ opts = _load_json_file(args.opts)
168
+ require = _load_json_file(args.require)
169
+ ok = await signer.verify_bytes(
170
+ args.format,
171
+ payload,
172
+ signature_entries,
173
+ require=require,
174
+ opts=opts,
175
+ )
176
+ print("true" if ok else "false")
177
+ return 0 if ok else 1
178
+
179
+
180
+ def main(argv: Sequence[str] | None = None) -> int:
181
+ parser = _build_parser()
182
+ args = parser.parse_args(argv)
183
+ return asyncio.run(args.func(args))
184
+
185
+
186
+ if __name__ == "__main__": # pragma: no cover
187
+ raise SystemExit(main())
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: MediaSigner
3
+ Version: 0.6.2
4
+ Summary: Swarmauri signing facade plugin that aggregates registered SigningBase providers.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ 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
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 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Intended Audience :: Developers
21
+ Classifier: Framework :: AsyncIO
22
+ Classifier: Topic :: Security :: Cryptography
23
+ Classifier: Operating System :: OS Independent
24
+ Classifier: Topic :: Multimedia :: Graphics
25
+ Classifier: Topic :: Multimedia :: Video
26
+ Classifier: Topic :: Software Development :: Libraries
27
+ Provides-Extra: plugins
28
+ Requires-Dist: cryptography (>=42.0.0)
29
+ Requires-Dist: swarmauri_base
30
+ Requires-Dist: swarmauri_core
31
+ Requires-Dist: swarmauri_keyprovider_inmemory
32
+ Requires-Dist: swarmauri_signing_cms
33
+ Requires-Dist: swarmauri_signing_cms ; extra == "plugins"
34
+ Requires-Dist: swarmauri_signing_jws
35
+ Requires-Dist: swarmauri_signing_jws ; extra == "plugins"
36
+ Requires-Dist: swarmauri_signing_openpgp
37
+ Requires-Dist: swarmauri_signing_openpgp ; extra == "plugins"
38
+ Requires-Dist: swarmauri_signing_pdf
39
+ Requires-Dist: swarmauri_signing_pdf ; extra == "plugins"
40
+ Requires-Dist: swarmauri_signing_xmld
41
+ Requires-Dist: swarmauri_signing_xmld ; extra == "plugins"
42
+ Project-URL: Changelog, https://github.com/swarmauri/swarmauri-sdk/releases
43
+ Project-URL: Documentation, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/media_signer#readme
44
+ Project-URL: Discussions, https://github.com/orgs/swarmauri/discussions
45
+ Project-URL: Homepage, https://github.com/swarmauri/swarmauri-sdk
46
+ Project-URL: Issues, https://github.com/swarmauri/swarmauri-sdk/issues
47
+ Project-URL: Source, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/media_signer
48
+ Description-Content-Type: text/markdown
49
+
50
+ <p align="center">
51
+ <img src="../../../assets/swarmauri.brand.theme.svg" alt="Swarmauri logotype" width="420" />
52
+ </p>
53
+
54
+ <h1 align="center">MediaSigner</h1>
55
+
56
+ <p align="center">
57
+ <a href="https://pypi.org/project/MediaSigner/"><img src="https://img.shields.io/pypi/dm/MediaSigner?style=for-the-badge" alt="PyPI - Downloads" /></a>
58
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/media_signer/"><img src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/media_signer.svg?style=for-the-badge" alt="Repository views" /></a>
59
+ <a href="https://pypi.org/project/MediaSigner/"><img src="https://img.shields.io/pypi/pyversions/MediaSigner?style=for-the-badge" alt="Supported Python versions" /></a>
60
+ <a href="https://pypi.org/project/MediaSigner/"><img src="https://img.shields.io/pypi/l/MediaSigner?style=for-the-badge" alt="License" /></a>
61
+ <a href="https://pypi.org/project/MediaSigner/"><img src="https://img.shields.io/pypi/v/MediaSigner?style=for-the-badge&label=MediaSigner" alt="Latest release" /></a>
62
+ </p>
63
+
64
+ ---
65
+
66
+ MediaSigner packages the asynchronous `Signer` facade that orchestrates registered
67
+ `SigningBase` providers. Moving the facade into a standalone plugin keeps the
68
+ core standards library lightweight while still enabling drop-in discovery of
69
+ specialised signers such as CMS, JWS, OpenPGP, PDF, and XMLDSig providers.
70
+
71
+ ## Features
72
+
73
+ - **Unified signing façade** – talk to every installed `SigningBase` through a
74
+ single async API that automatically discovers entry-point contributions.
75
+ - **Format-aware routing** – delegates signing and verification to the provider
76
+ registered for a format token such as `jws`, `pdf`, or `xmld`.
77
+ - **Optional plugin bundles** – install curated extras (e.g. `[plugins]`) to
78
+ bring in all available signer backends in one step.
79
+ - **Key-provider integration** – share Swarmauri key providers with the facade
80
+ so opaque key references resolve before signature creation.
81
+ - **Production-ready CLI** – inspect capabilities, sign payloads, and verify
82
+ results directly from the command line for fast automation.
83
+
84
+ ## Installation
85
+
86
+ ### Using `uv`
87
+
88
+ ```bash
89
+ uv add MediaSigner
90
+
91
+ # install every optional backend
92
+ uv add "MediaSigner[plugins]"
93
+ ```
94
+
95
+ The `[plugins]` extra pulls in CMS, JWS, OpenPGP, PDF, and XMLDSig signers.
96
+
97
+ ### Using `pip`
98
+
99
+ ```bash
100
+ pip install MediaSigner
101
+
102
+ # with every optional backend
103
+ pip install "MediaSigner[plugins]"
104
+ ```
105
+
106
+ ## Usage
107
+
108
+ ```python
109
+ import asyncio
110
+
111
+ from MediaSigner import MediaSigner
112
+ from swarmauri_core.key_providers.IKeyProvider import IKeyProvider
113
+
114
+ # Optionally pass a key provider so plugins receive a shared source for
115
+ # retrieving signing material.
116
+ key_provider: IKeyProvider | None = None
117
+ signer = MediaSigner(key_provider=key_provider)
118
+
119
+
120
+ async def sign_payload(payload: bytes) -> None:
121
+ signatures = await signer.sign_bytes("jws", key="my-key", payload=payload)
122
+ assert signatures, "At least one signature should be returned"
123
+ print(signer.supports("jws"))
124
+
125
+
126
+ asyncio.run(sign_payload(b"payload"))
127
+ ```
128
+
129
+ ### Integrating a key provider
130
+
131
+ Any Swarmauri key provider can be shared with the facade so backends receive
132
+ ready-to-use key material:
133
+
134
+ ```python
135
+ import asyncio
136
+
137
+ from MediaSigner import MediaSigner
138
+ from swarmauri_keyprovider_inmemory import InMemoryKeyProvider
139
+
140
+ provider = InMemoryKeyProvider(keys={"local://demo": b"secret"})
141
+ signer = MediaSigner(key_provider=provider)
142
+
143
+
144
+ async def main() -> None:
145
+ signatures = await signer.sign_bytes(
146
+ "jws",
147
+ key="local://demo",
148
+ payload=b"demo",
149
+ alg="HS256",
150
+ opts={"kid": "demo"},
151
+ )
152
+ print(signatures[0].mode)
153
+
154
+
155
+ asyncio.run(main())
156
+ ```
157
+
158
+ ### Discover installed plugins
159
+
160
+ Use the facade to list installed signers and inspect their capabilities:
161
+
162
+ ```python
163
+ for format_name in signer.supported_formats():
164
+ capabilities = signer.supports(format_name)
165
+ print(format_name, list(capabilities))
166
+ ```
167
+
168
+ ### Why this structure?
169
+
170
+ * **Separation of concerns** – standards remain focused on common abstractions
171
+ while the plugin encapsulates optional dependencies.
172
+ * **Explicit opt-in** – downstream projects can install only the signing stacks
173
+ they need via the curated extras.
174
+ * **Consistent ergonomics** – usage matches the historical
175
+ `swarmauri_standard.signing.Signer` import, preserving existing tutorials and
176
+ code samples.
177
+
178
+ ## Command line utility
179
+
180
+ MediaSigner ships a small CLI for quick inspection and automation:
181
+
182
+ ```bash
183
+ media-signer list # List available formats
184
+ media-signer supports jws # Show capability metadata
185
+ media-signer sign-bytes jws \
186
+ --alg HS256 \
187
+ --key key.json \
188
+ --input payload.bin \
189
+ --output signatures.json
190
+
191
+ media-signer verify-bytes jws \
192
+ --input payload.bin \
193
+ --sigs signatures.json \
194
+ --opts verify-keys.json
195
+ ```
196
+
197
+ The CLI expects JSON files describing `KeyRef` objects and verification
198
+ materials matching the selected plugin.
199
+
200
+ ## Project Resources
201
+
202
+ - Source: <https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/media_signer>
203
+ - Documentation: <https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/plugins/media_signer#readme>
204
+ - Issues: <https://github.com/swarmauri/swarmauri-sdk/issues>
205
+ - Releases: <https://github.com/swarmauri/swarmauri-sdk/releases>
206
+ - Discussions: <https://github.com/orgs/swarmauri/discussions>
207
+
@@ -0,0 +1,8 @@
1
+ MediaSigner/__init__.py,sha256=8p0PasgvbJZijXSAu-ByNpvXwoEe9dlidbqPS8kPA8Q,177
2
+ MediaSigner/_signer.py,sha256=cEDL-j91m6H52nM9-0alBD-nJgR4cpYZYUeL3vO3fis,6658
3
+ MediaSigner/cli.py,sha256=Jj4LUWkwXSEev1DghkNgYqKsSONmPIUUr0Iwfg-YWHQ,6184
4
+ mediasigner-0.6.2.dist-info/METADATA,sha256=BM1AsoddRFJp6iWOq6DpM5TVWXAzLBHOP2oYnX8iQ_A,7841
5
+ mediasigner-0.6.2.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
6
+ mediasigner-0.6.2.dist-info/entry_points.txt,sha256=pk-u4om8it63TW_cXFxFOXlOKe6z4U2VSdda68rCsdg,53
7
+ mediasigner-0.6.2.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
8
+ mediasigner-0.6.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.3.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ media-signer=MediaSigner.cli:main
3
+
@@ -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.