Loading...
Searching...
No Matches
lime_x3dh_protocol.cpp File Reference

## Namespaces

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

## Enumerations

enum class

lime::x3dh_protocol::x3dh_message_type : uint8_t {
lime::x3dh_protocol::deprecated_registerUser =0x01 , lime::x3dh_protocol::deleteUser =0x02 , lime::x3dh_protocol::postSPk =0x03 , lime::x3dh_protocol::postOPks =0x04 ,
lime::x3dh_protocol::getPeerBundle =0x05 , lime::x3dh_protocol::peerBundle =0x06 , lime::x3dh_protocol::getSelfOPks =0x07 , lime::x3dh_protocol::selfOPks =0x08 ,
lime::x3dh_protocol::registerUser =0x09 , lime::x3dh_protocol::error =0xff
}

| the x3dh message type exchanged with the X3DH server More...

enum class

lime::x3dh_protocol::x3dh_error_code : uint8_t {
lime::x3dh_protocol::bad_content_type =0x00 , lime::x3dh_protocol::bad_curve =0x01 , lime::x3dh_protocol::missing_senderId =0x02 , lime::x3dh_protocol::bad_x3dh_protocol_version =0x03 ,
lime::x3dh_protocol::bad_size =0x04 , lime::x3dh_protocol::user_already_in =0x05 , lime::x3dh_protocol::user_not_found =0x06 , lime::x3dh_protocol::db_error =0x07 ,
lime::x3dh_protocol::bad_request =0x08 , lime::x3dh_protocol::server_failure =0x09 , lime::x3dh_protocol::resource_limit_reached =0x0a , lime::x3dh_protocol::unknown_error_code =0xfe ,
lime::x3dh_protocol::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.
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.
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>
template<typename Curve>
void | lime::x3dh_protocol::buildMessage_deleteUser (std::vector< uint8_t > &message) noexcept
| build a deleteUser message
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
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
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
template<typename Curve>
void | lime::x3dh_protocol::buildMessage_getSelfOPks (std::vector< uint8_t > &message) noexcept
| build a getSelfOPks message
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.
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.

## Variables

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