beembase.memo module

beembase.memo.decode_memo(priv, message)

Decode a message with a shared secret between Alice and Bob :param PrivateKey priv: Private Key (of Bob) :param base58encoded message: Encrypted Memo message :return: Decrypted message :rtype: str :raise 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 :param PrivateKey priv: Private Key (of Alice) :param PublicKey pub: Public Key (of Bob) :param int nonce: Random nonce :param str message: Memo message :return: Encrypted message :rtype: 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.get_shared_secret(priv, pub)

Derive the share secret between priv and pub

Parameters:
Returns:

Shared secret

Return type:

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 :return: AES instance and checksum of the encryption key :rtype: length 2 tuple

beembase.memo.init_aes_bts(shared_secret, nonce)

Initialize AES instance

Parameters:
  • shared_secret (hex) – Shared Secret to use as encryption key
  • nonce (int) – Random nonce
Returns:

AES instance

Return type:

AES