Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Base64 Helper Functions for Vodozemac-Olm Interoperability #16

Open
TrevisGordan opened this issue Dec 10, 2024 · 0 comments
Open

Comments

@TrevisGordan
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant