tba-storage-digital-credential 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.
@@ -0,0 +1,7 @@
1
+ """Standalone identity storage component."""
2
+
3
+ from .manifest import MANIFEST, load_manifest
4
+ from .tables import * # noqa: F401,F403
5
+ from .tables import TABLE_MODEL_BY_NAME, TABLE_MODEL_BY_TABLENAME, TABLE_MODELS
6
+
7
+ __all__ = ["MANIFEST", "load_manifest", "TABLE_MODELS", "TABLE_MODEL_BY_NAME", "TABLE_MODEL_BY_TABLENAME"] + [model.__name__ for model in TABLE_MODELS]
@@ -0,0 +1,89 @@
1
+ manifest_version = "1.0.0"
2
+
3
+ [component]
4
+ id = "tigrbl.identity.storage.digital-credential"
5
+ distribution = "tba-storage-digital-credential"
6
+ import_root = "tba_storage_digital_credential"
7
+
8
+ [schema]
9
+ contract = "1.0.0"
10
+ migration_head = "0e47cb7f-3dd7-5c79-a82a-371198cf5b27"
11
+ migrations_package = "tba_storage_digital_credential.migrations.versions"
12
+
13
+ [[schema.objects]]
14
+ id = "tigrbl.identity.storage.digital-credential:table:credential_issuers"
15
+ kind = "table"
16
+ physical_name = "authn.credential_issuers"
17
+ model = "tba_storage_digital_credential.tables:CredentialIssuer"
18
+
19
+ [[schema.objects]]
20
+ id = "tigrbl.identity.storage.digital-credential:table:credential_configurations"
21
+ kind = "table"
22
+ physical_name = "authn.credential_configurations"
23
+ model = "tba_storage_digital_credential.tables:CredentialConfiguration"
24
+
25
+ [[schema.objects]]
26
+ id = "tigrbl.identity.storage.digital-credential:table:wallet_registrations"
27
+ kind = "table"
28
+ physical_name = "authn.wallet_registrations"
29
+ model = "tba_storage_digital_credential.tables:WalletRegistration"
30
+
31
+ [[schema.objects]]
32
+ id = "tigrbl.identity.storage.digital-credential:table:wallet_instances"
33
+ kind = "table"
34
+ physical_name = "authn.wallet_instances"
35
+ model = "tba_storage_digital_credential.tables:WalletInstance"
36
+
37
+ [[schema.objects]]
38
+ id = "tigrbl.identity.storage.digital-credential:table:wallet_attestations"
39
+ kind = "table"
40
+ physical_name = "authn.wallet_attestations"
41
+ model = "tba_storage_digital_credential.tables:WalletAttestation"
42
+
43
+ [[schema.objects]]
44
+ id = "tigrbl.identity.storage.digital-credential:table:wallet_key_bindings"
45
+ kind = "table"
46
+ physical_name = "authn.wallet_key_bindings"
47
+ model = "tba_storage_digital_credential.tables:WalletKeyBinding"
48
+
49
+ [[schema.objects]]
50
+ id = "tigrbl.identity.storage.digital-credential:table:credential_offers"
51
+ kind = "table"
52
+ physical_name = "authn.credential_offers"
53
+ model = "tba_storage_digital_credential.tables:CredentialOffer"
54
+
55
+ [[schema.objects]]
56
+ id = "tigrbl.identity.storage.digital-credential:table:credential_issuance_transactions"
57
+ kind = "table"
58
+ physical_name = "authn.credential_issuance_transactions"
59
+ model = "tba_storage_digital_credential.tables:CredentialIssuanceTransaction"
60
+
61
+ [[schema.objects]]
62
+ id = "tigrbl.identity.storage.digital-credential:table:credential_deferred_transactions"
63
+ kind = "table"
64
+ physical_name = "authn.credential_deferred_transactions"
65
+ model = "tba_storage_digital_credential.tables:CredentialDeferredTransaction"
66
+
67
+ [[schema.objects]]
68
+ id = "tigrbl.identity.storage.digital-credential:table:credential_notifications"
69
+ kind = "table"
70
+ physical_name = "authn.credential_notifications"
71
+ model = "tba_storage_digital_credential.tables:CredentialNotification"
72
+
73
+ [[schema.objects]]
74
+ id = "tigrbl.identity.storage.digital-credential:table:credential_status_lists"
75
+ kind = "table"
76
+ physical_name = "authn.credential_status_lists"
77
+ model = "tba_storage_digital_credential.tables:CredentialStatusList"
78
+
79
+ [[schema.objects]]
80
+ id = "tigrbl.identity.storage.digital-credential:table:credential_status_entries"
81
+ kind = "table"
82
+ physical_name = "authn.credential_status_entries"
83
+ model = "tba_storage_digital_credential.tables:CredentialStatusEntry"
84
+
85
+ [[schema.objects]]
86
+ id = "tigrbl.identity.storage.digital-credential:table:credential_status_publications"
87
+ kind = "table"
88
+ physical_name = "authn.credential_status_publications"
89
+ model = "tba_storage_digital_credential.tables:CredentialStatusPublication"
@@ -0,0 +1,9 @@
1
+ """Installed component manifest access."""
2
+ from importlib.resources import as_file, files
3
+ from tigrbl_migrations import StorageManifest
4
+
5
+ def load_manifest() -> StorageManifest:
6
+ with as_file(files(__package__).joinpath("component.toml")) as path:
7
+ return StorageManifest.from_toml(path)
8
+
9
+ MANIFEST = load_manifest()
File without changes
@@ -0,0 +1,23 @@
1
+ """Initial owned schema for tigrbl.identity.storage.digital-credential."""
2
+ from tigrbl_migrations import Migration
3
+ from tba_storage_digital_credential.tables import TABLE_MODELS
4
+
5
+ REVISION = "0e47cb7f-3dd7-5c79-a82a-371198cf5b27"
6
+
7
+ def upgrade(connection):
8
+ for model in TABLE_MODELS:
9
+ model.__table__.create(bind=connection, checkfirst=True)
10
+
11
+ def downgrade(connection):
12
+ for model in reversed(TABLE_MODELS):
13
+ model.__table__.drop(bind=connection, checkfirst=True)
14
+
15
+ MIGRATION = Migration(
16
+ component="tigrbl.identity.storage.digital-credential",
17
+ revision=REVISION,
18
+ parents=(),
19
+ kind="standard",
20
+ reversible=True,
21
+ upgrade=upgrade,
22
+ downgrade=downgrade,
23
+ )
File without changes
@@ -0,0 +1,25 @@
1
+ """Owned mapped-table inventory."""
2
+
3
+ from .credential_ecosystem_registry import CredentialIssuer, CredentialConfiguration, WalletRegistration, WalletInstance, WalletAttestation, WalletKeyBinding
4
+ from .credential_issuance_state import CredentialOffer, CredentialIssuanceTransaction, CredentialDeferredTransaction, CredentialNotification, CredentialStatusList, CredentialStatusEntry, CredentialStatusPublication
5
+
6
+ TABLE_MODELS = (
7
+ CredentialIssuer,
8
+ CredentialConfiguration,
9
+ WalletRegistration,
10
+ WalletInstance,
11
+ WalletAttestation,
12
+ WalletKeyBinding,
13
+ CredentialOffer,
14
+ CredentialIssuanceTransaction,
15
+ CredentialDeferredTransaction,
16
+ CredentialNotification,
17
+ CredentialStatusList,
18
+ CredentialStatusEntry,
19
+ CredentialStatusPublication,
20
+ )
21
+ TABLE_MODEL_BY_NAME = {model.__name__: model for model in TABLE_MODELS}
22
+ TABLE_MODEL_BY_TABLENAME = {model.__tablename__: model for model in TABLE_MODELS}
23
+ __all__ = [model.__name__ for model in TABLE_MODELS] + [
24
+ "TABLE_MODELS", "TABLE_MODEL_BY_NAME", "TABLE_MODEL_BY_TABLENAME",
25
+ ]
@@ -0,0 +1,119 @@
1
+ """Durable credential issuer, configuration, and wallet registry state."""
2
+
3
+ from __future__ import annotations
4
+ import datetime as dt
5
+ from tba_primitives_identity.orm import (
6
+ Boolean,
7
+ GUIDPk,
8
+ JSON,
9
+ Mapped,
10
+ RestOltpTable,
11
+ S,
12
+ String,
13
+ TZDateTime,
14
+ Timestamped,
15
+ acol,
16
+ )
17
+
18
+
19
+ class CredentialIssuer(RestOltpTable, GUIDPk, Timestamped):
20
+ __tablename__ = "credential_issuers"
21
+ __table_args__ = ({"schema": "authn"},)
22
+ issuer: Mapped[str] = acol(
23
+ storage=S(String(1000), nullable=False, unique=True, index=True)
24
+ )
25
+ status: Mapped[str] = acol(
26
+ storage=S(String(32), nullable=False, default="active", index=True)
27
+ )
28
+ metadata_document: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
29
+
30
+
31
+ class CredentialConfiguration(RestOltpTable, GUIDPk, Timestamped):
32
+ __tablename__ = "credential_configurations"
33
+ __table_args__ = ({"schema": "authn"},)
34
+ issuer_id: Mapped[str] = acol(storage=S(String(36), nullable=False, index=True))
35
+ configuration_id: Mapped[str] = acol(
36
+ storage=S(String(255), nullable=False, index=True)
37
+ )
38
+ format: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
39
+ credential_type: Mapped[str | None] = acol(
40
+ storage=S(String(255), nullable=True, index=True)
41
+ )
42
+ configuration: Mapped[dict] = acol(storage=S(JSON, nullable=False))
43
+ enabled: Mapped[bool] = acol(
44
+ storage=S(Boolean, nullable=False, default=True, index=True)
45
+ )
46
+
47
+
48
+ class WalletRegistration(RestOltpTable, GUIDPk, Timestamped):
49
+ __tablename__ = "wallet_registrations"
50
+ __table_args__ = ({"schema": "authn"},)
51
+ wallet_id: Mapped[str] = acol(
52
+ storage=S(String(255), nullable=False, unique=True, index=True)
53
+ )
54
+ subject_id: Mapped[str | None] = acol(
55
+ storage=S(String(255), nullable=True, index=True)
56
+ )
57
+ status: Mapped[str] = acol(
58
+ storage=S(String(32), nullable=False, default="active", index=True)
59
+ )
60
+ wallet_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
61
+
62
+
63
+ class WalletInstance(RestOltpTable, GUIDPk, Timestamped):
64
+ __tablename__ = "wallet_instances"
65
+ __table_args__ = ({"schema": "authn"},)
66
+ wallet_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
67
+ instance_id: Mapped[str] = acol(
68
+ storage=S(String(255), nullable=False, unique=True, index=True)
69
+ )
70
+ key_reference: Mapped[str | None] = acol(
71
+ storage=S(String(255), nullable=True, index=True)
72
+ )
73
+ status: Mapped[str] = acol(
74
+ storage=S(String(32), nullable=False, default="active", index=True)
75
+ )
76
+
77
+
78
+ class WalletAttestation(RestOltpTable, GUIDPk, Timestamped):
79
+ __tablename__ = "wallet_attestations"
80
+ __table_args__ = ({"schema": "authn"},)
81
+ wallet_instance_id: Mapped[str] = acol(
82
+ storage=S(String(255), nullable=False, index=True)
83
+ )
84
+ profile: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
85
+ evidence_digest: Mapped[str] = acol(
86
+ storage=S(String(128), nullable=False, index=True)
87
+ )
88
+ verification_result: Mapped[str] = acol(
89
+ storage=S(String(64), nullable=False, index=True)
90
+ )
91
+ valid_until: Mapped[dt.datetime | None] = acol(
92
+ storage=S(TZDateTime, nullable=True, index=True)
93
+ )
94
+
95
+
96
+ class WalletKeyBinding(RestOltpTable, GUIDPk, Timestamped):
97
+ __tablename__ = "wallet_key_bindings"
98
+ __table_args__ = ({"schema": "authn"},)
99
+ wallet_instance_id: Mapped[str] = acol(
100
+ storage=S(String(255), nullable=False, index=True)
101
+ )
102
+ key_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
103
+ binding_kind: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
104
+ valid_from: Mapped[dt.datetime | None] = acol(
105
+ storage=S(TZDateTime, nullable=True, index=True)
106
+ )
107
+ valid_until: Mapped[dt.datetime | None] = acol(
108
+ storage=S(TZDateTime, nullable=True, index=True)
109
+ )
110
+
111
+
112
+ __all__ = [
113
+ "CredentialIssuer",
114
+ "CredentialConfiguration",
115
+ "WalletRegistration",
116
+ "WalletInstance",
117
+ "WalletAttestation",
118
+ "WalletKeyBinding",
119
+ ]
@@ -0,0 +1,154 @@
1
+ """Durable credential offer, issuance, notification, and status state."""
2
+
3
+ from __future__ import annotations
4
+ import datetime as dt
5
+ from tba_primitives_identity.orm import (
6
+ Boolean,
7
+ GUIDPk,
8
+ JSON,
9
+ Mapped,
10
+ RestOltpTable,
11
+ S,
12
+ String,
13
+ TZDateTime,
14
+ Timestamped,
15
+ acol,
16
+ )
17
+
18
+
19
+ class CredentialOffer(RestOltpTable, GUIDPk, Timestamped):
20
+ __tablename__ = "credential_offers"
21
+ __table_args__ = ({"schema": "authn"},)
22
+ offer_id: Mapped[str] = acol(
23
+ storage=S(String(255), nullable=False, unique=True, index=True)
24
+ )
25
+ issuer_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
26
+ configuration_ids: Mapped[list] = acol(storage=S(JSON, nullable=False))
27
+ grant_types: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
28
+ expires_at: Mapped[dt.datetime | None] = acol(
29
+ storage=S(TZDateTime, nullable=True, index=True)
30
+ )
31
+ consumed_at: Mapped[dt.datetime | None] = acol(
32
+ storage=S(TZDateTime, nullable=True, index=True)
33
+ )
34
+
35
+
36
+ class CredentialIssuanceTransaction(RestOltpTable, GUIDPk, Timestamped):
37
+ __tablename__ = "credential_issuance_transactions"
38
+ __table_args__ = ({"schema": "authn"},)
39
+ transaction_id: Mapped[str] = acol(
40
+ storage=S(String(255), nullable=False, unique=True, index=True)
41
+ )
42
+ issuer_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
43
+ subject_id: Mapped[str | None] = acol(
44
+ storage=S(String(255), nullable=True, index=True)
45
+ )
46
+ wallet_instance_id: Mapped[str | None] = acol(
47
+ storage=S(String(255), nullable=True, index=True)
48
+ )
49
+ configuration_id: Mapped[str] = acol(
50
+ storage=S(String(255), nullable=False, index=True)
51
+ )
52
+ status: Mapped[str] = acol(
53
+ storage=S(String(32), nullable=False, default="pending", index=True)
54
+ )
55
+ request_digest: Mapped[str | None] = acol(
56
+ storage=S(String(128), nullable=True, index=True)
57
+ )
58
+ result_reference: Mapped[str | None] = acol(storage=S(String(1000), nullable=True))
59
+ expires_at: Mapped[dt.datetime | None] = acol(
60
+ storage=S(TZDateTime, nullable=True, index=True)
61
+ )
62
+
63
+
64
+ class CredentialDeferredTransaction(RestOltpTable, GUIDPk, Timestamped):
65
+ __tablename__ = "credential_deferred_transactions"
66
+ __table_args__ = ({"schema": "authn"},)
67
+ transaction_id: Mapped[str] = acol(
68
+ storage=S(String(255), nullable=False, unique=True, index=True)
69
+ )
70
+ issuance_transaction_id: Mapped[str] = acol(
71
+ storage=S(String(255), nullable=False, index=True)
72
+ )
73
+ status: Mapped[str] = acol(
74
+ storage=S(String(32), nullable=False, default="pending", index=True)
75
+ )
76
+ interval_seconds: Mapped[str | None] = acol(storage=S(String(16), nullable=True))
77
+ expires_at: Mapped[dt.datetime | None] = acol(
78
+ storage=S(TZDateTime, nullable=True, index=True)
79
+ )
80
+
81
+
82
+ class CredentialNotification(RestOltpTable, GUIDPk, Timestamped):
83
+ __tablename__ = "credential_notifications"
84
+ __table_args__ = ({"schema": "authn"},)
85
+ notification_id: Mapped[str] = acol(
86
+ storage=S(String(255), nullable=False, unique=True, index=True)
87
+ )
88
+ issuance_transaction_id: Mapped[str] = acol(
89
+ storage=S(String(255), nullable=False, index=True)
90
+ )
91
+ event: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
92
+ description: Mapped[str | None] = acol(storage=S(String(1000), nullable=True))
93
+ acknowledged: Mapped[bool] = acol(
94
+ storage=S(Boolean, nullable=False, default=False, index=True)
95
+ )
96
+
97
+
98
+ class CredentialStatusList(RestOltpTable, GUIDPk, Timestamped):
99
+ __tablename__ = "credential_status_lists"
100
+ __table_args__ = ({"schema": "authn"},)
101
+ status_list_id: Mapped[str] = acol(
102
+ storage=S(String(255), nullable=False, unique=True, index=True)
103
+ )
104
+ issuer_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
105
+ purpose: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
106
+ size: Mapped[str] = acol(storage=S(String(32), nullable=False))
107
+ current_version: Mapped[str] = acol(
108
+ storage=S(String(64), nullable=False, default="1", index=True)
109
+ )
110
+
111
+
112
+ class CredentialStatusEntry(RestOltpTable, GUIDPk, Timestamped):
113
+ __tablename__ = "credential_status_entries"
114
+ __table_args__ = ({"schema": "authn"},)
115
+ status_list_id: Mapped[str] = acol(
116
+ storage=S(String(255), nullable=False, index=True)
117
+ )
118
+ credential_id: Mapped[str] = acol(
119
+ storage=S(String(255), nullable=False, unique=True, index=True)
120
+ )
121
+ status_index: Mapped[str] = acol(storage=S(String(32), nullable=False, index=True))
122
+ status: Mapped[str] = acol(
123
+ storage=S(String(32), nullable=False, default="valid", index=True)
124
+ )
125
+ changed_at: Mapped[dt.datetime | None] = acol(
126
+ storage=S(TZDateTime, nullable=True, index=True)
127
+ )
128
+
129
+
130
+ class CredentialStatusPublication(RestOltpTable, GUIDPk, Timestamped):
131
+ __tablename__ = "credential_status_publications"
132
+ __table_args__ = ({"schema": "authn"},)
133
+ status_list_id: Mapped[str] = acol(
134
+ storage=S(String(255), nullable=False, index=True)
135
+ )
136
+ version: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
137
+ artifact_locator: Mapped[str] = acol(storage=S(String(1000), nullable=False))
138
+ artifact_digest: Mapped[str] = acol(
139
+ storage=S(String(128), nullable=False, index=True)
140
+ )
141
+ published_at: Mapped[dt.datetime | None] = acol(
142
+ storage=S(TZDateTime, nullable=True, index=True)
143
+ )
144
+
145
+
146
+ __all__ = [
147
+ "CredentialOffer",
148
+ "CredentialIssuanceTransaction",
149
+ "CredentialDeferredTransaction",
150
+ "CredentialNotification",
151
+ "CredentialStatusList",
152
+ "CredentialStatusEntry",
153
+ "CredentialStatusPublication",
154
+ ]
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.4
2
+ Name: tba-storage-digital-credential
3
+ Version: 0.4.0.dev2
4
+ Summary: Owned digital-credential identity database tables and migrations.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.10,<3.15
7
+ Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Dist: tba-primitives-identity[storage] (>=0.4.0.dev2)
15
+ Requires-Dist: tigrbl (>=0.4.4.dev1,<0.5)
16
+ Requires-Dist: tigrbl-migrations (>=0.4.5.dev4)
17
+ Description-Content-Type: text/markdown
18
+
19
+ # tba-storage-digital-credential
20
+
21
+ Owns the `tigrbl.identity.storage.digital-credential` schema component.
22
+
@@ -0,0 +1,13 @@
1
+ tba_storage_digital_credential/__init__.py,sha256=HoJ8HOyxQOG9vvo4LEJPfEUW3IDGqZF6ZIgJQ59tK6Q,366
2
+ tba_storage_digital_credential/component.toml,sha256=u7HXevB7rEN0fjmwXsXNUP6k5Pkbm0cU_ch41vxsKfw,3369
3
+ tba_storage_digital_credential/manifest.py,sha256=bYZmb6ItB8bRxtuCspB1us5eTvB1RqlTedISJZbws_w,325
4
+ tba_storage_digital_credential/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ tba_storage_digital_credential/migrations/versions/0e47cb7f_3dd7_5c79_a82a_371198cf5b27_initial_schema.py,sha256=ZKbszvGTD9LLusmy3MyzuScZ6wqy5ySzKCXWHIZfXHw,696
6
+ tba_storage_digital_credential/migrations/versions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ tba_storage_digital_credential/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ tba_storage_digital_credential/tables/__init__.py,sha256=EhAAhNvL8F_Z2FvAqSRwzJ_6oWnxHj6hmfGo19vyhJQ,1059
9
+ tba_storage_digital_credential/tables/credential_ecosystem_registry.py,sha256=4NFm5vu50Dd5niglVz2iguRxVDhAjKRX994QYrLTCIs,4117
10
+ tba_storage_digital_credential/tables/credential_issuance_state.py,sha256=f4zGkY6b5nkSRcWAJi9CnSy5OOW7TMmpnzZfVu2bhqU,5777
11
+ tba_storage_digital_credential-0.4.0.dev2.dist-info/METADATA,sha256=HQ3xdrP45-JIQi8UGswBpDdta3u_uuf2hWrGRaFvz2c,871
12
+ tba_storage_digital_credential-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
13
+ tba_storage_digital_credential-0.4.0.dev2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.5.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any