An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(auth): split mod.rs into focused submodules #50

open opened by malpercio.dev targeting main from refactor/extract-auth-and-db-modules

Split the 1,896-line crates/relay/src/auth/mod.rs into focused modules:

  • jwt.rs (149 lines): JWT validation - AccessTokenClaims, AuthScope, TokenType, peek_jwt_typ, verify_access_token (HS256/ES256), parse_scope. Pattern: Functional Core.

  • bearer.rs (37 lines): Bearer token extraction. Pattern: Functional Core.

  • dpop.rs (459 lines): DPoP proof validation + nonce management - DPopHeader, DPopClaims, DpopNonceStore, DpopTokenEndpointError, issue_nonce, validate_and_consume_nonce, cleanup_expired_nonces, validate_dpop_for_token_endpoint, validate_dpop, dpop_alg_from_str, jwk_thumbprint. Pattern: Mixed (nonce store combines pure validation with async I/O).

  • signing_key.rs (139 lines): OAuth signing key lifecycle - OAuthSigningKey, load_or_create_oauth_signing_key, decode_oauth_signing_key, build_encoding_key. Pattern: Imperative Shell.

  • extractors.rs (114 lines): Axum FromRequestParts implementations - AuthenticatedUser with full DPoP/Bearer validation logic. Pattern: Imperative Shell.

  • mod.rs (1,032 lines): Module declarations, re-exports, and test suite. Tests use 'use super::*' to access internal helpers.

All code refactored exactly as-is with no logic changes. Public API unchanged. Tests passing: 61 auth tests, 144 total.

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:web:malpercio.dev/sh.tangled.repo.pull/3mhr6lbosey22
Diff #0

No differences found between the selected revisions.

History

1 round 0 comments
sign up or login to add to the discussion
malpercio.dev submitted #0
patch application failed: error: No valid patches in input (allow with "--allow-empty")
expand 0 comments