pub struct PrivateDocumentRecipientKeys { /* private fields */ }Expand description
A wallet’s decryption keys, prepared to open many entries: each key’s public key is derived
and serialized once, rather than for every entry a scan tries, which for nearly every entry
opens none. The keys keep their order, which OpenedPrivateDocumentEntry::recipient_key_index
reports.
Implementations§
Source§impl PrivateDocumentRecipientKeys
impl PrivateDocumentRecipientKeys
pub fn new(secret_keys: &[SecretKey]) -> Self
Sourcepub fn open(
&self,
entry: &[u8],
target: &PrivateDocumentTarget<'_>,
recipient_identity_id: &[u8; 32],
) -> Result<Option<OpenedPrivateDocumentEntry>, PrivateDocumentEnvelopeError>
pub fn open( &self, entry: &[u8], target: &PrivateDocumentTarget<'_>, recipient_identity_id: &[u8; 32], ) -> Result<Option<OpenedPrivateDocumentEntry>, PrivateDocumentEnvelopeError>
Opens entry of the private document type target with the first of these keys it is
encrypted to, for the identity recipient_identity_id.
Ok(None) when it is for none of the keys, the case of nearly every entry a wallet scans:
a key whose decryption fails, or whose commitment does not match, is passed over for the
next. An entry that opens but is malformed, or names another recipient identity, is
refused with an error. The sender is not yet checked: see
OpenedPrivateDocumentEntry::verify_sender.
Sourcepub fn verify_sender(
&self,
entry: &OpenedPrivateDocumentEntry,
sender_public_key: &PublicKey,
) -> Result<(), PrivateDocumentEnvelopeError>
pub fn verify_sender( &self, entry: &OpenedPrivateDocumentEntry, sender_public_key: &PublicKey, ) -> Result<(), PrivateDocumentEnvelopeError>
OpenedPrivateDocumentEntry::verify_sender with the one of these keys that opened
entry, which a deniable MAC is checked with. An entry these keys did not open (one a
sender recovered, or that other keys opened) is refused with
RecipientSecretKeyRequired.