diff --git a/parity/cli.rs b/parity/cli.rs index 6fe38224a..94eaaed13 100644 --- a/parity/cli.rs +++ b/parity/cli.rs @@ -109,6 +109,8 @@ API and Console Options: [default: 8180]. --signer-path PATH Specify directory where Signer UIs tokens should be stored. [default: $HOME/.parity/signer] + --no-token By default a new system UI security token will be + output on start up. This will prevent it. Sealing/Mining Options: --force-sealing Force the node to author new blocks as if it were @@ -255,6 +257,7 @@ pub struct Args { pub flag_signer: bool, pub flag_signer_port: u16, pub flag_signer_path: String, + pub flag_no_token: bool, pub flag_force_sealing: bool, pub flag_author: String, pub flag_usd_per_tx: String, diff --git a/parity/main.rs b/parity/main.rs index 973b1174f..6ac07741c 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -186,6 +186,13 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig) let net_settings = conf.net_settings(&spec); let sync_config = conf.sync_config(&spec); + // Create and display a new token for UIs. + if conf.args.flag_signer && !conf.args.flag_no_token { + new_token(conf.directories().signer).unwrap_or_else(|e| { + die!("Error generating token: {:?}", e) + }); + } + // Secret Store let account_service = Arc::new(conf.account_service()); diff --git a/parity/signer.rs b/parity/signer.rs index 3c8dceb6b..e280b0441 100644 --- a/parity/signer.rs +++ b/parity/signer.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +extern crate ansi_term; +use self::ansi_term::Colour::Red; use std::io; use std::path::PathBuf; use std::sync::Arc; @@ -65,8 +67,7 @@ pub fn new_token(path: String) -> io::Result<()> { let mut codes = try!(signer::AuthCodes::from_file(&path)); let code = try!(codes.generate_new()); try!(codes.to_file(&path)); - println!("New token has been generated. Copy the code below to your Signer UI:"); - println!("{}", code); + println!("This key code will authorise your System Signer UI: {}", White.bold().paint(code)); Ok(()) }