Use keyapi for address generation in import key in dictkeystore
This commit is contained in:
@@ -5,3 +5,4 @@ from eth_keys.backends import NativeECCBackend
|
||||
keyapi = KeyAPI(NativeECCBackend)
|
||||
|
||||
from .postgres import ReferenceKeystore
|
||||
from .dict import DictKeystore
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# standard imports
|
||||
import os
|
||||
|
||||
# third-party imports
|
||||
import eth_keyfile
|
||||
|
||||
# local imports
|
||||
from . import keyapi
|
||||
|
||||
@@ -25,6 +28,11 @@ class Keystore:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def insert_key(self, pk, password=None):
|
||||
raise NotImplementedError
|
||||
def import_keystore_data(self, keystore_content, password=''):
|
||||
#private_key = w3.eth.account.decrypt(keystore_content, password)
|
||||
private_key = eth_keyfile.decode_keyfile_json(keystore_content, password.encode('utf-8'))
|
||||
return self.import_raw_key(private_key, password)
|
||||
|
||||
def import_keystore_file(self, keystore_file, password=''):
|
||||
keystore_content = eth_keyfile.load_keyfile(keystore_file)
|
||||
return self.import_keystore_data(keystore_content, password)
|
||||
|
||||
Reference in New Issue
Block a user