pub struct Conversation<S: ConversationState> { /* private fields */ }Expand description
A conversation with peer, parameterized by its consent state.
Implementations§
Source§impl<S: ConversationState> Conversation<S>
impl<S: ConversationState> Conversation<S>
Source§impl Conversation<Proposed>
impl Conversation<Proposed>
Sourcepub fn with_purpose(self, purpose: impl Into<String>) -> Self
pub fn with_purpose(self, purpose: impl Into<String>) -> Self
Declare the purpose of the conversation.
Sourcepub fn request_consent<I, T>(self, scopes: I) -> Conversation<AwaitingConsent>
pub fn request_consent<I, T>(self, scopes: I) -> Conversation<AwaitingConsent>
Ask for consent to the named action scopes. The conversation can no longer be treated as consent-free — and is not yet consented.
Source§impl Conversation<AwaitingConsent>
impl Conversation<AwaitingConsent>
Sourcepub fn requested_scopes(&self) -> &[String]
pub fn requested_scopes(&self) -> &[String]
The scopes consent was requested for.
Sourcepub fn grant_via(
self,
engine: &dyn PolicyEngine,
subject: impl Into<SubjectId>,
) -> Result<Conversation<Consented>, (Self, CapabilityError)>
pub fn grant_via( self, engine: &dyn PolicyEngine, subject: impl Into<SubjectId>, ) -> Result<Conversation<Consented>, (Self, CapabilityError)>
Resolve the consent request through a policy engine.
Consent is granted only if engine allows subject the delegate
action on conversation/<peer> — the decision is audited and the
resulting capability expires like any other. On deny, the
conversation is returned unchanged so the caller can renegotiate.
Source§impl Conversation<Consented>
impl Conversation<Consented>
Sourcepub fn consented_scopes(&self) -> &[String]
pub fn consented_scopes(&self) -> &[String]
The scopes this conversation is consented for.
Sourcepub fn consent(&self) -> &Capability<CanDelegate, GenericResource>
pub fn consent(&self) -> &Capability<CanDelegate, GenericResource>
The consent proof: a real capability, checkable and expiring.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Conversation<S>
impl<S> RefUnwindSafe for Conversation<S>
impl<S> Send for Conversation<S>
impl<S> Sync for Conversation<S>
impl<S> Unpin for Conversation<S>
impl<S> UnsafeUnpin for Conversation<S>
impl<S> UnwindSafe for Conversation<S>
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
Mutably borrows from an owned value. Read more