2020-09-21 19:10:20 +02:00
|
|
|
# standard imports
|
|
|
|
import os
|
|
|
|
|
|
|
|
# local imports
|
|
|
|
from . import keyapi
|
|
|
|
|
|
|
|
|
2020-08-06 14:11:43 +02:00
|
|
|
class Keystore:
|
|
|
|
|
|
|
|
def get(self, address, password=None):
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2020-09-21 19:10:20 +02:00
|
|
|
|
2020-08-06 14:11:43 +02:00
|
|
|
def new(self, password=None):
|
2020-09-21 19:10:20 +02:00
|
|
|
b = os.urandom(32)
|
|
|
|
return self.import_raw_key(b, password)
|
|
|
|
|
|
|
|
|
|
|
|
def import_raw_key(self, b, password=None):
|
|
|
|
pk = keyapi.PrivateKey(b)
|
|
|
|
return self.import_key(pk, password)
|
|
|
|
|
2020-08-06 14:11:43 +02:00
|
|
|
|
2020-09-20 10:00:59 +02:00
|
|
|
def import_key(self, pk, password=None):
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2020-09-21 19:10:20 +02:00
|
|
|
|
|
|
|
def insert_key(self, pk, password=None):
|
|
|
|
raise NotImplementedError
|
|
|
|
|