From b39abba41ea6fdd961c3c19332108d20925ff9fb Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 3 Jan 2020 13:32:31 +0000 Subject: [PATCH] Use checkDeviceTrust with key backup We did check if it was signed with a cross signing key which should be the norm going forward, but for completeness, use the proper cross-signing ernabled check for sigs from individual devices too. Also adds a deviceTrust member to the signature so the app can see the cross-signing trust status ofthe device without having to recalculate it. --- src/crypto/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crypto/index.js b/src/crypto/index.js index fa547c395..10b0a0e54 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -1068,6 +1068,7 @@ Crypto.prototype.isKeyBackupTrusted = async function(backupInfo) { ); if (device) { sigInfo.device = device; + sigInfo.deviceTrust = await this.checkDeviceTrust(this._userId, sigInfo.deviceId); try { await olmlib.verifySignature( this._olmDevice, @@ -1095,7 +1096,7 @@ Crypto.prototype.isKeyBackupTrusted = async function(backupInfo) { ret.usable = ret.sigs.some((s) => { return ( s.valid && ( - (s.device && s.device.isVerified()) || + (s.device && s.deviceTrust.isVerified()) || (s.crossSigningId) ) );