bhivebase.memo module¶
-
bhivebase.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
-
bhivebase.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
-
bhivebase.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
-
bhivebase.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
Derive the share secret between
priv
andpub
- Parameters
- Returns
Shared secret
- Return type
hex
The shared secret is generated such that:
Pub(Alice) * Priv(Bob) = Pub(Bob) * Priv(Alice)
-
bhivebase.memo.
init_aes
(shared_secret, nonce)¶ Initialize AES instance
- Parameters
shared_secret (hex) – Shared Secret to use as encryption key
nonce (int) – Random nonce
- Returns
AES instance and checksum of the encryption key
- Return type
length 2 tuple
-
bhivebase.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