Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cross-signing trust to mark backups verified #1244

Merged
merged 1 commit into from
Mar 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/crypto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,18 @@ Crypto.prototype.checkUserTrust = function(userId) {
*/
Crypto.prototype.checkDeviceTrust = function(userId, deviceId) {
const device = this._deviceList.getStoredDevice(userId, deviceId);
return this._checkDeviceInfoTrust(userId, device);
};

/**
* Check whether a given deviceinfo is trusted.
*
* @param {string} userId The ID of the user whose devices is to be checked.
* @param {module:crypto/deviceinfo?} device The device info object to check
*
* @returns {DeviceTrustLevel}
*/
Crypto.prototype._checkDeviceInfoTrust = function(userId, device) {
const trustedLocally = device && device.isVerified();

const userCrossSigning = this._deviceList.getStoredCrossSigningForUser(userId);
Expand Down Expand Up @@ -2135,7 +2147,7 @@ Crypto.prototype._backupPendingKeys = async function(limit) {
data[roomId]['sessions'][session.sessionId] = {
first_message_index: firstKnownIndex,
forwarded_count: forwardedCount,
is_verified: !!(device && device.isVerified()),
is_verified: this._checkDeviceInfoTrust(this._userId, device),
session_data: encrypted,
};
}
Expand Down