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
impl OpenedPrivateDocumentEntry
Sourcepub fn contract_id(&self) -> &[u8; 32]
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.
Sourcepub fn document_type_name(&self) -> &str
pub fn document_type_name(&self) -> &str
The private document type of the store the entry was opened for.
Sourcepub fn commitment(&self) -> &[u8; 32]
pub fn commitment(&self) -> &[u8; 32]
The entry’s commitment: two entries with the same one are copies.
Sourcepub fn recipient_key_index(&self) -> Option<usize>
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.
Sourcepub fn recipient_public_key(&self) -> &PublicKey
pub fn recipient_public_key(&self) -> &PublicKey
The key the entry is encrypted to.
pub fn recipient_identity_id(&self) -> &[u8; 32]
pub fn auth_mode(&self) -> PrivateDocumentAuthMode
Sourcepub fn sender_identity_id(&self) -> &[u8; 32]
pub fn sender_identity_id(&self) -> &[u8; 32]
Zeros when the entry is anonymous.
Sourcepub fn sender_key_id(&self) -> u32
pub fn sender_key_id(&self) -> u32
Zero when the entry is anonymous.
Sourcepub fn payload(&self) -> &[u8] ⓘ
pub fn payload(&self) -> &[u8] ⓘ
The type’s properties in the document property encoding, for the type’s schema to decode and validate.
Sourcepub fn into_payload(self) -> Vec<u8> ⓘ
pub fn into_payload(self) -> Vec<u8> ⓘ
The payload, taking the entry.
Sourcepub fn verify_sender(
&self,
sender_public_key: &PublicKey,
recipient_secret_key: Option<&SecretKey>,
) -> Result<(), PrivateDocumentEnvelopeError>
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.
Sourcepub fn recover_signer(&self) -> Result<PublicKey, PrivateDocumentEnvelopeError>
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.