Merge pull request #1334 from ethcore/givetoken

Provide a signer UI token by default.
This commit is contained in:
Arkadiy Paronyan 2016-06-20 12:53:42 +02:00 committed by GitHub
commit a4b35180d1
3 changed files with 13 additions and 2 deletions

View File

@ -109,6 +109,8 @@ API and Console Options:
[default: 8180]. [default: 8180].
--signer-path PATH Specify directory where Signer UIs tokens should --signer-path PATH Specify directory where Signer UIs tokens should
be stored. [default: $HOME/.parity/signer] 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: Sealing/Mining Options:
--force-sealing Force the node to author new blocks as if it were --force-sealing Force the node to author new blocks as if it were
@ -256,6 +258,7 @@ pub struct Args {
pub flag_signer: bool, pub flag_signer: bool,
pub flag_signer_port: u16, pub flag_signer_port: u16,
pub flag_signer_path: String, pub flag_signer_path: String,
pub flag_no_token: bool,
pub flag_force_sealing: bool, pub flag_force_sealing: bool,
pub flag_author: String, pub flag_author: String,
pub flag_usd_per_tx: String, pub flag_usd_per_tx: String,

View File

@ -186,6 +186,13 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig)
let net_settings = conf.net_settings(&spec); let net_settings = conf.net_settings(&spec);
let sync_config = conf.sync_config(&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 // Secret Store
let account_service = Arc::new(conf.account_service()); let account_service = Arc::new(conf.account_service());

View File

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
extern crate ansi_term;
use self::ansi_term::Colour::White;
use std::io; use std::io;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; 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 mut codes = try!(signer::AuthCodes::from_file(&path));
let code = try!(codes.generate_new()); let code = try!(codes.generate_new());
try!(codes.to_file(&path)); try!(codes.to_file(&path));
println!("New token has been generated. Copy the code below to your Signer UI:"); println!("This key code will authorise your System Signer UI: {}", White.bold().paint(code));
println!("{}", code);
Ok(()) Ok(())
} }