Example #1
0
 def save_aead(self, path, adata=b"", plaintext=b"", key=None):
     """Encrypts and saves plaintext and associated data to file"""
     if key is None:
         key = self.idkey
     if key is None:
         raise KeyStoreError("Pass the key please")
     d = aead_encrypt(key, adata, plaintext)
     with open(path, "wb") as f:
         f.write(d)
     platform.sync()
Example #2
0
 def create_default_wallet(self, path):
     """Creates default p2wpkh wallet with name `Default`"""
     der = "m/84h/%dh/0h" % NETWORKS[self.network]["bip32"]
     xpub = self.keystore.get_xpub(der)
     desc = "Default&wpkh([%s%s]%s)" % (
         hexlify(self.keystore.fingerprint).decode(), der[1:],
         xpub.to_base58(NETWORKS[self.network]["xpub"]))
     w = Wallet.parse(desc, path)
     # pass keystore to encrypt data
     w.save(self.keystore)
     platform.sync()
     return w