Add import of raw private key RPCs (#2942)

* Importing an account from raw secret

* Add jsapi & jsonrpc for personal_newAccountFromSecret
This commit is contained in:
Jaco Greeff
2016-10-28 16:46:25 +02:00
committed by Gav Wood
parent 6abd08f5b2
commit 8d66fc50e2
4 changed files with 45 additions and 3 deletions

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { inAddress, inNumber10, inNumber16, inOptions } from '../../format/input';
import { inAddress, inHex, inNumber10, inNumber16, inOptions } from '../../format/input';
import { outAccountInfo, outAddress, outSignerRequest } from '../../format/output';
export default class Personal {
@@ -73,6 +73,12 @@ export default class Personal {
.then(outAddress);
}
newAccountFromSecret (secret, password) {
return this._transport
.execute('personal_newAccountFromSecret', inHex(secret), password)
.then(outAddress);
}
newAccountFromWallet (json, password) {
return this._transport
.execute('personal_newAccountFromWallet', json, password)

View File

@@ -141,7 +141,7 @@ export default {
},
newAccountFromPhrase: {
desc: 'Creates a new account from a brainwallet passphrase',
desc: 'Creates a new account from a recovery passphrase',
params: [
{
type: String,
@@ -158,6 +158,24 @@ export default {
}
},
newAccountFromSecret: {
desc: 'Creates a new account from a private ethstore secret key',
params: [
{
type: Data,
desc: 'Secret, 32-byte hex'
},
{
type: String,
desc: 'Password'
}
],
returns: {
type: Address,
desc: 'The created address'
}
},
newAccountFromWallet: {
desc: 'Creates a new account from a JSON import',
params: [