hpke_dispatch/
ciphertext.rs

1#[cfg(target_arch = "wasm32")]
2use wasm_bindgen::prelude::*;
3
4/**
5a simple struct to return the combined encapsulated key
6and ciphertext from seal
7*/
8#[cfg_attr(target_arch = "wasm32", wasm_bindgen(getter_with_clone))]
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct EncappedKeyAndCiphertext {
11    /// the encapsulated encryption key
12    pub encapped_key: Vec<u8>,
13
14    /// the ciphertext, encrypted with the key
15    pub ciphertext: Vec<u8>,
16}
17
18impl EncappedKeyAndCiphertext {
19    /// returns (encapsulated key, ciphertext)
20    #[must_use]
21    pub fn into_parts(self) -> (Vec<u8>, Vec<u8>) {
22        (self.encapped_key, self.ciphertext)
23    }
24}