Merge pull request #2437 from ethcore/signer

Fixing Signer token RPC API
This commit is contained in:
Robert Habermeier 2016-10-03 20:34:55 +02:00 committed by GitHub
commit d205c0800c
2 changed files with 4 additions and 2 deletions

View File

@ -241,7 +241,9 @@ pub fn execute(cmd: RunCmd) -> Result<(), String> {
let signer_path = cmd.signer_conf.signer_path.clone(); let signer_path = cmd.signer_conf.signer_path.clone();
let deps_for_rpc_apis = Arc::new(rpc_apis::Dependencies { let deps_for_rpc_apis = Arc::new(rpc_apis::Dependencies {
signer_port: cmd.signer_port, 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(), client: client.clone(),
sync: sync_provider.clone(), sync: sync_provider.clone(),
net: manage_network.clone(), net: manage_network.clone(),

View File

@ -74,7 +74,7 @@ pub fn new_token(path: String) -> Result<String, String> {
.map_err(|err| format!("Error generating token: {:?}", err)) .map_err(|err| format!("Error generating token: {:?}", err))
} }
fn generate_new_token(path: String) -> io::Result<String> { pub fn generate_new_token(path: String) -> io::Result<String> {
let path = codes_path(path); let path = codes_path(path);
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());