Skip to content

Commit

Permalink
Check that master key is returned when querying device for first time (
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston authored Nov 11, 2021
1 parent 57c856c commit 491d3fe
Showing 1 changed file with 23 additions and 1 deletion.
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");

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

0 comments on commit 491d3fe

Please sign in to comment.