pub struct Client { /* private fields */ }Expand description
Async Project Auth protocol client. It owns no pending or credential persistence.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(config: ClientConfig) -> Result<Self, Error>
pub fn new(config: ClientConfig) -> Result<Self, Error>
Creates a client with the production HTTP transport, OS entropy, and system clock.
§Errors
Returns a configuration error when URL, identifiers, or deadline are invalid.
Sourcepub fn with_dependencies(
config: ClientConfig,
transport: Arc<dyn Transport>,
entropy: Arc<dyn EntropySource>,
clock: Arc<dyn Clock>,
) -> Result<Self, Error>
pub fn with_dependencies( config: ClientConfig, transport: Arc<dyn Transport>, entropy: Arc<dyn EntropySource>, clock: Arc<dyn Clock>, ) -> Result<Self, Error>
Constructs a client with explicit protocol dependencies for deterministic tests and custom transport policy.
§Errors
Returns a configuration error when URL, identifiers, or deadline are invalid.
Sourcepub fn with_debug_hook(self, debug_hook: Arc<dyn DebugHook>) -> Self
pub fn with_debug_hook(self, debug_hook: Arc<dyn DebugHook>) -> Self
Installs an optional secret-free completion observer. Hook panics are isolated from protocol outcomes.
pub fn base_url(&self) -> &str
pub fn project_id(&self) -> &str
pub fn application_id(&self) -> &str
Sourcepub fn restore_pending_login(
&self,
value: PendingLoginRecord,
) -> Result<PendingLogin, Error>
pub fn restore_pending_login( &self, value: PendingLoginRecord, ) -> Result<PendingLogin, Error>
Restores an explicitly exported pending-login record into this exact client without I/O.
§Errors
Returns a configuration error for a stale, malformed, or cross-context record.
Sourcepub fn restore_credentials(
&self,
value: CredentialPairRecord,
) -> Result<CredentialPair, Error>
pub fn restore_credentials( &self, value: CredentialPairRecord, ) -> Result<CredentialPair, Error>
Restores an explicitly exported credential generation into this exact client without I/O.
§Errors
Returns a configuration error for a malformed, expired, or cross-context record.
Sourcepub async fn public_configuration(&self) -> Result<PublicConfiguration, Error>
pub async fn public_configuration(&self) -> Result<PublicConfiguration, Error>
Fetches bounded public Project/Application configuration.
§Errors
Returns a typed transport, Runtime, or protocol error.
Sourcepub async fn public_configuration_with_options(
&self,
options: &OperationOptions,
) -> Result<PublicConfiguration, Error>
pub async fn public_configuration_with_options( &self, options: &OperationOptions, ) -> Result<PublicConfiguration, Error>
Fetches public configuration with explicit operation controls.
§Errors
Returns a typed transport, Runtime, or protocol error.
Sourcepub async fn project_jwks(&self) -> Result<JwksDocument, Error>
pub async fn project_jwks(&self) -> Result<JwksDocument, Error>
Fetches Project JWKS and signing revision metadata.
§Errors
Returns a typed transport, Runtime, or protocol error.
Sourcepub async fn project_jwks_with_options(
&self,
options: &OperationOptions,
) -> Result<JwksDocument, Error>
pub async fn project_jwks_with_options( &self, options: &OperationOptions, ) -> Result<JwksDocument, Error>
Fetches Project JWKS with explicit operation controls.
§Errors
Returns a typed transport, Runtime, or protocol error.
Sourcepub async fn begin_login(
&self,
redirect_uri: &str,
application_state: Option<&str>,
presentation_hint: Option<&str>,
) -> Result<LoginStart, Error>
pub async fn begin_login( &self, redirect_uri: &str, application_state: Option<&str>, presentation_hint: Option<&str>, ) -> Result<LoginStart, Error>
Creates fresh S256 PKCE/state and starts a generic Hosted login without navigation.
§Errors
Returns a configuration, entropy, transport, login, or protocol error.
Sourcepub async fn begin_login_with_options(
&self,
redirect_uri: &str,
application_state: Option<&str>,
presentation_hint: Option<&str>,
options: &OperationOptions,
) -> Result<LoginStart, Error>
pub async fn begin_login_with_options( &self, redirect_uri: &str, application_state: Option<&str>, presentation_hint: Option<&str>, options: &OperationOptions, ) -> Result<LoginStart, Error>
Starts Hosted login with explicit operation controls.
§Errors
Returns a configuration, entropy, transport, login, or protocol error.
Sourcepub fn validate_callback(
&self,
callback_url: &str,
pending: &PendingLogin,
) -> Result<ValidatedCallback, Error>
pub fn validate_callback( &self, callback_url: &str, pending: &PendingLogin, ) -> Result<ValidatedCallback, Error>
Validates local callback input without consuming pending state on malformed input. A successful validation returns a value sharing the pending login’s one-use guard.
§Errors
Returns a handoff error for expiry, state, redirect, or context mismatch.
Sourcepub async fn exchange_handoff(
&self,
callback: &ValidatedCallback,
) -> Result<CredentialPair, Error>
pub async fn exchange_handoff( &self, callback: &ValidatedCallback, ) -> Result<CredentialPair, Error>
Exchanges locally validated one-use handoff material without automatic retry.
§Errors
Returns Indeterminate when a post-dispatch outcome cannot be known safely.
Sourcepub async fn exchange_handoff_with_options(
&self,
callback: &ValidatedCallback,
options: &OperationOptions,
) -> Result<CredentialPair, Error>
pub async fn exchange_handoff_with_options( &self, callback: &ValidatedCallback, options: &OperationOptions, ) -> Result<CredentialPair, Error>
Exchanges handoff material with explicit operation controls.
§Errors
Returns Indeterminate when a post-dispatch outcome cannot be known safely.
Sourcepub async fn complete_login(
&self,
callback_url: &str,
pending: &PendingLogin,
) -> Result<CredentialPair, Error>
pub async fn complete_login( &self, callback_url: &str, pending: &PendingLogin, ) -> Result<CredentialPair, Error>
Validates a callback and exchanges its handoff as one explicit operation.
§Errors
Returns a handoff, transport, protocol, or indeterminate error.
Sourcepub async fn complete_login_with_options(
&self,
callback_url: &str,
pending: &PendingLogin,
options: &OperationOptions,
) -> Result<CredentialPair, Error>
pub async fn complete_login_with_options( &self, callback_url: &str, pending: &PendingLogin, options: &OperationOptions, ) -> Result<CredentialPair, Error>
Validates and exchanges a login callback with explicit operation controls.
§Errors
Returns a handoff, transport, protocol, cancellation, or indeterminate error.
Sourcepub async fn refresh(
&self,
current: &CredentialPair,
) -> Result<CredentialPair, Error>
pub async fn refresh( &self, current: &CredentialPair, ) -> Result<CredentialPair, Error>
Rotates one explicit credential generation without automatic retry.
§Errors
Returns a refresh, protocol, transport, or indeterminate error.
Sourcepub async fn refresh_with_options(
&self,
current: &CredentialPair,
options: &OperationOptions,
) -> Result<CredentialPair, Error>
pub async fn refresh_with_options( &self, current: &CredentialPair, options: &OperationOptions, ) -> Result<CredentialPair, Error>
Rotates one credential generation with explicit operation controls.
§Errors
Returns a refresh, protocol, transport, cancellation, or indeterminate error.
Sourcepub async fn current_user(
&self,
credentials: &CredentialPair,
) -> Result<CurrentUser, Error>
pub async fn current_user( &self, credentials: &CredentialPair, ) -> Result<CurrentUser, Error>
Retrieves the bounded current Project user for an exact context-bound credential pair.
§Errors
Returns an authentication, protocol, or transport error.
Sourcepub async fn current_user_with_options(
&self,
credentials: &CredentialPair,
options: &OperationOptions,
) -> Result<CurrentUser, Error>
pub async fn current_user_with_options( &self, credentials: &CredentialPair, options: &OperationOptions, ) -> Result<CurrentUser, Error>
Retrieves the current user with explicit operation controls.
§Errors
Returns an authentication, protocol, transport, or cancellation error.
Sourcepub async fn logout_application(
&self,
credentials: &CredentialPair,
) -> Result<(), Error>
pub async fn logout_application( &self, credentials: &CredentialPair, ) -> Result<(), Error>
Revokes only the exact Application session represented by a context-bound pair.
§Errors
Returns a session error or Indeterminate after an ambiguous dispatch.
Sourcepub async fn logout_application_with_options(
&self,
credentials: &CredentialPair,
options: &OperationOptions,
) -> Result<(), Error>
pub async fn logout_application_with_options( &self, credentials: &CredentialPair, options: &OperationOptions, ) -> Result<(), Error>
Revokes an Application session with explicit operation controls.
§Errors
Returns a session, cancellation, or indeterminate error.
Sourcepub async fn prepare_browser_logout(
&self,
credentials: &CredentialPair,
) -> Result<BrowserLogoutPreparation, Error>
pub async fn prepare_browser_logout( &self, credentials: &CredentialPair, ) -> Result<BrowserLogoutPreparation, Error>
Creates a Hosted Project-browser logout target without navigating to it.
§Errors
Returns a session, protocol, transport, or indeterminate error.
Sourcepub async fn prepare_browser_logout_with_options(
&self,
credentials: &CredentialPair,
options: &OperationOptions,
) -> Result<BrowserLogoutPreparation, Error>
pub async fn prepare_browser_logout_with_options( &self, credentials: &CredentialPair, options: &OperationOptions, ) -> Result<BrowserLogoutPreparation, Error>
Creates a browser logout target with explicit operation controls.
§Errors
Returns a session, protocol, transport, cancellation, or indeterminate error.