35 #include <boost/serialization/vector.hpp>
36 #include <boost/program_options/variables_map.hpp>
37 #include <boost/program_options/options_description.hpp>
38 #include <boost/optional/optional.hpp>
45 #include "wipeable_string.h"
46 #include "net/abstract_http_client.h"
52 #undef MONERO_DEFAULT_LOG_CATEGORY
53 #define MONERO_DEFAULT_LOG_CATEGORY "wallet.mms"
54 #define AUTO_CONFIG_TOKEN_BYTES 4
55 #define AUTO_CONFIG_TOKEN_PREFIX "mms"
159 FIELD(transport_address)
160 FIELD(monero_address_known)
161 FIELD(monero_address)
164 FIELD(auto_config_token)
165 FIELD(auto_config_public_key)
166 FIELD(auto_config_secret_key)
167 FIELD(auto_config_transport_address)
168 FIELD(auto_config_running)
173 monero_address_known =
false;
179 auto_config_running =
false;
187 uint32_t receiving_signer_index = 0;
193 crypto::chacha_iv
iv;
207 FIELD(transport_address)
208 FIELD(monero_address)
218 crypto::chacha_iv
iv;
225 FIELD(encrypted_data)
256 FIELD(view_secret_key)
258 FIELD(multisig_is_ready)
259 FIELD(has_multisig_partial_key_images)
269 message_store(std::unique_ptr<epee::net_utils::http::abstract_http_client> http_client);
275 const std::string &own_transport_address, uint32_t num_authorized_signers, uint32_t num_required_signers);
278 void set_options(
const boost::program_options::variables_map& vm);
279 void set_options(
const std::string &bitmessage_address,
const epee::wipeable_string &bitmessage_login);
287 const boost::optional<std::string> &label,
288 const boost::optional<std::string> &transport_address,
289 const boost::optional<cryptonote::account_public_address> monero_address);
293 bool get_signer_index_by_label(
const std::string label, uint32_t &index)
const;
295 bool signer_config_complete()
const;
296 bool signer_labels_complete()
const;
297 void get_signer_config(std::string &signer_config);
299 std::vector<authorized_signer> &signers);
303 bool check_auto_config_token(
const std::string &raw_token,
304 std::string &adjusted_token)
const;
306 const std::string &auto_config_token);
307 void process_auto_config_data_message(uint32_t
id);
308 std::string get_config_checksum()
const;
309 void stop_auto_config();
329 std::vector<processing_data> &data_list,
330 std::string &wait_reason);
337 bool get_message_by_id(uint32_t
id,
message &m)
const;
338 message get_message_by_id(uint32_t
id)
const;
339 void set_message_processed_or_sent(uint32_t
id);
340 void delete_message(uint32_t
id);
341 void delete_all_messages();
342 static std::string get_sanitized_text(
const std::string &text,
size_t max_length);
346 void stop() { m_run.store(
false, std::memory_order_relaxed); m_transporter.stop(); }
351 template <
class t_archive>
355 a & m_num_authorized_signers;
357 a & m_num_required_signers;
360 a & m_next_message_id;
382 static void init_options(boost::program_options::options_description& desc_params);
397 bool get_message_index_by_id(uint32_t
id,
size_t &index)
const;
398 size_t get_message_index_by_id(uint32_t
id)
const;
399 message& get_message_ref_by_id(uint32_t
id);
402 size_t get_other_signers_id_count(
const std::vector<uint32_t> &ids)
const;
403 bool message_ids_complete(
const std::vector<uint32_t> &ids)
const;
408 std::string create_auto_config_token();
409 void setup_signer_for_auto_config(uint32_t index,
const std::string token,
bool receiving);
410 void delete_transport_message(uint32_t
id);
427 template <
class Archive>
436 template <
class Archive>
455 template <
class Archive>
475 template <
class Archive>
483 template <
class Archive>
492 template <
class Archive>
493 inline void serialize(Archive &
a, crypto::chacha_iv &x,
const boost::serialization::version_type ver)
static void init(std::string cache_filename)
Definition: blockchain_blackball.cpp:221
Definition: message_store.h:267
std::vector< authorized_signer > m_signers
Definition: message_store.h:390
uint32_t m_num_authorized_signers
Definition: message_store.h:386
void set_active(bool active)
Definition: message_store.h:276
bool get_auto_send() const
Definition: message_store.h:281
const std::vector< message > & get_all_messages() const
Definition: message_store.h:336
uint32_t m_next_message_id
Definition: message_store.h:392
void stop()
Definition: message_store.h:346
uint32_t m_num_required_signers
Definition: message_store.h:387
const std::vector< authorized_signer > & get_all_signers() const
Definition: message_store.h:294
std::string m_filename
Definition: message_store.h:393
uint32_t get_num_required_signers() const
Definition: message_store.h:282
bool m_auto_send
Definition: message_store.h:388
void set_auto_send(bool auto_send)
Definition: message_store.h:277
cryptonote::network_type m_nettype
Definition: message_store.h:389
uint32_t get_num_authorized_signers() const
Definition: message_store.h:283
bool m_active
Definition: message_store.h:385
bool get_active() const
Definition: message_store.h:280
std::atomic< bool > m_run
Definition: message_store.h:395
void serialize(t_archive &a, const unsigned int ver)
Definition: message_store.h:352
std::vector< message > m_messages
Definition: message_store.h:391
message_transporter m_transporter
Definition: message_store.h:394
Definition: message_transporter.h:83
#define tr(x)
Definition: common_defines.h:4
const char * i18n_translate(const char *s, const std::string &context)
Definition: i18n.cpp:321
string a
Definition: MakeCryptoOps.py:15
bool read_from_file(epee::wipeable_string &pass)
Definition: password.cpp:208
void serialize(Archive &a, crypto::chacha_iv &x, const boost::serialization::version_type ver)
Definition: message_store.h:493
void save(Archive &a, const std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Definition: unordered_containers_boost_serialization.h:42
Definition: unordered_containers_boost_serialization.h:38
const
Definition: build_protob.py:9
const crypto::public_key null_pkey
Definition: crypto.cpp:74
const crypto::secret_key null_skey
Definition: crypto.cpp:75
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:67
POD_CLASS public_key
Definition: crypto.h:61
POD_CLASS hash
Definition: hash.h:48
network_type
Definition: cryptonote_config.h:273
void init_options(boost::program_options::options_description &hidden_options, boost::program_options::options_description &normal_options)
Definition: posix_daemonizer.inl:56
Definition: message_store.cpp:49
message_direction
Definition: message_store.h:72
message_state
Definition: message_store.h:78
message_processing
Definition: message_store.h:89
@ process_auto_config_data
message_type
Definition: message_store.h:60
Definition: binary_utils.h:36
Definition: blockchain_ancestry.cpp:72
BOOST_CLASS_VERSION(nodetool::peerlist_types, nodetool::CURRENT_PEERLIST_STORAGE_ARCHIVE_VER)
static std::string decrypt(const std::string &ciphertext, const crypto::key_image &key_image, const crypto::chacha_key &key, uint8_t field)
Definition: ringdb.cpp:138
static std::string encrypt(const std::string &plaintext, const crypto::key_image &key_image, const crypto::chacha_key &key, uint8_t field)
Definition: ringdb.cpp:123
Simple DSL AAPI based on.
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL \detailed for described the serialization of an object
Definition: serialization.h:191
#define FIELD(f)
tags the field with the variable name and then serializes it
Definition: serialization.h:244
#define VERSION_FIELD(v)
Definition: serialization.h:295
#define END_SERIALIZE()
self-explanatory
Definition: serialization.h:215
#define VARINT_FIELD(f)
tags and serializes the varint f
Definition: serialization.h:264
static const unsigned char iv[64]
Definition: sha512-hash.c:13
Definition: cryptonote_basic.h:501
Definition: message_store.h:143
cryptonote::account_public_address monero_address
Definition: message_store.h:147
crypto::secret_key auto_config_secret_key
Definition: message_store.h:152
bool me
Definition: message_store.h:148
bool auto_config_running
Definition: message_store.h:154
std::string transport_address
Definition: message_store.h:145
std::string label
Definition: message_store.h:144
uint32_t index
Definition: message_store.h:149
std::string auto_config_token
Definition: message_store.h:150
bool monero_address_known
Definition: message_store.h:146
crypto::public_key auto_config_public_key
Definition: message_store.h:151
std::string auto_config_transport_address
Definition: message_store.h:153
Definition: message_store.h:199
std::string label
Definition: message_store.h:200
std::string transport_address
Definition: message_store.h:201
cryptonote::account_public_address monero_address
Definition: message_store.h:202
Definition: message_store.h:215
std::string magic_string
Definition: message_store.h:216
crypto::chacha_iv iv
Definition: message_store.h:218
std::string encrypted_data
Definition: message_store.h:219
uint32_t file_version
Definition: message_store.h:217
Definition: message_store.h:191
crypto::chacha_iv iv
Definition: message_store.h:193
cryptonote::account_public_address sender_address
Definition: message_store.h:192
message internal_message
Definition: message_store.h:195
crypto::public_key encryption_public_key
Definition: message_store.h:194
Definition: message_store.h:103
uint64_t modified
Definition: message_store.h:109
uint32_t signer_index
Definition: message_store.h:111
uint32_t wallet_height
Definition: message_store.h:114
message_state state
Definition: message_store.h:113
crypto::hash hash
Definition: message_store.h:112
uint32_t round
Definition: message_store.h:115
message_type type
Definition: message_store.h:105
std::string content
Definition: message_store.h:107
uint64_t sent
Definition: message_store.h:110
uint32_t id
Definition: message_store.h:104
uint64_t created
Definition: message_store.h:108
std::string transport_id
Definition: message_store.h:117
message_direction direction
Definition: message_store.h:106
uint32_t signature_count
Definition: message_store.h:116
Definition: message_store.h:241
cryptonote::network_type nettype
Definition: message_store.h:243
uint32_t multisig_rounds_passed
Definition: message_store.h:248
crypto::secret_key view_secret_key
Definition: message_store.h:244
size_t num_transfer_details
Definition: message_store.h:249
bool has_multisig_partial_key_images
Definition: message_store.h:247
bool multisig_is_ready
Definition: message_store.h:246
cryptonote::account_public_address address
Definition: message_store.h:242
std::string mms_file
Definition: message_store.h:250
bool multisig
Definition: message_store.h:245
Definition: message_store.h:184
std::vector< uint32_t > message_ids
Definition: message_store.h:186
message_processing processing
Definition: message_store.h:185
Definition: blake256.h:36