mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-27 21:24:42 +00:00
Accept any length group link password.
This commit is contained in:
@@ -33,7 +33,11 @@ public final class GroupInviteLinkUrlTest {
|
||||
|
||||
givenGroup().withMasterKey("00f7e0c2a71ab064cc3ced4c04f08d7b7ef4b84b2c2206f69833be6cfe34df80")
|
||||
.andPassword("9bc324eec437cfda6ae5b8aefbf47ee8")
|
||||
.expectUrl("https://signal.group/#CjQKIAD34MKnGrBkzDztTATwjXt-9LhLLCIG9pgzvmz-NN-AEhCbwyTuxDfP2mrluK779H7o")
|
||||
.expectUrl("https://signal.group/#CjQKIAD34MKnGrBkzDztTATwjXt-9LhLLCIG9pgzvmz-NN-AEhCbwyTuxDfP2mrluK779H7o"),
|
||||
|
||||
givenGroup().withMasterKey("00f7e0c2a71ab064cc3ced4c04f08d7b7ef4b84b2c2206f69833be6cfe34df80")
|
||||
.andPassword("9b")
|
||||
.expectUrl("https://signal.group/#CiUKIAD34MKnGrBkzDztTATwjXt-9LhLLCIG9pgzvmz-NN-AEgGb")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,11 +95,7 @@ public final class GroupInviteLinkUrlTest {
|
||||
}
|
||||
|
||||
public Object[] expectUrl(String url) {
|
||||
try {
|
||||
return new Object[]{ groupMasterKey, GroupLinkPassword.fromBytes(passwordBytes), url };
|
||||
} catch (GroupLinkPassword.InvalidLengthException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
return new Object[]{ groupMasterKey, GroupLinkPassword.fromBytes(passwordBytes), url };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,20 +92,6 @@ public final class GroupInviteLinkUrl_InvalidGroupLinkException_Test {
|
||||
.hasCauseExactlyInstanceOf(InvalidInputException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bad_password_length() throws InvalidInputException {
|
||||
GroupMasterKey groupMasterKey = new GroupMasterKey(Util.getSecretBytes(32));
|
||||
byte[] passwordBytes = Util.getSecretBytes(15);
|
||||
|
||||
String encoding = createEncodedProtobuf(groupMasterKey.serialize(), passwordBytes);
|
||||
|
||||
String url = "https://signal.group/#" + encoding;
|
||||
|
||||
assertThatThrownBy(() -> GroupInviteLinkUrl.fromUrl(url))
|
||||
.isInstanceOf(GroupInviteLinkUrl.InvalidGroupLinkException.class)
|
||||
.hasCauseExactlyInstanceOf(GroupLinkPassword.InvalidLengthException.class);
|
||||
}
|
||||
|
||||
private static String createEncodedProtobuf(@NonNull byte[] groupMasterKey,
|
||||
@NonNull byte[] passwordBytes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user