SignalProtocol.PreKeyBundle (libsignal_protocol v0.3.0)
View SourceSerialization for the pre-key bundle a party publishes so others can start sessions with them asynchronously.
The wire form is exactly what the NIF's process_pre_key_bundle/2 consumes:
identity_pub(32) || signed_pre_key_pub(32) || signature(64) [|| one_time_pre_key_pub(32)]128 bytes, or 160 with a one-time pre-key. signature is Ed25519 over
signed_pre_key_pub under the identity key -- produced by
SignalProtocol.generate_signed_pre_key/2.
Key ids and the registration id are not part of this binary: they travel in the PreKeySignalMessage of the first message, where the responder needs them to look up which private keys to use.
Summary
Functions
Parses a bundle from its wire form. Accepts exactly 128 or 160 bytes.
Serializes a bundle to the NIF wire form.
Verifies the bundle's Ed25519 signature over its signed pre-key, under the
identity key the bundle itself carries. Returns :ok or the bare atom
:invalid_signature, mirroring signal_nif:verify_signature/3.
Types
Functions
Parses a bundle from its wire form. Accepts exactly 128 or 160 bytes.
Serializes a bundle to the NIF wire form.
Returns {:error, :invalid_key_size} if any component is the wrong length,
rather than emitting a binary the NIF would reject with
:invalid_bundle_size or a signature failure.
Verifies the bundle's Ed25519 signature over its signed pre-key, under the
identity key the bundle itself carries. Returns :ok or the bare atom
:invalid_signature, mirroring signal_nif:verify_signature/3.
This is the same check process_pre_key_bundle/2 performs, exposed for
callers who want to validate a bundle before using it. It proves internal
consistency only: trust in identity_key has to come from out-of-band
identity verification.