Skip to main content

pas_external/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod audit;
4// `epoch` re-exports the engine `EpochRevocation` port + ships the
5// canonical adapter set (Phase 11.Z, RFC_2026-05-09 §3.5). Gated on
6// `well-known-fetch` because `UserinfoFetcher` needs the HTTP client
7// (`oauth`) and the engine port itself needs `token` — both implied
8// by the `well-known-fetch` flag.
9#[cfg(feature = "well-known-fetch")]
10pub mod epoch;
11pub mod error;
12// `oauth` is the OAuth2 wire-DTO + AuthClient adapter used internally by
13// `oidc::RelyingParty`. As of 0.8.0 it is `pub(crate)` — consumers reach
14// the OIDC RP composition root (`oidc::RelyingParty<S>`) and never the
15// raw OAuth surface. See `oidc::RefreshOutcome` for the boundary type at
16// `RelyingParty::refresh`.
17#[cfg(feature = "oauth")]
18pub(crate) mod oauth;
19#[cfg(feature = "token")]
20pub mod oidc;
21#[cfg(feature = "oauth")]
22pub mod pas_port;
23// `pkce` primitives (`generate_state`, `generate_code_verifier`,
24// `generate_code_challenge`) are SDK plumbing — `oidc::RelyingParty::start`
25// consumes them internally and exposes the resulting state via
26// `AuthorizationRedirect`. As of 0.8.0 the module is `pub(crate)`.
27#[cfg(feature = "oauth")]
28pub(crate) mod pkce;
29#[cfg(feature = "session-liveness")]
30pub mod session_liveness;
31#[cfg(feature = "token")]
32pub mod token;
33pub mod types;
34
35// Test-support helpers. `FakePasServer` is the SDK-owned wiremock-wrapped
36// fake PAS Authorization Server, replacing the 0.7.x
37// `RelyingParty::for_test_with_parts` escape hatch. Consumer integration
38// tests construct a real `RelyingParty::new(...)` against
39// `FakePasServer.issuer_url()` so production and test go through the same
40// public interface.
41#[cfg(feature = "test-support")]
42pub mod test_support;
43
44// Re-exports for convenient access
45pub use audit::{
46    AuditEvent, AuditSink, IdTokenFailureKind, MemoryRateLimiter, NoopAuditSink, RateLimitKey,
47    RateLimitedAuditSink, RateLimiter, VerifyErrorKind, compose_id_token_source_id,
48    compose_source_id,
49};
50#[cfg(any(test, feature = "test-support"))]
51pub use audit::MemoryAuditSink;
52pub use error::{Error, TokenError};
53#[cfg(feature = "session-liveness")]
54pub use session_liveness::{
55    CipherError, EncryptedRefreshToken, LivenessFailure, LivenessOutcome, RevokeCause,
56    TokenCipher, TransientCause, attempt_liveness_refresh,
57};
58// γ port-and-adapter — Phase 6.1 (D-04 = γ, locked 2026-05-05).
59// `KeySet`, `PublicKey`, `VerifiedClaims`, `verify_v4_*`,
60// `parse_public_key_hex`, `extract_unverified_kid`, and the
61// `WellKnownPaseto*` types from 0.5 are removed — see CHANGELOG 0.6.0.
62#[cfg(feature = "token")]
63pub use token::{AuthSession, BearerVerifier, Expectations, VerifyError};
64#[cfg(feature = "well-known-fetch")]
65pub use token::PasJwtVerifier;
66// Re-export gated on BOTH `token` (the source module) AND
67// `test-support` / `cfg(test)` (the consumer-facing flag). Pre-9.C
68// the cfg was just `any(test, feature = "test-support")` which broke
69// `--no-default-features --features test-support` builds because the
70// `token` module itself is gated `feature = "token"`. Tightening
71// here is a feature-matrix correctness fix; semantics under default
72// features (where `token` is on) are unchanged.
73#[cfg(all(feature = "token", any(test, feature = "test-support")))]
74pub use token::MemoryBearerVerifier;
75// OIDC RP surface — composition root + post-verify shapes + ports.
76// `RelyingParty<S>` is the consumer-facing entry point; `RefreshOutcome`
77// is the typed boundary return for `RelyingParty::refresh` (replaces
78// the 0.7.x `oauth::TokenResponse` re-export).
79#[cfg(feature = "token")]
80pub use oidc::{Address, IdAssertion, IdTokenVerifier, IdVerifyError, Nonce, ScopePiiReader};
81#[cfg(all(feature = "token", any(test, feature = "test-support")))]
82pub use oidc::MemoryIdTokenVerifier;
83pub use types::{KeyId, Ppnum, PpnumId, SessionId, UserId};
84// `Url` is consumer-facing via `Config::new(client_id, redirect_uri: Url, ...)`
85// and `Discovery::for_test`. Re-exported so consumers reach the same `url`
86// crate version the SDK uses without separately tracking it in their
87// Cargo.toml.
88#[cfg(feature = "oauth")]
89pub use url::Url;