Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3524213
D11956.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11956.diff
View Options
diff --git a/lib/handlers/peer-to-peer-message-handler.js b/lib/handlers/peer-to-peer-message-handler.js
--- a/lib/handlers/peer-to-peer-message-handler.js
+++ b/lib/handlers/peer-to-peer-message-handler.js
@@ -1,5 +1,8 @@
// @flow
+import _isEqual from 'lodash/fp/isEqual.js';
+
+import { verifyAndGetDeviceList } from '../shared/device-list-utils.js';
import type {
IdentityServiceClient,
DeviceOlmInboundKeys,
@@ -127,6 +130,38 @@
} catch (e) {
console.log(`Error uploading one-time keys: ${e.message}`);
}
+ } else if (message.type === peerToPeerMessageTypes.DEVICE_LIST_UPDATED) {
+ try {
+ const result = await verifyAndGetDeviceList(
+ identityClient,
+ message.userID,
+ null,
+ );
+ if (result.valid) {
+ console.log(
+ `Received valid device list update for user ${message.userID}`,
+ );
+ const receivedRawList = JSON.parse(
+ message.signedDeviceList.rawDeviceList,
+ );
+
+ // additional check for broadcasted and Identity device list equality
+ const listsAreEqual = _isEqual(result.deviceList)(receivedRawList);
+ console.log(
+ `Identity and received device lists are ${
+ listsAreEqual ? '' : 'not'
+ } equal.`,
+ );
+ } else {
+ console.log(
+ `Received invalid device list update for user ${message.userID}. Reason: ${result.reason}`,
+ );
+ }
+ } catch (e) {
+ console.log(
+ `Error verifying device list for user ${message.userID}: ${e}`,
+ );
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 11:38 AM (6 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699885
Default Alt Text
D11956.diff (1 KB)
Attached To
Mode
D11956: [lib] Verify device lists when received update from peer
Attached
Detach File
Event Timeline
Log In to Comment