Commit 008d0b63 authored by Adrien Béraud's avatar Adrien Béraud

account archive: avoid using account template

The archive now reports exactly what was in the archive, not more

Change-Id: I63d71fb5c54104706a69ea19b4578c17c0b0e19d
parent f59ff335
......@@ -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(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment