aboutsummaryrefslogtreecommitdiff
path: root/lib/encryptionmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/encryptionmanager.cpp')
-rw-r--r--lib/encryptionmanager.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/encryptionmanager.cpp b/lib/encryptionmanager.cpp
index a62775d9..c2e244fc 100644
--- a/lib/encryptionmanager.cpp
+++ b/lib/encryptionmanager.cpp
@@ -112,19 +112,29 @@ void EncryptionManager::uploadIdentityKeys(Connection* connection)
d->olmAccount->ed25519IdentityKey()
}
},
- /*
- * Signatures for the device key object.
- * A map from user ID, to a map from <algorithm>:<device_id> to the signature.
- * The signature is calculated using the process called Signing JSON.
- */
+ /* signatures should be provided after the unsigned deviceKeys generation */
+ {}
+ };
+
+ QJsonObject deviceKeysJsonObject = toJson(deviceKeys);
+ /* additionally removing signatures key,
+ * since we could not initialize deviceKeys
+ * without an empty signatures value:
+ */
+ deviceKeysJsonObject.remove(QStringLiteral("signatures"));
+ /*
+ * Signatures for the device key object.
+ * A map from user ID, to a map from <algorithm>:<device_id> to the signature.
+ * The signature is calculated using the process called Signing JSON.
+ */
+ deviceKeys.signatures =
+ {
{
+ connection->userId(),
{
- connection->userId(),
{
- {
- ed25519Name + QStringLiteral(":") + connection->deviceId(),
- d->olmAccount->sign(toJson(deviceKeys))
- }
+ ed25519Name + QStringLiteral(":") + connection->deviceId(),
+ d->olmAccount->sign(deviceKeysJsonObject)
}
}
}