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

Check that master key is returned when querying device for first time #1166

Merged
merged 5 commits into from
Nov 11, 2021
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
24 changes: 23 additions & 1 deletion tests/41end-to-end-keys/08-cross-signing.pl
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,21 @@
matrix_join_room( $user2, $room_id );
})->then( sub {
sync_until_user_in_device_list( $user1, $user2 );
})->then( sub {
matrix_get_e2e_keys( $user1, $user2_id );
})->then( sub {
my ( $content ) = @_;

log_if_fail "key query content1", $content;

# Check that we do in fact see the master key when querying the
# devices.
assert_json_keys( $content->{master_keys}, $user2_id );
assert_json_keys( $content->{master_keys}->{$user2_id}, "keys");
assert_json_keys( $content->{master_keys}->{$user2_id}{keys},
"ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk");
Comment on lines +664 to +667
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also expect to see this in the second call to matrix_get_e2e_keys on +685?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we should. I suppose its worth checking that its still there


matrix_sync_again( $user1 )
})->then( sub {
sign_json(
$device, secret_key => $self_signing_secret_key,
Expand All @@ -671,8 +686,9 @@
})->then( sub {
my ( $content ) = @_;

log_if_fail "key query content", $content;
log_if_fail "key query content2", $content;

# Check that fetching the devices again returns the new signature
assert_json_keys( $content->{device_keys}->{$user2_id}->{$user2_device}, "signatures" );

assert_deeply_eq( $content->{device_keys}->{$user2_id}->{$user2_device}->{signatures}, {
Expand All @@ -681,6 +697,12 @@
},
} );

# Check that we still see the master key when querying the devices.
assert_json_keys( $content->{master_keys}, $user2_id );
assert_json_keys( $content->{master_keys}->{$user2_id}, "keys");
assert_json_keys( $content->{master_keys}->{$user2_id}{keys},
"ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk");

Future->done(1);
});
};
Expand Down