1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::{random::RngSingletonImpl, AsSharedKey};
use serde::{Deserialize, Serialize};
use crate::{serialize::impls::CborSerializer, traits::SerdeEncryptPublicKey};
#[derive(Clone, Eq, PartialEq, Hash, Debug, Serialize, Deserialize)]
pub struct SharedKey([u8; 32]);
impl AsSharedKey for SharedKey {
type R = RngSingletonImpl;
fn from_array(key: [u8; 32]) -> Self {
Self(key)
}
fn as_slice(&self) -> &[u8] {
&self.0
}
}
impl SerdeEncryptPublicKey for SharedKey {
type S = CborSerializer<Self>;
}