Merge pull request #1139 from matrix-org/dbkr/fix_create_key_backup_crosssigning_disabled

Fix creating a key backup with cross signing diabled
This commit is contained in:
David Baker
2020-01-03 14:52:16 +00:00
committed by GitHub
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -1505,8 +1505,14 @@ MatrixClient.prototype.createKeyBackupVersion = async function(info) {
// favour of just signing with the cross-singing master key.
await this._crypto._signObject(data.auth_data);
if (this._crypto._crossSigningInfo.getId()) {
if (
this._cryptoCallbacks.getCrossSigningKey &&
this._crypto._crossSigningInfo.getId()
) {
// now also sign the auth data with the cross-signing master key
// we check for the callback explicitly here because we still want to be able
// to create an un-cross-signed key backup if there is a cross-signing key but
// no callback supplied.
await this._crypto._crossSigningInfo.signObject(data.auth_data, "master");
}
+1 -1
View File
@@ -218,7 +218,7 @@ export default function Crypto(baseApis, sessionStore, userId, deviceId,
);
// Assuming no app-supplied callback, default to getting from SSSS.
if (!cryptoCallbacks.getCrossSigningKey) {
if (!cryptoCallbacks.getCrossSigningKey && cryptoCallbacks.getSecretStorageKey) {
cryptoCallbacks.getCrossSigningKey = async (type) => {
return CrossSigningInfo.getFromSecretStorage(type, this._secretStorage);
};