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
30
31
32
33
34
35
36
37
38
39
40
use std::ops::Deref;
use arrayvec::ArrayVec;
use serde::{Deserialize, Serialize};
use zeroize::Zeroize;
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Zeroize)]
#[zeroize(drop)]
pub struct ExportKey(ArrayVec<u8, 64>);
impl ExportKey {
pub(crate) const fn new(key: ArrayVec<u8, 64>) -> Self {
Self(key)
}
#[must_use]
pub const fn as_bytes(&self) -> &ArrayVec<u8, 64> {
&self.0
}
}
impl AsRef<ArrayVec<u8, 64>> for ExportKey {
fn as_ref(&self) -> &ArrayVec<u8, 64> {
self.as_bytes()
}
}
impl Deref for ExportKey {
type Target = ArrayVec<u8, 64>;
fn deref(&self) -> &Self::Target {
self.as_bytes()
}
}