pub struct MailCardCache { /* private fields */ }Expand description
Sender-side pins: the greatest-nonce card seen per (owner, mailbox),
including closed or expired cards. Save snapshot() after every
observation, even one that returns an error for an unusable new pin.
Implementations§
Source§impl MailCardCache
impl MailCardCache
pub fn new() -> Self
Sourcepub fn observe_historical(
&mut self,
value: &Value,
owner: &AgentId,
now: i64,
) -> Result<MailboxCard>
pub fn observe_historical( &mut self, value: &Value, owner: &AgentId, now: i64, ) -> Result<MailboxCard>
Pin an authenticated card, including a closed or expired one. This is appropriate for card reads; check usability before encrypting.
Sourcepub fn observe(
&mut self,
value: &Value,
owner: &AgentId,
now: i64,
) -> Result<MailboxCard>
pub fn observe( &mut self, value: &Value, owner: &AgentId, now: i64, ) -> Result<MailboxCard>
Pin a card, then require that it is usable for new encryption.
Sourcepub fn get(&self, owner: &AgentId, mailbox_id: &str) -> Option<&MailboxCard>
pub fn get(&self, owner: &AgentId, mailbox_id: &str) -> Option<&MailboxCard>
The pinned card of (owner, mailbox_id), if any.
Sourcepub fn prune(&mut self, now: i64) -> Result<()>
pub fn prune(&mut self, now: i64) -> Result<()>
Drop pins old enough that every earlier card of the mailbox has expired.
Sourcepub fn seal(
&mut self,
message: &MessagePayload,
card: &Value,
signer: &AgentSigner,
nonce: u64,
now: i64,
) -> Result<Packet>
pub fn seal( &mut self, message: &MessagePayload, card: &Value, signer: &AgentSigner, nonce: u64, now: i64, ) -> Result<Packet>
Pin, encrypt the immutable message, and sign a fresh packet.
pub fn snapshot(&self) -> Result<Value>
pub fn from_snapshot(value: &Value) -> Result<Self>
Trait Implementations§
Source§impl Clone for MailCardCache
impl Clone for MailCardCache
Source§impl Debug for MailCardCache
impl Debug for MailCardCache
Auto Trait Implementations§
impl Freeze for MailCardCache
impl RefUnwindSafe for MailCardCache
impl Send for MailCardCache
impl Sync for MailCardCache
impl Unpin for MailCardCache
impl UnsafeUnpin for MailCardCache
impl UnwindSafe for MailCardCache
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