diff --git a/src/jamidht/accountarchive.cpp b/src/jamidht/accountarchive.cpp index 874f2b9f4b38f3db7c8178a2068566a93c4ed4d8..673174f907dfbbe9524398b5969a254fee750663 100644 --- a/src/jamidht/accountarchive.cpp +++ b/src/jamidht/accountarchive.cpp @@ -18,11 +18,12 @@ #include "accountarchive.h" #include "account_const.h" -#include "configurationmanager_interface.h" #include "configkeys.h" #include "base64.h" #include "logger.h" +#include <json/json.h> + namespace jami { void @@ -44,7 +45,6 @@ AccountArchive::deserialize(const std::vector<uint8_t>& dat) // Import content try { - config = DRing::getAccountTemplate(DRing::Account::ProtocolNames::RING); for (Json::ValueIterator itr = value.begin(); itr != value.end(); itr++) { try { const auto key = itr.key().asString(); @@ -54,14 +54,11 @@ AccountArchive::deserialize(const std::vector<uint8_t>& dat) } else if (key.compare(DRing::Account::ConfProperties::TLS::PRIVATE_KEY_FILE) == 0) { } else if (key.compare(DRing::Account::ConfProperties::TLS::CERTIFICATE_FILE) == 0) { } else if (key.compare(Conf::RING_CA_KEY) == 0) { - ca_key = std::make_shared<dht::crypto::PrivateKey>( - base64::decode(itr->asString())); + ca_key = std::make_shared<dht::crypto::PrivateKey>(base64::decode(itr->asString())); } else if (key.compare(Conf::RING_ACCOUNT_KEY) == 0) { - id.first = std::make_shared<dht::crypto::PrivateKey>( - base64::decode(itr->asString())); + id.first = std::make_shared<dht::crypto::PrivateKey>(base64::decode(itr->asString())); } else if (key.compare(Conf::RING_ACCOUNT_CERT) == 0) { - id.second = std::make_shared<dht::crypto::Certificate>( - base64::decode(itr->asString())); + id.second = std::make_shared<dht::crypto::Certificate>(base64::decode(itr->asString())); } else if (key.compare(Conf::RING_ACCOUNT_CONTACTS) == 0) { for (Json::ValueIterator citr = itr->begin(); citr != itr->end(); citr++) { dht::InfoHash h {citr.key().asString()}; @@ -71,10 +68,10 @@ AccountArchive::deserialize(const std::vector<uint8_t>& dat) } else if (key.compare(Conf::ETH_KEY) == 0) { eth_key = base64::decode(itr->asString()); } else if (key.compare(Conf::RING_ACCOUNT_CRL) == 0) { - revoked = std::make_shared<dht::crypto::RevocationList>( - base64::decode(itr->asString())); - } else + revoked = std::make_shared<dht::crypto::RevocationList>(base64::decode(itr->asString())); + } else { config[key] = itr->asString(); + } } catch (const std::exception& ex) { JAMI_ERR("Can't parse JSON entry with value of type %d: %s", (unsigned) itr->type(),