Skip to main content

AuthsContextBuilder

Struct AuthsContextBuilder 

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

Typestate builder for AuthsContext.

Call AuthsContext::builder() to obtain an instance. The build() method is only available once all six required fields have been supplied — omitting any produces a compile-time error.

Implementations§

Source§

impl<K, C, IS, AS, ASrc> AuthsContextBuilder<Missing, K, C, IS, AS, ASrc>

Source

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

Set the registry storage backend.

Args:

  • registry: Pre-initialized registry backend.

Usage:

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

impl<R, C, IS, AS, ASrc> AuthsContextBuilder<R, Missing, C, IS, AS, ASrc>

Source

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

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, IS, AS, ASrc> AuthsContextBuilder<R, K, Missing, IS, AS, ASrc>

Source

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

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, AS, ASrc> AuthsContextBuilder<R, K, C, Missing, AS, ASrc>

Source

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

Set the identity storage adapter.

Args:

  • storage: Pre-initialized identity storage implementation.

Usage:

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

impl<R, K, C, IS, ASrc> AuthsContextBuilder<R, K, C, IS, Missing, ASrc>

Source

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

Set the attestation sink adapter.

Args:

  • sink: Pre-initialized attestation sink implementation.

Usage:

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

impl<R, K, C, IS, AS> AuthsContextBuilder<R, K, C, IS, AS, Missing>

Source

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

Set the attestation source adapter.

Args:

  • source: Pre-initialized attestation source implementation.

Usage:

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

impl<R, K, C, IS, AS, ASrc> AuthsContextBuilder<R, K, C, IS, AS, ASrc>

Source

pub fn event_sink(self, sink: Arc<dyn EventSink>) -> Self

Set an optional event sink.

Defaults to a no-op sink (all events discarded) when not called.

Args:

Usage:

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

pub fn passphrase_provider( self, provider: Arc<dyn PassphraseProvider + Send + Sync>, ) -> Self

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>, ) -> Self

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>, ) -> Self

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

Defaults to a noop provider (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

pub fn witness_config(self, config: WitnessConfig) -> Self

Set witness configuration for KEL event receipting.

Source

pub fn repo_path(self, path: PathBuf) -> Self

Set the repository path (needed for witness receipt storage).

Source§

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

Source

pub fn build(self) -> AuthsContext

Build the AuthsContext.

Infallible — only callable once all six required fields are set. Omitting any required field is a compile-time error.

Usage:

let ctx = AuthsContext::builder()
    .registry(Arc::new(my_registry))
    .key_storage(Arc::new(my_keychain))
    .clock(Arc::new(SystemClock))
    .identity_storage(Arc::new(my_identity_storage))
    .attestation_sink(Arc::new(my_store.clone()))
    .attestation_source(Arc::new(my_store))
    .build();

Auto Trait Implementations§

§

impl<R, K, C, IS, AS, ASrc> !RefUnwindSafe for AuthsContextBuilder<R, K, C, IS, AS, ASrc>

§

impl<R, K, C, IS, AS, ASrc> !UnwindSafe for AuthsContextBuilder<R, K, C, IS, AS, ASrc>

§

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

§

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

§

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

§

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

§

impl<R, K, C, IS, AS, ASrc> UnsafeUnpin for AuthsContextBuilder<R, K, C, IS, AS, ASrc>

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, 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

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