pub struct Session {
pub store: HiveStore,
pub instance: InstanceRecord,
pub lease: VerifiedLease,
/* private fields */
}Expand description
A connected instance: its record, verified lease and keys.
Fields§
§store: HiveStore§instance: InstanceRecord§lease: VerifiedLeaseImplementations§
Source§impl Session
impl Session
Sourcepub fn load(store: HiveStore, root: [u8; 32]) -> Result<Self, HiveError>
pub fn load(store: HiveStore, root: [u8; 32]) -> Result<Self, HiveError>
Load and re-verify the local enrollment. root is the root key of the
origin the instance is enrolled with.
Sourcepub fn bearer_token(&self, force: bool) -> Result<Zeroizing<String>, HiveError>
pub fn bearer_token(&self, force: bool) -> Result<Zeroizing<String>, HiveError>
The current access token (minted when needed), for transports that
authenticate outside HiveClient (the bus WebSocket upgrade).
force mints a new one.
Sourcepub fn client(&self) -> Result<HiveClient, HiveError>
pub fn client(&self) -> Result<HiveClient, HiveError>
An authenticated client, minting an access token when needed.
Sourcepub fn with_client<T>(
&self,
call: impl Fn(&HiveClient) -> Result<T, HiveError>,
) -> Result<T, HiveError>
pub fn with_client<T>( &self, call: impl Fn(&HiveClient) -> Result<T, HiveError>, ) -> Result<T, HiveError>
Run call with an authenticated client; on 401 mint a new token once.
Sourcepub fn bounded_client(&self, deadline: Instant) -> Result<HiveClient, HiveError>
pub fn bounded_client(&self, deadline: Instant) -> Result<HiveClient, HiveError>
An authenticated client for one call that must end by deadline,
minting the token (if needed) inside the same budget and without the
401 retry of Self::with_client (C5c, rule 3 exception).
Sourcepub fn renew(&mut self) -> Result<&VerifiedLease, HiveError>
pub fn renew(&mut self) -> Result<&VerifiedLease, HiveError>
Renew the lease and persist it; returns the new lease. Always as 1.x: the lease is checked against the v1 key set stored at enrollment (which also feeds the runtime lease), and a 1.x request gets exactly that set’s signer (E13 negotiation).
Sourcepub fn delete_instance(&self) -> Result<(), HiveError>
pub fn delete_instance(&self) -> Result<(), HiveError>
Free the seat in Hive.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more