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>
impl<'a> SessionBundleBuilder<'a, dyn AitpSigner + 'a>
Sourcepub fn new(coordinator_key: &'a dyn AitpSigner) -> Self
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(_)).
Sourcepub fn build(self) -> Result<SessionTrustBundle, SessionBundleError>
pub fn build(self) -> Result<SessionTrustBundle, SessionBundleError>
Construct, sign, and return the bundle.
Source§impl<'a> SessionBundleBuilder<'a, dyn DynAsyncAitpSigner + 'a>
impl<'a> SessionBundleBuilder<'a, dyn DynAsyncAitpSigner + 'a>
Sourcepub fn new_async(coordinator_key: &'a dyn DynAsyncAitpSigner) -> Self
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(_)).
Sourcepub async fn build_async(self) -> Result<SessionTrustBundle, SessionBundleError>
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>
impl<'a, S: ?Sized + CoordinatorAid> SessionBundleBuilder<'a, S>
Sourcepub fn session_id(self, id: Uuid) -> Self
pub fn session_id(self, id: Uuid) -> Self
Set the session ID (UUIDv4). If unset, a fresh one is generated
at build() time.
Sourcepub fn extensions(self, extensions: ExtensionsMap) -> Self
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.
Sourcepub fn participant(self, aid: Aid, tct: String) -> Self
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().