tba-storage-core 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.
Files changed (294) hide show
  1. tba_storage_core/__init__.py +25 -0
  2. tba_storage_core/components.py +35 -0
  3. tba_storage_core/framework.py +3 -0
  4. tba_storage_core/migrations/__init__.py +15 -0
  5. tba_storage_core/migrations/contract.py +74 -0
  6. tba_storage_core/migrations/env.py +7 -0
  7. tba_storage_core/migrations/helpers.py +219 -0
  8. tba_storage_core/migrations/versions/0001_initial_identity_tables.py +17 -0
  9. tba_storage_core/migrations/versions/0002_client_and_service_tables.py +23 -0
  10. tba_storage_core/migrations/versions/0003_authorization_runtime_tables.py +17 -0
  11. tba_storage_core/migrations/versions/0004_device_par_revocation_tables.py +17 -0
  12. tba_storage_core/migrations/versions/0005_session_logout_tables.py +17 -0
  13. tba_storage_core/migrations/versions/0006_key_rotation_and_audit_tables.py +17 -0
  14. tba_storage_core/migrations/versions/0007_browser_session_cookie_and_auth_code_linkage.py +50 -0
  15. tba_storage_core/migrations/versions/0008_refresh_token_family_state.py +44 -0
  16. tba_storage_core/migrations/versions/0009_admin_identity_bootstrap_and_password_recovery.py +48 -0
  17. tba_storage_core/migrations/versions/0010_realm_namespace_tables.py +33 -0
  18. tba_storage_core/migrations/versions/0011_delegation_grant_lifecycle_tables.py +39 -0
  19. tba_storage_core/migrations/versions/0012_key_version_and_token_provenance_tables.py +36 -0
  20. tba_storage_core/migrations/versions/0013_contract_durable_state_tables.py +59 -0
  21. tba_storage_core/migrations/versions/0014_optional_contract_state_tables.py +57 -0
  22. tba_storage_core/migrations/versions/0015_principal_identity_credential_tables.py +85 -0
  23. tba_storage_core/migrations/versions/0016_crypto_key_storage_tables.py +84 -0
  24. tba_storage_core/migrations/versions/0017_authorization_server_table.py +21 -0
  25. tba_storage_core/migrations/versions/0018_policy_tables.py +27 -0
  26. tba_storage_core/migrations/versions/0019_federation_and_invariant_tables.py +35 -0
  27. tba_storage_core/migrations/versions/0020_backchannel_logout_replay_table.py +21 -0
  28. tba_storage_core/migrations/versions/0021_authentication_challenge_table.py +21 -0
  29. tba_storage_core/migrations/versions/0022_authority_and_trust_graph_tables.py +35 -0
  30. tba_storage_core/migrations/versions/0023_artifact_and_token_profile_discriminators.py +65 -0
  31. tba_storage_core/migrations/versions/0024_credential_issuer_wallet_and_configuration.py +32 -0
  32. tba_storage_core/migrations/versions/0025_credential_issuance_and_status.py +34 -0
  33. tba_storage_core/migrations/versions/0026_presentation_transaction_and_replay.py +28 -0
  34. tba_storage_core/migrations/versions/0027_attestation_and_reference_material.py +32 -0
  35. tba_storage_core/migrations/versions/0028_spiffe_svid_and_trust_bundles.py +22 -0
  36. tba_storage_core/migrations/versions/0029_security_event_delivery.py +28 -0
  37. tba_storage_core/migrations/versions/0030_optional_did_and_gnap_state.py +37 -0
  38. tba_storage_core/migrations/versions/0031_certificate_trust_and_status.py +22 -0
  39. tba_storage_core/migrations/versions/0032_claim_definition_and_provenance.py +30 -0
  40. tba_storage_core/migrations/versions/0033_replay_reservations.py +18 -0
  41. tba_storage_core/migrations/versions/0034_dpop_replay_nonce_tables.py +21 -0
  42. tba_storage_core/migrations/versions/0035_webauthn_rp_ceremony_and_credentials.py +76 -0
  43. tba_storage_core/migrations/versions/0036_workload_credentials_artifacts_and_proof_replay.py +27 -0
  44. tba_storage_core/migrations/versions/0037_operator_tables.py +30 -0
  45. tba_storage_core/migrations/versions/0038_adopt_component_ownership.py +66 -0
  46. tba_storage_core/migrations/versions/0039_normalized_platform_iam.py +17 -0
  47. tba_storage_core/py.typed +0 -0
  48. tba_storage_core/storage.lock.toml +211 -0
  49. tba_storage_core/storage.toml +34 -0
  50. tba_storage_core/tables/__init__.py +179 -0
  51. tba_storage_core/tables/_graph_base.py +53 -0
  52. tba_storage_core/tables/_registry.py +200 -0
  53. tba_storage_core/tables/access_review_campaign/__init__.py +9 -0
  54. tba_storage_core/tables/access_review_campaign/_table.py +25 -0
  55. tba_storage_core/tables/access_review_decision/__init__.py +9 -0
  56. tba_storage_core/tables/access_review_decision/_table.py +27 -0
  57. tba_storage_core/tables/access_review_item/__init__.py +9 -0
  58. tba_storage_core/tables/access_review_item/_table.py +26 -0
  59. tba_storage_core/tables/attestation_appraisal_policy/__init__.py +3 -0
  60. tba_storage_core/tables/attestation_endorsement/__init__.py +3 -0
  61. tba_storage_core/tables/attestation_evidence/__init__.py +3 -0
  62. tba_storage_core/tables/attestation_reference_manifest/__init__.py +3 -0
  63. tba_storage_core/tables/attestation_reference_value/__init__.py +3 -0
  64. tba_storage_core/tables/attestation_result/__init__.py +3 -0
  65. tba_storage_core/tables/attestation_state.py +124 -0
  66. tba_storage_core/tables/attribute_policy/__init__.py +9 -0
  67. tba_storage_core/tables/attribute_policy/_table.py +40 -0
  68. tba_storage_core/tables/audit_event/__init__.py +10 -0
  69. tba_storage_core/tables/audit_event/_table.py +47 -0
  70. tba_storage_core/tables/auth_code/__init__.py +13 -0
  71. tba_storage_core/tables/auth_code/_table.py +41 -0
  72. tba_storage_core/tables/auth_session/__init__.py +13 -0
  73. tba_storage_core/tables/auth_session/_table.py +45 -0
  74. tba_storage_core/tables/authentication_challenge/__init__.py +7 -0
  75. tba_storage_core/tables/authentication_challenge/_table.py +38 -0
  76. tba_storage_core/tables/authority_derivation_graph/__init__.py +15 -0
  77. tba_storage_core/tables/authority_derivation_graph/_table.py +94 -0
  78. tba_storage_core/tables/authorization_invariant/__init__.py +5 -0
  79. tba_storage_core/tables/authorization_invariant/_table.py +34 -0
  80. tba_storage_core/tables/authorization_server/__init__.py +6 -0
  81. tba_storage_core/tables/authorization_server/_table.py +61 -0
  82. tba_storage_core/tables/authz_verification_report/__init__.py +9 -0
  83. tba_storage_core/tables/authz_verification_report/_table.py +29 -0
  84. tba_storage_core/tables/backchannel_logout_replay/__init__.py +5 -0
  85. tba_storage_core/tables/backchannel_logout_replay/_table.py +37 -0
  86. tba_storage_core/tables/certificate_record/__init__.py +3 -0
  87. tba_storage_core/tables/certificate_state.py +82 -0
  88. tba_storage_core/tables/certificate_status_snapshot/__init__.py +3 -0
  89. tba_storage_core/tables/claim_state.py +98 -0
  90. tba_storage_core/tables/client/__init__.py +9 -0
  91. tba_storage_core/tables/client/_table.py +41 -0
  92. tba_storage_core/tables/client_registration/__init__.py +10 -0
  93. tba_storage_core/tables/client_registration/_table.py +47 -0
  94. tba_storage_core/tables/consent/__init__.py +13 -0
  95. tba_storage_core/tables/consent/_table.py +57 -0
  96. tba_storage_core/tables/control_correctness_report/__init__.py +9 -0
  97. tba_storage_core/tables/control_correctness_report/_table.py +20 -0
  98. tba_storage_core/tables/credential/__init__.py +9 -0
  99. tba_storage_core/tables/credential/_table.py +74 -0
  100. tba_storage_core/tables/credential_api_key/__init__.py +9 -0
  101. tba_storage_core/tables/credential_api_key/_table.py +50 -0
  102. tba_storage_core/tables/credential_audit_event/__init__.py +9 -0
  103. tba_storage_core/tables/credential_audit_event/_table.py +25 -0
  104. tba_storage_core/tables/credential_client_secret/__init__.py +9 -0
  105. tba_storage_core/tables/credential_client_secret/_table.py +24 -0
  106. tba_storage_core/tables/credential_configuration/__init__.py +3 -0
  107. tba_storage_core/tables/credential_deferred_transaction/__init__.py +3 -0
  108. tba_storage_core/tables/credential_dpop_key/__init__.py +9 -0
  109. tba_storage_core/tables/credential_dpop_key/_table.py +22 -0
  110. tba_storage_core/tables/credential_ecosystem_registry.py +119 -0
  111. tba_storage_core/tables/credential_issuance_state.py +154 -0
  112. tba_storage_core/tables/credential_issuance_transaction/__init__.py +3 -0
  113. tba_storage_core/tables/credential_issuer/__init__.py +3 -0
  114. tba_storage_core/tables/credential_mfa_factor/__init__.py +9 -0
  115. tba_storage_core/tables/credential_mfa_factor/_table.py +24 -0
  116. tba_storage_core/tables/credential_mtls_certificate/__init__.py +9 -0
  117. tba_storage_core/tables/credential_mtls_certificate/_table.py +26 -0
  118. tba_storage_core/tables/credential_notification/__init__.py +3 -0
  119. tba_storage_core/tables/credential_offer/__init__.py +3 -0
  120. tba_storage_core/tables/credential_password/__init__.py +9 -0
  121. tba_storage_core/tables/credential_password/_table.py +24 -0
  122. tba_storage_core/tables/credential_recovery_code/__init__.py +9 -0
  123. tba_storage_core/tables/credential_recovery_code/_table.py +23 -0
  124. tba_storage_core/tables/credential_service_key/__init__.py +9 -0
  125. tba_storage_core/tables/credential_service_key/_table.py +49 -0
  126. tba_storage_core/tables/credential_status_entry/__init__.py +3 -0
  127. tba_storage_core/tables/credential_status_list/__init__.py +3 -0
  128. tba_storage_core/tables/credential_status_publication/__init__.py +3 -0
  129. tba_storage_core/tables/credential_webauthn_passkey/__init__.py +9 -0
  130. tba_storage_core/tables/credential_webauthn_passkey/_table.py +42 -0
  131. tba_storage_core/tables/crypto_key/__init__.py +13 -0
  132. tba_storage_core/tables/crypto_key/_table.py +52 -0
  133. tba_storage_core/tables/crypto_key_version/__init__.py +13 -0
  134. tba_storage_core/tables/crypto_key_version/_table.py +53 -0
  135. tba_storage_core/tables/delegated_admin_scope/__init__.py +9 -0
  136. tba_storage_core/tables/delegated_admin_scope/_table.py +34 -0
  137. tba_storage_core/tables/delegation_grant/__init__.py +13 -0
  138. tba_storage_core/tables/delegation_grant/_table.py +134 -0
  139. tba_storage_core/tables/device_code/__init__.py +13 -0
  140. tba_storage_core/tables/device_code/_table.py +54 -0
  141. tba_storage_core/tables/did_document/__init__.py +3 -0
  142. tba_storage_core/tables/did_document_version/__init__.py +3 -0
  143. tba_storage_core/tables/did_gnap_state.py +169 -0
  144. tba_storage_core/tables/did_resolution_cache/__init__.py +3 -0
  145. tba_storage_core/tables/did_service/__init__.py +3 -0
  146. tba_storage_core/tables/did_verification_method/__init__.py +3 -0
  147. tba_storage_core/tables/dpop_nonce/__init__.py +5 -0
  148. tba_storage_core/tables/dpop_nonce/_table.py +77 -0
  149. tba_storage_core/tables/dpop_replay/__init__.py +5 -0
  150. tba_storage_core/tables/dpop_replay/_table.py +97 -0
  151. tba_storage_core/tables/entitlement/__init__.py +9 -0
  152. tba_storage_core/tables/entitlement/_table.py +22 -0
  153. tba_storage_core/tables/entitlement_assignment/__init__.py +9 -0
  154. tba_storage_core/tables/entitlement_assignment/_table.py +26 -0
  155. tba_storage_core/tables/federated_session/__init__.py +5 -0
  156. tba_storage_core/tables/federated_session/_table.py +32 -0
  157. tba_storage_core/tables/federation/__init__.py +5 -0
  158. tba_storage_core/tables/federation/_table.py +37 -0
  159. tba_storage_core/tables/gnap_client_instance/__init__.py +3 -0
  160. tba_storage_core/tables/gnap_continuation/__init__.py +3 -0
  161. tba_storage_core/tables/gnap_grant/__init__.py +3 -0
  162. tba_storage_core/tables/gnap_interaction/__init__.py +3 -0
  163. tba_storage_core/tables/identity_provider/__init__.py +5 -0
  164. tba_storage_core/tables/identity_provider/_table.py +37 -0
  165. tba_storage_core/tables/invariant_evaluation/__init__.py +5 -0
  166. tba_storage_core/tables/invariant_evaluation/_table.py +29 -0
  167. tba_storage_core/tables/invariant_violation/__init__.py +5 -0
  168. tba_storage_core/tables/invariant_violation/_table.py +27 -0
  169. tba_storage_core/tables/key_attestation_evidence/__init__.py +13 -0
  170. tba_storage_core/tables/key_attestation_evidence/_table.py +99 -0
  171. tba_storage_core/tables/key_envelope/__init__.py +13 -0
  172. tba_storage_core/tables/key_envelope/_table.py +54 -0
  173. tba_storage_core/tables/key_rotation_event/__init__.py +9 -0
  174. tba_storage_core/tables/key_rotation_event/_table.py +44 -0
  175. tba_storage_core/tables/key_rotation_policy/__init__.py +9 -0
  176. tba_storage_core/tables/key_rotation_policy/_table.py +38 -0
  177. tba_storage_core/tables/logout_state/__init__.py +10 -0
  178. tba_storage_core/tables/logout_state/_table.py +67 -0
  179. tba_storage_core/tables/machine_identity/__init__.py +9 -0
  180. tba_storage_core/tables/machine_identity/_table.py +49 -0
  181. tba_storage_core/tables/operator_activity/__init__.py +9 -0
  182. tba_storage_core/tables/operator_activity/_table.py +29 -0
  183. tba_storage_core/tables/operator_audit_event/__init__.py +9 -0
  184. tba_storage_core/tables/operator_audit_event/_table.py +29 -0
  185. tba_storage_core/tables/operator_metadata/__init__.py +9 -0
  186. tba_storage_core/tables/operator_metadata/_table.py +19 -0
  187. tba_storage_core/tables/operator_record/__init__.py +9 -0
  188. tba_storage_core/tables/operator_record/_table.py +44 -0
  189. tba_storage_core/tables/operator_transaction/__init__.py +9 -0
  190. tba_storage_core/tables/operator_transaction/_table.py +33 -0
  191. tba_storage_core/tables/plugin_descriptor/__init__.py +9 -0
  192. tba_storage_core/tables/plugin_descriptor/_table.py +23 -0
  193. tba_storage_core/tables/plugin_lifecycle_event/__init__.py +9 -0
  194. tba_storage_core/tables/plugin_lifecycle_event/_table.py +22 -0
  195. tba_storage_core/tables/policy/__init__.py +5 -0
  196. tba_storage_core/tables/policy/_table.py +30 -0
  197. tba_storage_core/tables/policy_condition/__init__.py +9 -0
  198. tba_storage_core/tables/policy_condition/_table.py +21 -0
  199. tba_storage_core/tables/policy_set/__init__.py +5 -0
  200. tba_storage_core/tables/policy_set/_table.py +33 -0
  201. tba_storage_core/tables/policy_set_member/__init__.py +5 -0
  202. tba_storage_core/tables/policy_set_member/_table.py +32 -0
  203. tba_storage_core/tables/policy_target/__init__.py +5 -0
  204. tba_storage_core/tables/policy_target/_table.py +36 -0
  205. tba_storage_core/tables/policy_version/__init__.py +5 -0
  206. tba_storage_core/tables/policy_version/_table.py +35 -0
  207. tba_storage_core/tables/presentation_consent/__init__.py +3 -0
  208. tba_storage_core/tables/presentation_replay/__init__.py +3 -0
  209. tba_storage_core/tables/presentation_state.py +98 -0
  210. tba_storage_core/tables/presentation_transaction/__init__.py +3 -0
  211. tba_storage_core/tables/principal/__init__.py +9 -0
  212. tba_storage_core/tables/principal/_table.py +49 -0
  213. tba_storage_core/tables/principal_key_binding/__init__.py +13 -0
  214. tba_storage_core/tables/principal_key_binding/_table.py +48 -0
  215. tba_storage_core/tables/provider_artifact/__init__.py +9 -0
  216. tba_storage_core/tables/provider_artifact/_table.py +22 -0
  217. tba_storage_core/tables/pushed_authorization_request/__init__.py +13 -0
  218. tba_storage_core/tables/pushed_authorization_request/_table.py +59 -0
  219. tba_storage_core/tables/realm/__init__.py +13 -0
  220. tba_storage_core/tables/realm/_table.py +87 -0
  221. tba_storage_core/tables/release_attestation_event/__init__.py +9 -0
  222. tba_storage_core/tables/release_attestation_event/_table.py +21 -0
  223. tba_storage_core/tables/release_authorization_state/__init__.py +9 -0
  224. tba_storage_core/tables/release_authorization_state/_table.py +21 -0
  225. tba_storage_core/tables/release_capability_record/__init__.py +9 -0
  226. tba_storage_core/tables/release_capability_record/_table.py +21 -0
  227. tba_storage_core/tables/release_posture/__init__.py +9 -0
  228. tba_storage_core/tables/release_posture/_table.py +21 -0
  229. tba_storage_core/tables/release_security_posture/__init__.py +9 -0
  230. tba_storage_core/tables/release_security_posture/_table.py +22 -0
  231. tba_storage_core/tables/replay_reservation.py +34 -0
  232. tba_storage_core/tables/residency_zone/__init__.py +9 -0
  233. tba_storage_core/tables/residency_zone/_table.py +20 -0
  234. tba_storage_core/tables/resource_server_contract/__init__.py +9 -0
  235. tba_storage_core/tables/resource_server_contract/_table.py +21 -0
  236. tba_storage_core/tables/revoked_token/__init__.py +13 -0
  237. tba_storage_core/tables/revoked_token/_table.py +39 -0
  238. tba_storage_core/tables/role/__init__.py +9 -0
  239. tba_storage_core/tables/role/_table.py +22 -0
  240. tba_storage_core/tables/runtime_qualification/__init__.py +9 -0
  241. tba_storage_core/tables/runtime_qualification/_table.py +21 -0
  242. tba_storage_core/tables/scim_group/__init__.py +9 -0
  243. tba_storage_core/tables/scim_group/_table.py +21 -0
  244. tba_storage_core/tables/scim_patch_event/__init__.py +9 -0
  245. tba_storage_core/tables/scim_patch_event/_table.py +22 -0
  246. tba_storage_core/tables/scim_schema/__init__.py +9 -0
  247. tba_storage_core/tables/scim_schema/_table.py +21 -0
  248. tba_storage_core/tables/scim_user/__init__.py +9 -0
  249. tba_storage_core/tables/scim_user/_table.py +21 -0
  250. tba_storage_core/tables/sdk_package/__init__.py +9 -0
  251. tba_storage_core/tables/sdk_package/_table.py +23 -0
  252. tba_storage_core/tables/security_event/__init__.py +3 -0
  253. tba_storage_core/tables/security_event_delivery/__init__.py +3 -0
  254. tba_storage_core/tables/security_event_replay/__init__.py +3 -0
  255. tba_storage_core/tables/security_event_state.py +100 -0
  256. tba_storage_core/tables/security_event_subscription/__init__.py +3 -0
  257. tba_storage_core/tables/service_identity/__init__.py +9 -0
  258. tba_storage_core/tables/service_identity/_table.py +47 -0
  259. tba_storage_core/tables/spiffe_state.py +83 -0
  260. tba_storage_core/tables/spiffe_trust_bundle/__init__.py +3 -0
  261. tba_storage_core/tables/subject_alias/__init__.py +9 -0
  262. tba_storage_core/tables/subject_alias/_table.py +21 -0
  263. tba_storage_core/tables/svid_record/__init__.py +3 -0
  264. tba_storage_core/tables/tenant/__init__.py +13 -0
  265. tba_storage_core/tables/tenant/_table.py +83 -0
  266. tba_storage_core/tables/tenant_membership/__init__.py +9 -0
  267. tba_storage_core/tables/tenant_membership/_table.py +28 -0
  268. tba_storage_core/tables/tenant_residency/__init__.py +9 -0
  269. tba_storage_core/tables/tenant_residency/_table.py +23 -0
  270. tba_storage_core/tables/token_record/__init__.py +10 -0
  271. tba_storage_core/tables/token_record/_table.py +123 -0
  272. tba_storage_core/tables/trust_anchor/__init__.py +3 -0
  273. tba_storage_core/tables/trust_domain_federation/__init__.py +3 -0
  274. tba_storage_core/tables/trust_federation_graph/__init__.py +15 -0
  275. tba_storage_core/tables/trust_federation_graph/_table.py +94 -0
  276. tba_storage_core/tables/user/__init__.py +13 -0
  277. tba_storage_core/tables/user/_table.py +127 -0
  278. tba_storage_core/tables/verifier_registration/__init__.py +3 -0
  279. tba_storage_core/tables/wallet_attestation/__init__.py +3 -0
  280. tba_storage_core/tables/wallet_instance/__init__.py +3 -0
  281. tba_storage_core/tables/wallet_key_binding/__init__.py +3 -0
  282. tba_storage_core/tables/wallet_registration/__init__.py +3 -0
  283. tba_storage_core/tables/webauthn_attestation_record/__init__.py +3 -0
  284. tba_storage_core/tables/webauthn_attestation_record/_table.py +28 -0
  285. tba_storage_core/tables/webauthn_ceremony/__init__.py +3 -0
  286. tba_storage_core/tables/webauthn_ceremony/_table.py +43 -0
  287. tba_storage_core/tables/webauthn_relying_party/__init__.py +3 -0
  288. tba_storage_core/tables/webauthn_relying_party/_table.py +24 -0
  289. tba_storage_core/tables/workload_credential_state.py +57 -0
  290. tba_storage_core/tables/workload_identity/__init__.py +9 -0
  291. tba_storage_core/tables/workload_identity/_table.py +89 -0
  292. tba_storage_core-0.4.0.dev2.dist-info/METADATA +126 -0
  293. tba_storage_core-0.4.0.dev2.dist-info/RECORD +294 -0
  294. tba_storage_core-0.4.0.dev2.dist-info/WHEEL +4 -0
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ try:
7
+ __all__ = list(_table.__all__)
8
+ except AttributeError:
9
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,22 @@
1
+ """Durable DPoP key credential bindings."""
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ from tba_storage_core.framework import RestOltpTable, GUIDPk, JSON, Mapped, S, String, Timestamped, acol
7
+
8
+
9
+
10
+ class CredentialDpopKey(RestOltpTable, GUIDPk, Timestamped):
11
+ __tablename__ = "credential_dpop_keys"
12
+ __table_args__ = ({"schema": "authn"},)
13
+
14
+ credential_id: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
15
+ principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
16
+ jwk_thumbprint: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
17
+ public_jwk: Mapped[dict] = acol(storage=S(JSON, nullable=False))
18
+ status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
19
+ key_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
20
+
21
+
22
+ __all__ = ["CredentialDpopKey"]
@@ -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_storage_core.framework 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_storage_core.framework 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,3 @@
1
+ from ..credential_issuance_state import CredentialIssuanceTransaction
2
+
3
+ __all__ = ["CredentialIssuanceTransaction"]
@@ -0,0 +1,3 @@
1
+ from ..credential_ecosystem_registry import CredentialIssuer
2
+
3
+ __all__ = ["CredentialIssuer"]
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ try:
7
+ __all__ = list(_table.__all__)
8
+ except AttributeError:
9
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,24 @@
1
+ """Durable MFA factor credential records."""
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ from tba_storage_core.framework import GUIDPk, JSON, Mapped, RestOltpTable, S, String, Timestamped, acol
7
+
8
+
9
+
10
+ class CredentialMfaFactor(RestOltpTable, GUIDPk, Timestamped):
11
+ __tablename__ = "credential_mfa_factors"
12
+ __table_args__ = {"extend_existing": True, "schema": "authn"}
13
+
14
+ credential_id: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
15
+ principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
16
+ factor_id: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
17
+ method: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
18
+ secret_digest: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
19
+ public_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
20
+ status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
21
+ factor_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
22
+
23
+
24
+ __all__ = ["CredentialMfaFactor"]
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ try:
7
+ __all__ = list(_table.__all__)
8
+ except AttributeError:
9
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,26 @@
1
+ """Durable mTLS credential bindings."""
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ from tba_storage_core.framework import RestOltpTable, GUIDPk, JSON, Mapped, S, String, Timestamped, acol
7
+
8
+
9
+
10
+ class CredentialMtlsCertificate(RestOltpTable, GUIDPk, Timestamped):
11
+ __tablename__ = "credential_mtls_certificates"
12
+ __table_args__ = ({"schema": "authn"},)
13
+
14
+ credential_id: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
15
+ principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
16
+ certificate_thumbprint: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
17
+ subject_dn: Mapped[str | None] = acol(storage=S(String(1000), nullable=True))
18
+ san_dns: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
19
+ san_uri: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
20
+ san_ip: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
21
+ san_email: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
22
+ status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
23
+ certificate_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
24
+
25
+
26
+ __all__ = ["CredentialMtlsCertificate"]
@@ -0,0 +1,3 @@
1
+ from ..credential_issuance_state import CredentialNotification
2
+
3
+ __all__ = ["CredentialNotification"]
@@ -0,0 +1,3 @@
1
+ from ..credential_issuance_state import CredentialOffer
2
+
3
+ __all__ = ["CredentialOffer"]
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ try:
7
+ __all__ = list(_table.__all__)
8
+ except AttributeError:
9
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,24 @@
1
+ """Durable password credential records."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import datetime as dt
6
+
7
+ from tba_storage_core.framework import GUIDPk, JSON, Mapped, RestOltpTable, S, String, TZDateTime, Timestamped, acol
8
+
9
+
10
+
11
+ class CredentialPassword(RestOltpTable, GUIDPk, Timestamped):
12
+ __tablename__ = "credential_passwords"
13
+ __table_args__ = {"extend_existing": True, "schema": "authn"}
14
+
15
+ credential_id: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
16
+ principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
17
+ password_digest: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
18
+ status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
19
+ rotated_from: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
20
+ expires_at: Mapped[dt.datetime | None] = acol(storage=S(TZDateTime, nullable=True, index=True))
21
+ password_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
22
+
23
+
24
+ __all__ = ["CredentialPassword"]
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ try:
7
+ __all__ = list(_table.__all__)
8
+ except AttributeError:
9
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,23 @@
1
+ """Durable recovery-code credential records."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import datetime as dt
6
+
7
+ from tba_storage_core.framework import GUIDPk, JSON, Mapped, RestOltpTable, S, String, TZDateTime, Timestamped, acol
8
+
9
+
10
+
11
+ class CredentialRecoveryCode(RestOltpTable, GUIDPk, Timestamped):
12
+ __tablename__ = "credential_recovery_codes"
13
+ __table_args__ = {"extend_existing": True, "schema": "authn"}
14
+
15
+ credential_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
16
+ principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
17
+ code_digest: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
18
+ status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
19
+ consumed_at: Mapped[dt.datetime | None] = acol(storage=S(TZDateTime, nullable=True, index=True))
20
+ recovery_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
21
+
22
+
23
+ __all__ = ["CredentialRecoveryCode"]
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ try:
7
+ __all__ = list(_table.__all__)
8
+ except AttributeError:
9
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,49 @@
1
+ """Durable service-identity key credential records."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from uuid import UUID
6
+
7
+ from tba_storage_core.framework import (
8
+ ForeignKeySpec,
9
+ Created,
10
+ GUIDPk,
11
+ KeyDigest,
12
+ LastUsed,
13
+ ValidityWindow,
14
+ RestOltpTable,
15
+ F,
16
+ IO,
17
+ S,
18
+ acol,
19
+ Mapped,
20
+ PgUUID,
21
+ String,
22
+ relationship,
23
+ )
24
+
25
+
26
+ class CredentialServiceKey(RestOltpTable, GUIDPk, Created, LastUsed, ValidityWindow, KeyDigest):
27
+ __tablename__ = "credential_service_keys"
28
+ __table_args__ = {"extend_existing": True, "schema": "authn"}
29
+
30
+ label: Mapped[str] = acol(
31
+ storage=S(String, nullable=False),
32
+ field=F(constraints={"max_length": 120}, required_in=("create",)),
33
+ io=IO(in_verbs=("create",), out_verbs=("read", "list"), filter_ops=("eq",)),
34
+ )
35
+ service_identity_id: Mapped[UUID] = acol(
36
+ storage=S(
37
+ PgUUID(as_uuid=True),
38
+ fk=ForeignKeySpec(target="authn.service_identities.id"),
39
+ index=True,
40
+ nullable=False,
41
+ ),
42
+ field=F(py_type=UUID, required_in=("create",)),
43
+ io=IO(in_verbs=("create",), out_verbs=("read", "list"), filter_ops=("eq",)),
44
+ )
45
+
46
+ _service_identity = relationship("ServiceIdentity", back_populates="_credential_service_keys", lazy="joined")
47
+
48
+
49
+ __all__ = ["CredentialServiceKey"]
@@ -0,0 +1,3 @@
1
+ from ..credential_issuance_state import CredentialStatusEntry
2
+
3
+ __all__ = ["CredentialStatusEntry"]
@@ -0,0 +1,3 @@
1
+ from ..credential_issuance_state import CredentialStatusList
2
+
3
+ __all__ = ["CredentialStatusList"]
@@ -0,0 +1,3 @@
1
+ from ..credential_issuance_state import CredentialStatusPublication
2
+
3
+ __all__ = ["CredentialStatusPublication"]
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ try:
7
+ __all__ = list(_table.__all__)
8
+ except AttributeError:
9
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,42 @@
1
+ """Durable WebAuthn passkey credential records."""
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ import datetime as dt
7
+
8
+ from tba_storage_core.framework import Boolean, GUIDPk, Integer, JSON, LargeBinary, Mapped, RestOltpTable, S, String, TZDateTime, Timestamped, acol
9
+
10
+
11
+
12
+ class CredentialWebAuthnPasskey(RestOltpTable, GUIDPk, Timestamped):
13
+ __tablename__ = "credential_webauthn_passkeys"
14
+ __table_args__ = {"extend_existing": True, "schema": "authn"}
15
+
16
+ credential_id: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
17
+ principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
18
+ webauthn_credential_id: Mapped[str] = acol(storage=S(String(1000), nullable=False, unique=True, index=True))
19
+ public_key: Mapped[str] = acol(storage=S(String(4000), nullable=False))
20
+ rp_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
21
+ algorithm: Mapped[str | None] = acol(storage=S(String(64), nullable=True))
22
+ sign_count: Mapped[int] = acol(storage=S(Integer, nullable=False, default=0))
23
+ transports: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
24
+ status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
25
+ passkey_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
26
+ credential_external_id: Mapped[str | None] = acol(storage=S(String(1000), nullable=True, unique=True, index=True))
27
+ credential_public_key_cose: Mapped[bytes | None] = acol(storage=S(LargeBinary, nullable=True))
28
+ user_handle: Mapped[bytes | None] = acol(storage=S(LargeBinary, nullable=True, index=True))
29
+ cose_algorithm: Mapped[int | None] = acol(storage=S(Integer, nullable=True))
30
+ aaguid: Mapped[bytes | None] = acol(storage=S(LargeBinary, nullable=True, index=True))
31
+ attestation_format: Mapped[str | None] = acol(storage=S(String(64), nullable=True))
32
+ attestation_type: Mapped[str | None] = acol(storage=S(String(64), nullable=True))
33
+ attestation_trust_status: Mapped[str | None] = acol(storage=S(String(32), nullable=True, index=True))
34
+ discoverable: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=False, index=True))
35
+ backup_eligible: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=False, index=True))
36
+ backup_state: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=False, index=True))
37
+ last_used_at: Mapped[dt.datetime | None] = acol(storage=S(TZDateTime, nullable=True, index=True))
38
+ revoked_at: Mapped[dt.datetime | None] = acol(storage=S(TZDateTime, nullable=True, index=True))
39
+ display_name: Mapped[str | None] = acol(storage=S(String(255), nullable=True))
40
+
41
+
42
+ __all__ = ["CredentialWebAuthnPasskey"]
@@ -0,0 +1,13 @@
1
+ from __future__ import annotations
2
+
3
+ from . import _table as _table
4
+ from ._table import *
5
+
6
+ for _name in dir(_table):
7
+ if not _name.startswith("__"):
8
+ globals().setdefault(_name, getattr(_table, _name))
9
+
10
+ try:
11
+ __all__ = list(_table.__all__)
12
+ except AttributeError:
13
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,52 @@
1
+ """Durable provider-neutral crypto key metadata."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import uuid
6
+
7
+ from tba_storage_core.framework import (
8
+ Boolean,
9
+ ForeignKeySpec,
10
+ GUIDPk,
11
+ Integer,
12
+ JSON,
13
+ Mapped,
14
+ PgUUID,
15
+ RestOltpTable,
16
+ S,
17
+ String,
18
+ Timestamped,
19
+ acol,
20
+ )
21
+
22
+
23
+
24
+ class CryptoKey(RestOltpTable, GUIDPk, Timestamped):
25
+ __tablename__ = "crypto_keys"
26
+ __table_args__ = ({"schema": "authn"},)
27
+
28
+ kid: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
29
+ algorithm: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
30
+ key_kind: Mapped[str] = acol(storage=S(String(64), nullable=False, default="asymmetric", index=True))
31
+ key_usages: Mapped[list[str] | None] = acol(storage=S(JSON, nullable=True))
32
+ allowed_ops: Mapped[list[str] | None] = acol(storage=S(JSON, nullable=True))
33
+ status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
34
+ primary_version: Mapped[int | None] = acol(storage=S(Integer, nullable=True, default=1))
35
+ provider: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
36
+ provider_key_ref: Mapped[str | None] = acol(storage=S(String(1000), nullable=True))
37
+ export_policy: Mapped[str] = acol(storage=S(String(64), nullable=False, default="public_only", index=True))
38
+ origin: Mapped[str] = acol(storage=S(String(64), nullable=False, default="generated", index=True))
39
+ extractable: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=False))
40
+ public_material_format: Mapped[str | None] = acol(storage=S(String(64), nullable=True))
41
+ public_material: Mapped[dict | str | None] = acol(storage=S(JSON, nullable=True))
42
+ fingerprint: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
43
+ key_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
44
+ tenant_id: Mapped[uuid.UUID | None] = acol(
45
+ storage=S(PgUUID(as_uuid=True), fk=ForeignKeySpec(target="authn.tenants.id"), nullable=True, index=True)
46
+ )
47
+ realm_id: Mapped[uuid.UUID | None] = acol(
48
+ storage=S(PgUUID(as_uuid=True), fk=ForeignKeySpec(target="authn.realms.id"), nullable=True, index=True)
49
+ )
50
+
51
+
52
+ __all__ = ["CryptoKey"]