lime
Lime is a C++ library implementing Open Whisper System Signal protocol
Variables
lime::settings Namespace Reference

Hold constants definition used as settings in all components of the lime library. More...

Variables

constexpr size_t DRChainKeySize =32
 Sending, Receiving and Root key chain use 32 bytes keys (spec 3.2) More...
 
const std::string hkdf_DRChainKey_info {"DR Root Chain Key Derivation"}
 String used as info in the root key derivation. More...
 
constexpr size_t DRMessageKeySize =32
 DR Message Key are composed of a 32 bytes key and 16 bytes of IV. More...
 
constexpr size_t DRMessageIVSize =16
 DR Message Key are composed of a 32 bytes key and 16 bytes of IV. More...
 
constexpr size_t DRrandomSeedSize =32
 
const std::string hkdf_randomSeed_info {"DR Message Key Derivation"}
 
constexpr size_t DRMessageAuthTagSize =16
 AEAD generates tag 16 bytes long. More...
 
constexpr int DBuserVersion =0x000001
 
constexpr uint16_t DBInactiveUserBit = 0x0100
 
constexpr uint16_t DBCurveIdByte = 0x00FF
 
constexpr uint8_t DBInvalidIk = 0x00
 
const std::string X3DH_SK_info {"Lime"}
 shall be an ASCII string identifying the application (X3DH spec section 2.1) More...
 
const std::string X3DH_AD_info {"X3DH Associated Data"}
 used to generate a shared AD based on Ik and deviceID More...
 
constexpr size_t DRSessionSharedADSize =32
 
constexpr std::uint16_t maxMessageSkip =1024
 
constexpr std::uint16_t maxMessagesReceivedAfterSkip = 128
 
constexpr std::uint16_t maxSendingChain =1000
 Maximum length of Sending chain. More...
 
constexpr unsigned int DRSession_limboTime_days =30
 
constexpr unsigned int SPK_lifeTime_days =7
 in days, Life time of a signed pre-key, it will be set to stale after that period More...
 
constexpr unsigned int SPK_limboTime_days =30
 in days, How long shall we keep a signed pre-key once it has been replaced by a new one More...
 
constexpr uint16_t OPk_batchSize = 25
 default batch size when uploading OPks to X3DH server More...
 
constexpr uint16_t OPk_initialBatchSize = 4*OPk_batchSize
 default batch size when creating a new user More...
 
constexpr uint16_t OPk_serverLowLimit = 100
 default limit for keys on server to trigger generation/upload of a new batch of OPks More...
 
constexpr unsigned int OPk_limboTime_days =SPK_lifeTime_days+SPK_limboTime_days
 in days, How long shall we keep an OPk in localStorage once we've noticed X3DH server dispatched it More...
 

Detailed Description

Hold constants definition used as settings in all components of the lime library.

in lime_setting.hpp: you can tweak the behavior of the library. No compatibility break between clients shall result by modifying this definitions

Note
: you can tweak values but not the types, uint16_t values are intended to be bounded by 2^16 -1.

in lime_defines.hpp: the constants defined cannot be modified without some work on the source code unless you really know what you're doing, just leave them alone

Variable Documentation

◆ DBCurveIdByte

constexpr uint16_t lime::settings::DBCurveIdByte = 0x00FF

◆ DBInactiveUserBit

constexpr uint16_t lime::settings::DBInactiveUserBit = 0x0100

◆ DBInvalidIk

constexpr uint8_t lime::settings::DBInvalidIk = 0x00

◆ DBuserVersion

constexpr int lime::settings::DBuserVersion =0x000001

define a version number for the DB schema as an integer 0xMMmmpp

current version is 0.0.1

◆ DRChainKeySize

constexpr size_t lime::settings::DRChainKeySize =32

Sending, Receiving and Root key chain use 32 bytes keys (spec 3.2)

◆ DRMessageAuthTagSize

constexpr size_t lime::settings::DRMessageAuthTagSize =16

AEAD generates tag 16 bytes long.

◆ DRMessageIVSize

constexpr size_t lime::settings::DRMessageIVSize =16

DR Message Key are composed of a 32 bytes key and 16 bytes of IV.

◆ DRMessageKeySize

constexpr size_t lime::settings::DRMessageKeySize =32

DR Message Key are composed of a 32 bytes key and 16 bytes of IV.

◆ DRrandomSeedSize

constexpr size_t lime::settings::DRrandomSeedSize =32

Size of the random seed used to generate the cipherMessage key

Message Key is based on a message seed(sent in the DR message) Message key and nonce are derived(HKDF) from this seed and have the same length as DR Message Key

◆ DRSession_limboTime_days

constexpr unsigned int lime::settings::DRSession_limboTime_days =30

Lifetime of a session once not active anymore, unit is day

◆ DRSessionSharedADSize

constexpr size_t lime::settings::DRSessionSharedADSize =32

Each DR session stores a shared AD given at built and derived from Identity keys of sender and receiver
SharedAD is computed by HKDF-Sha512(session Initiator Ik || session receiver Ik || session Initiator device Id || session receiver device Id)

◆ hkdf_DRChainKey_info

const std::string lime::settings::hkdf_DRChainKey_info {"DR Root Chain Key Derivation"}

String used as info in the root key derivation.

◆ hkdf_randomSeed_info

const std::string lime::settings::hkdf_randomSeed_info {"DR Message Key Derivation"}

info string used in the derivation(HKDF) of random seed into the key used to encrypt the cipherMessage key

Message Key is based on a message seed(sent in the DR message) Message key and nonce are derived(HKDF) from this seed and have the same length as DR Message Key

◆ maxMessageSkip

constexpr std::uint16_t lime::settings::maxMessageSkip =1024

Maximum number of Message we can skip(and store their keys) at reception of one message

◆ maxMessagesReceivedAfterSkip

constexpr std::uint16_t lime::settings::maxMessagesReceivedAfterSkip = 128

after a message key is stored, count how many messages we can receive from peer before deleting the key at next update

Note
: implemented by receiving key chain, so any new skipped message in a chain will reset the counter to 0

◆ maxSendingChain

constexpr std::uint16_t lime::settings::maxSendingChain =1000

Maximum length of Sending chain.

when this count is reached without any return from peer the DR session is set to stale and we must create another one to send messages Can't be more than 2^16 as message number is send on 2 bytes

◆ OPk_batchSize

constexpr uint16_t lime::settings::OPk_batchSize = 25

default batch size when uploading OPks to X3DH server

◆ OPk_initialBatchSize

constexpr uint16_t lime::settings::OPk_initialBatchSize = 4*OPk_batchSize

default batch size when creating a new user

◆ OPk_limboTime_days

constexpr unsigned int lime::settings::OPk_limboTime_days =SPK_lifeTime_days+SPK_limboTime_days

in days, How long shall we keep an OPk in localStorage once we've noticed X3DH server dispatched it

◆ OPk_serverLowLimit

constexpr uint16_t lime::settings::OPk_serverLowLimit = 100

default limit for keys on server to trigger generation/upload of a new batch of OPks

◆ SPK_lifeTime_days

constexpr unsigned int lime::settings::SPK_lifeTime_days =7

in days, Life time of a signed pre-key, it will be set to stale after that period

◆ SPK_limboTime_days

constexpr unsigned int lime::settings::SPK_limboTime_days =30

in days, How long shall we keep a signed pre-key once it has been replaced by a new one

◆ X3DH_AD_info

const std::string lime::settings::X3DH_AD_info {"X3DH Associated Data"}

used to generate a shared AD based on Ik and deviceID

◆ X3DH_SK_info

const std::string lime::settings::X3DH_SK_info {"Lime"}

shall be an ASCII string identifying the application (X3DH spec section 2.1)