lime
Lime is a C++ library implementing Open Whisper System Signal protocol
Namespaces | Enumerations | Functions | Variables
lime_x3dh_protocol.cpp File Reference

Namespaces

 lime
 
 lime::x3dh_protocol
 Group in this namespace all the functions related to building or parsing x3dh packets.
 

Enumerations

enum  lime::x3dh_protocol::x3dh_message_type : uint8_t {
  lime::x3dh_protocol::x3dh_message_type::deprecated_registerUser =0x01, lime::x3dh_protocol::x3dh_message_type::deleteUser =0x02, lime::x3dh_protocol::x3dh_message_type::postSPk =0x03, lime::x3dh_protocol::x3dh_message_type::postOPks =0x04,
  lime::x3dh_protocol::x3dh_message_type::getPeerBundle =0x05, lime::x3dh_protocol::x3dh_message_type::peerBundle =0x06, lime::x3dh_protocol::x3dh_message_type::getSelfOPks =0x07, lime::x3dh_protocol::x3dh_message_type::selfOPks =0x08,
  lime::x3dh_protocol::x3dh_message_type::registerUser =0x09, lime::x3dh_protocol::x3dh_message_type::error =0xff
}
 the x3dh message type exchanged with the X3DH server More...
 
enum  lime::x3dh_protocol::x3dh_error_code : uint8_t {
  lime::x3dh_protocol::x3dh_error_code::bad_content_type =0x00, lime::x3dh_protocol::x3dh_error_code::bad_curve =0x01, lime::x3dh_protocol::x3dh_error_code::missing_senderId =0x02, lime::x3dh_protocol::x3dh_error_code::bad_x3dh_protocol_version =0x03,
  lime::x3dh_protocol::x3dh_error_code::bad_size =0x04, lime::x3dh_protocol::x3dh_error_code::user_already_in =0x05, lime::x3dh_protocol::x3dh_error_code::user_not_found =0x06, lime::x3dh_protocol::x3dh_error_code::db_error =0x07,
  lime::x3dh_protocol::x3dh_error_code::bad_request =0x08, lime::x3dh_protocol::x3dh_error_code::server_failure =0x09, lime::x3dh_protocol::x3dh_error_code::resource_limit_reached =0x0a, lime::x3dh_protocol::x3dh_error_code::unknown_error_code =0xfe,
  lime::x3dh_protocol::x3dh_error_code::unset_error_code =0xff
}
 the error codes included in the x3dh error message received from the X3DH server More...
 

Functions

static std::string lime::x3dh_protocol::x3dh_messageTypeString (const x3dh_message_type message_type)
 Helper function to get human readable trace of x3dh messages types. More...
 
static std::vector< uint8_t > lime::x3dh_protocol::X3DH_makeHeader (const x3dh_message_type message_type, const lime::CurveId curve) noexcept
 Build X3DH message header using current protocol Version byte. More...
 
template<typename Curve >
void lime::x3dh_protocol::buildMessage_registerUser (std::vector< uint8_t > &message, const DSA< Curve, lime::DSAtype::publicKey > &Ik, const X< Curve, lime::Xtype::publicKey > &SPk, const DSA< Curve, lime::DSAtype::signature > &Sig, const uint32_t SPk_id, const std::vector< X< Curve, lime::Xtype::publicKey >> &OPks, const std::vector< uint32_t > &OPk_ids) noexcept
 build a registerUser message : Identity Key<EDDSA Public Key length> More...
 
template<typename Curve >
void lime::x3dh_protocol::buildMessage_deleteUser (std::vector< uint8_t > &message) noexcept
 build a deleteUser message More...
 
template<typename Curve >
void lime::x3dh_protocol::buildMessage_publishSPk (std::vector< uint8_t > &message, const X< Curve, lime::Xtype::publicKey > &SPk, const DSA< Curve, lime::DSAtype::signature > &Sig, const uint32_t SPk_id) noexcept
 build a postSPk message More...
 
template<typename Curve >
void lime::x3dh_protocol::buildMessage_publishOPks (std::vector< uint8_t > &message, const std::vector< X< Curve, lime::Xtype::publicKey >> &OPks, const std::vector< uint32_t > &OPk_ids) noexcept
 build a postOPks message More...
 
template<typename Curve >
void lime::x3dh_protocol::buildMessage_getPeerBundles (std::vector< uint8_t > &message, std::vector< std::string > &peer_device_ids) noexcept
 build a getPeerBundle message More...
 
template<typename Curve >
void lime::x3dh_protocol::buildMessage_getSelfOPks (std::vector< uint8_t > &message) noexcept
 build a getSelfOPks message More...
 
template<typename Curve >
bool lime::x3dh_protocol::parseMessage_getType (const std::vector< uint8_t > &body, x3dh_message_type &message_type, x3dh_error_code &error_code, const limeCallback callback) noexcept
 
template<typename Curve >
bool lime::x3dh_protocol::parseMessage_getPeerBundles (const std::vector< uint8_t > &body, std::vector< X3DH_peerBundle< Curve >> &peersBundle) noexcept
 Parse a peerBundles message and populate a vector of peerBundles. More...
 
template<typename Curve >
bool lime::x3dh_protocol::parseMessage_selfOPks (const std::vector< uint8_t > &body, std::vector< uint32_t > &selfOPkIds) noexcept
 Parse a selfOPk message and populate a self OPk ids. More...
 

Variables

constexpr uint8_t lime::x3dh_protocol::X3DH_protocolVersion = 0x01
 
constexpr size_t lime::x3dh_protocol::X3DH_headerSize = 3