lime
Lime is a C++ library implementing Open Whisper System Signal protocol
Loading...
Searching...
No Matches
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).
const std::string hkdf_DRChainKey_info {"DR Root Chain Key Derivation"}
 String used as info in the root key derivation.
constexpr size_t DRMessageKeySize =32
 DR Message Key are composed of a 32 bytes key and 16 bytes of IV.
constexpr size_t DRMessageIVSize =16
 DR Message Key are composed of a 32 bytes key and 16 bytes of IV.
constexpr size_t DRrandomSeedSize =32
const std::string hkdf_randomSeed_info {"DR Message Key Derivation"}
constexpr size_t DRPkIndexSize =12
constexpr size_t DRMessageAuthTagSize =16
 AEAD generates tag 16 bytes long.
constexpr int DBuserVersion =0x000300
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)
const std::string X3DH_AD_info {"X3DH Associated Data"}
 used to generate a shared AD based on Ik and deviceID
constexpr size_t DRSessionSharedADSize =32
constexpr uint16_t maxMessageSkip =512
constexpr uint16_t maxMessagesReceivedAfterSkip = 64
constexpr uint16_t maxSendingChain =500
 Maximum length of Sending chain.
constexpr uint16_t KEMRatchetChainSize =42
 KEM ratchet chain settings :
constexpr unsigned int maxKEMRatchetChainPeriod =86400
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
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
constexpr uint16_t OPk_batchSize = 25
 default batch size when uploading OPks to X3DH server
constexpr uint16_t OPk_initialBatchSize = 4*OPk_batchSize
 default batch size when creating a new user
constexpr uint16_t OPk_serverLowLimit = 100
 default limit for keys on server to trigger generation/upload of a new batch of OPks
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
constexpr unsigned int OPk_updatePeriod =86400
 in seconds, how often should we perform an update (check if we should publish new OPk, cleaning DB routine etc...)

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

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

◆ DBInactiveUserBit

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

◆ DBInvalidIk

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

◆ DBuserVersion

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

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

current version is 0.3.0

◆ DRChainKeySize

size_t lime::settings::DRChainKeySize =32
constexpr

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

◆ DRMessageAuthTagSize

size_t lime::settings::DRMessageAuthTagSize =16
constexpr

AEAD generates tag 16 bytes long.

◆ DRMessageIVSize

size_t lime::settings::DRMessageIVSize =16
constexpr

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

◆ DRMessageKeySize

size_t lime::settings::DRMessageKeySize =32
constexpr

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

◆ DRPkIndexSize

size_t lime::settings::DRPkIndexSize =12
constexpr

DR Public key index size is 12 bytes long (used to identify a DR reception chain for KEM based DR) it is a hash of the key, on 96 bits, collision chances are negligible

◆ DRrandomSeedSize

size_t lime::settings::DRrandomSeedSize =32
constexpr

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

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

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

◆ DRSessionSharedADSize

size_t lime::settings::DRSessionSharedADSize =32
constexpr

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

◆ KEMRatchetChainSize

uint16_t lime::settings::KEMRatchetChainSize =42
constexpr

KEM ratchet chain settings :

  • before KEMRatchetChainSize is reached (cummulative on sent and received messages), do not perform a KEM ratchet
  • previous setting is overriden if the last KEM ratchet is older than maxKEMRatchetChainPeriod (in seconds)

◆ maxKEMRatchetChainPeriod

unsigned int lime::settings::maxKEMRatchetChainPeriod =86400
constexpr

◆ maxMessageSkip

uint16_t lime::settings::maxMessageSkip =512
constexpr

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

◆ maxMessagesReceivedAfterSkip

uint16_t lime::settings::maxMessagesReceivedAfterSkip = 64
constexpr

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

uint16_t lime::settings::maxSendingChain =500
constexpr

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

uint16_t lime::settings::OPk_batchSize = 25
constexpr

default batch size when uploading OPks to X3DH server

◆ OPk_initialBatchSize

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

default batch size when creating a new user

◆ OPk_limboTime_days

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

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

◆ OPk_serverLowLimit

uint16_t lime::settings::OPk_serverLowLimit = 100
constexpr

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

◆ OPk_updatePeriod

unsigned int lime::settings::OPk_updatePeriod =86400
constexpr

in seconds, how often should we perform an update (check if we should publish new OPk, cleaning DB routine etc...)

◆ SPK_lifeTime_days

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

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

◆ SPK_limboTime_days

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

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)