pub struct Session {
pub store: CloudStore,
pub instance: InstanceRecord,
pub lease: VerifiedLease,
/* private fields */
}Expand description
A connected instance: its record, verified lease and keys.
Fields§
§store: CloudStore§instance: InstanceRecord§lease: VerifiedLeaseImplementations§
Source§impl Session
impl Session
Sourcepub fn load(store: CloudStore, root: [u8; 32]) -> Result<Self, CloudError>
pub fn load(store: CloudStore, root: [u8; 32]) -> Result<Self, CloudError>
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>, CloudError>
pub fn bearer_token(&self, force: bool) -> Result<Zeroizing<String>, CloudError>
The current access token (minted when needed), for transports that
authenticate outside CloudClient (the bus WebSocket upgrade).
force mints a new one.
Sourcepub fn client(&self) -> Result<CloudClient, CloudError>
pub fn client(&self) -> Result<CloudClient, CloudError>
An authenticated client, minting an access token when needed.
Sourcepub fn with_client<T>(
&self,
call: impl Fn(&CloudClient) -> Result<T, CloudError>,
) -> Result<T, CloudError>
pub fn with_client<T>( &self, call: impl Fn(&CloudClient) -> Result<T, CloudError>, ) -> Result<T, CloudError>
Run call with an authenticated client; on 401 mint a new token once.
Sourcepub fn bounded_client(
&self,
deadline: Instant,
) -> Result<CloudClient, CloudError>
pub fn bounded_client( &self, deadline: Instant, ) -> Result<CloudClient, CloudError>
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, CloudError>
pub fn renew(&mut self) -> Result<&VerifiedLease, CloudError>
Renew the lease and persist it; returns the new lease. Asked in C0
2.0 like the enrollment whose lease it replaces, and checked against
the key set that holds its kid (which also feeds the runtime lease):
the stored one, else key set v3, by which a C0 2.x Cloud signs leases
once it serves v3, fetched once when it is not stored yet. The key
set the lease verified with is stored with it, so every later load
re-verifies it the same way.
Sourcepub fn delete_instance(&self) -> Result<(), CloudError>
pub fn delete_instance(&self) -> Result<(), CloudError>
Free the seat in Cloud.
Auto Trait Implementations§
impl Forget for Session
impl Freeze for Session
impl Move 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
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