Skip to main content

AuthsContextBuilder

Struct AuthsContextBuilder 

Source
pub struct AuthsContextBuilder<R, K, C> { /* private fields */ }
Expand description

Typestate builder for AuthsContext.

Call AuthsContext::builder() to obtain an instance. The build() method is only available once registry, key_storage, and clock have all been supplied.

Implementations§

Source§

impl<K, C> AuthsContextBuilder<Missing, K, C>

Source

pub fn registry( self, registry: Arc<dyn RegistryBackend + Send + Sync>, ) -> AuthsContextBuilder<Set<Arc<dyn RegistryBackend + Send + Sync>>, K, C>

Set the registry storage backend.

Args:

  • registry: Pre-initialized registry backend.

Usage:

builder.registry(Arc::new(my_git_backend))
Source§

impl<R, C> AuthsContextBuilder<R, Missing, C>

Source

pub fn key_storage( self, key_storage: Arc<dyn KeyStorage + Send + Sync>, ) -> AuthsContextBuilder<R, Set<Arc<dyn KeyStorage + Send + Sync>>, C>

Set the key storage backend.

Args:

  • key_storage: Platform keychain or in-memory test fake.

Usage:

builder.key_storage(Arc::new(my_keychain))
Source§

impl<R, K> AuthsContextBuilder<R, K, Missing>

Source

pub fn clock( self, clock: Arc<dyn ClockProvider + Send + Sync>, ) -> AuthsContextBuilder<R, K, Set<Arc<dyn ClockProvider + Send + Sync>>>

Set the clock provider.

Args:

  • clock: Wall-clock implementation (SystemClock in production, MockClock in tests).

Usage:

builder.clock(Arc::new(SystemClock))
Source§

impl<R, K, C> AuthsContextBuilder<R, K, C>

Source

pub fn event_sink( self, sink: Arc<dyn EventSink>, ) -> AuthsContextBuilder<R, K, C>

Set an optional event sink.

Defaults to [NoopSink] (all events discarded) when not called.

Args:

Usage:

builder.event_sink(Arc::new(my_sink))
Source

pub fn identity_storage( self, storage: Arc<dyn IdentityStorage + Send + Sync>, ) -> AuthsContextBuilder<R, K, C>

Set the identity storage adapter.

Args:

  • storage: Pre-initialized identity storage implementation.

Usage:

builder.identity_storage(Arc::new(my_identity_storage))
Source

pub fn attestation_sink( self, sink: Arc<dyn AttestationSink + Send + Sync>, ) -> AuthsContextBuilder<R, K, C>

Set the attestation sink adapter.

Args:

  • sink: Pre-initialized attestation sink implementation.

Usage:

builder.attestation_sink(Arc::new(my_attestation_store))
Source

pub fn attestation_source( self, source: Arc<dyn AttestationSource + Send + Sync>, ) -> AuthsContextBuilder<R, K, C>

Set the attestation source adapter.

Args:

  • source: Pre-initialized attestation source implementation.

Usage:

builder.attestation_source(Arc::new(my_attestation_store))
Source

pub fn passphrase_provider( self, provider: Arc<dyn PassphraseProvider + Send + Sync>, ) -> AuthsContextBuilder<R, K, C>

Set the passphrase provider for key decryption during signing operations.

Defaults to a noop provider that returns an error. Set this when SDK workflow functions will perform signing with encrypted key material.

Args:

Usage:

builder.passphrase_provider(Arc::new(PrefilledPassphraseProvider::new(passphrase)))
Source

pub fn uuid_provider( self, provider: Arc<dyn UuidProvider + Send + Sync>, ) -> AuthsContextBuilder<R, K, C>

Set the UUID provider.

Defaults to SystemUuidProvider (random v4 UUIDs) when not called. Override with a deterministic stub in tests.

Args:

Usage:

builder.uuid_provider(Arc::new(my_uuid_stub))
Source

pub fn agent_signing( self, provider: Arc<dyn AgentSigningPort + Send + Sync>, ) -> AuthsContextBuilder<R, K, C>

Set the agent signing port for delegating signing to a running agent process.

Defaults to NoopAgentProvider (all operations return Unavailable) when not called. Set this on Unix platforms where the auths-agent daemon is available.

Args:

Usage:

builder.agent_signing(Arc::new(CliAgentAdapter::new(socket_path)))
Source§

impl AuthsContextBuilder<Set<Arc<dyn RegistryBackend + Send + Sync>>, Set<Arc<dyn KeyStorage + Send + Sync>>, Set<Arc<dyn ClockProvider + Send + Sync>>>

Source

pub fn build(self) -> Result<AuthsContext, BuilderError>

Build the AuthsContext.

Only callable once registry, key_storage, and clock have been set. Omitting any of these fields produces a compile-time error.

Usage:

let ctx = AuthsContext::builder()
    .registry(Arc::new(my_registry))
    .key_storage(Arc::new(my_keychain))
    .clock(Arc::new(SystemClock))
    .build();

Auto Trait Implementations§

§

impl<R, K, C> Freeze for AuthsContextBuilder<R, K, C>
where R: Freeze, K: Freeze, C: Freeze,

§

impl<R, K, C> !RefUnwindSafe for AuthsContextBuilder<R, K, C>

§

impl<R, K, C> Send for AuthsContextBuilder<R, K, C>
where R: Send, K: Send, C: Send,

§

impl<R, K, C> Sync for AuthsContextBuilder<R, K, C>
where R: Sync, K: Sync, C: Sync,

§

impl<R, K, C> Unpin for AuthsContextBuilder<R, K, C>
where R: Unpin, K: Unpin, C: Unpin,

§

impl<R, K, C> UnsafeUnpin for AuthsContextBuilder<R, K, C>

§

impl<R, K, C> !UnwindSafe for AuthsContextBuilder<R, K, C>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V