eck 0.0.3

A fast, simple file & folder encryption manager, written in Rust
1
2
3
4
5
6
7
8
use crate::errors::EnkryptitError;

/// Simple public helper for converting a `key` from a `Vec<u8>` to an `[u8; 32]` array safely.
pub fn convert_key(vec: Vec<u8>) -> Result<[u8; 32], EnkryptitError> {
    vec.as_slice()
        .try_into()
        .map_err(|_| EnkryptitError::InvalidKeyLength)
}