Accept any length group link password.

This commit is contained in:
Alan Evans
2020-08-20 15:03:03 -03:00
committed by Alex Hart
parent 878b0c9275
commit ffcb90da52
4 changed files with 8 additions and 30 deletions

View File

@@ -26,7 +26,6 @@ public final class GroupInviteLinkUrl {
public static GroupInviteLinkUrl forGroup(@NonNull GroupMasterKey groupMasterKey,
@NonNull DecryptedGroup group)
throws GroupLinkPassword.InvalidLengthException
{
return new GroupInviteLinkUrl(groupMasterKey, GroupLinkPassword.fromBytes(group.getInviteLinkPassword().toByteArray()));
}
@@ -73,7 +72,7 @@ public final class GroupInviteLinkUrl {
}
default: throw new UnknownGroupLinkVersionException("Url contains no known group link content");
}
} catch (GroupLinkPassword.InvalidLengthException | InvalidInputException | IOException e){
} catch (InvalidInputException | IOException e) {
throw new InvalidGroupLinkException(e);
}
}

View File

@@ -16,11 +16,7 @@ public final class GroupLinkPassword {
return new GroupLinkPassword(Util.getSecretBytes(SIZE));
}
public static @NonNull GroupLinkPassword fromBytes(@NonNull byte[] bytes) throws InvalidLengthException {
if (bytes.length != SIZE) {
throw new InvalidLengthException();
}
public static @NonNull GroupLinkPassword fromBytes(@NonNull byte[] bytes) {
return new GroupLinkPassword(bytes);
}
@@ -45,7 +41,4 @@ public final class GroupLinkPassword {
public int hashCode() {
return Arrays.hashCode(bytes);
}
public static class InvalidLengthException extends Exception {
}
}