:mod:`viz.memo` =============== .. py:module:: viz.memo Module Contents --------------- .. py:class:: Memo Bases: :class:`graphenecommon.memo.Memo` .. autoapi-inheritance-diagram:: viz.memo.Memo :parts: 1 :private-bases: Deals with Memos that are attached to a transfer. :param viz.account.Account from_account: Account that has sent the memo :param viz.account.Account to_account: Account that has received the memo :param viz.viz.Client blockchain_instance: Client instance A memo is encrypted with a shared secret derived from a private key of the sender and a public key of the receiver. Due to the underlying mathematics, the same shared secret can be derived by the private key of the receiver and the public key of the sender. The encrypted message is perturbed by a nonce that is part of the transmitted message. .. code-block:: python from viz.memo import Memo m = Memo("alice", "bob") m.unlock_wallet("secret") enc = (m.encrypt("foobar")) print(enc) print(m.decrypt(enc)) >> foobar To decrypt a memo, simply use .. code-block:: python from viz.memo import Memo m = Memo() m.blockchain.wallet.unlock("secret") print(memo.decrypt(op_data["memo"])) if ``op_data`` being the payload of a transfer operation. .. method:: define_classes(self) .. method:: encrypt(self, message: str) Encrypt a memo. This class overriden because upstream assumes memo key is in account['options']['memo_key'], and bitshares memo format is different. We're using Golos memo format. :param str message: clear text memo message :returns: encrypted message :rtype: str .. method:: decrypt(self, message: str) Decrypt a message. :param dict message: encrypted memo message :returns: decrypted message :rtype: str