removing extra crate
This commit is contained in:
parent
bceafe9094
commit
5bd355e0af
@ -1,13 +0,0 @@
|
||||
[package]
|
||||
description = "Ethcore Ethereum tools"
|
||||
homepage = "http://ethcore.io"
|
||||
license = "GPL-3.0"
|
||||
name = "ethtools"
|
||||
version = "0.9.99"
|
||||
authors = ["Ethcore <admin@ethcore.io>"]
|
||||
|
||||
[dependencies]
|
||||
ethcore-util = { path = "../util" }
|
||||
rustc-serialize = "0.3"
|
||||
ethcore-devtools = { path = "../devtools" }
|
||||
log = "0.3"
|
@ -1 +0,0 @@
|
||||
# ethtools
|
@ -1,24 +0,0 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Ethereum Tools Library
|
||||
|
||||
extern crate ethcore_util as util;
|
||||
extern crate rustc_serialize;
|
||||
extern crate ethcore_devtools as devtools;
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
pub mod geth_keys;
|
@ -618,6 +618,8 @@ impl KeyDirectory {
|
||||
Err(_) => Err(KeyFileLoadError::ParseError(KeyFileParseError::InvalidJson))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,16 +16,9 @@
|
||||
|
||||
//! Geth keys import/export tool
|
||||
|
||||
use util::hash::*;
|
||||
use util::keys::store::SecretStore;
|
||||
use util::keys::directory::KeyFileContent;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::result::*;
|
||||
use std::fs;
|
||||
use std::str::FromStr;
|
||||
use std::io;
|
||||
use std::io::Read;
|
||||
use rustc_serialize::json::Json;
|
||||
use common::*;
|
||||
use keys::store::SecretStore;
|
||||
use keys::directory::KeyFileContent;
|
||||
|
||||
/// Enumerates all geth keys in the directory and returns collection of tuples `(accountId, filename)`
|
||||
pub fn enumerate_geth_keys(path: &Path) -> Result<Vec<(Address, String)>, io::Error> {
|
||||
@ -86,6 +79,7 @@ pub fn import_geth_key(secret_store: &mut SecretStore, geth_keyfile_path: &Path)
|
||||
|
||||
/// Imports all geth keys in the directory
|
||||
pub fn import_geth_keys(secret_store: &mut SecretStore, geth_keyfiles_directory: &Path) -> Result<(), ImportError> {
|
||||
use std::path::PathBuf;
|
||||
let geth_files = try!(enumerate_geth_keys(geth_keyfiles_directory));
|
||||
for &(ref address, ref file_path) in geth_files.iter() {
|
||||
let mut path = PathBuf::new();
|
||||
@ -101,10 +95,9 @@ pub fn import_geth_keys(secret_store: &mut SecretStore, geth_keyfiles_directory:
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::path::Path;
|
||||
use util::hash::*;
|
||||
use util::keys::store::SecretStore;
|
||||
use std::str::FromStr;
|
||||
use common::*;
|
||||
use keys::store::SecretStore;
|
||||
|
||||
|
||||
#[test]
|
||||
fn can_enumerate() {
|
||||
@ -136,7 +129,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn imports_as_scrypt_keys() {
|
||||
use util::keys::directory::{KeyDirectory, KeyFileKdf};
|
||||
use keys::directory::{KeyDirectory, KeyFileKdf};
|
||||
let temp = ::devtools::RandomTempPath::create_dir();
|
||||
{
|
||||
let mut secret_store = SecretStore::new_in(temp.as_path());
|
||||
@ -158,8 +151,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn can_decrypt_with_imported() {
|
||||
use util::keys::store::EncryptedHashMap;
|
||||
use util::bytes::*;
|
||||
use keys::store::EncryptedHashMap;
|
||||
|
||||
let temp = ::devtools::RandomTempPath::create_dir();
|
||||
let mut secret_store = SecretStore::new_in(temp.as_path());
|
@ -18,3 +18,4 @@
|
||||
|
||||
pub mod directory;
|
||||
pub mod store;
|
||||
mod geth_import;
|
||||
|
@ -75,6 +75,20 @@ impl SecretStore {
|
||||
}
|
||||
}
|
||||
|
||||
/// trys to import keys in the known locations
|
||||
pub fn try_import_existing(&mut self) {
|
||||
use std::path::PathBuf;
|
||||
use keys::geth_import;
|
||||
|
||||
let mut import_path = PathBuf::new();
|
||||
import_path.push(::std::env::home_dir().expect("Failed to get home dir"));
|
||||
import_path.push(".ethereum");
|
||||
import_path.push("keystore");
|
||||
if let Err(e) = geth_import::import_geth_keys(self, &import_path) {
|
||||
warn!(target: "sstore", "Error retrieving geth keys: {:?}", e)
|
||||
}
|
||||
}
|
||||
|
||||
/// Lists all accounts and corresponding key ids
|
||||
pub fn accounts(&self) -> Result<Vec<(Address, H128)>, ::std::io::Error> {
|
||||
let accounts = try!(self.directory.list()).iter().map(|key_id| self.directory.get(key_id))
|
||||
|
Loading…
Reference in New Issue
Block a user