Skip to main content

OAuthState

Struct OAuthState 

Source
pub struct OAuthState {
Show 64 fields pub clients: RwLock<HashMap<String, RegisteredClient>>, pub cimd_cache: Arc<CimdCache>, pub jwks_uri_cache: RwLock<HashMap<String, (Value, Instant)>>, pub client_jwks_uri_cache_ttl: Duration, pub pending_codes: RwLock<HashMap<String, PendingAuthCode>>, pub pending_nonces: RwLock<HashMap<String, Instant>>, pub pending_authorize_bindings: RwLock<HashMap<String, AuthorizeBinding>>, pub pending_par_requests: RwLock<HashMap<String, PushedAuthRequest>>, pub pending_device_codes: RwLock<HashMap<String, PendingDeviceCode>>, pub device_code_by_user_code: RwLock<HashMap<String, String>>, pub token_db: Option<Arc<dyn TokenStore>>, pub policy_client: PolicyClient, pub discovery_client: DiscoveryClient, pub issuer_url: String, pub hosted_account_zone: Option<AccountZone>, pub ninep_canonical_read: Option<NinepCanonicalReadConfig>, pub default_scopes: Vec<String>, pub token_ttl: u32, pub refresh_token_ttl: u32, pub require_pushed_authorization_requests: bool, pub http_client: Client, pub verifying_key_bytes: [u8; 32], pub user_service: Option<Arc<UserService>>, pub hosted_account_store: Option<Arc<AccountRecordStore>>, pub identity_registration_api: Option<Arc<IdentityRegistrationApi>>, pub signing_key: Option<SigningKey>, pub root_identity_key_store: Option<Arc<SigningKeyStore>>, pub authority_hints: Vec<String>, pub pending_external_auths: RwLock<HashMap<String, PendingExternalAuth>>, pub external_providers: HashMap<String, OidcProviderConfig>, pub oidc_discovery: SharedDiscoveryCache, pub sessions: SessionStore, pub xrpc_repos: Arc<XrpcRepoStore>, pub public_repo_writer: Option<Arc<PublicRepoWriter>>, pub hosted_public_repo_writer: Option<Arc<HostedAccountPublicRepoWriter>>, pub public_git_canary_record: Option<PublicGitCanaryRecord>, pub atproto_session_resolver: Option<Arc<dyn AtprotoSessionResolver>>, pub xrpc_read_slice: bool, pub public_git_canary_backend_port: Option<u16>, pub deployment_well_known_dir: Option<PathBuf>, pub rsa_encoding_key: Option<EncodingKey>, pub rsa_jwk: Option<Value>, pub rsa_kid: Option<String>, pub dpop_jti_seen: TtlCache<ReplayKey, ()>, pub assertion_jti_seen: TtlCache<ReplayKey, ()>, pub atproto_service_jti_seen: TtlCache<ReplayKey, ()>, pub atproto_did_resolver: Arc<dyn AtprotoDidDocumentResolver>, pub dpop_nonces: RwLock<HashMap<String, i64>>, pub dpop_clients_seen: RwLock<HashMap<String, i64>>, pub trusted_issuers: HashMap<String, TrustedIssuerConfig>, pub ca_jwt_key: Option<Arc<SigningKey>>, pub device_store: Option<Arc<dyn DeviceStore>>, pub jwt_key_nbf: i64, pub jwt_key_exp: i64, pub signing_key_store: Option<Arc<SigningKeyStore>>, pub es256_key_store: Option<Arc<Es256SigningKeyStore>>, pub ml_dsa_key_store: Option<Arc<MlDsaSigningKeyStore>>, pub audit_sink: Option<Arc<dyn AuditSink>>, pub quic_cert_hashes: Vec<[u8; 32]>, pub quic_public_uri: Option<String>, pub mesh_pq_verifying_key: Option<Vec<u8>>, pub mesh_kem_public: Option<RecipientPublic>, pub iroh_node_id: Option<[u8; 32]>, pub iroh_relays: Vec<String>, /* private fields */
}
Expand description

Shared OAuth server state.

Fields§

§clients: RwLock<HashMap<String, RegisteredClient>>

Dynamically-registered (RFC 7591) clients keyed by issued UUID client_id. CIMD clients live in cimd_cache instead — DCR entries have no TTL and outlive cache evictions, so storage is separated.

§cimd_cache: Arc<CimdCache>

CIMD metadata cache. CIMD documents (HTTPS-URL client_ids) are fetched + verified once, then cached respecting HTTP cache headers, bounded TTL and capacity. See cimd_cache module.

§jwks_uri_cache: RwLock<HashMap<String, (Value, Instant)>>

JWKS-URI fetch cache for private_key_jwt client auth. Keyed by the absolute URL; value is (parsed_jwks_json, fetched_at). Entries expire after client_jwks_uri_cache_ttl_secs and are evicted lazily on read. Capacity is implicitly bounded by the number of registered clients with jwks_uri (typically small).

§client_jwks_uri_cache_ttl: Duration

TTL for the jwks_uri_cache. Copied from OAuthConfig::client_jwks_uri_cache_ttl_secs at construction.

§pending_codes: RwLock<HashMap<String, PendingAuthCode>>

Pending authorization codes (single-use, 60s TTL)

§pending_nonces: RwLock<HashMap<String, Instant>>

Pending authorize nonces (single-use, 5-min TTL). Proves a nonce was issued by this server and hasn’t been replayed.

§pending_authorize_bindings: RwLock<HashMap<String, AuthorizeBinding>>

Complete resolved authorization requests, keyed and consumed alongside the consent nonce so browser-carried fields are never authority.

§pending_par_requests: RwLock<HashMap<String, PushedAuthRequest>>

Pending Pushed Authorization Requests (RFC 9126), keyed by request_uri. Single-use, 60s TTL. In-memory is correct here — no value to persistence.

§pending_device_codes: RwLock<HashMap<String, PendingDeviceCode>>

Pending device authorization codes (RFC 8628), keyed by device_code

§device_code_by_user_code: RwLock<HashMap<String, String>>

Reverse lookup: user_code -> device_code

§token_db: Option<Arc<dyn TokenStore>>

Persistent refresh token store. Keyed by opaque token string. None when no credentials path is configured (tokens silently lost on restart).

§policy_client: PolicyClient

PolicyClient for JWT token issuance via ZMQ

§discovery_client: DiscoveryClient

DiscoveryClient for resolving service QUIC endpoints via ZMQ

§issuer_url: String

Issuer URL (e.g., “http://localhost:6791”)

§hosted_account_zone: Option<AccountZone>

Deployment-owned account-zone apex. User tokens may carry only a tenant derived from a hosted DID under this exact configured zone.

§ninep_canonical_read: Option<NinepCanonicalReadConfig>

Operator-selected canonical 9P read export. When set, hosted-account signup seeds the new account’s HolderGate baseline rows (model:{repo} query, registry:{repo-uuid} query) in its tenant.

§default_scopes: Vec<String>

Default scopes for new clients

§token_ttl: u32

Access token TTL in seconds

§refresh_token_ttl: u32

Refresh token TTL in seconds

§require_pushed_authorization_requests: bool

When true, /oauth/authorize rejects inline params and requires a request_uri from a prior /oauth/par call (RFC 9126). Advertised in server metadata.

§http_client: Client

HTTP client for fetching Client ID Metadata Documents

§verifying_key_bytes: [u8; 32]

Raw Ed25519 verifying key bytes (32 bytes) for the JWKS endpoint.

§user_service: Option<Arc<UserService>>

User credential store for Ed25519 challenge-response device verification. Now backed by user_service. Legacy code uses user_store_reader(). Kept as Option for backward-compatible is_none() checks.

§hosted_account_store: Option<Arc<AccountRecordStore>>

Authority-owned hosted-account records used to resolve an ATProto DID to its local tenant binding. None means every ATProto identity is federated-only for tenant exchange purposes.

§identity_registration_api: Option<Arc<IdentityRegistrationApi>>

Authenticated registration/intake wire adapter. None keeps every identity mutation endpoint fail-closed with 503 after authentication.

§signing_key: Option<SigningKey>

Ed25519 signing key for signing entity configurations (OpenID Federation 1.0). None when not configured.

§root_identity_key_store: Option<Arc<SigningKeyStore>>

Named root-DID identity slots (drain/active/lead).

This store is seeded from signing_key on first deployment, then rotated independently with bounded overlap. The root DID publisher snapshots all three roles; entity statements sign with the active role.

§authority_hints: Vec<String>

OpenID Federation 1.0 Trust Anchor URLs. Included as authority_hints in the entity configuration JWT.

§pending_external_auths: RwLock<HashMap<String, PendingExternalAuth>>

Pending external OIDC authentication flows (keyed by external state).

§external_providers: HashMap<String, OidcProviderConfig>

Provider configuration fixed at server construction for a consistent authorize page, upstream start, and callback verification.

§oidc_discovery: SharedDiscoveryCache

OIDC discovery cache for external providers.

§sessions: SessionStore

Server-side session store for browser login flow.

§xrpc_repos: Arc<XrpcRepoStore>

In-memory com.atproto.* XRPC read slice repo store (#1112). Populated by the write path (#910) and tests; the read endpoints consult it directly. Default-empty so existing construction sites need no change.

§public_repo_writer: Option<Arc<PublicRepoWriter>>

Optional native-authorized public repository writer. No public write routes are mounted while this is absent.

§hosted_public_repo_writer: Option<Arc<HostedAccountPublicRepoWriter>>

Production hosted-account writer. It resolves the requested DID and signs through AccountRecordStore without exposing private key bytes.

§public_git_canary_record: Option<PublicGitCanaryRecord>

One explicitly enabled Registry/PDS record. Its DID and rkey are fixed at startup; public callers cannot select another Discovery target.

§atproto_session_resolver: Option<Arc<dyn AtprotoSessionResolver>>

Optional native account resolver for the protected standard com.atproto.server.getSession route.

§xrpc_read_slice: bool

When true, the XRPC read-slice routes (/xrpc/…) are mounted on the OAuth router (#1112). Copied from OAuthConfig::xrpc_read_slice.

§public_git_canary_backend_port: Option<u16>

Optional loopback-only sidecar port for the fixed public Git canary. None keeps the Git routes absent from the public router.

§deployment_well_known_dir: Option<PathBuf>

Deployment static well-known directory (#1137 serving half). When set, this OAuth instance terminates the deployment’s did:web host: it serves <dir>/did.json in place of the dynamic node document, plus <dir>/at9p/<cid>.cbor, <dir>/deployment/deployment-authority.log.json, and <dir>/deployment/registry-service.jwt. All four are public, integrity-anchored bytes — see deployment_well_known.rs. Copied from OAuthConfig::deployment_well_known_dir.

§rsa_encoding_key: Option<EncodingKey>

RSA encoding key for RS256 id_token signing (optional, loaded from secrets).

§rsa_jwk: Option<Value>

RSA public key as JWK JSON (for the JWKS endpoint).

§rsa_kid: Option<String>

RSA key kid (for the JWT header).

§dpop_jti_seen: TtlCache<ReplayKey, ()>

Seen DPoP JTIs for replay prevention (RFC 9449 §11.1). Backed by the shared TtlCache with atomic check-and-record — see check_and_record_dpop_jti. A BLAKE3-256 digest retains a fixed-size key; TTL = iat + 120s per entry.

§assertion_jti_seen: TtlCache<ReplayKey, ()>

Seen client-assertion JTIs for replay prevention (RFC 7523 §3 / atproto OAuth; #1146 T3.3). Keyed by a BLAKE3-256 digest of {client_id}\u{1f}{jti}; TTL = the assertion’s remaining exp lifetime. See check_and_record_assertion_jti.

§atproto_service_jti_seen: TtlCache<ReplayKey, ()>

One-use ATProto service-auth JTIs, keyed by a BLAKE3-256 digest of the issuer/JTI composite and retained until the source assertion expires.

§atproto_did_resolver: Arc<dyn AtprotoDidDocumentResolver>

Validated did:plc/did:web document source for service-auth keys.

§dpop_nonces: RwLock<HashMap<String, i64>>

Server-issued DPoP nonces. Value = expiry unix timestamp.

§dpop_clients_seen: RwLock<HashMap<String, i64>>

Per-client (keyed by DPoP jkt thumbprint) nonce-issuance state. Once a jkt appears here, RFC 9449 §8 enforcement kicks in: subsequent proofs from the same key MUST carry a server-issued nonce. Value = expiry unix timestamp (matches nonce TTL; entry pruned when expired to allow re-bootstrap after silence).

§trusted_issuers: HashMap<String, TrustedIssuerConfig>

Trusted external OIDC issuers for the JWT bearer grant (RFC 7523).

§ca_jwt_key: Option<Arc<SigningKey>>

CA JWT signing key for browser WIT issuance (POST /oauth/wit). Derived from the root CA key via derive_purpose_key(“hyprstream-jwt-v1”). None when credentials are unavailable (WIT endpoint returns 503).

§device_store: Option<Arc<dyn DeviceStore>>

Anonymous device identity store.

§jwt_key_nbf: i64

Unix timestamp of when the JWT signing key became active (nbf for JWKS entry).

§jwt_key_exp: i64

Unix timestamp of when the JWT signing key expires (exp for JWKS entry). Default: jwt_key_nbf + 14 days.

§signing_key_store: Option<Arc<SigningKeyStore>>

Multi-slot JWT signing key store for rotation (drain/active/lead lifecycle). When present, JWKS serves all slots and issuance uses the active key.

§es256_key_store: Option<Arc<Es256SigningKeyStore>>

Shared JWT ID blocklist for access token revocation (shared with PolicyService). ES256 (P-256) signing key rotation store for JWKS and DPoP/atproto interop.

§ml_dsa_key_store: Option<Arc<MlDsaSigningKeyStore>>

ML-DSA-65 signing key rotation store for PQ-hybrid JWT issuance.

§audit_sink: Option<Arc<dyn AuditSink>>

MAC #547 / B2 (#674): the tamper-evident audit sink the S6 grant path (mac::exchange::audited_evaluate_grant/audited_evaluate_refresh) records every decision through. None means the grant-path audit trail is not configured — the grant path treats that as fail-closed (deny, not “audit best-effort”) rather than minting unaudited tokens. Production wiring is crate::mac::audit::WalAuditStore + an crate::mac::audit::cose::OwnedCoseAuditSigner (see the oauth service factory).

§quic_cert_hashes: Vec<[u8; 32]>

QUIC/WebTransport cert hashes (SHA-256 of leaf DER, sha2-256 multihash encoding). Published in the DID-doc #quic service entry so peers can pin the cert (#185). A set so cert rotation can publish old + new simultaneously.

§quic_public_uri: Option<String>

Public QUIC URI (https://host:port) for the DID-doc service entry (#185). None until the QUIC server is started and the cert hash is known.

§mesh_pq_verifying_key: Option<Vec<u8>>

Raw ML-DSA-65 verifying-key bytes (1952 bytes) for the node’s mesh post-quantum signing key (#157). Published as the #mesh-pq Multikey verification method in the root DID document. Derived from the same Ed25519 key as Self::signing_key (via derive_mesh_mldsa_key), so the published VM equals the key the node signs mesh responses with. None when the entity signing key is not configured.

§mesh_kem_public: Option<RecipientPublic>

The node’s #mesh-kem hybrid keyAgreement public material (S1 / #552): one ML-KEM-768-hybrid recipient public (X25519 + ML-KEM-768 encapsulation keys, suite HyKemX25519MlKem768). Published as the keyAgreement verification methods in the root DID document. Derived from the same Ed25519 key as Self::signing_key (via derive_mesh_kem_recipient), so the published keys equal what the node decapsulates #mesh-kem envelopes with. None when the entity signing key is not configured, or when derivation failed under Classical policy (Hybrid fails closed during with_signing_key).

§iroh_node_id: Option<[u8; 32]>

#282: the node’s iroh endpoint id (its Ed25519 node_id, 32 bytes), published only as an IrohTransport service entry when bound. It is not a verification method or JWKS key (#1031).

§iroh_relays: Vec<String>

#282: iroh relay URLs to advertise in the IrohTransport entry’s relays. Empty = rely on pkarr/DNS discovery for reachability (the peer resolves direct paths by node_id alone).

Implementations§

Source§

impl OAuthState

Source

pub fn new( config: &OAuthConfig, policy_client: PolicyClient, discovery_client: DiscoveryClient, verifying_key_bytes: [u8; 32], ) -> Self

Source

pub fn with_device_store(self, store: Arc<dyn DeviceStore>) -> Self

Attach the anonymous device store.

Source

pub fn with_atproto_did_resolver( self, resolver: Arc<dyn AtprotoDidDocumentResolver>, ) -> Self

Override ATProto DID resolution with a validated fixture or private resolver.

Source

pub fn with_hosted_account_store(self, store: Arc<AccountRecordStore>) -> Self

Attach the authority-owned hosted-account record store.

Source

pub fn with_public_repo_writer(self, writer: Arc<PublicRepoWriter>) -> Self

Install the explicit native-authorized public repository writer. This opt-in is required before standard XRPC repository writes are exposed.

Source

pub fn with_hosted_public_repo_writer( self, writer: Arc<HostedAccountPublicRepoWriter>, ) -> Self

Source

pub fn with_public_git_canary_record( self, record: PublicGitCanaryRecord, ) -> Self

Source

pub fn with_atproto_session_resolver( self, resolver: Arc<dyn AtprotoSessionResolver>, ) -> Self

Install the explicit native account resolver used by standard com.atproto.server.getSession. The resolver owns handle, DID-document and lifecycle truth; no session route is mounted without it.

Source

pub fn with_identity_registration_api( self, api: Arc<IdentityRegistrationApi>, ) -> Self

Attach the authenticated hosted-account registration/intake adapter.

Source

pub async fn hosted_account_tenant( &self, did: &str, ) -> Result<Option<String>, String>

Resolve a signed ATProto subject DID to its hosted local tenant.

The request tenant is deliberately absent from this API. A missing store or record is a federated-only identity (Ok(None)); store corruption, authorization failure, and ambiguous bindings are errors.

Source

pub async fn refresh_hosted_account_index_after_signup( &self, ) -> Result<(), String>

Refresh the authority-owned hosted-DID index after OAuth signup has durably published and activated an account. This is a no-op when the production hosted-account store is not configured, preserving the existing non-local-store path.

Source

pub fn atproto_service_did(&self) -> Option<String>

Host service DID accepted in ATProto service-auth aud.

Source

pub fn with_jwt_key_timestamps(self, nbf: i64, exp: i64) -> Self

Set JWT signing key validity window for the JWKS endpoint.

Source

pub fn with_ca_jwt_key(self, key: SigningKey) -> Self

Attach the CA JWT signing key for browser WIT issuance (POST /oauth/wit).

Source

pub fn with_signing_key_store(self, store: Arc<SigningKeyStore>) -> Self

Attach the multi-slot signing key store (rotation).

When set, JWKS serves all slots and WIT issuance uses the active key.

Source

pub fn with_root_identity_key_store(self, store: Arc<SigningKeyStore>) -> Self

Attach the independently persisted root-DID identity rotation set.

Source

pub fn with_es256_key_store(self, store: Arc<Es256SigningKeyStore>) -> Self

Attach the ES256 (P-256) key rotation store.

Source

pub fn with_ml_dsa_key_store(self, store: Arc<MlDsaSigningKeyStore>) -> Self

Attach the ML-DSA-65 key rotation store.

Source

pub fn with_audit_sink(self, sink: Arc<dyn AuditSink>) -> Self

Attach the S6 grant-path audit sink (B2, #674). Without this, the grant path fails closed on every request rather than minting tokens with no audit trail.

Source

pub fn with_quic_transport( self, public_uri: String, cert_hashes: Vec<[u8; 32]>, ) -> Self

Set the node’s QUIC transport info for DID-doc publication (#185).

cert_hashes is the set of SHA-256 cert DER hashes currently in use (old + new during rotation). public_uri is https://host:port that external peers dial.

Source

pub fn with_iroh_transport(self, node_id: [u8; 32], relays: Vec<String>) -> Self

Set the node’s iroh transport info for DID-doc publication (#282).

Call this only when the iroh substrate is actually bound: it makes root_did_document advertise an IrohTransport service entry. The node_id is reachability metadata, never a DID verification method. relays may be empty — peers then resolve reachability by node_id alone via iroh’s pkarr/DNS discovery.

Source

pub async fn jwt_bearer_verifying_key(&self) -> Option<VerifyingKey>

Return the verifying key to use for JWT bearer token validation.

Prefers the active slot from the signing key store; falls back to the legacy verifying_key_bytes field (policy-service-issued key).

Source

pub async fn active_jwt_signing_key(&self) -> Option<Arc<SigningKey>>

Return the active JWT signing key for token issuance (WIT/ADT).

Prefers the active slot from the signing key store; falls back to ca_jwt_key.

Source

pub async fn active_root_identity_signing_key(&self) -> Option<Arc<SigningKey>>

Active root-DID signing key, falling back to the pre-rotation singleton.

Source

pub fn with_user_store(self, store: ProductionUserStore) -> Self

Attach an account store admitted by the sole production construction boundary.

Source

pub fn with_hosted_account_zone(self, zone: AccountZone) -> Self

Bind token issuance to the account zone this deployment actually hosts.

Source

pub fn with_ninep_canonical_read(self, export: NinepCanonicalReadConfig) -> Self

Attach the operator-selected canonical 9P read export so hosted-account signup can seed the HolderGate baseline rows for new accounts.

Source

pub fn has_user_store(&self) -> bool

Backward-compatible check: returns true if a user store is configured.

Source

pub fn with_signing_key( self, key: SigningKey, policy: CryptoPolicy, ) -> Result<Self>

Attach the signing key for OpenID Federation 1.0 entity configuration signing.

Also derives and stores the node’s mesh ML-DSA-65 verifying key (#157) from this same Ed25519 key, so the root DID document’s #mesh-pq Multikey verification method matches the post-quantum key the mesh signs with (derive_mesh_mldsa_key), and the node’s #mesh-kem hybrid keyAgreement public material (S1 / #552, derive_mesh_kem_recipient) so peers can anchor a recipient key that matches what this node decapsulates with. A #mesh-kem derivation failure is fail-closed under Hybrid policy: startup returns an error rather than publishing a root DID document with an empty keyAgreement relationship. Under Classical policy, the failure is logged and mesh_kem_public stays unset.

Source

pub fn with_token_store_impl(&mut self, store: Arc<dyn TokenStore>)

Inject a pre-built token store implementation.

Source

pub async fn put_refresh_token( &self, token: &str, entry: &RefreshTokenEntry, ttl_secs: u64, ) -> Result<()>

Persist a refresh token entry to the store.

Source

pub async fn get_refresh_token( &self, token: &str, ) -> Result<Option<RefreshTokenEntry>>

Look up a refresh token. Returns None if not found or expired (lazy expiry).

Source

pub async fn take_refresh_token( &self, token: &str, ) -> Result<Option<RefreshTokenEntry>>

Atomically claim a refresh token for one-time rotation. Only one caller across all OAuth replicas can receive a given entry.

Source

pub async fn delete_refresh_token(&self, token: &str) -> Result<()>

Remove a refresh token (revocation / rotation).

Source

pub fn check_and_record_dpop_jti(&self, jti: &str, iat: i64) -> bool

Check a DPoP JTI for replay and record it if new.

Returns true when the JTI is fresh (caller should proceed). Returns false when the JTI is a replay or the fail-closed barrier is full. Expired entries are pruned opportunistically on each call.

Source

pub fn check_and_record_atproto_service_jti( &self, issuer: &str, jti: &str, exp: i64, ) -> bool

Atomically consume an ATProto service-auth assertion identifier.

Source

pub fn check_and_record_assertion_jti( &self, client_id: &str, jti: &str, exp: i64, ) -> bool

Check a client-assertion JTI for replay and record it if new (#1146 T3.3; RFC 7523 §3 — an AS MUST NOT accept the same jti more than once).

Keyed by {client_id}\u{1f}{jti} so distinct clients cannot collide on the same identifier. The entry lives until the assertion’s own exp, after which a replayed assertion would be rejected as expired anyway.

Returns true when the JTI is fresh (caller should proceed); false when it is a replay or the fail-closed barrier is full.

Source

pub async fn issue_dpop_nonce(&self) -> String

Issue a fresh server-side DPoP nonce (RFC 9449 §8).

Returns the base64url nonce string that should be placed in the DPoP-Nonce response header. Stored with a 5-minute TTL.

Source

pub async fn verify_dpop_nonce(&self, nonce: &str) -> bool

Validate a DPoP nonce issued by this server. Returns true if valid and unexpired.

Source

pub async fn dpop_client_requires_nonce(&self, jkt: &str) -> bool

RFC 9449 §8 nonce-enforcement bookkeeping: has this client (jkt) previously been issued a nonce that has not yet expired? If so the next DPoP proof from this key MUST include a valid nonce.

Source

pub async fn mark_dpop_client_nonced(&self, jkt: &str)

Record that this client (jkt) has been issued a server nonce. Future proofs from this key are required to carry one (sliding 5-min window per nonce TTL).

Source

pub fn subject_did(&self, subject: &str) -> Result<String, SubjectDidError>

Validate the JWT sub claim for an atproto-conformant access token (#1113 rev2 / #1124 split).

atproto OAuth requires the access token’s sub to be a real, resolvable atproto account DID: did:plc:<opaque> or host-form did:web:<host>[:port] (NO path component — the atproto DID profile rejects did:web:host:users:alice). A hyprstream-local account (enrolled by Ed25519 username) has no atproto DID yet; provisioning is tracked in #1124. Such accounts are REJECTED from the atproto profile (fail closed), never minted a spec-invalid path-form alias.

Source

pub fn atproto_issuer_url(&self) -> String

Origin-only issuer required by the atproto OAuth profile.

Source

pub fn issuer_for_scopes(&self, scopes: &[String]) -> String

Select the issuer used at a profile-sensitive mint/redirect boundary.

Source

pub async fn check_atproto_account_eligibility( &self, username: &str, ) -> Result<String, SubjectDidError>

Check whether an account is eligible for the atproto OAuth profile and return the account’s mapped atproto DID (#1113 r5 / #1124 split).

This inspects the ACCOUNT/KEY MAPPING, not the subject string:

  1. Rejects at9p-backed accounts (any key with [KeyAlgorithm::HybridEd25519MlDsa65] → SubjectDidError::At9pBackedAccount).
  2. Looks up the account’s MAPPED atproto DID from the profile’s atproto_did field. If present and valid → returns it (success).
  3. An account without a mapped DID fails closed (SubjectDidError::NoAtprotoIdentity).

PROVISIONING mappings (creating did:plc, etc.) is #1124 — out of scope. The LOOKUP + success path exists here so the atproto OAuth profile can emit the mapped DID as sub when an account has one.

Source

pub fn server_supported_scopes(&self) -> Vec<String>

The full set of scopes this AS supports (#1113 rev2 F4). Extends default_scopes (the omitted-scope grant set) with the atproto transition scopes, which are supported-but-explicit: a client must request them to activate the strict profile; omitting scope grants only default_scopes.

Source

pub fn with_rsa_key(self, rsa_der: &[u8]) -> Self

Attach an RSA key for RS256 id_token signing (OIDC interop).

rsa_der is the PKCS#8 DER-encoded RSA private key.

Source

pub fn spawn_code_sweeper(self: &Arc<Self>)

Spawn a background task that sweeps expired codes every 30 seconds.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> JaggedSlice<T> for T

§

type Index = Index2

§

fn push_into(self, array: &mut Jagged<T>)

§

fn insert_into(self, index: <T as JaggedSlice<T>>::Index, array: &mut Jagged<T>)

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,