|
| Db ()=delete |
|
| Db (const std::string &filename, std::shared_ptr< std::recursive_mutex > db_mutex) |
| Open and check DB validity, create or update db schema is needed. More...
|
|
| ~Db () |
|
void | load_LimeUser (const std::string &deviceId, long int &Uid, lime::CurveId &curveId, std::string &url, const bool allStatus=false) |
| Check for existence, retrieve Uid for local user based on its userId (GRUU) and curve from table lime_LocalUsers. More...
|
|
void | delete_LimeUser (const std::string &deviceId) |
| if exists, delete user More...
|
|
void | clean_DRSessions () |
| Delete old stale sessions and old stored message key. Apply to all users in localStorage. More...
|
|
void | clean_SPk () |
| Delete old stale SPk. Apply to all users in localStorage. More...
|
|
bool | is_updateRequested (const std::string &deviceId) |
| checks if a device needs to be updated return true if the device exists and updateTs is older than OPk_updatePeriod More...
|
|
void | set_updateTs (const std::string &deviceId) |
| update the update timestamp to now() More...
|
|
void | set_peerDeviceStatus (const std::string &peerDeviceId, const std::vector< uint8_t > &Ik, lime::PeerDeviceStatus status) |
| set the peer device status flag in local storage: unsafe, trusted or untrusted. More...
|
|
void | set_peerDeviceStatus (const std::string &peerDeviceId, lime::PeerDeviceStatus status) |
|
lime::PeerDeviceStatus | get_peerDeviceStatus (const std::string &peerDeviceId) |
| get the status of a peer device: unknown, untrusted, trusted, unsafe device's Id matching a local account are always considered as trusted More...
|
|
lime::PeerDeviceStatus | get_peerDeviceStatus (const std::list< std::string > &peerDeviceIds) |
| get the status of a list of peer device: unknown, untrusted, trusted, unsafe and return the lowest found, crescent order being unsafe, unknown, untrusted, trusted device's Id matching a local account are always considered as trusted More...
|
|
bool | is_localUser (const std::string &deviceId) |
| checks if a device Id exists in the local users table More...
|
|
void | delete_peerDevice (const std::string &peerDeviceId) |
| delete a peerDevice from local storage More...
|
|
template<typename Curve > |
long int | check_peerDevice (const std::string &peerDeviceId, const DSA< Curve, lime::DSAtype::publicKey > &peerIk, const bool updateInvalid=false) |
| Check peer device information(DeviceId - GRUU -, public Ik, Uid to link it to a user) in local storage. More...
|
|
template<typename Curve > |
long int | store_peerDevice (const std::string &peerDeviceId, const DSA< Curve, lime::DSAtype::publicKey > &peerIk) |
| Store peer device information(DeviceId - GRUU -, public Ik, Uid to link it to a user) in local storage. More...
|
|
void | start_transaction () |
| start a transaction on this Db More...
|
|
void | commit_transaction () |
| commit a transaction on this Db More...
|
|
void | rollback_transaction () |
| rollback a transaction on this Db More...
|
|
get the status of a list of peer device: unknown, untrusted, trusted, unsafe and return the lowest found, crescent order being unsafe, unknown, untrusted, trusted device's Id matching a local account are always considered as trusted
- Parameters
-
[in] | peerDeviceIds | A list of devices Id, shall be their GRUUs |
- Returns
- the lowest status found in the list
void lime::Db::set_peerDeviceStatus |
( |
const std::string & |
peerDeviceId, |
|
|
const std::vector< uint8_t > & |
Ik, |
|
|
lime::PeerDeviceStatus |
status |
|
) |
| |
set the peer device status flag in local storage: unsafe, trusted or untrusted.
- Parameters
-
[in] | peerDeviceId | The device Id of peer, shall be its GRUU |
[in] | Ik | the EdDSA peer public identity key, formatted as in RFC8032 |
[in] | status | value of flag to set: accepted values are trusted, untrusted, unsafe |
- Exceptions
-
BCTBX_EXCEPTION | if given key doesn't match the one present in local storage |
if the status flag value is unexpected (not one of trusted, untrusted, unsafe), ignore the call
if the status flag is unsafe or untrusted, ignore the value of Ik and call the version of this function without it
if peer Device is not present in local storage and status is trusted or unsafe, it is added, if status is untrusted, it is just ignored
General algorithm followed by the set_peerDeviceStatus functions
- Status is valid? (not one of trusted, untrusted, unsafe)? No: return
- status is trusted
- We have Ik? -> No: return
- Device is already in storage but Ik differs from the given one : exception
- Insert/update in local storage
- status is untrusted
- Ik is ignored
- Device already in storage? No: return
- Device already in storage but current status is unsafe? Yes: return
- update in local storage
-status is unsafe
- ignore Ik
- insert/update the status. If inserted, insert an invalid Ik