keyhive_wasm 0.3.0

WebAssembly wrappers for keyhive_core
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[derive(Debug, Clone)]
pub(crate) struct Base64(pub(crate) String);

impl Base64 {
    #[allow(dead_code)]
    pub fn from_vec(bytes: Vec<u8>) -> Self {
        Self(base64_simd::STANDARD.encode_to_string(bytes))
    }

    #[allow(dead_code)]
    pub fn into_vec(self) -> Result<Vec<u8>, base64_simd::Error> {
        base64_simd::STANDARD.decode_to_vec(self.0)
    }

    pub fn as_str(&self) -> &str {
        &self.0
    }
}