Skip to main content

OpenedPrivateDocumentEntry

Struct OpenedPrivateDocumentEntry 

Source
pub struct OpenedPrivateDocumentEntry { /* private fields */ }
Expand description

An entry its recipient opened, or its sender recovered.

The sender fields are what the entry claims; Self::verify_sender checks the claim against the key the sender’s identity holds under sender_key_id, and Self::recover_signer gives the key that signed a signed entry. The fields are read-only, so what a caller reads is what was authenticated.

Implementations§

Source§

impl OpenedPrivateDocumentEntry

Source

pub fn contract_id(&self) -> &[u8; 32]

The contract of the store the entry was opened for: its commitment binds that store, so it opens for no other.

Source

pub fn document_type_name(&self) -> &str

The private document type of the store the entry was opened for.

Source

pub fn commitment(&self) -> &[u8; 32]

The entry’s commitment: two entries with the same one are copies.

Source

pub fn recipient_key_index(&self) -> Option<usize>

Which of the keys given to open_private_document_entry opened it; None when the sender recovered it.

Source

pub fn recipient_public_key(&self) -> &PublicKey

The key the entry is encrypted to.

Source

pub fn recipient_identity_id(&self) -> &[u8; 32]

Source

pub fn auth_mode(&self) -> PrivateDocumentAuthMode

Source

pub fn sender_identity_id(&self) -> &[u8; 32]

Zeros when the entry is anonymous.

Source

pub fn sender_key_id(&self) -> u32

Zero when the entry is anonymous.

Source

pub fn payload(&self) -> &[u8] ⓘ

The type’s properties in the document property encoding, for the type’s schema to decode and validate.

Source

pub fn into_payload(self) -> Vec<u8> ⓘ

The payload, taking the entry.

Source

pub fn verify_sender( &self, sender_public_key: &PublicKey, recipient_secret_key: Option<&SecretKey>, ) -> Result<(), PrivateDocumentEnvelopeError>

Checks that the key the entry names wrote it: sender_public_key is the key the sender identity holds under sender_key_id, as it was when the entry was written (keys are disabled, never removed). A deniable MAC is checked with the recipient’s own secret key, the one that opened the entry, and is refused with RecipientSecretKeyRequired without it; a signature needs only the sender’s key, so a sender checks its own recovered entry with None.

Source

pub fn recover_signer(&self) -> Result<PublicKey, PrivateDocumentEnvelopeError>

The key that signed a signed entry, recovered from its signature. The signature is valid under the key returned, so the caller’s check is that the key is one the sender identity may sign with, as it was when the entry was written. An anonymous entry is refused with AnonymousSender, and one carrying a deniable MAC with NotSigned.

Trait Implementations§

Source§

impl Clone for OpenedPrivateDocumentEntry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpenedPrivateDocumentEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for OpenedPrivateDocumentEntry

Source§

impl PartialEq for OpenedPrivateDocumentEntry

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for OpenedPrivateDocumentEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V