pub struct InteractionReceipt {
pub type_: String,
pub version: String,
pub id: String,
pub participants: Vec<String>,
pub initiator: String,
pub timestamp: i64,
pub context: InteractionContext,
pub outcome: InteractionOutcome,
pub signatures: HashMap<String, ParticipantSignature>,
}Expand description
A signed record of an interaction between two or more agents.
Fields§
§type_: StringType identifier.
version: StringProtocol version.
id: StringUnique receipt ID.
participants: Vec<String>DIDs of all participants.
initiator: StringDID of the initiator.
timestamp: i64When the interaction occurred (unix ms).
context: InteractionContextContext about the interaction.
outcome: InteractionOutcomeOutcome of the interaction.
signatures: HashMap<String, ParticipantSignature>Signatures from participants (DID -> signature).
Implementations§
Source§impl InteractionReceipt
impl InteractionReceipt
Sourcepub fn new(
initiator: Did,
participants: Vec<Did>,
context: InteractionContext,
) -> Self
pub fn new( initiator: Did, participants: Vec<Did>, context: InteractionContext, ) -> Self
Create a new unsigned interaction receipt.
Sourcepub fn with_outcome(self, outcome: InteractionOutcome) -> Self
pub fn with_outcome(self, outcome: InteractionOutcome) -> Self
Set the outcome.
Sourcepub fn sign(
&mut self,
signer: &RootKey,
key_id: impl Into<String>,
) -> Result<()>
pub fn sign( &mut self, signer: &RootKey, key_id: impl Into<String>, ) -> Result<()>
Add a signature from a participant.
Sourcepub fn verify_participant(&self, participant_did: &str) -> Result<()>
pub fn verify_participant(&self, participant_did: &str) -> Result<()>
Verify a specific participant’s signature.
Sourcepub fn verify_all(&self) -> Result<()>
pub fn verify_all(&self) -> Result<()>
Verify all signatures.
Sourcepub fn is_fully_signed(&self) -> bool
pub fn is_fully_signed(&self) -> bool
Check if all participants have signed.
Sourcepub fn pending_signatures(&self) -> Vec<&str>
pub fn pending_signatures(&self) -> Vec<&str>
Get list of participants who haven’t signed yet.
Sourcepub fn signature_count(&self) -> usize
pub fn signature_count(&self) -> usize
Get the number of signatures.
Trait Implementations§
Source§impl Clone for InteractionReceipt
impl Clone for InteractionReceipt
Source§fn clone(&self) -> InteractionReceipt
fn clone(&self) -> InteractionReceipt
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InteractionReceipt
impl Debug for InteractionReceipt
Source§impl<'de> Deserialize<'de> for InteractionReceipt
impl<'de> Deserialize<'de> for InteractionReceipt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InteractionReceipt
impl RefUnwindSafe for InteractionReceipt
impl Send for InteractionReceipt
impl Sync for InteractionReceipt
impl Unpin for InteractionReceipt
impl UnwindSafe for InteractionReceipt
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