24 #include <unordered_map>
87 virtual void encrypt(std::shared_ptr<lime::EncryptionContext> encryptionContext,
const std::shared_ptr<limeCallback> callback,
const std::shared_ptr<limeRandomSeedCallback> randomSeedCallback =
nullptr) = 0;
101 virtual lime::PeerDeviceStatus decrypt(
const std::vector<uint8_t> &recipientUserId,
const std::string &senderDeviceId,
const std::vector<uint8_t> &DRmessage,
const std::vector<uint8_t> &
cipherMessage, std::vector<uint8_t> &plainMessage) = 0;
107 virtual std::unique_lock<std::mutex>
lock(
void) = 0;
129 virtual void DRcache_insert(
const std::string &deviceId, std::shared_ptr<DR> DRsession) = 0;
136 virtual std::shared_ptr<X3DH>
get_X3DH(
void) = 0;
146 virtual void publish_user(
const std::shared_ptr<limeCallback> callback,
const uint16_t OPkInitialBatchSize) = 0;
153 virtual void delete_user(
const std::shared_ptr<limeCallback> callback) = 0;
170 virtual void update_SPk(
const std::shared_ptr<limeCallback> callback) = 0;
181 virtual void update_OPk(
const std::shared_ptr<limeCallback> callback, uint16_t OPkServerLowLimit, uint16_t OPkBatchSize) = 0;
188 virtual void get_Ik(std::vector<uint8_t> &Ik) = 0;
219 std::shared_ptr<LimeGeneric>
insert_LimeUser(std::shared_ptr<lime::Db> localStorage,
const DeviceId &deviceId,
const std::string &url,
const uint16_t OPkInitialBatchSize,
222 std::shared_ptr<LimeGeneric>
load_LimeUser(std::shared_ptr<lime::Db> localStorage,
const DeviceId &deviceId,
const limeX3DHServerPostData &X3DH_post_data,
const bool allStatus=
false);
225 #endif // lime_lime_hpp
virtual ~LimeGeneric()
Definition: lime_lime.hpp:214
virtual lime::PeerDeviceStatus decrypt(const std::vector< uint8_t > &recipientUserId, const std::string &senderDeviceId, const std::vector< uint8_t > &DRmessage, const std::vector< uint8_t > &cipherMessage, std::vector< uint8_t > &plainMessage)=0
Decrypt the given message.
virtual void stale_sessions(const std::string &peerDeviceId)=0
Stale all sessions between localDeviceId and peerDevice. If peerDevice keep using this session to enc...
virtual void processEncryptionQueue(void)=0
Check if we have queued encryption to process, if yes, do it.
virtual void update_OPk(const std::shared_ptr< limeCallback > callback, uint16_t OPkServerLowLimit, uint16_t OPkBatchSize)=0
check if we shall upload more OPks on X3DH server
virtual void set_x3dhServerUrl(const std::string &x3dhServerUrl)=0
Set the X3DH key server URL for this identified user.
virtual std::unique_lock< std::mutex > lock(void)=0
virtual void publish_user(const std::shared_ptr< limeCallback > callback, const uint16_t OPkInitialBatchSize)=0
Publish on X3DH server the user, it is performed just after creation in local storage this will...
virtual std::shared_ptr< X3DH > get_X3DH(void)=0
accessor to the internal X3DH engine
virtual void encrypt(std::shared_ptr< lime::EncryptionContext > encryptionContext, const std::shared_ptr< limeCallback > callback, const std::shared_ptr< limeRandomSeedCallback > randomSeedCallback=nullptr)=0
Encrypt a buffer (text or file) for a given list of recipient devices.
std::shared_ptr< LimeGeneric > load_LimeUser(std::shared_ptr< lime::Db > localStorage, const DeviceId &deviceId, const limeX3DHServerPostData &X3DH_post_data, const bool allStatus)
: Load user from database and return a pointer to the control class instanciating the appropriate Lim...
Definition: lime.cpp:556
std::function< void(const std::string &url, const std::string &from, std::vector< uint8_t > &&message, const limeX3DHServerResponseProcess &reponseProcess)> limeX3DHServerPostData
Post a message to the X3DH server.
Definition: lime.hpp:123
virtual void get_Ik(std::vector< uint8_t > &Ik)=0
Retrieve self public Identity key.
PeerDeviceStatus
Definition: lime.hpp:59
virtual std::string get_x3dhServerUrl()=0
Get the X3DH key server URL for this identified user.
virtual void delete_peerDevice(const std::string &peerDeviceId)=0
Purge cached sessions for a given peer Device (used when a peer device is being deleted) ...
virtual void update_SPk(const std::shared_ptr< limeCallback > callback)=0
Check if the current SPk needs to be updated, if yes, generate a new one and publish it on server...
virtual void delete_user(const std::shared_ptr< limeCallback > callback)=0
Delete user from local Storage and from X3DH server.
virtual void DRcache_delete(const std::string &deviceId)=0
delete an entry (if found) from the DR session cache
virtual void DRcache_insert(const std::string &deviceId, std::shared_ptr< DR > DRsession)=0
insert an entry in the DR session cache if an entry with the same key already exists, do nothing
A pure abstract class defining the API to encrypt/decrypt/manage user and its keys.
Definition: lime_lime.hpp:42
std::shared_ptr< LimeGeneric > insert_LimeUser(std::shared_ptr< lime::Db > localStorage, const DeviceId &deviceId, const std::string &url, const uint16_t OPkInitialBatchSize, const limeX3DHServerPostData &X3DH_post_data, const std::shared_ptr< limeCallback > callback)
: Insert user in database and return a pointer to the control class instanciating the appropriate Lim...
Definition: lime.cpp:453