mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
darkirc: Implement --gen-secret
This commit is contained in:
@@ -45,6 +45,8 @@ transport_mixing = false
|
||||
## ====================
|
||||
##
|
||||
## You can create a shared secret with `darkirc --gen-secret`.
|
||||
## Never share this secret over unencrypted channels or with someone
|
||||
## who you do not want to be able to read all the channel messages.
|
||||
## Use it like this example:
|
||||
#[channel."#foo"]
|
||||
#secret = "7CkVuFgwTUpJn5Sv67Q3fyEDpa28yrSeL5Hg2GqQ4jfM"
|
||||
|
||||
@@ -85,6 +85,13 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'_>>) -> Result<(
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
if settings.gen_secret {
|
||||
let secret_key = crypto_box::SecretKey::generate(&mut OsRng);
|
||||
let encoded = bs58::encode(secret_key.to_bytes());
|
||||
println!("{}", encoded.into_string());
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Initialize the base structures
|
||||
////////////////////
|
||||
|
||||
@@ -71,6 +71,10 @@ pub struct Args {
|
||||
#[structopt(long)]
|
||||
pub gen_keypair: bool,
|
||||
|
||||
/// Generate a new NaCl secret for an encrypted channel and exit
|
||||
#[structopt(long)]
|
||||
pub gen_secret: bool,
|
||||
|
||||
/// Path to save keypair in
|
||||
#[structopt(short)]
|
||||
pub output: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user