Esempio n. 1
0
 def update_password(self, old_password, new_password):
     self.check_password(old_password)
     if new_password == '':
         new_password = None
     if self.has_seed():
         decoded = self.get_seed(old_password)
         self.seed = pw_encode(decoded, new_password)
     if self.passphrase:
         decoded = self.get_passphrase(old_password)
         self.passphrase = pw_encode(decoded, new_password)
     if self.xprv is not None:
         b = pw_decode(self.xprv, old_password)
         self.xprv = pw_encode(b, new_password)
Esempio n. 2
0
 def update_password(self, old_password, new_password):
     self.check_password(old_password)
     if new_password == '':
         new_password = None
     # for k, v in self.keypairs.items():
     b = pw_decode(self.encrypt_priv_key, old_password)
     self.encrypt_priv_key = pw_encode(b, new_password)
Esempio n. 3
0
 def update_password(self, old_password, new_password):
     self.check_password(old_password)
     if new_password == '':
         new_password = None
     for k, v in self.keypairs.items():
         b = pw_decode(v, old_password)
         c = pw_encode(b, new_password)
         self.keypairs[k] = c
Esempio n. 4
0
 def import_key(self, sec, password):
     try:
         pubkey = public_key_from_private_key(sec)
     except Exception:
         traceback.print_exc()
         raise BaseException('Invalid private key')
     # allow overwrite
     self.keypairs[pubkey] = pw_encode(sec, password)
     return pubkey
Esempio n. 5
0
 def create(cls, sec, password):
     try:
         pubkey = public_key_from_private_key(sec)
     except Exception:
         traceback.print_exc()
         raise BaseException('Invalid private key')
     return SimpleKeyStore({
         'type':
         'simple',
         'pub_key':
         pubkey,
         'encrypt_priv_key':
         pw_encode(sec, password),
         'address':
         public_key_to_p2pkh(pubkey.decode('hex'))
     })