Initial codebase was forked from https://github.com/tgalal/python-axolotl
This is a python port of libsignal-protocol-java originally written by Moxie Marlinspike
Dependencies
Linux
pip install .
Usage
This python port is done in an almost 1:1 mapping to the original java code. Therefore any original documentation for the java code can be easily mapped and used with this python port.
Install time
At install time, a libaxolotl client needs to generate its identity keys, registration id, and prekeys.
identity_key_pair = KeyHelper.generate_identity_key_pair()
registration_id = KeyHelper.generate_registration_id()
pre_keys = KeyHelper.generate_pre_keys(start_id, 100)
last_resort_key = KeyHelper.generate_last_resort_key()
signed_pre_key = KeyHelper.generate_signed_pre_key(identity_key_pair, 5)
#Store identity_key_pair somewhere durable and safe.
#Store registration_id somewhere durable and safe.
#Store pre_keys in PreKeyStore.
#Store signed prekey in SignedPreKeyStore.
Building a session
A libaxolotl client needs to implement the Store interface. This will manage loading and storing of identity, prekeys, signed prekeys, and session state.
Once this is implemented, building a session is fairly straightforward:
store = MyStore()
# Instantiate a SessionBuilder for a remote recipient_id + device_id tuple.
session_builder = SessionBuilder(store, recipient_id, device_id)
# Build a session with a PreKey retrieved from the server.
sessionBuilder.process(retrieved_pre_key)
session_cipher = SessionCipher(store, recipient_id, device_id)
message = session_cipher.encrypt("Hello world!")
deliver(message.serialize())
Development
Generating protobuf files
Download the protobuf-compiler and execute
protoc -I=omemo_dr/protobuf --python_out=omemo_dr/protobuf OMEMO.proto WhisperTextProtocol.proto LocalStorageProtocol.proto
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file omemo-dr-0.99.1.tar.gz.
File metadata
- Download URL: omemo-dr-0.99.1.tar.gz
- Upload date:
- Size: 158.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23f4c7cfae31874752e7931faeeb007a0ba325865cb3f06880e35e7d4df235c2
|
|
| MD5 |
1f905f996992f67e497a6d46571f3ea1
|
|
| BLAKE2b-256 |
3a6f71e575d9a84527af4c4f7968b0aa464ed61d12635a29f6701ba102cd0625
|