-
-
Notifications
You must be signed in to change notification settings - Fork 580
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
e2e key backups #684
e2e key backups #684
Changes from 1 commit
fb1b554
e0c9b99
69204d4
d556189
1faf477
fb8efe3
75107f9
e5ec479
73e294b
ec5fff2
017f81e
bf873bd
29db856
72bd51f
3838fab
e789747
073fb73
009430e
f75d188
3af9af9
54c443a
e4bb37b
0bad7b2
a78825e
1b62a21
2f4c1df
c556ca4
63cc3fd
33ad65a
e9b0aca
ce2058a
7cd101d
262ace1
258adda
89c3f6f
b3fe05e
59e6066
ada4b6e
da65f43
fc59bc2
3957006
9b12c22
91fb7b0
d49c0a1
40d0a82
434ac86
322ef1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -940,6 +940,7 @@ Crypto.prototype.exportRoomKeys = async function() { | |
const sess = this._olmDevice.exportInboundGroupSession( | ||
s.senderKey, s.sessionId, s.sessionData, | ||
); | ||
delete sess.first_known_index; | ||
sess.algorithm = olmlib.MEGOLM_ALGORITHM; | ||
exportedSessions.push(sess); | ||
}); | ||
|
@@ -1002,13 +1003,21 @@ Crypto.prototype._maybeSendKeyBackup = async function() { | |
sessionData.algorithm = olmlib.MEGOLM_ALGORITHM; | ||
delete sessionData.session_id; | ||
delete sessionData.room_id; | ||
const firstKnownIndex = sessionData.first_known_index; | ||
delete sessionData.first_known_index; | ||
const encrypted = this.backupKey.encrypt(JSON.stringify(sessionData)); | ||
|
||
const forwardedCount = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no forwardingCurve25519KeyChain field in the dict returned by exportInboundGroupSession but forwarding_curve25519_key_chain. The mix of forwarding_curve25519_key_chain and forwardingCurve25519KeyChain in the js code makes me terrified. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good spot - turns out this was completely broken |
||
(sessionData.forwardingCurve25519KeyChain || []).length; | ||
|
||
const device = this._deviceList.getDeviceByIdentityKey( | ||
olmlib.MEGOLM_ALGORITHM, session.senderKey, | ||
); | ||
|
||
data[roomId]['sessions'][session.sessionId] = { | ||
first_message_index: 1, // FIXME | ||
forwarded_count: | ||
(sessionData.forwardingCurve25519KeyChain || []).length, | ||
is_verified: false, // FIXME: how do we determine this? | ||
first_message_index: firstKnownIndex, | ||
forwarded_count: forwardedCount, | ||
is_verified: !!(device && device.isVerified()), | ||
session_data: encrypted, | ||
}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit magic, but given the name of the function I can't really suggest anything better. Maybe in the future we can deprecate the 3 arg usage of this function altogether.