pysigned 0.2.2__tar.gz → 0.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pysigned
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Sign and verify URLs with an expiry, using HMAC or Ed25519
5
5
  Author: Meg Hicks
6
6
  Author-email: Meg Hicks <meg.d.hicks@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pysigned"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "Sign and verify URLs with an expiry, using HMAC or Ed25519"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -37,7 +37,7 @@ class Backend:
37
37
  def __init__(self, digest: str = DIGEST):
38
38
  self.digest = digest
39
39
 
40
- def parse_key(self, value: KeyValue) -> KeyLike:
40
+ def parse_key(self, value: KeyValue) -> Key | Ed25519KeyPair:
41
41
  """Wrap a user-supplied key value as a :class:`~pysigned.keys.KeyLike`.
42
42
 
43
43
  Already-wrapped keys pass through; raw ``bytes`` or a ``(bytes, id)``
@@ -5,7 +5,7 @@ from base64 import urlsafe_b64decode
5
5
  from collections.abc import Iterable, Mapping
6
6
  from dataclasses import dataclass
7
7
  from types import MappingProxyType
8
- from typing import TYPE_CHECKING, Any, Self, cast
8
+ from typing import TYPE_CHECKING, Any, Self, cast, Iterator
9
9
  from cryptography.hazmat.primitives.asymmetric import ed25519
10
10
 
11
11
  if TYPE_CHECKING:
@@ -157,7 +157,7 @@ class KeySet:
157
157
  key dispatches on its type via the backend.
158
158
  """
159
159
 
160
- def __init__(self, keys: Iterable, backend: "Backend | None" = None):
160
+ def __init__(self, keys: Iterable[Key], backend: "Backend | None" = None):
161
161
  if backend is None:
162
162
  # Deferred to break the keys <-> backends import cycle: backends
163
163
  # imports the key types from this module, so Backend can't be
@@ -166,14 +166,14 @@ class KeySet:
166
166
 
167
167
  backend = Backend()
168
168
  self.backend = backend
169
- self._keys: Mapping[str, Key | KeyLike] = MappingProxyType(
169
+ self._keys: Mapping[str, Key | Ed25519KeyPair] = MappingProxyType(
170
170
  {k.id: k for k in map(backend.parse_key, keys)}
171
171
  )
172
172
 
173
- def __getitem__(self, key: str):
173
+ def __getitem__(self, key: str) -> KeyLike:
174
174
  return self._keys[key]
175
175
 
176
- def __iter__(self):
176
+ def __iter__(self) -> Iterator[Key | Ed25519KeyPair]:
177
177
  return iter(self._keys.values())
178
178
 
179
179
  def __reversed__(self):
File without changes
File without changes
File without changes
File without changes
File without changes