diff --git a/Cargo.lock b/Cargo.lock index f4b506062fe56537842e6d3e79bcfb579f0393f2..1e61c3201c938d15c1979b510a5aa429ebee05e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2087,11 +2087,9 @@ dependencies = [ "graphql_client", "hex", "inquire", - "itertools 0.12.1", "log", "nacl", "parity-scale-codec", - "rand_chacha", "reqwest", "rpassword", "scrypt", diff --git a/Cargo.toml b/Cargo.toml index d8407770ea355b37a04f6ea864f4f5cd0e15af3c..bd3166d885f09950c7b92f36a5b8195a8a67a6af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,16 +41,13 @@ confy = "^0.5.1" bs58 = "^0.5.0" inquire = "^0.6.2" directories = "^5.0.1" -itertools = "^0.12.1" # crypto -scrypt = { version = "^0.11", default-features = false } # for old-style key generation -nacl = { version = "^0.5.3" } # for old-style key generation -age = { default-features = false, version = "^0.10.0", features = [ - "armor", -] } # this is beta crate for password -encrypted files -rand_chacha = "^0.3.1" # used to generate random seed -bip39 = "^2.0.0" # to convert seed to mnemonic +scrypt = { version = "^0.11", default-features = false } # for old-style key generation +nacl = { version = "^0.5.3" } # for old-style key generation +# this is beta crate for password-encrypted files +age = { default-features = false, version = "^0.10.0", features = ["armor"] } +bip39 = { version = "^2.0.0", features = ["rand"] } # mnemonic # allows to build gcli for different runtimes and with different predefined networks [features] diff --git a/src/commands/vault.rs b/src/commands/vault.rs index 63551102e2c4292afddb2c87b8b5f541910e15c9..d8e0bc0d0af946ae88a601d096059063979bfa53 100644 --- a/src/commands/vault.rs +++ b/src/commands/vault.rs @@ -1,7 +1,5 @@ use crate::*; use age::secrecy::Secret; -use itertools::Itertools; -use rand_chacha::rand_core::SeedableRng; use std::io::{Read, Write}; /// define universal dividends subcommands @@ -60,12 +58,8 @@ pub fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliError> println!("{}", data.project_dir.data_dir().to_str().unwrap()); } Subcommand::Generate => { - // ChaCha20Rng is ok for cryptography - let rng = rand_chacha::ChaCha20Rng::from_entropy(); - let seed = rng.get_seed(); - let mnemonic = bip39::Mnemonic::from_entropy(&seed); - let phrase = mnemonic.unwrap().word_iter().join(" "); - println!("{phrase}"); + let mnemonic = bip39::Mnemonic::generate(12).unwrap(); // TODO allow word count + println!("{mnemonic}"); } Subcommand::Import => { // --- currently only support mnemonic secret