pub trait BatchDomain: Domain {
// Provided methods
fn batch_kdf<'a>(
items: impl Iterator<Item = (Option<Self::SharedSecret>, &'a EphemeralKeyBytes)>,
) -> Vec<Option<Self::SymmetricKey>> { ... }
fn batch_epk(
ephemeral_keys: impl Iterator<Item = EphemeralKeyBytes>,
) -> Vec<(Option<Self::PreparedEphemeralPublicKey>, EphemeralKeyBytes)> { ... }
fn batch_ka_agree_dec<'a>(
ivk: &Self::IncomingViewingKey,
epks: impl Iterator<Item = Option<&'a Self::PreparedEphemeralPublicKey>>,
) -> Vec<Option<Self::SharedSecret>>
where Self::PreparedEphemeralPublicKey: 'a { ... }
}alloc only.Expand description
Trait that encapsulates protocol-specific batch trial decryption logic.
Each batchable operation has a default implementation that calls through to the non-batched implementation. Domains can override whichever operations benefit from batched logic.
Provided Methods§
Sourcefn batch_kdf<'a>(
items: impl Iterator<Item = (Option<Self::SharedSecret>, &'a EphemeralKeyBytes)>,
) -> Vec<Option<Self::SymmetricKey>>
fn batch_kdf<'a>( items: impl Iterator<Item = (Option<Self::SharedSecret>, &'a EphemeralKeyBytes)>, ) -> Vec<Option<Self::SymmetricKey>>
Computes Self::kdf on a batch of items.
For each item in the batch, if the shared secret is None, this returns
None at
that position.
Sourcefn batch_epk(
ephemeral_keys: impl Iterator<Item = EphemeralKeyBytes>,
) -> Vec<(Option<Self::PreparedEphemeralPublicKey>, EphemeralKeyBytes)>
fn batch_epk( ephemeral_keys: impl Iterator<Item = EphemeralKeyBytes>, ) -> Vec<(Option<Self::PreparedEphemeralPublicKey>, EphemeralKeyBytes)>
Computes Self::epk on a batch of ephemeral keys.
This is useful for protocols where the underlying curve requires an inversion to parse an encoded point.
For usability, this returns tuples of the ephemeral keys and the result of parsing them.
Sourcefn batch_ka_agree_dec<'a>(
ivk: &Self::IncomingViewingKey,
epks: impl Iterator<Item = Option<&'a Self::PreparedEphemeralPublicKey>>,
) -> Vec<Option<Self::SharedSecret>>where
Self::PreparedEphemeralPublicKey: 'a,
fn batch_ka_agree_dec<'a>(
ivk: &Self::IncomingViewingKey,
epks: impl Iterator<Item = Option<&'a Self::PreparedEphemeralPublicKey>>,
) -> Vec<Option<Self::SharedSecret>>where
Self::PreparedEphemeralPublicKey: 'a,
Computes Self::ka_agree_dec on a batch of prepared ephemeral keys
against a
single incoming viewing key.
For each item, if the prepared ephemeral key is None (i.e. its
encoding could
not be parsed), this returns None at that position.
Trial decryption multiplies many ephemeral keys by the same viewing key, so domains for which same-scalar multiplications can share work (for example, lockstep ladders over a shared batched field inversion) can override this to reduce the cost of the scalar multiplications, which dominate batched trial decryption. The default implementation performs the per-item computation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".