tba-profile-workload-proof-wimse-wpt 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.
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/PKG-INFO +11 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/pyproject.toml +10 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/__init__.py +11 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/bindings.py +5 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/claims.py +5 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/compatibility.py +3 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/errors.py +8 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/features.py +10 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/migrations.py +6 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/py.typed +0 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/schemas.py +5 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/validation.py +35 -0
- tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/versions.py +16 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-profile-workload-proof-wimse-wpt
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.10,<3.15
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name="tba-profile-workload-proof-wimse-wpt"
|
|
3
|
+
version="0.4.0.dev2"
|
|
4
|
+
requires-python=">=3.10,<3.15"
|
|
5
|
+
dependencies=[]
|
|
6
|
+
[build-system]
|
|
7
|
+
requires=["poetry-core>=1.0.0"]
|
|
8
|
+
build-backend="poetry.core.masonry.api"
|
|
9
|
+
[tool.poetry]
|
|
10
|
+
packages=[{include="tba_profile_workload_proof_wimse_wpt",from="src"}]
|
tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/__init__.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .validation import OPTIONAL_BINDING_CLAIMS, REQUIRED_WPT_CLAIMS, validate_wpt
|
|
2
|
+
from .versions import CURRENT_VERSION, VERSION_HISTORY, WptVersion
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"CURRENT_VERSION",
|
|
6
|
+
"OPTIONAL_BINDING_CLAIMS",
|
|
7
|
+
"REQUIRED_WPT_CLAIMS",
|
|
8
|
+
"VERSION_HISTORY",
|
|
9
|
+
"WptVersion",
|
|
10
|
+
"validate_wpt",
|
|
11
|
+
]
|
tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from collections.abc import Mapping, Sequence
|
|
2
|
+
|
|
3
|
+
REQUIRED_WPT_CLAIMS = frozenset({"aud", "exp", "jti", "wth"})
|
|
4
|
+
OPTIONAL_BINDING_CLAIMS = frozenset({"ath", "tth", "oth"})
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def validate_wpt(
|
|
8
|
+
headers: Mapping[str, object],
|
|
9
|
+
claims: Mapping[str, object],
|
|
10
|
+
*,
|
|
11
|
+
expected_audience: str,
|
|
12
|
+
expected_wit_hash: str,
|
|
13
|
+
) -> None:
|
|
14
|
+
if headers.get("typ") != "wpt+jwt":
|
|
15
|
+
raise ValueError("WPT requires typ=wpt+jwt")
|
|
16
|
+
if headers.get("alg") in {None, "none"}:
|
|
17
|
+
raise ValueError("WPT must be signed with the WIT confirmation key")
|
|
18
|
+
missing = REQUIRED_WPT_CLAIMS.difference(claims)
|
|
19
|
+
if missing:
|
|
20
|
+
raise ValueError(f"missing WPT claims: {sorted(missing)}")
|
|
21
|
+
aud = claims["aud"]
|
|
22
|
+
audiences = (
|
|
23
|
+
(aud,)
|
|
24
|
+
if isinstance(aud, str)
|
|
25
|
+
else tuple(aud)
|
|
26
|
+
if isinstance(aud, Sequence)
|
|
27
|
+
else ()
|
|
28
|
+
)
|
|
29
|
+
if expected_audience not in audiences:
|
|
30
|
+
raise ValueError("WPT audience mismatch")
|
|
31
|
+
if claims["wth"] != expected_wit_hash:
|
|
32
|
+
raise ValueError("WPT does not bind the presented WIT")
|
|
33
|
+
oth = claims.get("oth", ())
|
|
34
|
+
if not isinstance(oth, (Mapping, Sequence)):
|
|
35
|
+
raise ValueError("WPT oth must contain token hashes")
|
tba_profile_workload_proof_wimse_wpt-0.4.0.dev2/src/tba_profile_workload_proof_wimse_wpt/versions.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True, slots=True)
|
|
5
|
+
class WptVersion:
|
|
6
|
+
identifier: str
|
|
7
|
+
status: str
|
|
8
|
+
specification_uri: str
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
CURRENT_VERSION = WptVersion(
|
|
12
|
+
"draft-ietf-wimse-wpt-01",
|
|
13
|
+
"IETF-draft",
|
|
14
|
+
"https://datatracker.ietf.org/doc/draft-ietf-wimse-wpt/01/",
|
|
15
|
+
)
|
|
16
|
+
VERSION_HISTORY = (CURRENT_VERSION,)
|