tba-protocol-attestation-corim 0.4.0.dev2__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.
- tba_protocol_attestation_corim/__init__.py +63 -0
- tba_protocol_attestation_corim/bindings.py +56 -0
- tba_protocol_attestation_corim/claims.py +16 -0
- tba_protocol_attestation_corim/compatibility.py +42 -0
- tba_protocol_attestation_corim/errors.py +20 -0
- tba_protocol_attestation_corim/features.py +16 -0
- tba_protocol_attestation_corim/migrations.py +19 -0
- tba_protocol_attestation_corim/py.typed +1 -0
- tba_protocol_attestation_corim/schemas.py +32 -0
- tba_protocol_attestation_corim/versions.py +25 -0
- tba_protocol_attestation_corim-0.4.0.dev2.dist-info/METADATA +14 -0
- tba_protocol_attestation_corim-0.4.0.dev2.dist-info/RECORD +13 -0
- tba_protocol_attestation_corim-0.4.0.dev2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Versioned CoRIM-family reference-material profile ownership."""
|
|
2
|
+
|
|
3
|
+
from tba_contracts_identity.protocol_processing import (
|
|
4
|
+
build_protocol_capability_report,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from .bindings import CAPABILITY_REQUIREMENTS
|
|
8
|
+
from .claims import CORIM_CLAIM_CLASSES, CORIM_MAP_FIELDS
|
|
9
|
+
from .compatibility import COMPATIBILITY_PATHS, CorimCompatibility, compatibility
|
|
10
|
+
from .errors import (
|
|
11
|
+
CorimProtocolError,
|
|
12
|
+
CorimReferenceIntegrityError,
|
|
13
|
+
UnsupportedCorimMediaTypeError,
|
|
14
|
+
)
|
|
15
|
+
from .features import FEATURES_BY_VERSION, supports
|
|
16
|
+
from .migrations import migrate_document
|
|
17
|
+
from .schemas import (
|
|
18
|
+
CORIM_CARRIERS,
|
|
19
|
+
CORIM_SIGNED_CARRIER,
|
|
20
|
+
CORIM_UNSIGNED_CARRIER,
|
|
21
|
+
CorimCarrier,
|
|
22
|
+
select_carrier,
|
|
23
|
+
)
|
|
24
|
+
from .versions import CURRENT_VERSION, VERSION_HISTORY, CorimVersion, select_version
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def capability_report() -> dict[str, object]:
|
|
28
|
+
report = build_protocol_capability_report(
|
|
29
|
+
protocol="corim",
|
|
30
|
+
revision=CURRENT_VERSION.identifier,
|
|
31
|
+
features=tuple(FEATURES_BY_VERSION[CURRENT_VERSION.identifier]),
|
|
32
|
+
evidence_links=("tests/unit/test_corim_protocol_versioning.py",),
|
|
33
|
+
extra_requirements=CAPABILITY_REQUIREMENTS,
|
|
34
|
+
include_default_artifact_requirements=False,
|
|
35
|
+
)
|
|
36
|
+
report["status"] = CURRENT_VERSION.status
|
|
37
|
+
return report
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"CAPABILITY_REQUIREMENTS",
|
|
42
|
+
"COMPATIBILITY_PATHS",
|
|
43
|
+
"CORIM_CARRIERS",
|
|
44
|
+
"CORIM_CLAIM_CLASSES",
|
|
45
|
+
"CORIM_MAP_FIELDS",
|
|
46
|
+
"CORIM_SIGNED_CARRIER",
|
|
47
|
+
"CORIM_UNSIGNED_CARRIER",
|
|
48
|
+
"CURRENT_VERSION",
|
|
49
|
+
"FEATURES_BY_VERSION",
|
|
50
|
+
"VERSION_HISTORY",
|
|
51
|
+
"CorimCarrier",
|
|
52
|
+
"CorimCompatibility",
|
|
53
|
+
"CorimProtocolError",
|
|
54
|
+
"CorimReferenceIntegrityError",
|
|
55
|
+
"CorimVersion",
|
|
56
|
+
"UnsupportedCorimMediaTypeError",
|
|
57
|
+
"capability_report",
|
|
58
|
+
"compatibility",
|
|
59
|
+
"migrate_document",
|
|
60
|
+
"select_carrier",
|
|
61
|
+
"select_version",
|
|
62
|
+
"supports",
|
|
63
|
+
]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""CoRIM artifact operations mapped to semantic capabilities."""
|
|
2
|
+
|
|
3
|
+
from tba_contracts_identity.capabilities import ProtocolCapabilityRequirement
|
|
4
|
+
|
|
5
|
+
from .versions import CURRENT_VERSION
|
|
6
|
+
|
|
7
|
+
CAPABILITY_REQUIREMENTS = (
|
|
8
|
+
ProtocolCapabilityRequirement(
|
|
9
|
+
"corim",
|
|
10
|
+
CURRENT_VERSION.identifier,
|
|
11
|
+
"corim-cbor-decode",
|
|
12
|
+
"signed or unsigned CoRIM CBOR",
|
|
13
|
+
"artifact.processing",
|
|
14
|
+
"decode",
|
|
15
|
+
"corim-reference-manifest",
|
|
16
|
+
),
|
|
17
|
+
ProtocolCapabilityRequirement(
|
|
18
|
+
"corim",
|
|
19
|
+
CURRENT_VERSION.identifier,
|
|
20
|
+
"corim-validation",
|
|
21
|
+
"CoRIM/CoMID/CoSWID/CoTL/CoTS",
|
|
22
|
+
"artifact.processing",
|
|
23
|
+
"validate",
|
|
24
|
+
"validated-reference-manifest",
|
|
25
|
+
),
|
|
26
|
+
ProtocolCapabilityRequirement(
|
|
27
|
+
"corim",
|
|
28
|
+
CURRENT_VERSION.identifier,
|
|
29
|
+
"corim-cbor-encode",
|
|
30
|
+
"signed or unsigned CoRIM CBOR",
|
|
31
|
+
"artifact.processing",
|
|
32
|
+
"encode",
|
|
33
|
+
"corim",
|
|
34
|
+
),
|
|
35
|
+
ProtocolCapabilityRequirement(
|
|
36
|
+
"corim",
|
|
37
|
+
CURRENT_VERSION.identifier,
|
|
38
|
+
"corim-reference-resolution",
|
|
39
|
+
"tag-identity",
|
|
40
|
+
"attestation.appraisal",
|
|
41
|
+
"resolve_reference_material",
|
|
42
|
+
"attestation-reference-manifest",
|
|
43
|
+
),
|
|
44
|
+
ProtocolCapabilityRequirement(
|
|
45
|
+
"corim",
|
|
46
|
+
CURRENT_VERSION.identifier,
|
|
47
|
+
"corim-appraisal-consumption",
|
|
48
|
+
"reference values and endorsements",
|
|
49
|
+
"attestation.appraisal",
|
|
50
|
+
"appraise",
|
|
51
|
+
"attestation-appraisal-result",
|
|
52
|
+
required=False,
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
__all__ = ["CAPABILITY_REQUIREMENTS"]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""CoRIM family map-field ownership.
|
|
2
|
+
|
|
3
|
+
CoRIM does not register JWT/CWT claims. Its concise map fields describe
|
|
4
|
+
reference values, endorsements, trust lists, and trust stores.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
CORIM_CLAIM_CLASSES: tuple[type, ...] = ()
|
|
8
|
+
CORIM_MAP_FIELDS = (
|
|
9
|
+
"tag-identity",
|
|
10
|
+
"profile",
|
|
11
|
+
"tags",
|
|
12
|
+
"validity",
|
|
13
|
+
"entities",
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = ["CORIM_CLAIM_CLASSES", "CORIM_MAP_FIELDS"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""CoRIM draft compatibility paths."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from .versions import CURRENT_VERSION, VERSION_HISTORY
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True, slots=True)
|
|
9
|
+
class CorimCompatibility:
|
|
10
|
+
source: str
|
|
11
|
+
target: str
|
|
12
|
+
compatible: bool
|
|
13
|
+
migration_required: bool
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
COMPATIBILITY_PATHS = (
|
|
17
|
+
CorimCompatibility(
|
|
18
|
+
VERSION_HISTORY[0].identifier,
|
|
19
|
+
CURRENT_VERSION.identifier,
|
|
20
|
+
True,
|
|
21
|
+
True,
|
|
22
|
+
),
|
|
23
|
+
CorimCompatibility(
|
|
24
|
+
CURRENT_VERSION.identifier,
|
|
25
|
+
CURRENT_VERSION.identifier,
|
|
26
|
+
True,
|
|
27
|
+
False,
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def compatibility(
|
|
33
|
+
source: str,
|
|
34
|
+
target: str = CURRENT_VERSION.identifier,
|
|
35
|
+
) -> CorimCompatibility:
|
|
36
|
+
for path in COMPATIBILITY_PATHS:
|
|
37
|
+
if path.source == source and path.target == target:
|
|
38
|
+
return path
|
|
39
|
+
return CorimCompatibility(source, target, False, False)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
__all__ = ["COMPATIBILITY_PATHS", "CorimCompatibility", "compatibility"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""CoRIM protocol/profile mapping errors."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class CorimProtocolError(ValueError):
|
|
5
|
+
"""Base error for a selected CoRIM draft mapping."""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class UnsupportedCorimMediaTypeError(CorimProtocolError):
|
|
9
|
+
"""Raised when no selected signed/unsigned CoRIM carrier applies."""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CorimReferenceIntegrityError(CorimProtocolError):
|
|
13
|
+
"""Raised when reference material fails integrity/profile validation."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"CorimProtocolError",
|
|
18
|
+
"CorimReferenceIntegrityError",
|
|
19
|
+
"UnsupportedCorimMediaTypeError",
|
|
20
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
FEATURES_BY_VERSION = {
|
|
2
|
+
"draft-ietf-rats-corim-10": frozenset({"corim", "comid", "coswid"}),
|
|
3
|
+
"draft-ietf-rats-corim-11": frozenset(
|
|
4
|
+
{"corim", "comid", "coswid", "cotl", "cots", "reference-values", "endorsements"}
|
|
5
|
+
),
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def supports(version: str, feature: str) -> bool:
|
|
10
|
+
try:
|
|
11
|
+
return feature in FEATURES_BY_VERSION[version]
|
|
12
|
+
except KeyError as exc:
|
|
13
|
+
raise ValueError(f"unsupported CoRIM version: {version}") from exc
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = ["FEATURES_BY_VERSION", "supports"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def migrate_document(
|
|
5
|
+
document: Mapping[str, object], *, from_version: str, to_version: str
|
|
6
|
+
) -> dict[str, object]:
|
|
7
|
+
if from_version == to_version:
|
|
8
|
+
return dict(document)
|
|
9
|
+
if (from_version, to_version) == (
|
|
10
|
+
"draft-ietf-rats-corim-10",
|
|
11
|
+
"draft-ietf-rats-corim-11",
|
|
12
|
+
):
|
|
13
|
+
migrated = dict(document)
|
|
14
|
+
migrated.setdefault("profile", "tag:ietf.org,2025:corim")
|
|
15
|
+
return migrated
|
|
16
|
+
raise ValueError(f"unsupported CoRIM migration: {from_version} -> {to_version}")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
__all__ = ["migrate_document"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""CoRIM family carrier descriptors."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from .errors import UnsupportedCorimMediaTypeError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True, slots=True)
|
|
9
|
+
class CorimCarrier:
|
|
10
|
+
media_type: str
|
|
11
|
+
signed: bool
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
CORIM_UNSIGNED_CARRIER = CorimCarrier("application/corim-unsigned+cbor", False)
|
|
15
|
+
CORIM_SIGNED_CARRIER = CorimCarrier("application/corim-signed+cbor", True)
|
|
16
|
+
CORIM_CARRIERS = (CORIM_UNSIGNED_CARRIER, CORIM_SIGNED_CARRIER)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def select_carrier(media_type: str) -> CorimCarrier:
|
|
20
|
+
for carrier in CORIM_CARRIERS:
|
|
21
|
+
if carrier.media_type == media_type:
|
|
22
|
+
return carrier
|
|
23
|
+
raise UnsupportedCorimMediaTypeError(f"unsupported CoRIM media type: {media_type}")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"CORIM_CARRIERS",
|
|
28
|
+
"CORIM_SIGNED_CARRIER",
|
|
29
|
+
"CORIM_UNSIGNED_CARRIER",
|
|
30
|
+
"CorimCarrier",
|
|
31
|
+
"select_carrier",
|
|
32
|
+
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True, slots=True)
|
|
5
|
+
class CorimVersion:
|
|
6
|
+
identifier: str
|
|
7
|
+
status: str
|
|
8
|
+
published: str
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
VERSION_HISTORY = (
|
|
12
|
+
CorimVersion("draft-ietf-rats-corim-10", "superseded-draft", "2024-07"),
|
|
13
|
+
CorimVersion("draft-ietf-rats-corim-11", "active-draft", "2025-03"),
|
|
14
|
+
)
|
|
15
|
+
CURRENT_VERSION = VERSION_HISTORY[-1]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def select_version(identifier: str = CURRENT_VERSION.identifier) -> CorimVersion:
|
|
19
|
+
for version in VERSION_HISTORY:
|
|
20
|
+
if version.identifier == identifier:
|
|
21
|
+
return version
|
|
22
|
+
raise ValueError(f"unsupported CoRIM version: {identifier}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
__all__ = ["CURRENT_VERSION", "VERSION_HISTORY", "CorimVersion", "select_version"]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-protocol-attestation-corim
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Versioned CoRIM-family protocol profile and capability mapping.
|
|
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-concrete-corim (==0.4.0.dev2)
|
|
14
|
+
Requires-Dist: tba-contracts-identity (==0.4.0.dev2)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
tba_protocol_attestation_corim/__init__.py,sha256=G8j8SvoVdDZYazTFc787TQ6cesa6FUDqogqqzRdiodA,1847
|
|
2
|
+
tba_protocol_attestation_corim/bindings.py,sha256=bJpZ-2zauBHyu3-HrPmb26p1tO7fPU8p56u4ntT3N_k,1554
|
|
3
|
+
tba_protocol_attestation_corim/claims.py,sha256=G5RxolycMsjd6tTkvZz7TpUdxg7PjDTEquMt6VHrPbw,378
|
|
4
|
+
tba_protocol_attestation_corim/compatibility.py,sha256=cSGk_HJaCbuTSx-7-Y3kErsiO8JLwCGqgNnps4LJGmk,935
|
|
5
|
+
tba_protocol_attestation_corim/errors.py,sha256=fySgU9TSZmyqNLsODyK7y1jJw6OA7eszsdr0DN3yg-o,526
|
|
6
|
+
tba_protocol_attestation_corim/features.py,sha256=IhF2GnSmMYwVykuUxSeMk5v6jpGnImlQV5tn5WBsNWM,505
|
|
7
|
+
tba_protocol_attestation_corim/migrations.py,sha256=h3__vXGXaSdAsrBZdbxleSOWlDMFvqPyykeLR0rJxSU,583
|
|
8
|
+
tba_protocol_attestation_corim/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
9
|
+
tba_protocol_attestation_corim/schemas.py,sha256=J4TwC17Z-ighZK9yeYSAzVubpyFlOFKNHzAfE3EYH60,831
|
|
10
|
+
tba_protocol_attestation_corim/versions.py,sha256=UBtfKzVUm-K85idP6IYT4qoR3LJX1cHbXXCvXHc34Lo,701
|
|
11
|
+
tba_protocol_attestation_corim-0.4.0.dev2.dist-info/METADATA,sha256=dz5IwCGS_Kj3ST3Ca4_hhIluW1wD3uIjge4cppTtqpk,618
|
|
12
|
+
tba_protocol_attestation_corim-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
13
|
+
tba_protocol_attestation_corim-0.4.0.dev2.dist-info/RECORD,,
|