Fix keys upload
This commit is contained in:
parent
95deba1139
commit
6d83e1d4d3
1 changed files with 5 additions and 8 deletions
|
@ -967,23 +967,20 @@ json_t* Client::get_device_keys() {
|
||||||
size_t acclen = acc.get_identity_json_length();
|
size_t acclen = acc.get_identity_json_length();
|
||||||
std::unique_ptr<uint8_t[]> acckeys = std::make_unique<uint8_t[]>(acclen);
|
std::unique_ptr<uint8_t[]> acckeys = std::make_unique<uint8_t[]>(acclen);
|
||||||
size_t bytes = acc.get_identity_json(acckeys.get(), acclen);
|
size_t bytes = acc.get_identity_json(acckeys.get(), acclen);
|
||||||
std::cout << "Parsing bytes" << std::endl;
|
|
||||||
json_error_t error;
|
json_error_t error;
|
||||||
sleep(5);
|
|
||||||
std::cout << "Heading into it..." << std::endl;
|
|
||||||
json_t* keys = json_loadb(reinterpret_cast<const char*>(acckeys.get()), bytes, 0, &error);
|
json_t* keys = json_loadb(reinterpret_cast<const char*>(acckeys.get()), bytes, 0, &error);
|
||||||
if (keys == nullptr) {
|
if (keys == nullptr) {
|
||||||
printf("error: on line %d at char %d: %s\n", error.line, error.column, error.text);
|
printf("error: on line %d at char %d: %s\n", error.line, error.column, error.text);
|
||||||
sleep(10);
|
sleep(10);
|
||||||
}
|
}
|
||||||
std::cout << "Reloaded data" << std::endl;
|
|
||||||
std::cout << "Adding bits" << std::endl;
|
|
||||||
|
|
||||||
// Merge keys
|
// Merge keys
|
||||||
json_object_set(device_keys, ("ed25519:" + getDeviceId()).c_str(), json_object_get(keys, "ed25519"));
|
json_t* keysobj = json_object();
|
||||||
json_object_set(device_keys, ("curve25519:" + getDeviceId()).c_str(), json_object_get(keys, "curve25519"));
|
json_object_set(keysobj, ("ed25519:" + getDeviceId()).c_str(), json_object_get(keys, "ed25519"));
|
||||||
|
json_object_set(keysobj, ("curve25519:" + getDeviceId()).c_str(), json_object_get(keys, "curve25519"));
|
||||||
json_decref(keys);
|
json_decref(keys);
|
||||||
std::cout << "Finalizing" << std::endl;
|
|
||||||
|
json_object_set_new(device_keys, "keys", keysobj);
|
||||||
return device_keys;
|
return device_keys;
|
||||||
}
|
}
|
||||||
json_t* Client::get_fallback_keys() {
|
json_t* Client::get_fallback_keys() {
|
||||||
|
|
Loading…
Reference in a new issue