tba-protocol-oauth 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 (62) hide show
  1. tba_protocol_oauth/__init__.py +122 -0
  2. tba_protocol_oauth/bindings.py +116 -0
  3. tba_protocol_oauth/capability_requirements.py +5 -0
  4. tba_protocol_oauth/claim_sets.py +19 -0
  5. tba_protocol_oauth/claims.py +79 -0
  6. tba_protocol_oauth/compatibility.py +39 -0
  7. tba_protocol_oauth/errors.py +25 -0
  8. tba_protocol_oauth/features.py +36 -0
  9. tba_protocol_oauth/jwtoken.py +16 -0
  10. tba_protocol_oauth/migrations.py +37 -0
  11. tba_protocol_oauth/protocol.py +282 -0
  12. tba_protocol_oauth/py.typed +0 -0
  13. tba_protocol_oauth/reusable_components.py +5 -0
  14. tba_protocol_oauth/schemas.py +198 -0
  15. tba_protocol_oauth/standards/__init__.py +9 -0
  16. tba_protocol_oauth/standards/_dpop/__init__.py +57 -0
  17. tba_protocol_oauth/standards/_dpop/metadata.py +18 -0
  18. tba_protocol_oauth/standards/_dpop/primitives.py +194 -0
  19. tba_protocol_oauth/standards/_dpop/proofs.py +393 -0
  20. tba_protocol_oauth/standards/_dpop/state.py +74 -0
  21. tba_protocol_oauth/standards/_introspection_activity.py +32 -0
  22. tba_protocol_oauth/standards/_mtls_identity.py +98 -0
  23. tba_protocol_oauth/standards/_rfc8693/__init__.py +26 -0
  24. tba_protocol_oauth/standards/_rfc8693/endpoint.py +56 -0
  25. tba_protocol_oauth/standards/_rfc8693/runtime.py +289 -0
  26. tba_protocol_oauth/standards/_rfc9700/__init__.py +45 -0
  27. tba_protocol_oauth/standards/_rfc9700/security_profile.py +265 -0
  28. tba_protocol_oauth/standards/_rfc9700/sender_constraints.py +397 -0
  29. tba_protocol_oauth/standards/assertion_framework.py +173 -0
  30. tba_protocol_oauth/standards/authorization_framework.py +102 -0
  31. tba_protocol_oauth/standards/authorization_server_metadata.py +43 -0
  32. tba_protocol_oauth/standards/authorization_server_metadata_endpoint.py +21 -0
  33. tba_protocol_oauth/standards/bearer_token_usage.py +86 -0
  34. tba_protocol_oauth/standards/client_registration_management.py +89 -0
  35. tba_protocol_oauth/standards/device_authorization.py +140 -0
  36. tba_protocol_oauth/standards/dpop.py +59 -0
  37. tba_protocol_oauth/standards/dynamic_client_registration.py +68 -0
  38. tba_protocol_oauth/standards/gnap.py +6 -0
  39. tba_protocol_oauth/standards/introspection.py +56 -0
  40. tba_protocol_oauth/standards/issuer_identification.py +130 -0
  41. tba_protocol_oauth/standards/json_web_token.py +159 -0
  42. tba_protocol_oauth/standards/jwt_access_tokens.py +44 -0
  43. tba_protocol_oauth/standards/jwt_best_practices.py +44 -0
  44. tba_protocol_oauth/standards/jwt_client_auth.py +208 -0
  45. tba_protocol_oauth/standards/jwt_secured_authorization_requests.py +421 -0
  46. tba_protocol_oauth/standards/legacy_jwt_client_assertions.py +113 -0
  47. tba_protocol_oauth/standards/mutual_tls_client_authentication.py +394 -0
  48. tba_protocol_oauth/standards/native_apps.py +132 -0
  49. tba_protocol_oauth/standards/oauth_security_bcp.py +47 -0
  50. tba_protocol_oauth/standards/proof_key_for_code_exchange.py +82 -0
  51. tba_protocol_oauth/standards/protected_resource_metadata.py +103 -0
  52. tba_protocol_oauth/standards/pushed_authorization_requests.py +198 -0
  53. tba_protocol_oauth/standards/resource_indicators.py +127 -0
  54. tba_protocol_oauth/standards/resource_verifier_contract.py +91 -0
  55. tba_protocol_oauth/standards/revocation.py +59 -0
  56. tba_protocol_oauth/standards/rich_authorization_requests.py +221 -0
  57. tba_protocol_oauth/standards/token_endpoint.py +76 -0
  58. tba_protocol_oauth/standards/token_exchange.py +60 -0
  59. tba_protocol_oauth/versions.py +110 -0
  60. tba_protocol_oauth-0.4.0.dev2.dist-info/METADATA +114 -0
  61. tba_protocol_oauth-0.4.0.dev2.dist-info/RECORD +62 -0
  62. tba_protocol_oauth-0.4.0.dev2.dist-info/WHEEL +4 -0
@@ -0,0 +1,282 @@
1
+ from __future__ import annotations
2
+
3
+ import hashlib
4
+ import hmac
5
+ import secrets
6
+ from dataclasses import dataclass, replace
7
+ from datetime import datetime, timedelta, timezone
8
+ from typing import Callable, Iterable
9
+
10
+ from tba_contracts_identity.oauth import (
11
+ DPoPProof,
12
+ DeviceAuthorization,
13
+ OAuthClient,
14
+ TokenExchangeResult,
15
+ )
16
+ from tba_contracts_identity.protocols import OAuthGrantStatus
17
+
18
+ from .errors import OAuthProtocolError
19
+
20
+
21
+ class OAuthError(OAuthProtocolError):
22
+ """Backward-compatible concrete OAuth service error."""
23
+
24
+
25
+ def _utc_now() -> datetime:
26
+ return datetime.now(tz=timezone.utc)
27
+
28
+
29
+ def _code(prefix: str) -> str:
30
+ return f"{prefix}_{secrets.token_urlsafe(24)}"
31
+
32
+
33
+ def _normalize_scope(scopes: Iterable[str]) -> tuple[str, ...]:
34
+ return tuple(sorted({scope.strip() for scope in scopes if scope and scope.strip()}))
35
+
36
+
37
+ @dataclass(frozen=True, slots=True)
38
+ class OAuthStateOperations:
39
+ persist_client: Callable[[OAuthClient], None]
40
+ resolve_client: Callable[[str], OAuthClient | None]
41
+ persist_device_authorization: Callable[[DeviceAuthorization], None]
42
+ resolve_device_authorization: Callable[[str], DeviceAuthorization | None]
43
+ reserve_dpop_jti: Callable[[str, str], bool]
44
+
45
+
46
+ class InMemoryOAuthState:
47
+ def __init__(self) -> None:
48
+ self.clients: dict[str, OAuthClient] = {}
49
+ self.device_authorizations: dict[str, DeviceAuthorization] = {}
50
+ self.dpop_jtis: set[tuple[str, str]] = set()
51
+
52
+ def save_client(self, client: OAuthClient) -> None:
53
+ self.clients[client.client_id] = client
54
+
55
+ def get_client(self, client_id: str) -> OAuthClient | None:
56
+ return self.clients.get(client_id)
57
+
58
+ def save_device_authorization(self, grant: DeviceAuthorization) -> None:
59
+ self.device_authorizations[grant.device_code] = grant
60
+
61
+ def get_device_authorization(self, device_code: str) -> DeviceAuthorization | None:
62
+ return self.device_authorizations.get(device_code)
63
+
64
+ def remember_dpop_jti(self, client_id: str, jti: str) -> bool:
65
+ key = (client_id, jti)
66
+ if key in self.dpop_jtis:
67
+ return False
68
+ self.dpop_jtis.add(key)
69
+ return True
70
+
71
+ def operations(self) -> OAuthStateOperations:
72
+ return OAuthStateOperations(
73
+ self.save_client,
74
+ self.get_client,
75
+ self.save_device_authorization,
76
+ self.get_device_authorization,
77
+ self.remember_dpop_jti,
78
+ )
79
+
80
+
81
+ InMemoryOAuthRepository = InMemoryOAuthState
82
+
83
+
84
+ class OAuthProtocolService:
85
+ def __init__(
86
+ self,
87
+ operations: OAuthStateOperations | None = None,
88
+ now: Callable[[], datetime] = _utc_now,
89
+ *,
90
+ repository: InMemoryOAuthState | None = None,
91
+ ) -> None:
92
+ if operations is None:
93
+ if repository is None:
94
+ raise TypeError("OAuth state operations are required")
95
+ operations = repository.operations()
96
+ self.operations = operations
97
+ self.now = now
98
+
99
+ def register_client(self, client: OAuthClient) -> OAuthClient:
100
+ if not client.client_id or not client.tenant_id:
101
+ raise OAuthError(
102
+ "invalid_client_metadata", "client_id and tenant_id are required"
103
+ )
104
+ if not client.allowed_scopes:
105
+ raise OAuthError(
106
+ "invalid_client_metadata", "at least one allowed scope is required"
107
+ )
108
+ self.operations.persist_client(client)
109
+ return client
110
+
111
+ def start_device_authorization(
112
+ self,
113
+ *,
114
+ client_id: str,
115
+ scopes: Iterable[str],
116
+ expires_in_seconds: int = 600,
117
+ interval_seconds: int = 5,
118
+ ) -> DeviceAuthorization:
119
+ client = self._require_client(client_id)
120
+ requested = _normalize_scope(scopes)
121
+ self._require_scopes(client, requested)
122
+ if expires_in_seconds <= 0 or interval_seconds <= 0:
123
+ raise OAuthError(
124
+ "invalid_request",
125
+ "device code expiry and polling interval must be positive",
126
+ )
127
+ grant = DeviceAuthorization(
128
+ device_code=_code("dc"),
129
+ user_code=_code("uc")[:16],
130
+ client_id=client.client_id,
131
+ tenant_id=client.tenant_id,
132
+ scopes=requested,
133
+ expires_at=self.now() + timedelta(seconds=expires_in_seconds),
134
+ interval_seconds=interval_seconds,
135
+ )
136
+ self.operations.persist_device_authorization(grant)
137
+ return grant
138
+
139
+ def approve_device_authorization(
140
+ self, device_code: str, *, subject: str
141
+ ) -> DeviceAuthorization:
142
+ grant = self._require_device_authorization(device_code)
143
+ self._require_pending_not_expired(grant)
144
+ approved = replace(grant, status=OAuthGrantStatus.APPROVED, subject=subject)
145
+ self.operations.persist_device_authorization(approved)
146
+ return approved
147
+
148
+ def poll_device_authorization(self, device_code: str) -> TokenExchangeResult:
149
+ grant = self._require_device_authorization(device_code)
150
+ if self.now() >= grant.expires_at:
151
+ expired = replace(grant, status=OAuthGrantStatus.EXPIRED)
152
+ self.operations.persist_device_authorization(expired)
153
+ raise OAuthError("expired_token", "device code expired")
154
+ if grant.status == OAuthGrantStatus.PENDING:
155
+ polled = replace(grant, poll_count=grant.poll_count + 1)
156
+ self.operations.persist_device_authorization(polled)
157
+ code = "slow_down" if polled.poll_count > 1 else "authorization_pending"
158
+ raise OAuthError(code, "authorization is still pending")
159
+ if grant.status == OAuthGrantStatus.DENIED:
160
+ raise OAuthError("access_denied", "device authorization was denied")
161
+ if grant.status == OAuthGrantStatus.CONSUMED:
162
+ raise OAuthError("invalid_grant", "device code was already consumed")
163
+ if not grant.subject:
164
+ raise OAuthError("server_error", "approved device grant has no subject")
165
+ consumed = replace(grant, status=OAuthGrantStatus.CONSUMED)
166
+ self.operations.persist_device_authorization(consumed)
167
+ return TokenExchangeResult(
168
+ issued_token=_code("at"),
169
+ subject=grant.subject,
170
+ actor=grant.client_id,
171
+ audience=grant.tenant_id,
172
+ scopes=grant.scopes,
173
+ )
174
+
175
+ def exchange_token(
176
+ self,
177
+ *,
178
+ client_id: str,
179
+ subject_token_subject: str,
180
+ requested_subject: str,
181
+ audience: str,
182
+ scopes: Iterable[str],
183
+ actor: str,
184
+ ) -> TokenExchangeResult:
185
+ client = self._require_client(client_id)
186
+ requested = _normalize_scope(scopes)
187
+ self._require_scopes(client, requested)
188
+ if not audience:
189
+ raise OAuthError("invalid_target", "audience is required")
190
+ if (
191
+ subject_token_subject != requested_subject
192
+ and actor != subject_token_subject
193
+ ):
194
+ raise OAuthError(
195
+ "invalid_request", "token exchange actor must match the subject token"
196
+ )
197
+ return TokenExchangeResult(
198
+ issued_token=_code("tx"),
199
+ subject=requested_subject,
200
+ actor=actor,
201
+ audience=audience,
202
+ scopes=requested,
203
+ )
204
+
205
+ def validate_dpop(
206
+ self,
207
+ *,
208
+ client_id: str,
209
+ proof: DPoPProof,
210
+ method: str,
211
+ url: str,
212
+ max_age_seconds: int = 300,
213
+ ) -> None:
214
+ client = self._require_client(client_id)
215
+ if client.jwk_thumbprint and proof.jwk_thumbprint != client.jwk_thumbprint:
216
+ raise OAuthError(
217
+ "invalid_dpop_proof",
218
+ "DPoP key thumbprint does not match client binding",
219
+ )
220
+ if proof.htm.upper() != method.upper() or proof.htu != url:
221
+ raise OAuthError("invalid_dpop_proof", "DPoP proof method or URL mismatch")
222
+ now_seconds = int(self.now().timestamp())
223
+ if abs(now_seconds - int(proof.iat)) > max_age_seconds:
224
+ raise OAuthError(
225
+ "invalid_dpop_proof", "DPoP proof is outside the accepted time window"
226
+ )
227
+ if not self.operations.reserve_dpop_jti(client_id, proof.jti):
228
+ raise OAuthError("use_dpop_nonce", "DPoP proof replay detected")
229
+
230
+ def validate_mtls_client(
231
+ self, *, client_id: str, certificate_thumbprint: str
232
+ ) -> None:
233
+ client = self._require_client(client_id)
234
+ if not client.mtls_thumbprint:
235
+ raise OAuthError("invalid_client", "client is not configured for mTLS")
236
+ if not hmac.compare_digest(client.mtls_thumbprint, certificate_thumbprint):
237
+ raise OAuthError("invalid_client", "mTLS certificate thumbprint mismatch")
238
+
239
+ def _require_client(self, client_id: str) -> OAuthClient:
240
+ client = self.operations.resolve_client(client_id)
241
+ if client is None or not client.enabled:
242
+ raise OAuthError("invalid_client", "client is unknown or disabled")
243
+ return client
244
+
245
+ def _require_device_authorization(self, device_code: str) -> DeviceAuthorization:
246
+ grant = self.operations.resolve_device_authorization(device_code)
247
+ if grant is None:
248
+ raise OAuthError("invalid_grant", "unknown device code")
249
+ return grant
250
+
251
+ def _require_pending_not_expired(self, grant: DeviceAuthorization) -> None:
252
+ if grant.status != OAuthGrantStatus.PENDING:
253
+ raise OAuthError("invalid_grant", "device authorization is not pending")
254
+ if self.now() >= grant.expires_at:
255
+ raise OAuthError("expired_token", "device code expired")
256
+
257
+ @staticmethod
258
+ def _require_scopes(client: OAuthClient, scopes: tuple[str, ...]) -> None:
259
+ allowed = set(client.allowed_scopes)
260
+ if not scopes or not set(scopes).issubset(allowed):
261
+ raise OAuthError(
262
+ "invalid_scope", "requested scopes are not allowed for client"
263
+ )
264
+
265
+
266
+ def sha256_thumbprint(value: str) -> str:
267
+ return hashlib.sha256(value.encode("utf-8")).hexdigest()
268
+
269
+
270
+ __all__ = [
271
+ "DPoPProof",
272
+ "DeviceAuthorization",
273
+ "InMemoryOAuthRepository",
274
+ "InMemoryOAuthState",
275
+ "OAuthClient",
276
+ "OAuthError",
277
+ "OAuthGrantStatus",
278
+ "OAuthProtocolService",
279
+ "OAuthStateOperations",
280
+ "TokenExchangeResult",
281
+ "sha256_thumbprint",
282
+ ]
File without changes
@@ -0,0 +1,5 @@
1
+ """OAuth composition exports from protocol-neutral concrete owners."""
2
+
3
+ from tba_concrete_authorization_scope_set_matcher import ScopeSetMatcher
4
+
5
+ __all__ = ["ScopeSetMatcher"]
@@ -0,0 +1,198 @@
1
+ """OAuth wire schemas owned by the versioned protocol package."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Literal
6
+
7
+ from pydantic import BaseModel, EmailStr, Field, constr
8
+
9
+ from tba_primitives_identity.typing import StrUUID
10
+
11
+
12
+ class TokenPair(BaseModel):
13
+ access_token: str
14
+ refresh_token: str | None = None
15
+ token_type: str = Field(default="bearer")
16
+ id_token: str | None = None
17
+
18
+
19
+ class RefreshIn(BaseModel):
20
+ refresh_token: str
21
+
22
+
23
+ class IntrospectOut(BaseModel):
24
+ active: bool
25
+ sub: StrUUID | None = None
26
+ tid: StrUUID | None = None
27
+ kind: str | None = None
28
+
29
+
30
+ class PasswordGrantForm(BaseModel):
31
+ grant_type: Literal["password"]
32
+ username: str
33
+ password: str
34
+
35
+
36
+ class AuthorizationCodeGrantForm(BaseModel):
37
+ grant_type: Literal["authorization_code"]
38
+ code: str
39
+ redirect_uri: str
40
+ client_id: str
41
+ code_verifier: str | None = None
42
+
43
+
44
+ _tenant_slug = constr(strip_whitespace=True, min_length=3, max_length=120)
45
+
46
+
47
+ class DynamicClientRegistrationIn(BaseModel):
48
+ tenant_slug: _tenant_slug = Field(default="public")
49
+ redirect_uris: list[str]
50
+ grant_types: list[str] = Field(default_factory=lambda: ["authorization_code"])
51
+ response_types: list[str] = Field(default_factory=lambda: ["code"])
52
+ token_endpoint_auth_method: str = Field(default="client_secret_basic")
53
+ token_endpoint_auth_signing_alg: str | None = None
54
+ tls_client_certificate_thumbprint: str | None = None
55
+ self_signed_tls_client_certificate_thumbprint: str | None = None
56
+ tls_client_auth_subject_dn: str | None = None
57
+ tls_client_auth_san_dns: str | None = None
58
+ tls_client_auth_san_uri: str | None = None
59
+ tls_client_auth_san_ip: str | None = None
60
+ tls_client_auth_san_email: str | None = None
61
+ application_type: str | None = None
62
+ scope: str | None = None
63
+ client_name: str | None = None
64
+ client_uri: str | None = None
65
+ jwks_uri: str | None = None
66
+ contacts: list[EmailStr] | None = None
67
+ software_id: str | None = None
68
+ software_version: str | None = None
69
+ post_logout_redirect_uris: list[str] | None = None
70
+ frontchannel_logout_uri: str | None = None
71
+ frontchannel_logout_session_required: bool = True
72
+ backchannel_logout_uri: str | None = None
73
+ backchannel_logout_session_required: bool = True
74
+
75
+
76
+ class DynamicClientRegistrationOut(BaseModel):
77
+ client_id: str
78
+ client_secret: str | None = None
79
+ client_id_issued_at: int
80
+ client_secret_expires_at: int = 0
81
+ redirect_uris: list[str]
82
+ grant_types: list[str]
83
+ response_types: list[str]
84
+ token_endpoint_auth_method: str
85
+ token_endpoint_auth_signing_alg: str | None = None
86
+ tls_client_certificate_thumbprint: str | None = None
87
+ self_signed_tls_client_certificate_thumbprint: str | None = None
88
+ tls_client_auth_subject_dn: str | None = None
89
+ tls_client_auth_san_dns: str | None = None
90
+ tls_client_auth_san_uri: str | None = None
91
+ tls_client_auth_san_ip: str | None = None
92
+ tls_client_auth_san_email: str | None = None
93
+ application_type: str | None = None
94
+ scope: str | None = None
95
+ client_name: str | None = None
96
+ client_uri: str | None = None
97
+ jwks_uri: str | None = None
98
+ contacts: list[EmailStr] | None = None
99
+ software_id: str | None = None
100
+ software_version: str | None = None
101
+ post_logout_redirect_uris: list[str] | None = None
102
+ frontchannel_logout_uri: str | None = None
103
+ frontchannel_logout_session_required: bool = True
104
+ backchannel_logout_uri: str | None = None
105
+ backchannel_logout_session_required: bool = True
106
+ registration_access_token: str | None = None
107
+ registration_client_uri: str | None = None
108
+
109
+
110
+ class DynamicClientRegistrationManagementIn(BaseModel):
111
+ tenant_slug: _tenant_slug | None = None
112
+ redirect_uris: list[str] | None = None
113
+ grant_types: list[str] | None = None
114
+ response_types: list[str] | None = None
115
+ token_endpoint_auth_method: str | None = None
116
+ token_endpoint_auth_signing_alg: str | None = None
117
+ tls_client_certificate_thumbprint: str | None = None
118
+ self_signed_tls_client_certificate_thumbprint: str | None = None
119
+ tls_client_auth_subject_dn: str | None = None
120
+ tls_client_auth_san_dns: str | None = None
121
+ tls_client_auth_san_uri: str | None = None
122
+ tls_client_auth_san_ip: str | None = None
123
+ tls_client_auth_san_email: str | None = None
124
+ application_type: str | None = None
125
+ scope: str | None = None
126
+ client_name: str | None = None
127
+ client_uri: str | None = None
128
+ jwks_uri: str | None = None
129
+ contacts: list[EmailStr] | None = None
130
+ software_id: str | None = None
131
+ software_version: str | None = None
132
+ post_logout_redirect_uris: list[str] | None = None
133
+ frontchannel_logout_uri: str | None = None
134
+ frontchannel_logout_session_required: bool | None = None
135
+ backchannel_logout_uri: str | None = None
136
+ backchannel_logout_session_required: bool | None = None
137
+
138
+
139
+ class DeviceAuthorizationIn(BaseModel):
140
+ client_id: str
141
+ scope: str | None = None
142
+ audience: str | None = None
143
+ resource: list[str] | None = None
144
+
145
+
146
+ class DeviceAuthorizationOut(BaseModel):
147
+ device_code: str
148
+ user_code: str
149
+ verification_uri: str
150
+ verification_uri_complete: str
151
+ expires_in: int
152
+ interval: int
153
+
154
+
155
+ class PushedAuthorizationRequestIn(BaseModel):
156
+ client_id: str
157
+ request: str | None = None
158
+ response_type: str | None = None
159
+ redirect_uri: str | None = None
160
+ scope: str | None = None
161
+ state: str | None = None
162
+ nonce: str | None = None
163
+ code_challenge: str | None = None
164
+ code_challenge_method: str | None = None
165
+ resource: list[str] | None = None
166
+ authorization_details: list[dict[str, Any]] | None = None
167
+
168
+
169
+ class PushedAuthorizationResponse(BaseModel):
170
+ request_uri: str
171
+ expires_in: int
172
+
173
+
174
+ class RevocationIn(BaseModel):
175
+ token: str
176
+ token_type_hint: str | None = None
177
+
178
+
179
+ class RevocationOut(BaseModel):
180
+ revoked: bool = True
181
+
182
+
183
+ __all__ = [
184
+ "AuthorizationCodeGrantForm",
185
+ "DeviceAuthorizationIn",
186
+ "DeviceAuthorizationOut",
187
+ "DynamicClientRegistrationIn",
188
+ "DynamicClientRegistrationManagementIn",
189
+ "DynamicClientRegistrationOut",
190
+ "IntrospectOut",
191
+ "PasswordGrantForm",
192
+ "PushedAuthorizationRequestIn",
193
+ "PushedAuthorizationResponse",
194
+ "RefreshIn",
195
+ "RevocationIn",
196
+ "RevocationOut",
197
+ "TokenPair",
198
+ ]
@@ -0,0 +1,9 @@
1
+ """OAuth2 standards package.
2
+
3
+ This package intentionally avoids eager star-imports so that governance,
4
+ contract-generation, and profile-resolution tooling can import individual
5
+ modules (for example RFC 9700 runtime policy helpers) without initializing the
6
+ full runtime stack.
7
+ """
8
+
9
+ __all__: list[str] = []
@@ -0,0 +1,57 @@
1
+ from __future__ import annotations
2
+
3
+ from .proofs import (
4
+ DPoPNonceRecord,
5
+ DPoPProofClaims,
6
+ OWNER,
7
+ RFC9449_SPEC_URL,
8
+ StandardOwner,
9
+ access_token_hash,
10
+ ath_for_access_token,
11
+ consume_nonce,
12
+ consume_nonce_async,
13
+ create_proof,
14
+ decode_proof,
15
+ describe,
16
+ issue_nonce,
17
+ issue_nonce_async,
18
+ jwk_from_public_key,
19
+ jwk_thumbprint,
20
+ make_proof,
21
+ makeProof,
22
+ proof_claims,
23
+ register_nonce,
24
+ register_nonce_async,
25
+ replay_table_snapshot,
26
+ replay_table_snapshot_async,
27
+ verify_proof,
28
+ verify_proof_async,
29
+ )
30
+
31
+ __all__ = [
32
+ "DPoPNonceRecord",
33
+ "DPoPProofClaims",
34
+ "OWNER",
35
+ "RFC9449_SPEC_URL",
36
+ "StandardOwner",
37
+ "access_token_hash",
38
+ "ath_for_access_token",
39
+ "consume_nonce",
40
+ "consume_nonce_async",
41
+ "create_proof",
42
+ "decode_proof",
43
+ "describe",
44
+ "issue_nonce",
45
+ "issue_nonce_async",
46
+ "jwk_from_public_key",
47
+ "jwk_thumbprint",
48
+ "makeProof",
49
+ "make_proof",
50
+ "proof_claims",
51
+ "register_nonce",
52
+ "register_nonce_async",
53
+ "replay_table_snapshot",
54
+ "replay_table_snapshot_async",
55
+ "verify_proof",
56
+ "verify_proof_async",
57
+ ]
@@ -0,0 +1,18 @@
1
+ """RFC 9449 feature metadata."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from tba_primitives_identity.standards import describe_owner
6
+
7
+ from .primitives import OWNER, RFC9449_SPEC_URL, _ALG_VALUE
8
+
9
+
10
+ def describe() -> dict[str, object]:
11
+ return describe_owner(
12
+ OWNER,
13
+ spec_url=RFC9449_SPEC_URL,
14
+ signing_alg_values_supported=[_ALG_VALUE],
15
+ ath_supported=True,
16
+ nonce_supported=True,
17
+ replay_detection_supported=True,
18
+ )