holochain_integrity_types/x_salsa20_poly1305/data.rs
1/// Data that can be encrypted with secretbox.
2#[derive(PartialEq, Eq, serde::Serialize, serde::Deserialize, Debug, Clone)]
3pub struct XSalsa20Poly1305Data(#[serde(with = "serde_bytes")] Vec<u8>);
4pub type SecretBoxData = XSalsa20Poly1305Data;
5pub type BoxData = XSalsa20Poly1305Data;
6
7impl From<Vec<u8>> for XSalsa20Poly1305Data {
8 fn from(v: Vec<u8>) -> Self {
9 Self(v)
10 }
11}
12
13impl AsRef<[u8]> for XSalsa20Poly1305Data {
14 fn as_ref(&self) -> &[u8] {
15 &self.0
16 }
17}