(v: &[u8])
| 164 | } |
| 165 | |
| 166 | fn decrypt(v: &[u8]) -> Result<Vec<u8>, ()> { |
| 167 | if !v.is_empty() { |
| 168 | base64::decode(v, base64::Variant::Original).and_then(|v| symmetric_crypt(&v, false)) |
| 169 | } else { |
| 170 | Err(()) |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | pub fn symmetric_crypt(data: &[u8], encrypt: bool) -> Result<Vec<u8>, ()> { |
| 175 | use sodiumoxide::crypto::secretbox; |
no test coverage detected