Local
Local::Local
Constructs a local store from existing data (stored from dump()) and the user's secret
key for generating the data encryption key. To construct a blank local store (i.e. with no
pre-existing dumped data to load) pass std::nullopt as the second argument.
Declaration
Local(std::span<const unsigned char> ed25519_secretkey,
std::optional<std::span<const unsigned char>> dumped);
Parameters
ed25519_secretkey— contains the libsodium secret key used to encrypt/decrypt the data when pushing/pulling from the swarm. This can either be the full 64-byte value (which is technically the 32-byte seed followed by the 32-byte pubkey), or just the 32-byte seed of the secret key.dumped— eitherstd::nulloptto construct a new, empty object; or binary state data that was previously dumped from an instance of this class by callingdump().
Returns
Local- Constructor
Local::encryption_domain
Returns the domain. Is constant, will always return "Local"
Declaration
Parameters
This endpoint takes no inputs.
Returns
const char*- Will return "Local"
Local::get_ios_notification_sound
Returns the setting indicating which sound should play when receiving a notification on iOS.
Declaration
Parameters
This endpoint takes no inputs.
Returns
notify_sound— integer indicating the sound that should be played when receiving a notification on iOS.
Local::get_notification_content
Returns the setting indicating what notification content should be displayed.
Declaration
Parameters
This endpoint takes no inputs.
Returns
notify_content— enum indicating the content that should be shown within a notification.
Local::get_setting
Accesses the setting for the provided key. Can have three values:
- std::nullopt — the value has not been given an explicit value so the client should use its default.
- true — the value is explicitly enabled
- false — the value is explicitly disabled
Declaration
Parameters
key— key that a setting was previously stored against.
Returns
std::optional<bool>- true/false if the value has been set;std::nulloptif the value has not been set.
Local::get_theme
Returns the setting indicating which theme the client should use.
Declaration
Parameters
This endpoint takes no inputs.
Returns
theme— enum indicating which theme the client should use.
Local::get_theme_primary_color
Returns the setting indicating which primary color the client should use.
Declaration
Parameters
This endpoint takes no inputs.
Returns
theme_primary_color— enum indicating which primary color the client should use.
Local::needs_push
Always returns false as the local store should never be pushed to the swarm.
Declaration
Parameters
This endpoint takes no inputs.
Returns
bool— Returns false
Local::push
Since the loal store should never be pushed this functions is overwritten to always return
empty data in case a client doesn't respect the needs_push flag.
Declaration
std::tuple<seqno_t, std::vector<std::vector<unsigned char>>, std::vector<std::string>> push()
override {
Parameters
This endpoint takes no inputs.
Returns
std::tuple<seqno_t, std::vector<unsigned char>, std::vector<std::string>>- Returns a tuple containingseqno_t— sequence number of 0std::vector<unsigned char>— empty data vectorstd::vector<std::string>— empty list of message hashes
Local::set_ios_notification_sound
Sets the setting indicating which sound should be played when receiving receiving a notification on iOS.
Declaration
Parameters
value— Updated notification sound setting
Returns
Local::set_notification_content
Sets the setting indicating what notification content should be displayed.
Declaration
Parameters
value— Updated notification content setting
Returns
Local::set_setting
Sets the setting. This is typically invoked with either true or false,
but can also be called withstd::nullopt` to explicitly clear the value.
Declaration
Parameters
key— key that a setting was previously stored against.enabled— value that should be stored locally against the key, orstd::nulloptto drop the setting from the local storage (and thus use the client's default).
Returns
Local::set_theme
Sets the setting indicating which theme the client should use.
Declaration
Parameters
value— Updated theme setting
Returns
Local::size_settings
Returns the number of settings
Declaration
Parameters
This endpoint takes no inputs.
Returns
size_t- Returns the number of settings
Local::storage_namespace
The local config should never be pushed so just provide the UserProfile namespace as a fallback. Is constant, will always return 2
Declaration
Parameters
This endpoint takes no inputs.
Returns
Namespace- Will return 2