From 491d3fed866fc6657d8690fb6ccceace6148a76e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 11 Nov 2021 11:50:22 +0000 Subject: [PATCH] Check that master key is returned when querying device for first time (#1166) See matrix-org/synapse#11234 --- tests/41end-to-end-keys/08-cross-signing.pl | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/41end-to-end-keys/08-cross-signing.pl b/tests/41end-to-end-keys/08-cross-signing.pl index 23f69266f..07b721a3a 100644 --- a/tests/41end-to-end-keys/08-cross-signing.pl +++ b/tests/41end-to-end-keys/08-cross-signing.pl @@ -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"); + + matrix_sync_again( $user1 ) })->then( sub { sign_json( $device, secret_key => $self_signing_secret_key, @@ -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}, { @@ -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); }); };