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
use crate::error::CryptoError;
use hex::FromHex;
mod derivation;
mod device;
pub mod encrypting_keypair;
mod seed;
pub mod signing_keypair;
pub use crate::identity::{
derivation::Identity, seed::generate_random_mnemonic, signing_keypair::SigningKeypair,
};
pub use device::new_device_identity;
pub const MNEMONIC_LEN: usize = 12;
pub type MnemonicPhrase = [String; MNEMONIC_LEN];
#[tracing::instrument(level = "debug", ret)]
fn bytes_key_from_str(key: &str) -> Result<[u8; 32], CryptoError> {
<[u8; 32]>::from_hex(key).map_err(|_| CryptoError::KeyParsingError(key.len()))
}