serde_encrypt/encrypt/
plain_message_public_key.rs

1//! Public key encryption
2
3use alloc::vec::Vec;
4use serde_encrypt_core::encrypt::plain_message_public_key::PlainMessagePublicKeyCore;
5
6use crate::random::RngSingletonImpl;
7
8/// Plain message structure serialized via serde.
9#[derive(Clone, Eq, PartialEq, Debug)]
10pub struct PlainMessagePublicKey(Vec<u8>);
11
12impl PlainMessagePublicKeyCore for PlainMessagePublicKey {
13    type R = RngSingletonImpl;
14
15    fn new(plain_message: Vec<u8>) -> Self
16    where
17        Self: Sized,
18    {
19        Self(plain_message)
20    }
21
22    fn into_vec(self) -> Vec<u8> {
23        self.0
24    }
25
26    fn as_slice(&self) -> &[u8] {
27        &self.0
28    }
29}