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