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

Invalidate device lists when encryption is enabled in a room #359

Merged
merged 5 commits into from
Feb 9, 2017

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Feb 8, 2017

... and other stories.

Most of this was cleanup work to get to a state where this change didn't break all the tests inexplicably. The commits might make some sense on their own - or I can pull it into separate PRs if you like.

we only really hit this in the tests, but it's a bit silly to download the
complete device list on every message.
89ced19 added some code which flagged our own device list as in need of an
update. However, 8d50274 then added code such that we invalidate *all* members
of e2e rooms on the first initialsync - which should include ourselves. We can
therefore remove the redundant special-case, which mostly serves to simplify
the tests.
@ara4n ara4n self-assigned this Feb 8, 2017
@@ -64,7 +64,7 @@ OlmEncryption.prototype._ensureSession = function(roomMembers) {
}

const self = this;
this._prepPromise = self._crypto.downloadKeys(roomMembers, true).then(function(res) {
this._prepPromise = self._crypto.downloadKeys(roomMembers).then(function(res) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this for the old m.room.encrypted m.olm.v1.curve25519-aes-sha2 messages?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup. that's why it hasn't been a problem in practice.

@@ -351,7 +351,6 @@ describe("MatrixClient", function() {

httpBackend.when("POST", "/keys/query").check(function(req) {
expect(req.data).toEqual({device_keys: {
'@alice:localhost': {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm a little surprised that we no longer see our own key here...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or rather, our own userId.

so... the reason for this is, as per the comment on bd07310, we no longer automatically queue up our own userId as needing a refresh - instead it happens once the initialsync happens. In this test, there is no initialsync, so our own userid isn't invalidated.

type: 'm.room.encryption',
skey: '',
content: {
algorithm: 'm.olm.v1.curve25519-aes-sha2',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I be surprised that the alg here is olm and not megolm, given it's for a room?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per

* Note that megolm (group) conversation is not tested here.
, this test file doesn't really do megolm - most of the tests here pre-existed megolm. The actual algorithm doesn't make any difference for this test.

@ara4n
Copy link
Member

ara4n commented Feb 8, 2017

sounds plausible to me, modulo a few questions of confusion

@ara4n
Copy link
Member

ara4n commented Feb 9, 2017

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants