pub struct Session { /* private fields */ }Implementations§
Source§impl Session
impl Session
Sourcepub fn bootstrap(entitlements: Vec<Capability>, pubkey: [u8; 32]) -> Self
pub fn bootstrap(entitlements: Vec<Capability>, pubkey: [u8; 32]) -> Self
This is a highly privileged kernel function and should only be used by the
runtime to bootstrap the first guest session. This should never be exposed to
the userland. For userland session creation, use Self::create instead.
Note that we don’t accept any entitlement resource restrictions as they won’t yet exist. Best practice is to send every capability enabled in the current kernel.
Sourcepub fn create(
&self,
entitlements: HashMap<Capability, ResourceScope>,
pubkey: [u8; 32],
) -> Result<Self, SessionError>
pub fn create( &self, entitlements: HashMap<Capability, ResourceScope>, pubkey: [u8; 32], ) -> Result<Self, SessionError>
Create a new session, which will be linked to this one. Note that a session cannot create a new session with privileges beyond its own.
Note that sessions are mutable, so the privileges rule is only valid at creation time. It is perfectly possible (and valid) for a session to have its scope reduced subsequently, making the owning session less than the child session.
Sourcepub fn authenticate(&self, _payload: &[u8], _signature: &[u8]) -> bool
pub fn authenticate(&self, _payload: &[u8], _signature: &[u8]) -> bool
Authenticate a payload against this session’s public key. If successful, the payload is an authentic payload for this session and can be trusted. Otherwise this payload is counterfit, meaning either that one or both of session Id and request payload have been forged.
Authorise the requested action against the set of entitlements for this session. If successful, the action can safely be executed for the given resource. Otherwise the action is outside the permission scope and should not be executed.
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.