|
libkazv
|
#include <client-model.hpp>

Classes | |
| struct | MakeJobT |
Public Types | |
| using | Action = ClientAction |
| using | Effect = ClientEffect |
| using | Result = ClientResult |
Public Member Functions | |
| immer::flex_vector< std::string > | devicesToSendKeys (std::string userId) const |
| immer::map< std::string, immer::flex_vector< std::string > > | devicesToRequestKeys () const |
| void | maybeRotateSessions (ClientModel oldClient) |
| rotate sessions for a room if there is a user in the room with devicesToSendKeys changes | |
| std::pair< Event, std::optional< std::string > > | megOlmEncrypt (Event e, std::string roomId, Timestamp timeMs, RandomData random) |
| immer::map< std::string, immer::map< std::string, Event > > | olmEncryptSplit (Event e, immer::map< std::string, immer::flex_vector< std::string > > userIdToDeviceIdMap, RandomData random, bool attachSenderDeviceKeys=false) |
| precondition: the one-time keys for those devices must already be claimed | |
| DeviceKeys | makeSelfDeviceKeys () |
| Make a struct of DeviceKeys for identity keys of the current device. | |
| json | convertSignature (std::string signature) const |
| Convert a signature from Crypto into a json object. | |
| std::size_t | numOneTimeKeysNeeded () const |
| auto | directRoomMap () const -> immer::map< std::string, std::string > |
| auto | roomIdsUnderTag (std::string tagId) const -> immer::map< std::string, double > |
| auto | roomIdsByTagId () const -> immer::map< std::string, immer::map< std::string, double > > |
| const Crypto & | constCrypto () const |
| Get the const reference of crypto of this client. | |
| template<class Func > | |
| auto | withCrypto (Func &&func) -> std::decay_t< std::invoke_result_t< Func &&, Crypto & > > |
| Do func with crypto, returning its return value. | |
| template<class Job > | |
| constexpr auto | job () const |
| void | addJob (BaseJob j) |
| auto | popAllJobs () |
| void | addTrigger (KazvTrigger t) |
| void | addTriggers (immer::flex_vector< KazvTrigger > c) |
| auto | popAllTriggers () |
| void | maybeAddSaveEventsTrigger (const ClientModel &old) |
Static Public Member Functions | |
| static Result | update (ClientModel m, Action a) |
Public Attributes | |
| std::string | serverUrl |
| std::string | userId |
| std::string | token |
| std::string | deviceId |
| bool | loggedIn {false} |
| bool | syncing {false} |
| bool | shouldSync {true} |
| int | firstRetryMs {1000} |
| int | retryTimeFactor {2} |
| int | maxRetryMs {30 * 1000} |
| int | syncTimeoutMs {20000} |
| std::string | initialSyncFilterId |
| std::string | incrementalSyncFilterId |
| std::optional< std::string > | syncToken |
| RoomListModel | roomList |
| immer::map< std::string, Event > | presence |
| immer::map< std::string, Event > | accountData |
| std::string | nextTxnId {DEFTXNID} |
| immer::flex_vector< BaseJob > | nextJobs |
| immer::flex_vector< KazvTrigger > | nextTriggers |
| EventList | toDevice |
| std::optional< immer::box< Crypto > > | crypto |
| bool | identityKeysUploaded {false} |
| DeviceListTracker | deviceLists |
| DeviceTrustLevel | trustLevelNeededToSendKeys {DeviceTrustLevel::Unseen} |
| immer::array< std::string > | versions |
|
inline |
|
inline |
|
inline |
| const Crypto & Kazv::ClientModel::constCrypto | ( | ) | const |
Get the const reference of crypto of this client.
crypto.has_value() must be true.
| json Kazv::ClientModel::convertSignature | ( | std::string | signature | ) | const |
Convert a signature from Crypto into a json object.
The returned object is a map from user id to key id to signature.
| immer::map< std::string, immer::flex_vector< std::string > > Kazv::ClientModel::devicesToRequestKeys | ( | ) | const |
| immer::flex_vector< std::string > Kazv::ClientModel::devicesToSendKeys | ( | std::string | userId | ) | const |
| auto Kazv::ClientModel::directRoomMap | ( | ) | const -> immer::map<std::string, std::string> |
|
inlineconstexpr |
| DeviceKeys Kazv::ClientModel::makeSelfDeviceKeys | ( | ) |
Make a struct of DeviceKeys for identity keys of the current device.
| void Kazv::ClientModel::maybeAddSaveEventsTrigger | ( | const ClientModel & | old | ) |
| void Kazv::ClientModel::maybeRotateSessions | ( | ClientModel | oldClient | ) |
rotate sessions for a room if there is a user in the room with devicesToSendKeys changes
| std::pair< Event, std::optional< std::string > > Kazv::ClientModel::megOlmEncrypt | ( | Event | e, |
| std::string | roomId, | ||
| Timestamp | timeMs, | ||
| RandomData | random | ||
| ) |
| std::size_t Kazv::ClientModel::numOneTimeKeysNeeded | ( | ) | const |
| immer::map< std::string, immer::map< std::string, Event > > Kazv::ClientModel::olmEncryptSplit | ( | Event | e, |
| immer::map< std::string, immer::flex_vector< std::string > > | userIdToDeviceIdMap, | ||
| RandomData | random, | ||
| bool | attachSenderDeviceKeys = false |
||
| ) |
precondition: the one-time keys for those devices must already be claimed
|
inline |
|
inline |
| auto Kazv::ClientModel::roomIdsByTagId | ( | ) | const -> immer::map<std::string, immer::map<std::string, double>> |
| auto Kazv::ClientModel::roomIdsUnderTag | ( | std::string | tagId | ) | const -> immer::map<std::string, double> |
|
static |
|
inline |
Do func with crypto, returning its return value.
crypto.has_value() must be true.
| immer::map<std::string , Event> Kazv::ClientModel::accountData |
| std::optional<immer::box<Crypto> > Kazv::ClientModel::crypto |
| std::string Kazv::ClientModel::deviceId |
| DeviceListTracker Kazv::ClientModel::deviceLists |
| int Kazv::ClientModel::firstRetryMs {1000} |
| bool Kazv::ClientModel::identityKeysUploaded {false} |
| std::string Kazv::ClientModel::incrementalSyncFilterId |
| std::string Kazv::ClientModel::initialSyncFilterId |
| bool Kazv::ClientModel::loggedIn {false} |
| int Kazv::ClientModel::maxRetryMs {30 * 1000} |
| immer::flex_vector<BaseJob> Kazv::ClientModel::nextJobs |
| immer::flex_vector<KazvTrigger> Kazv::ClientModel::nextTriggers |
| std::string Kazv::ClientModel::nextTxnId {DEFTXNID} |
| immer::map<std::string , Event> Kazv::ClientModel::presence |
| int Kazv::ClientModel::retryTimeFactor {2} |
| RoomListModel Kazv::ClientModel::roomList |
| std::string Kazv::ClientModel::serverUrl |
| bool Kazv::ClientModel::shouldSync {true} |
| bool Kazv::ClientModel::syncing {false} |
| int Kazv::ClientModel::syncTimeoutMs {20000} |
| std::optional<std::string> Kazv::ClientModel::syncToken |
| EventList Kazv::ClientModel::toDevice |
| std::string Kazv::ClientModel::token |
| DeviceTrustLevel Kazv::ClientModel::trustLevelNeededToSendKeys {DeviceTrustLevel::Unseen} |
| std::string Kazv::ClientModel::userId |
| immer::array<std::string > Kazv::ClientModel::versions |