Skip to main content

SessionBundleBuilder

Struct SessionBundleBuilder 

Source
pub struct SessionBundleBuilder<'a, S: ?Sized + 'a = dyn AitpSigner + 'a> { /* private fields */ }
Expand description

Fluent builder for issuing a SessionTrustBundle as the coordinator.

With an async (KMS, HSM) coordinator signer, start from SessionBundleBuilder::new_async and finish with SessionBundleBuilder::build_async; the setters are shared. The signer kind is a type parameter, so a sync builder has no build_async and an async one has no build.

Implementations§

Source§

impl<'a> SessionBundleBuilder<'a, dyn AitpSigner + 'a>

Source

pub fn new(coordinator_key: &'a dyn AitpSigner) -> Self

Begin a new bundle, signed by coordinator_key.

Accepts any AitpSigner (in-process key, KMS, HSM); a backend failure surfaces from Self::build as SessionBundleError::Crypto(CryptoError::Signer(_)).

Source

pub fn build(self) -> Result<SessionTrustBundle, SessionBundleError>

Construct, sign, and return the bundle.

Source§

impl<'a> SessionBundleBuilder<'a, dyn DynAsyncAitpSigner + 'a>

Source

pub fn new_async(coordinator_key: &'a dyn DynAsyncAitpSigner) -> Self

Begin a new bundle signed by an async backend, for example SessionBundleBuilder::new_async(&*arc_kms_signer). Finish with Self::build_async.

A backend failure surfaces from Self::build_async as SessionBundleError::Crypto(CryptoError::Signer(_)).

Source

pub async fn build_async(self) -> Result<SessionTrustBundle, SessionBundleError>

As SessionBundleBuilder::build, awaiting the backend. Validation and output are identical; the future is Send.

Source§

impl<'a, S: ?Sized + CoordinatorAid> SessionBundleBuilder<'a, S>

Source

pub fn session_id(self, id: Uuid) -> Self

Set the session ID (UUIDv4). If unset, a fresh one is generated at build() time.

Source

pub fn issued_at(self, ts: Timestamp) -> Self

Override issued_at. Tests / fixtures only.

Source

pub fn extensions(self, extensions: ExtensionsMap) -> Self

Set the extensions namespace (RFC-AITP-0001 §7).

Unset by default, which serializes as an absent extensions key — not "extensions":{}. Passing ExtensionsMap::new() here instead deliberately produces the present-but-empty form; the two are different signing inputs, so choose the one the caller means.

Source

pub fn participant(self, aid: Aid, tct: String) -> Self

Add a participant. The TCT (compact JWS, carried verbatim) MUST be coordinator-issued (iss == coordinator_key.aid()) with aud == aid. These invariants are checked in build().

Auto Trait Implementations§

§

impl<'a, S> Freeze for SessionBundleBuilder<'a, S>
where &'a S: Freeze, S: ?Sized,

§

impl<'a, S> RefUnwindSafe for SessionBundleBuilder<'a, S>

§

impl<'a, S> Send for SessionBundleBuilder<'a, S>
where &'a S: Send, S: ?Sized,

§

impl<'a, S> Sync for SessionBundleBuilder<'a, S>
where &'a S: Sync, S: ?Sized,

§

impl<'a, S> Unpin for SessionBundleBuilder<'a, S>
where &'a S: Unpin, S: ?Sized,

§

impl<'a, S> UnsafeUnpin for SessionBundleBuilder<'a, S>
where &'a S: UnsafeUnpin, S: ?Sized,

§

impl<'a, S> UnwindSafe for SessionBundleBuilder<'a, S>
where &'a S: UnwindSafe, S: ?Sized,

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 = !

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.