Skip to content

Commit

Permalink
Update tests to allow x-signing key upload without UIA (#1383)
Browse files Browse the repository at this point in the history
* Update test for MSC3967

* Remove redundant UIA for cross-signing-key upload

MSC3967 says this is no longer needed.
  • Loading branch information
richvdh authored Jun 14, 2024
1 parent 420f5bd commit 2d5e02f
Showing 1 changed file with 22 additions and 51 deletions.
73 changes: 22 additions & 51 deletions tests/41end-to-end-keys/08-cross-signing.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
my $user_id = $user->user_id;

matrix_set_cross_signing_key( $user, {
"auth" => {
type => "m.login.password",
identifier => {
type => "m.id.user",
user => $user->user_id,
},
password => $user->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -52,23 +44,37 @@
});
};

test "Fails to upload self-signing keys with no auth",
test "Fails to replace cross-signing keys with no auth",
requires => [ local_user_fixture(), qw( can_upload_self_signing_keys ) ],

do => sub {
my ( $user ) = @_;
my $user_id = $user->user_id;

# Initial upload does not require UIA
matrix_set_cross_signing_key( $user, {
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
"usage" => ["master"],
"keys" => {
"master_key" => {
# private key: HvQBbU+hc2Zr+JP1sE0XwBe1pfZZEYtJNPJLZJtS+F8
"user_id" => $user_id,
"usage" => ["master"],
"keys" => {
"ed25519:EmkqvokUn8p+vQAGZitOk4PWjp7Ukp3txV2TbMPEiBQ"
=> "EmkqvokUn8p+vQAGZitOk4PWjp7Ukp3txV2TbMPEiBQ",
},
},
})->then( sub {
# Replacing the key with no auth should be rejected
matrix_set_cross_signing_key( $user, {
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
"usage" => ["master"],
"keys" => {
"ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk"
=> "nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk",
},
},
},
},
});
})->main::expect_http_401;
};

Expand All @@ -80,11 +86,6 @@
my $user_id = $user->user_id;

matrix_set_cross_signing_key( $user, {
"auth" => {
"type" => "m.login.password",
"user" => $user_id,
"password" => $user->password,
},
"self_signing_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -134,11 +135,6 @@
origin => $user_id, key_id => "ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk"
);
matrix_set_cross_signing_key( $user1, {
"auth" => {
"type" => "m.login.password",
"user" => $user_id,
"password" => $user1->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -285,11 +281,6 @@
origin => $user_id, key_id => "ed25519:nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk"
);
matrix_set_cross_signing_key( $user1, {
"auth" => {
"type" => "m.login.password",
"user" => $user_id,
"password" => $user1->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user_id,
Expand Down Expand Up @@ -329,11 +320,6 @@
});
})->then( sub {
matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: OMkooTr76ega06xNvXIGPbgvvxAOzmQncN8VObS7aBA
"user_id" => $user2_id,
Expand Down Expand Up @@ -436,11 +422,6 @@
);

matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user2_id,
Expand Down Expand Up @@ -532,11 +513,6 @@
sync_until_user_in_device_list( $user1, $user2 );
})->then( sub {
matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user2_id,
Expand Down Expand Up @@ -621,11 +597,6 @@

matrix_put_e2e_keys( $user2, device_keys => $device)->then( sub {
matrix_set_cross_signing_key( $user2, {
"auth" => {
"type" => "m.login.password",
"user" => $user2_id,
"password" => $user2->password,
},
"master_key" => {
# private key: 2lonYOM6xYKdEsO+6KrC766xBcHnYnim1x/4LFGF8B0
"user_id" => $user2_id,
Expand Down

0 comments on commit 2d5e02f

Please sign in to comment.