Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Async Project Auth protocol client. It owns no pending or credential persistence.

Implementations§

Source§

impl Client

Source

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.

Source

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.

Source

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.

Source

pub fn base_url(&self) -> &str

Source

pub fn project_id(&self) -> &str

Source

pub fn application_id(&self) -> &str

Source

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.

Source

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.

Source

pub async fn public_configuration(&self) -> Result<PublicConfiguration, Error>

Fetches bounded public Project/Application configuration.

§Errors

Returns a typed transport, Runtime, or protocol error.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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