Skip to content

Commit 491d3fe

Browse files
authored
Check that master key is returned when querying device for first time (#1166)
See matrix-org/synapse#11234
1 parent 57c856c commit 491d3fe

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/41end-to-end-keys/08-cross-signing.pl

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,21 @@
652652
matrix_join_room( $user2, $room_id );
653653
})->then( sub {
654654
sync_until_user_in_device_list( $user1, $user2 );
655+
})->then( sub {
656+
matrix_get_e2e_keys( $user1, $user2_id );
657+
})->then( sub {
658+
my ( $content ) = @_;
659+
660+
log_if_fail "key query content1", $content;
661+
662+
# Check that we do in fact see the master key when querying the
663+
# devices.
664+
assert_json_keys( $content->{master_keys}, $user2_id );
665+
assert_json_keys( $content->{master_keys}->{$user2_id}, "keys");
666+
assert_json_keys( $content->{master_keys}->{$user2_id}{keys},
667+
"ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk");
668+
669+
matrix_sync_again( $user1 )
655670
})->then( sub {
656671
sign_json(
657672
$device, secret_key => $self_signing_secret_key,
@@ -671,8 +686,9 @@
671686
})->then( sub {
672687
my ( $content ) = @_;
673688

674-
log_if_fail "key query content", $content;
689+
log_if_fail "key query content2", $content;
675690

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

678694
assert_deeply_eq( $content->{device_keys}->{$user2_id}->{$user2_device}->{signatures}, {
@@ -681,6 +697,12 @@
681697
},
682698
} );
683699

700+
# Check that we still see the master key when querying the devices.
701+
assert_json_keys( $content->{master_keys}, $user2_id );
702+
assert_json_keys( $content->{master_keys}->{$user2_id}, "keys");
703+
assert_json_keys( $content->{master_keys}->{$user2_id}{keys},
704+
"ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk");
705+
684706
Future->done(1);
685707
});
686708
};

0 commit comments

Comments
 (0)