LibsignalProtocol (libsignal_protocol v0.1.0)

View Source

Elixir wrapper for the Signal Protocol library. Provides a clean, idiomatic interface for secure messaging.

Summary

Functions

Creates a new session for a recipient. Returns {:ok, session} on success or {:error, reason} on failure.

Decrypts a message using the given session. Returns {:ok, decrypted_message} on success or {:error, reason} on failure.

Encrypts a message using the given session. Returns {:ok, encrypted_message} on success or {:error, reason} on failure.

Initializes the Signal Protocol library. Returns :ok on success or {:error, reason} on failure.

Functions

create_session(recipient_id)

@spec create_session(String.t()) :: {:ok, String.t()} | {:error, String.t()}

Creates a new session for a recipient. Returns {:ok, session} on success or {:error, reason} on failure.

decrypt_message(session, encrypted_message)

@spec decrypt_message(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Decrypts a message using the given session. Returns {:ok, decrypted_message} on success or {:error, reason} on failure.

encrypt_message(session, message)

@spec encrypt_message(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Encrypts a message using the given session. Returns {:ok, encrypted_message} on success or {:error, reason} on failure.

init()

@spec init() :: :ok | {:error, String.t()}

Initializes the Signal Protocol library. Returns :ok on success or {:error, reason} on failure.