tba-bases-jose 0.4.0.dev2__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,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-bases-jose
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Base classes for Tigrbl JOSE providers.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10,<3.15
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Dist: tba-bases-protected-envelope (==0.4.0.dev2)
|
|
14
|
+
Requires-Dist: tba-bases-token (==0.4.0.dev2)
|
|
15
|
+
Requires-Dist: tba-contracts-identity (==0.4.0.dev2)
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# tba-bases-jose
|
|
19
|
+
|
|
20
|
+
Base classes connecting JOSE providers to provider-neutral contracts.
|
|
21
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tba-bases-jose"
|
|
3
|
+
version = "0.4.0.dev2"
|
|
4
|
+
description = "Base classes for Tigrbl JOSE providers."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10,<3.15"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"tba-contracts-identity==0.4.0.dev2",
|
|
10
|
+
"tba-bases-protected-envelope==0.4.0.dev2",
|
|
11
|
+
"tba-bases-token==0.4.0.dev2",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["poetry-core>=1.0.0"]
|
|
16
|
+
build-backend = "poetry.core.masonry.api"
|
|
17
|
+
|
|
18
|
+
[tool.poetry]
|
|
19
|
+
packages = [{ include = "tba_bases_jose", from = "src" }]
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""Base classes for JOSE providers."""
|
|
2
|
+
|
|
3
|
+
from abc import ABC
|
|
4
|
+
from typing import Any, Iterable, Mapping
|
|
5
|
+
|
|
6
|
+
from tba_contracts_identity.jose import (
|
|
7
|
+
JoseKeySetPort,
|
|
8
|
+
JwePolicyPort,
|
|
9
|
+
JwtCoderPort,
|
|
10
|
+
KeyRotationAdministrationPort,
|
|
11
|
+
KeyRotationPolicyPort,
|
|
12
|
+
)
|
|
13
|
+
from tba_bases_protected_envelope import (
|
|
14
|
+
ProtectedEnvelopeIssuerBase,
|
|
15
|
+
ProtectedEnvelopeVerifierBase,
|
|
16
|
+
)
|
|
17
|
+
from tba_bases_token import ProfiledTokenIssuerBase, ProfiledTokenVerifierBase
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class JoseEnvelopeIssuerBase(ProtectedEnvelopeIssuerBase):
|
|
21
|
+
"""Issue a protected envelope constrained to a JOSE serialization."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class JoseEnvelopeVerifierBase(ProtectedEnvelopeVerifierBase):
|
|
25
|
+
"""Verify a protected envelope constrained to a JOSE serialization."""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class JwtTokenIssuerBase(ProfiledTokenIssuerBase):
|
|
29
|
+
"""Issue tokens constrained to an explicit JWT profile."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class JwtTokenVerifierBase(ProfiledTokenVerifierBase):
|
|
33
|
+
"""Verify tokens constrained to an explicit JWT profile."""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class JwtCoderBase(JwtCoderPort, ABC):
|
|
37
|
+
def sign(self, **kwargs: Any) -> str:
|
|
38
|
+
raise NotImplementedError
|
|
39
|
+
|
|
40
|
+
def verify(self, token: str, **kwargs: Any) -> Mapping[str, Any]:
|
|
41
|
+
raise NotImplementedError
|
|
42
|
+
|
|
43
|
+
def decode(self, token: str, **kwargs: Any) -> Mapping[str, Any]:
|
|
44
|
+
raise NotImplementedError
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class JoseKeySetBase(JoseKeySetPort, ABC):
|
|
48
|
+
@property
|
|
49
|
+
def keys(self) -> Mapping[str, Any]:
|
|
50
|
+
raise NotImplementedError
|
|
51
|
+
|
|
52
|
+
def add(self, key: Any) -> Any:
|
|
53
|
+
raise NotImplementedError
|
|
54
|
+
|
|
55
|
+
def rotate(self, **kwargs: Any) -> Any:
|
|
56
|
+
raise NotImplementedError
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class JwePolicyBase(JwePolicyPort, ABC):
|
|
60
|
+
def as_header(
|
|
61
|
+
self, *, typ: str | None = None, cty: str | None = None
|
|
62
|
+
) -> Mapping[str, str]:
|
|
63
|
+
raise NotImplementedError
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class KeyRotationPolicyBase(KeyRotationPolicyPort, ABC):
|
|
67
|
+
@property
|
|
68
|
+
def versions(self) -> Mapping[tuple[str, str], Any]:
|
|
69
|
+
raise NotImplementedError
|
|
70
|
+
|
|
71
|
+
def create_policy_version(
|
|
72
|
+
self, policy_id: str, version_id: str, **kwargs: Any
|
|
73
|
+
) -> Any:
|
|
74
|
+
raise NotImplementedError
|
|
75
|
+
|
|
76
|
+
def approve_policy_version(
|
|
77
|
+
self, policy_id: str, version_id: str, *, actor: str
|
|
78
|
+
) -> Any:
|
|
79
|
+
raise NotImplementedError
|
|
80
|
+
|
|
81
|
+
def publish_policy_version(
|
|
82
|
+
self, policy_id: str, version_id: str, *, actor: str
|
|
83
|
+
) -> Any:
|
|
84
|
+
raise NotImplementedError
|
|
85
|
+
|
|
86
|
+
def effective_policy(self, **scope: str) -> Any | None:
|
|
87
|
+
raise NotImplementedError
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class KeyRotationAdministrationBase(KeyRotationAdministrationPort, ABC):
|
|
91
|
+
@property
|
|
92
|
+
def audit_records(self) -> Iterable[Any]:
|
|
93
|
+
raise NotImplementedError
|
|
94
|
+
|
|
95
|
+
def view_effective_policy(self, **scope: str) -> Any:
|
|
96
|
+
raise NotImplementedError
|
|
97
|
+
|
|
98
|
+
def execute_rotation(self, **kwargs: Any) -> Any:
|
|
99
|
+
raise NotImplementedError
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class SdJwtCoderBase(ABC):
|
|
103
|
+
def encode_sd_jwt(self, claims: Mapping[str, Any], **kwargs: Any) -> str:
|
|
104
|
+
raise NotImplementedError
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class SdJwtDisclosureVerifierBase(ABC):
|
|
108
|
+
def verify_disclosures(
|
|
109
|
+
self, token: str, disclosures: Iterable[str], /
|
|
110
|
+
) -> Mapping[str, Any]:
|
|
111
|
+
raise NotImplementedError
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class SdJwtKeyBindingVerifierBase(ABC):
|
|
115
|
+
def verify_key_binding(
|
|
116
|
+
self, key_binding_jwt: str, **kwargs: Any
|
|
117
|
+
) -> Mapping[str, Any]:
|
|
118
|
+
raise NotImplementedError
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class SetCoderBase(JwtCoderBase):
|
|
122
|
+
"""JWT coder constrained to the RFC 8417 Security Event Token profile."""
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class EatJwtCoderBase(JwtCoderBase):
|
|
126
|
+
"""JWT coder constrained to an EAT profile."""
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class WalletAttestationJwtVerifierBase(JwtCoderBase):
|
|
130
|
+
"""JWT verifier constrained to a wallet-attestation profile."""
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
__all__ = [
|
|
134
|
+
"EatJwtCoderBase",
|
|
135
|
+
"JoseEnvelopeIssuerBase",
|
|
136
|
+
"JoseEnvelopeVerifierBase",
|
|
137
|
+
"JoseKeySetBase",
|
|
138
|
+
"JwePolicyBase",
|
|
139
|
+
"JwtCoderBase",
|
|
140
|
+
"JwtTokenIssuerBase",
|
|
141
|
+
"JwtTokenVerifierBase",
|
|
142
|
+
"KeyRotationAdministrationBase",
|
|
143
|
+
"KeyRotationPolicyBase",
|
|
144
|
+
"SdJwtCoderBase",
|
|
145
|
+
"SdJwtDisclosureVerifierBase",
|
|
146
|
+
"SdJwtKeyBindingVerifierBase",
|
|
147
|
+
"SetCoderBase",
|
|
148
|
+
"WalletAttestationJwtVerifierBase",
|
|
149
|
+
]
|
|
File without changes
|