tba-protocol-credential-iso-mdoc 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_protocol_credential_iso_mdoc-0.4.0.dev2/PKG-INFO +18 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/pyproject.toml +11 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/__init__.py +69 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/bindings.py +9 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/claims.py +12 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/compatibility.py +21 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/device_request.py +10 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/device_response.py +9 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/errors.py +8 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/features.py +15 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/issuance.py +5 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/issuer_signed.py +9 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/mdoc.py +8 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/migrations.py +12 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/mobile_security_object.py +9 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/py.typed +1 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/schemas.py +41 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/session_transcript.py +7 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/verification.py +15 -0
- tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/versions.py +39 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-protocol-credential-iso-mdoc
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary:
|
|
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-digital-credential (==0.4.0.dev2)
|
|
14
|
+
Requires-Dist: tba-concrete-mdoc (==0.4.0.dev2)
|
|
15
|
+
Requires-Dist: tba-concrete-mdoc-credential (==0.4.0.dev2)
|
|
16
|
+
Requires-Dist: tba-contracts-identity (==0.4.0.dev2)
|
|
17
|
+
Requires-Dist: tba-provider-mdoc-issuer (==0.4.0.dev2)
|
|
18
|
+
Requires-Dist: tba-provider-mdoc-verifier (==0.4.0.dev2)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name="tba-protocol-credential-iso-mdoc"
|
|
3
|
+
version="0.4.0.dev2"
|
|
4
|
+
requires-python=">=3.10,<3.15"
|
|
5
|
+
license="Apache-2.0"
|
|
6
|
+
dependencies=["tba-concrete-mdoc==0.4.0.dev2","tba-concrete-mdoc-credential==0.4.0.dev2", "tba-bases-digital-credential==0.4.0.dev2", "tba-contracts-identity==0.4.0.dev2", "tba-provider-mdoc-issuer==0.4.0.dev2", "tba-provider-mdoc-verifier==0.4.0.dev2"]
|
|
7
|
+
[build-system]
|
|
8
|
+
requires=["poetry-core>=1.0.0"]
|
|
9
|
+
build-backend="poetry.core.masonry.api"
|
|
10
|
+
[tool.poetry]
|
|
11
|
+
packages=[{include="tba_protocol_credential_iso_mdoc",from="src"}]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from .compatibility import IsoMdocCompatibility, compatibility
|
|
2
|
+
from .features import FEATURES_BY_VERSION, supports
|
|
3
|
+
from .errors import IsoMdocProtocolError
|
|
4
|
+
from .migrations import migrate_document
|
|
5
|
+
from .issuance import MdocIssuerProvider
|
|
6
|
+
from .schemas import (
|
|
7
|
+
DeviceRequest,
|
|
8
|
+
DeviceResponse,
|
|
9
|
+
DeviceResponseStatus,
|
|
10
|
+
DocRequest,
|
|
11
|
+
IssuerSigned,
|
|
12
|
+
IssuerSignedItem,
|
|
13
|
+
ItemsRequest,
|
|
14
|
+
Mdoc,
|
|
15
|
+
MobileSecurityObject,
|
|
16
|
+
SessionTranscript,
|
|
17
|
+
ValidityInfo,
|
|
18
|
+
parse_device_request,
|
|
19
|
+
parse_device_response,
|
|
20
|
+
parse_issuer_signed,
|
|
21
|
+
parse_mdoc,
|
|
22
|
+
parse_mdoc_credential,
|
|
23
|
+
parse_mobile_security_object,
|
|
24
|
+
)
|
|
25
|
+
from .versions import (
|
|
26
|
+
CURRENT_VERSION,
|
|
27
|
+
VERSION_HISTORY,
|
|
28
|
+
IsoMdocRevision,
|
|
29
|
+
IsoMdocVersion,
|
|
30
|
+
select_version,
|
|
31
|
+
)
|
|
32
|
+
from .verification import MdocVerifierProvider
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"CURRENT_VERSION",
|
|
36
|
+
"CAPABILITY_REQUIREMENTS",
|
|
37
|
+
"DeviceRequest",
|
|
38
|
+
"DeviceResponse",
|
|
39
|
+
"DeviceResponseStatus",
|
|
40
|
+
"DocRequest",
|
|
41
|
+
"FEATURES_BY_VERSION",
|
|
42
|
+
"IssuerSigned",
|
|
43
|
+
"IssuerSignedItem",
|
|
44
|
+
"ItemsRequest",
|
|
45
|
+
"Mdoc",
|
|
46
|
+
"MdocIssuerProvider",
|
|
47
|
+
"MdocVerifierProvider",
|
|
48
|
+
"MobileSecurityObject",
|
|
49
|
+
"SessionTranscript",
|
|
50
|
+
"VERSION_HISTORY",
|
|
51
|
+
"ValidityInfo",
|
|
52
|
+
"IsoMdocCompatibility",
|
|
53
|
+
"IsoMdocProtocolError",
|
|
54
|
+
"IsoMdocRevision",
|
|
55
|
+
"IsoMdocVersion",
|
|
56
|
+
"compatibility",
|
|
57
|
+
"migrate_document",
|
|
58
|
+
"namespace_claims",
|
|
59
|
+
"parse_device_request",
|
|
60
|
+
"parse_device_response",
|
|
61
|
+
"parse_issuer_signed",
|
|
62
|
+
"parse_mdoc",
|
|
63
|
+
"parse_mdoc_credential",
|
|
64
|
+
"parse_mobile_security_object",
|
|
65
|
+
"select_version",
|
|
66
|
+
"supports",
|
|
67
|
+
]
|
|
68
|
+
from .bindings import CAPABILITY_REQUIREMENTS
|
|
69
|
+
from .claims import namespace_claims
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""ISO mdoc namespace claim material."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def namespace_claims(value: Mapping[str, object]) -> dict[str, object]:
|
|
7
|
+
"""Normalize one namespace without assigning issuer trust."""
|
|
8
|
+
|
|
9
|
+
return {str(name): claim for name, claim in value.items()}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__all__ = ["namespace_claims"]
|
tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/compatibility.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from .versions import CURRENT_VERSION
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass(frozen=True, slots=True)
|
|
7
|
+
class IsoMdocCompatibility:
|
|
8
|
+
source: str
|
|
9
|
+
target: str
|
|
10
|
+
compatible: bool
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def compatibility(
|
|
14
|
+
source: str, target: str = CURRENT_VERSION.value
|
|
15
|
+
) -> IsoMdocCompatibility:
|
|
16
|
+
return IsoMdocCompatibility(
|
|
17
|
+
source, target, source == target == CURRENT_VERSION.value
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
__all__ = ["IsoMdocCompatibility", "compatibility"]
|
tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/device_request.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Versioned ISO mdoc protocol exports backed by deterministic layer-10 models."""
|
|
2
|
+
|
|
3
|
+
from tba_concrete_mdoc.device_request import (
|
|
4
|
+
DeviceRequest,
|
|
5
|
+
DocRequest,
|
|
6
|
+
ItemsRequest,
|
|
7
|
+
parse_device_request,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__all__ = ["DeviceRequest", "DocRequest", "ItemsRequest", "parse_device_request"]
|
tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/device_response.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Versioned ISO mdoc protocol exports backed by deterministic layer-10 models."""
|
|
2
|
+
|
|
3
|
+
from tba_concrete_mdoc.device_response import (
|
|
4
|
+
DeviceResponse,
|
|
5
|
+
DeviceResponseStatus,
|
|
6
|
+
parse_device_response,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
__all__ = ["DeviceResponse", "DeviceResponseStatus", "parse_device_response"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .versions import CURRENT_VERSION, IsoMdocVersion
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
FEATURES_BY_VERSION = {
|
|
5
|
+
IsoMdocVersion.ISO_18013_5_2021.value: frozenset(
|
|
6
|
+
{"issuer-signed", "device-signed", "session-transcript", "cbor", "cose"}
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def supports(feature: str, version: IsoMdocVersion = CURRENT_VERSION) -> bool:
|
|
12
|
+
return feature in FEATURES_BY_VERSION[version.value]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
__all__ = ["FEATURES_BY_VERSION", "supports"]
|
tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/issuer_signed.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Versioned ISO mdoc protocol exports backed by deterministic layer-10 models."""
|
|
2
|
+
|
|
3
|
+
from tba_concrete_mdoc.issuer_signed import (
|
|
4
|
+
IssuerSigned,
|
|
5
|
+
IssuerSignedItem,
|
|
6
|
+
parse_issuer_signed,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
__all__ = ["IssuerSigned", "IssuerSignedItem", "parse_issuer_signed"]
|
tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/migrations.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import Mapping
|
|
2
|
+
|
|
3
|
+
from .versions import CURRENT_VERSION
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def migrate_document(value: Mapping[str, object], *, source: str) -> dict[str, object]:
|
|
7
|
+
if source != CURRENT_VERSION.value:
|
|
8
|
+
raise ValueError(f"no ISO mdoc migration path from {source}")
|
|
9
|
+
return dict(value)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__all__ = ["migrate_document"]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Versioned ISO mdoc protocol exports backed by deterministic layer-10 models."""
|
|
2
|
+
|
|
3
|
+
from tba_concrete_mdoc.mobile_security_object import (
|
|
4
|
+
MobileSecurityObject,
|
|
5
|
+
ValidityInfo,
|
|
6
|
+
parse_mobile_security_object,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
__all__ = ["MobileSecurityObject", "ValidityInfo", "parse_mobile_security_object"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Versioned ISO mdoc protocol exports backed by deterministic layer-10 models."""
|
|
2
|
+
|
|
3
|
+
from tba_concrete_mdoc.schemas import (
|
|
4
|
+
DeviceRequest,
|
|
5
|
+
DeviceResponse,
|
|
6
|
+
DeviceResponseStatus,
|
|
7
|
+
DocRequest,
|
|
8
|
+
IssuerSigned,
|
|
9
|
+
IssuerSignedItem,
|
|
10
|
+
ItemsRequest,
|
|
11
|
+
Mdoc,
|
|
12
|
+
MobileSecurityObject,
|
|
13
|
+
SessionTranscript,
|
|
14
|
+
ValidityInfo,
|
|
15
|
+
parse_device_request,
|
|
16
|
+
parse_device_response,
|
|
17
|
+
parse_issuer_signed,
|
|
18
|
+
parse_mdoc,
|
|
19
|
+
parse_mdoc_credential,
|
|
20
|
+
parse_mobile_security_object,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"DeviceRequest",
|
|
25
|
+
"DeviceResponse",
|
|
26
|
+
"DeviceResponseStatus",
|
|
27
|
+
"DocRequest",
|
|
28
|
+
"IssuerSigned",
|
|
29
|
+
"IssuerSignedItem",
|
|
30
|
+
"ItemsRequest",
|
|
31
|
+
"Mdoc",
|
|
32
|
+
"MobileSecurityObject",
|
|
33
|
+
"SessionTranscript",
|
|
34
|
+
"ValidityInfo",
|
|
35
|
+
"parse_device_request",
|
|
36
|
+
"parse_device_response",
|
|
37
|
+
"parse_issuer_signed",
|
|
38
|
+
"parse_mdoc",
|
|
39
|
+
"parse_mdoc_credential",
|
|
40
|
+
"parse_mobile_security_object",
|
|
41
|
+
]
|
tba_protocol_credential_iso_mdoc-0.4.0.dev2/src/tba_protocol_credential_iso_mdoc/verification.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Protocol export for the injected ISO mdoc verification provider."""
|
|
2
|
+
|
|
3
|
+
from tba_provider_mdoc_verifier import (
|
|
4
|
+
CanonicalCborEncoder,
|
|
5
|
+
CborDecoder,
|
|
6
|
+
CosePayloadDecoder,
|
|
7
|
+
MdocVerifierProvider,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"CanonicalCborEncoder",
|
|
12
|
+
"CborDecoder",
|
|
13
|
+
"CosePayloadDecoder",
|
|
14
|
+
"MdocVerifierProvider",
|
|
15
|
+
]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from enum import StrEnum
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IsoMdocVersion(StrEnum):
|
|
6
|
+
ISO_18013_5_2021 = "ISO/IEC 18013-5:2021"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(frozen=True, slots=True)
|
|
10
|
+
class IsoMdocRevision:
|
|
11
|
+
identifier: str
|
|
12
|
+
status: str
|
|
13
|
+
specification: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
CURRENT_VERSION = IsoMdocVersion.ISO_18013_5_2021
|
|
17
|
+
VERSION_HISTORY = {
|
|
18
|
+
CURRENT_VERSION.value: IsoMdocRevision(
|
|
19
|
+
CURRENT_VERSION.value,
|
|
20
|
+
"international-standard",
|
|
21
|
+
"ISO/IEC 18013-5:2021",
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def select_version(value: str | IsoMdocVersion) -> IsoMdocVersion:
|
|
27
|
+
version = IsoMdocVersion(value)
|
|
28
|
+
if version.value not in VERSION_HISTORY:
|
|
29
|
+
raise ValueError(f"unsupported ISO mdoc revision: {value}")
|
|
30
|
+
return version
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"CURRENT_VERSION",
|
|
35
|
+
"VERSION_HISTORY",
|
|
36
|
+
"IsoMdocRevision",
|
|
37
|
+
"IsoMdocVersion",
|
|
38
|
+
"select_version",
|
|
39
|
+
]
|