From a0a13600efbb5d07513429450b1d641fece3dfb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 3 Oct 2016 15:01:10 +0200 Subject: [PATCH] Fixing Signer token RPC API --- parity/run.rs | 4 +++- parity/signer.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/parity/run.rs b/parity/run.rs index d108ec53c..ef84d75a2 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -241,7 +241,9 @@ pub fn execute(cmd: RunCmd) -> Result<(), String> { let signer_path = cmd.signer_conf.signer_path.clone(); let deps_for_rpc_apis = Arc::new(rpc_apis::Dependencies { signer_port: cmd.signer_port, - signer_service: Arc::new(rpc_apis::SignerService::new(move || signer::new_token(signer_path.clone()))), + signer_service: Arc::new(rpc_apis::SignerService::new(move || { + signer::generate_new_token(signer_path.clone()).map_err(|e| format!("{:?}", e)) + })), client: client.clone(), sync: sync_provider.clone(), net: manage_network.clone(), diff --git a/parity/signer.rs b/parity/signer.rs index b60bc7211..869c7fab5 100644 --- a/parity/signer.rs +++ b/parity/signer.rs @@ -74,7 +74,7 @@ pub fn new_token(path: String) -> Result { .map_err(|err| format!("Error generating token: {:?}", err)) } -fn generate_new_token(path: String) -> io::Result { +pub fn generate_new_token(path: String) -> io::Result { let path = codes_path(path); let mut codes = try!(signer::AuthCodes::from_file(&path)); let code = try!(codes.generate_new());