pub fn new_sender<K: Kem, D: Kdf, A: Aead>(
mode: &Mode<'_>,
recipient_public_key: &K::PublicKey,
info: &[u8],
) -> Result<(K::EncappedKey, SenderContext<A, D>), HpkeError>Expand description
Sets up a sender context (draft-ietf-hpke-hpke-05 Section 5.1).
The encapsulated key must be transmitted to the recipient alongside the first message.
§Errors
HpkeError::EncapErrorwhen the recipient’s public key is invalid.HpkeError::ValidationErrorwhen the pre-shared key or its identifier is empty in a pre-shared key mode.HpkeError::Randomwhen the operating system’s random number generator is unavailable or fails.