swarmauri_signing_ecdsa 0.3.0.dev3__tar.gz → 0.3.0.dev30__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,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_signing_ecdsa
3
+ Version: 0.3.0.dev30
4
+ Summary: ECDSA-based signer for Swarmauri
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,signing,ecdsa,elliptic-curve,cryptography,sdk,standards,digital-signature,signature-algorithm,nist-curves,key-formats
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
+ Provides-Extra: cbor
23
+ Requires-Dist: cbor2 ; extra == "cbor"
24
+ Requires-Dist: cryptography
25
+ Requires-Dist: swarmauri_base
26
+ Requires-Dist: swarmauri_core
27
+ Project-URL: Documentation, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_ecdsa#readme
28
+ Project-URL: Homepage, https://github.com/swarmauri/swarmauri-sdk
29
+ Project-URL: Source, https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_ecdsa
30
+ Description-Content-Type: text/markdown
31
+
32
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
33
+
34
+
35
+ <p align="center">
36
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
37
+ <img src="https://img.shields.io/pypi/dm/swarmauri_signing_ecdsa" alt="PyPI - Downloads"/></a>
38
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_ecdsa/">
39
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_ecdsa.svg"/></a>
40
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
41
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_signing_ecdsa" alt="PyPI - Python Version"/></a>
42
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
43
+ <img src="https://img.shields.io/pypi/l/swarmauri_signing_ecdsa" alt="PyPI - License"/></a>
44
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
45
+ <img src="https://img.shields.io/pypi/v/swarmauri_signing_ecdsa?label=swarmauri_signing_ecdsa&color=green" alt="PyPI - swarmauri_signing_ecdsa"/></a>
46
+ </p>
47
+
48
+ ---
49
+
50
+ # Swarmauri Signing ECDSA
51
+
52
+ An asynchronous ECDSA-based signer that implements the `ISigning` interface for
53
+ detached signatures over raw bytes and canonicalized envelopes.
54
+
55
+ ## Features
56
+
57
+ - JSON canonicalization built in, with optional CBOR canonicalization via
58
+ [`cbor2`](https://pypi.org/project/cbor2/)
59
+ - Supports the `ECDSA-P256-SHA256`, `ECDSA-P384-SHA384`, and
60
+ `ECDSA-P521-SHA512` curves provided by
61
+ [`cryptography`](https://pypi.org/project/cryptography/)
62
+ - Multi-signature aware verification with opt-in algorithm restrictions through
63
+ the `require` mapping
64
+ - Detached signature generation for both raw byte payloads and Swarmauri
65
+ envelopes
66
+
67
+ ## Installation
68
+
69
+ ### pip
70
+
71
+ ```bash
72
+ pip install swarmauri_signing_ecdsa
73
+ # Optional CBOR support
74
+ pip install "swarmauri_signing_ecdsa[cbor]"
75
+ ```
76
+
77
+ ### Poetry
78
+
79
+ ```bash
80
+ poetry add swarmauri_signing_ecdsa
81
+ # Optional CBOR support
82
+ poetry add "swarmauri_signing_ecdsa[cbor]"
83
+ ```
84
+
85
+ ### uv
86
+
87
+ ```bash
88
+ # Install uv if it is not already available on your system
89
+ curl -LsSf https://astral.sh/uv/install.sh | sh
90
+
91
+ # Install the signer package
92
+ uv pip install swarmauri_signing_ecdsa
93
+ # Optional CBOR support
94
+ uv pip install "swarmauri_signing_ecdsa[cbor]"
95
+ ```
96
+
97
+ ## Usage
98
+
99
+ The signer operates asynchronously and expects private keys to be supplied via
100
+ the `KeyRef` mappings defined in `swarmauri_core`. When verifying, provide the
101
+ corresponding public keys through the `opts={"pubkeys": [...]}` option.
102
+
103
+ ```python
104
+ import asyncio
105
+ from cryptography.hazmat.primitives.asymmetric import ec
106
+
107
+ from swarmauri_signing_ecdsa import EcdsaEnvelopeSigner
108
+
109
+
110
+ async def main() -> None:
111
+ signer = EcdsaEnvelopeSigner()
112
+
113
+ # Provide the private key as a KeyRef understood by swarmauri_core
114
+ private_key = ec.generate_private_key(ec.SECP256R1())
115
+ key_ref = {"kind": "cryptography_obj", "obj": private_key}
116
+
117
+ envelope = {
118
+ "headers": {"kid": "example"},
119
+ "payload": {"message": "signed hello"},
120
+ }
121
+
122
+ signatures = await signer.sign_envelope(
123
+ key_ref,
124
+ envelope,
125
+ canon="json",
126
+ )
127
+
128
+ is_valid = await signer.verify_envelope(
129
+ envelope,
130
+ signatures,
131
+ canon="json",
132
+ opts={"pubkeys": [private_key.public_key()]},
133
+ )
134
+
135
+ print(f"Signature valid? {is_valid}")
136
+
137
+
138
+ if __name__ == "__main__":
139
+ asyncio.run(main())
140
+ ```
141
+
142
+ ## Entry Point
143
+
144
+ The signer registers under the `swarmauri.signings` entry point as
145
+ `EcdsaEnvelopeSigner`.
146
+
147
+ ## Want to help?
148
+
149
+ If you want to contribute to swarmauri-sdk, read up on our
150
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
151
+ that will help you get started.
@@ -0,0 +1,120 @@
1
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
+
3
+
4
+ <p align="center">
5
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
6
+ <img src="https://img.shields.io/pypi/dm/swarmauri_signing_ecdsa" alt="PyPI - Downloads"/></a>
7
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_ecdsa/">
8
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_signing_ecdsa.svg"/></a>
9
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
10
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_signing_ecdsa" alt="PyPI - Python Version"/></a>
11
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
12
+ <img src="https://img.shields.io/pypi/l/swarmauri_signing_ecdsa" alt="PyPI - License"/></a>
13
+ <a href="https://pypi.org/project/swarmauri_signing_ecdsa/">
14
+ <img src="https://img.shields.io/pypi/v/swarmauri_signing_ecdsa?label=swarmauri_signing_ecdsa&color=green" alt="PyPI - swarmauri_signing_ecdsa"/></a>
15
+ </p>
16
+
17
+ ---
18
+
19
+ # Swarmauri Signing ECDSA
20
+
21
+ An asynchronous ECDSA-based signer that implements the `ISigning` interface for
22
+ detached signatures over raw bytes and canonicalized envelopes.
23
+
24
+ ## Features
25
+
26
+ - JSON canonicalization built in, with optional CBOR canonicalization via
27
+ [`cbor2`](https://pypi.org/project/cbor2/)
28
+ - Supports the `ECDSA-P256-SHA256`, `ECDSA-P384-SHA384`, and
29
+ `ECDSA-P521-SHA512` curves provided by
30
+ [`cryptography`](https://pypi.org/project/cryptography/)
31
+ - Multi-signature aware verification with opt-in algorithm restrictions through
32
+ the `require` mapping
33
+ - Detached signature generation for both raw byte payloads and Swarmauri
34
+ envelopes
35
+
36
+ ## Installation
37
+
38
+ ### pip
39
+
40
+ ```bash
41
+ pip install swarmauri_signing_ecdsa
42
+ # Optional CBOR support
43
+ pip install "swarmauri_signing_ecdsa[cbor]"
44
+ ```
45
+
46
+ ### Poetry
47
+
48
+ ```bash
49
+ poetry add swarmauri_signing_ecdsa
50
+ # Optional CBOR support
51
+ poetry add "swarmauri_signing_ecdsa[cbor]"
52
+ ```
53
+
54
+ ### uv
55
+
56
+ ```bash
57
+ # Install uv if it is not already available on your system
58
+ curl -LsSf https://astral.sh/uv/install.sh | sh
59
+
60
+ # Install the signer package
61
+ uv pip install swarmauri_signing_ecdsa
62
+ # Optional CBOR support
63
+ uv pip install "swarmauri_signing_ecdsa[cbor]"
64
+ ```
65
+
66
+ ## Usage
67
+
68
+ The signer operates asynchronously and expects private keys to be supplied via
69
+ the `KeyRef` mappings defined in `swarmauri_core`. When verifying, provide the
70
+ corresponding public keys through the `opts={"pubkeys": [...]}` option.
71
+
72
+ ```python
73
+ import asyncio
74
+ from cryptography.hazmat.primitives.asymmetric import ec
75
+
76
+ from swarmauri_signing_ecdsa import EcdsaEnvelopeSigner
77
+
78
+
79
+ async def main() -> None:
80
+ signer = EcdsaEnvelopeSigner()
81
+
82
+ # Provide the private key as a KeyRef understood by swarmauri_core
83
+ private_key = ec.generate_private_key(ec.SECP256R1())
84
+ key_ref = {"kind": "cryptography_obj", "obj": private_key}
85
+
86
+ envelope = {
87
+ "headers": {"kid": "example"},
88
+ "payload": {"message": "signed hello"},
89
+ }
90
+
91
+ signatures = await signer.sign_envelope(
92
+ key_ref,
93
+ envelope,
94
+ canon="json",
95
+ )
96
+
97
+ is_valid = await signer.verify_envelope(
98
+ envelope,
99
+ signatures,
100
+ canon="json",
101
+ opts={"pubkeys": [private_key.public_key()]},
102
+ )
103
+
104
+ print(f"Signature valid? {is_valid}")
105
+
106
+
107
+ if __name__ == "__main__":
108
+ asyncio.run(main())
109
+ ```
110
+
111
+ ## Entry Point
112
+
113
+ The signer registers under the `swarmauri.signings` entry point as
114
+ `EcdsaEnvelopeSigner`.
115
+
116
+ ## Want to help?
117
+
118
+ If you want to contribute to swarmauri-sdk, read up on our
119
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
120
+ that will help you get started.
@@ -1,21 +1,36 @@
1
1
  [project]
2
2
  name = "swarmauri_signing_ecdsa"
3
- version = "0.3.0.dev3"
3
+ version = "0.3.0.dev30"
4
4
  description = "ECDSA-based signer for Swarmauri"
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.10,<3.13"
8
- authors = [{ name = "Swarmauri", email = "opensource@swarmauri.com" }]
8
+ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
9
+ keywords = [
10
+ "swarmauri",
11
+ "signing",
12
+ "ecdsa",
13
+ "elliptic-curve",
14
+ "cryptography",
15
+ "sdk",
16
+ "standards",
17
+ "digital-signature",
18
+ "signature-algorithm",
19
+ "nist-curves",
20
+ "key-formats",
21
+ ]
9
22
  classifiers = [
23
+ "Development Status :: 1 - Planning",
10
24
  "License :: OSI Approved :: Apache Software License",
11
25
  "Natural Language :: English",
26
+ "Programming Language :: Python",
27
+ "Programming Language :: Python :: 3",
12
28
  "Programming Language :: Python :: 3.10",
13
29
  "Programming Language :: Python :: 3.11",
14
30
  "Programming Language :: Python :: 3.12",
15
- "Programming Language :: Python :: 3.13",
16
- "Development Status :: 3 - Alpha",
17
31
  "Topic :: Security :: Cryptography",
18
32
  "Intended Audience :: Developers",
33
+ "Programming Language :: Python :: 3 :: Only",
19
34
  ]
20
35
  dependencies = [
21
36
  "swarmauri_core",
@@ -23,6 +38,11 @@ dependencies = [
23
38
  "cryptography",
24
39
  ]
25
40
 
41
+ [project.urls]
42
+ Homepage = "https://github.com/swarmauri/swarmauri-sdk"
43
+ Source = "https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_ecdsa"
44
+ Documentation = "https://github.com/swarmauri/swarmauri-sdk/tree/main/pkgs/standards/swarmauri_signing_ecdsa#readme"
45
+
26
46
  [project.optional-dependencies]
27
47
  cbor = ["cbor2"]
28
48
 
@@ -39,6 +59,7 @@ markers = [
39
59
  "r8n: Regression tests",
40
60
  "acceptance: Acceptance tests",
41
61
  "perf: Performance tests",
62
+ "example: Documentation examples",
42
63
  ]
43
64
  timeout = 300
44
65
  log_cli = true
@@ -186,7 +186,14 @@ class EcdsaEnvelopeSigner(SigningBase):
186
186
  def supports(self) -> Mapping[str, Iterable[str]]:
187
187
  algs = tuple(_EC_ALGS.keys()) + tuple(_ALIAS.keys())
188
188
  canons = ("json", "cbor") if _CBOR_OK else ("json",)
189
- return {"algs": algs, "canons": canons, "features": ("multi", "detached_only")}
189
+ return {
190
+ "algs": algs,
191
+ "canons": canons,
192
+ "signs": ("bytes", "digest", "envelope", "stream"),
193
+ "verifies": ("bytes", "digest", "envelope", "stream"),
194
+ "envelopes": ("mapping",),
195
+ "features": ("multi", "detached_only"),
196
+ }
190
197
 
191
198
  async def sign_bytes(
192
199
  self,
@@ -259,6 +266,26 @@ class EcdsaEnvelopeSigner(SigningBase):
259
266
  return True
260
267
  return False
261
268
 
269
+ async def sign_digest(
270
+ self,
271
+ key: KeyRef,
272
+ digest: bytes,
273
+ *,
274
+ alg: Optional[Alg] = None,
275
+ opts: Optional[Mapping[str, object]] = None,
276
+ ) -> Sequence[Signature]:
277
+ return await self.sign_bytes(key, digest, alg=alg, opts=opts)
278
+
279
+ async def verify_digest(
280
+ self,
281
+ digest: bytes,
282
+ signatures: Sequence[Signature],
283
+ *,
284
+ require: Optional[Mapping[str, object]] = None,
285
+ opts: Optional[Mapping[str, object]] = None,
286
+ ) -> bool:
287
+ return await self.verify_bytes(digest, signatures, require=require, opts=opts)
288
+
262
289
  async def canonicalize_envelope(
263
290
  self,
264
291
  env: Envelope,
@@ -1,55 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_signing_ecdsa
3
- Version: 0.3.0.dev3
4
- Summary: ECDSA-based signer for Swarmauri
5
- License: Apache-2.0
6
- Author: Swarmauri
7
- Author-email: opensource@swarmauri.com
8
- Requires-Python: >=3.10,<3.13
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Natural Language :: English
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Classifier: Development Status :: 3 - Alpha
16
- Classifier: Topic :: Security :: Cryptography
17
- Classifier: Intended Audience :: Developers
18
- Provides-Extra: cbor
19
- Requires-Dist: cbor2 ; extra == "cbor"
20
- Requires-Dist: cryptography
21
- Requires-Dist: swarmauri_base
22
- Requires-Dist: swarmauri_core
23
- Description-Content-Type: text/markdown
24
-
25
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
26
-
27
- # Swarmauri Signing ECDSA
28
-
29
- An ECDSA-based signer implementing the `ISigning` interface for detached
30
- signatures over raw bytes and canonicalized envelopes.
31
-
32
- Features:
33
- - JSON canonicalization (always available)
34
- - Optional CBOR canonicalization via `cbor2`
35
- - Supports curves P-256, P-384, P-521 with `cryptography`
36
-
37
- ## Installation
38
-
39
- ```bash
40
- pip install swarmauri_signing_ecdsa
41
- ```
42
-
43
- ## Usage
44
-
45
- ```python
46
- from swarmauri_signing_ecdsa import EcdsaEnvelopeSigner
47
-
48
- signer = EcdsaEnvelopeSigner()
49
- # create a KeyRef for an EC private key; see swarmauri_core for details
50
- ```
51
-
52
- ## Entry Point
53
-
54
- The signer registers under the `swarmauri.signings` entry point as `EcdsaEnvelopeSigner`.
55
-
@@ -1,30 +0,0 @@
1
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
2
-
3
- # Swarmauri Signing ECDSA
4
-
5
- An ECDSA-based signer implementing the `ISigning` interface for detached
6
- signatures over raw bytes and canonicalized envelopes.
7
-
8
- Features:
9
- - JSON canonicalization (always available)
10
- - Optional CBOR canonicalization via `cbor2`
11
- - Supports curves P-256, P-384, P-521 with `cryptography`
12
-
13
- ## Installation
14
-
15
- ```bash
16
- pip install swarmauri_signing_ecdsa
17
- ```
18
-
19
- ## Usage
20
-
21
- ```python
22
- from swarmauri_signing_ecdsa import EcdsaEnvelopeSigner
23
-
24
- signer = EcdsaEnvelopeSigner()
25
- # create a KeyRef for an EC private key; see swarmauri_core for details
26
- ```
27
-
28
- ## Entry Point
29
-
30
- The signer registers under the `swarmauri.signings` entry point as `EcdsaEnvelopeSigner`.