Пример #1
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
Пример #2
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)
Пример #3
0
 def get_hex_seed(self, password):
     return pw_decode(self.seed, password).encode('utf8')
Пример #4
0
 def check_password(self, password):
     xprv = pw_decode(self.xprv, password)
     if deserialize_xkey(xprv)[3] != deserialize_xkey(self.xpub)[3]:
         raise InvalidPassword()
Пример #5
0
 def get_master_private_key(self, password):
     return pw_decode(self.xprv, password)
Пример #6
0
 def get_passphrase(self, password):
     return pw_decode(self.passphrase, password) if self.passphrase else ''
Пример #7
0
 def get_seed(self, password):
     return pw_decode(self.seed, password)
Пример #8
0
 def get_private_key(self, pubkey, password):
     pk = pw_decode(self.keypairs[pubkey], password)
     # this checks the password
     if pubkey != public_key_from_private_key(pk):
         raise InvalidPassword()
     return pk