Skip to main content

PrivateDocumentRecipientKeys

Struct PrivateDocumentRecipientKeys 

Source
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

Source

pub fn new(secret_keys: &[SecretKey]) -> Self

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for PrivateDocumentRecipientKeys

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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, 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