beembase.memo¶
-
beembase.memo.
decode_memo
(priv, message)¶ Decode a message with a shared secret between Alice and Bob
Parameters: - priv (PrivateKey) – Private Key (of Bob)
- message (base58encoded) – Encrypted Memo message
Returns: Decrypted message
Return type: str
Raises: ValueError – if message cannot be decoded as valid UTF-8 string
-
beembase.memo.
decode_memo_bts
(priv, pub, nonce, message)¶ Decode a message with a shared secret between Alice and Bob
Parameters: - priv (PrivateKey) – Private Key (of Bob)
- pub (PublicKey) – Public Key (of Alice)
- nonce (int) – Nonce used for Encryption
- message (bytes) – Encrypted Memo message
Returns: Decrypted message
Return type: str
Raises: ValueError – if message cannot be decoded as valid UTF-8 string
-
beembase.memo.
encode_memo
(priv, pub, nonce, message, **kwargs)¶ Encode a message with a shared secret between Alice and Bob
Parameters: - priv (PrivateKey) – Private Key (of Alice)
- pub (PublicKey) – Public Key (of Bob)
- nonce (int) – Random nonce
- message (str) – Memo message
Returns: Encrypted message
Return type: hex
-
beembase.memo.
encode_memo_bts
(priv, pub, nonce, message)¶ Encode a message with a shared secret between Alice and Bob
Parameters: - priv (PrivateKey) – Private Key (of Alice)
- pub (PublicKey) – Public Key (of Bob)
- nonce (int) – Random nonce
- message (str) – Memo message
Returns: Encrypted message
Return type: hex
-
beembase.memo.
extract_memo_data
(message)¶ Returns the stored pubkey keys, nonce, checksum and encrypted message of a memo
Derive the share secret between
priv
andpub
:param Base58 priv: Private Key :param Base58 pub: Public Key :return: Shared secret :rtype: hex The shared secret is generated such that:Pub(Alice) * Priv(Bob) = Pub(Bob) * Priv(Alice)
-
beembase.memo.
init_aes
(shared_secret, nonce)¶ Initialize AES instance :param hex shared_secret: Shared Secret to use as encryption key :param int nonce: Random nonce
-
beembase.memo.
init_aes_bts
(shared_secret, nonce)¶ Initialize AES instance :param hex shared_secret: Shared Secret to use as encryption key :param int nonce: Random nonce :return: AES instance :rtype: AES