Skip to content
Snippets Groups Projects
Commit c70b26e8 authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

remove unnecessary complexity

parent 80d32122
No related branches found
No related tags found
1 merge request!22add vault
......@@ -2087,11 +2087,9 @@ dependencies = [
"graphql_client",
"hex",
"inquire",
"itertools 0.12.1",
"log",
"nacl",
"parity-scale-codec",
"rand_chacha",
"reqwest",
"rpassword",
"scrypt",
......
......@@ -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
# 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]
......
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment