SignalProtocol.PreKeyBundle (libsignal_protocol v0.1.1)

View Source

Handles the creation and processing of pre-key bundles for the Signal Protocol.

Pre-key bundles are used to establish initial sessions between users in an asynchronous manner.

Summary

Functions

Creates a new pre-key bundle with the given components.

Parses a pre-key bundle from its binary representation.

Verifies the signature of a pre-key bundle.

Functions

create(registration_id, identity_key, pre_key, signed_pre_key, base_key)

Creates a new pre-key bundle with the given components.

Parameters

  • registration_id - The registration ID of the user
  • identity_key - The user's identity key
  • pre_key - A pre-key tuple {key_id, public_key}
  • signed_pre_key - A signed pre-key tuple {key_id, public_key, signature}
  • base_key - The base key for the X3DH key agreement

Returns {:ok, bundle} on success, where bundle is a binary containing the serialized pre-key bundle.

parse(bundle)

Parses a pre-key bundle from its binary representation.

Returns {:ok, bundle} on success, where bundle is a map containing the bundle components.

verify_signature(bundle)

Verifies the signature of a pre-key bundle.

Returns :ok if the signature is valid, {:error, reason} otherwise.