To streamline interoperability between Vodozemac and python-olm, introduce helper functions that handle Base64 encoding and decoding of message attributes (ciphertext, mac, ephemeral_key) directly in Rust. This will remove the need for manual encoding on the Python side and improve usability.
Current example:
vodo_encryption = PkEncryption.from_key(public_key)
vodo_message = vodo_encryption.encrypt(PLAINTEXT)
vodo_mac = base64.b64encode(vodo_message.mac).decode('ascii')
vodo_ciphertext = base64.b64encode(vodo_message.ciphertext).decode('ascii')
vodo_ephemeral_key = base64.b64encode(vodo_message.ephemeral_key).decode('ascii')
A future enhancement could add a Rust helper function to handle this encoding automatically, such as:
(ciphertext, mac, ephemeral_key) = encryption.encrypt(json.dumps(media_body).encode()).to_base64()
This would provide a clearer API, as different message encodings in use can be unclear to the user.
See: #15
To streamline interoperability between Vodozemac and python-olm, introduce helper functions that handle Base64 encoding and decoding of message attributes (
ciphertext,mac,ephemeral_key) directly in Rust. This will remove the need for manual encoding on the Python side and improve usability.Current example:
A future enhancement could add a Rust helper function to handle this encoding automatically, such as:
This would provide a clearer API, as different message encodings in use can be unclear to the user.
See: #15