python-olm

raw JSON →
3.2.16 verified Mon Apr 27 auth: no python

Python CFFI bindings for the Olm cryptographic ratchet library, used for end-to-end encryption in Matrix and other messaging protocols. Current version 3.2.16. Release cadence is irregular.

pip install python-olm
error ModuleNotFoundError: No module named 'olm.account'
cause Importing submodules directly, which were removed in 3.0.0.
fix
Use: 'from olm import Account'
error AttributeError: module 'olm' has no attribute 'Account'
cause Importing the CFFI module olm itself instead of using the Python wrapper. The Python classes are in the olm Python package, not the olm CFFI module.
fix
Ensure you do 'from olm import Account' and that you have the Python package installed (pip install python-olm) not just the C library.
breaking In version 3.0.0, all submodules (olm.account, olm.session, etc.) were removed. All classes must be imported directly from olm: from olm import Account, Session.
fix Change imports: replace 'from olm.account import Account' with 'from olm import Account'.
breaking The Olm class initialization now requires calling Olm() before using other classes. Failure to do so may cause segfaults or undefined behavior.
fix Add 'olm = Olm()' at the start of your application.
deprecated The 'olm' module attribute for the CFFI binding (e.g., olm._olm) is deprecated and may be removed in future versions.
fix Use the high-level Python classes instead of accessing CFFI directly.

Create an Olm account and print the Curve25519 identity key.

from olm import Account, Olm

# Initialize the library
olm = Olm()

# Create an account
account = Account()
print(f"Account created: {account.identity_keys['curve25519']}")