@Test public void can_reconstruct_url() { String urlToCompare = expectedUrl; if (urlToCompare.startsWith("sgnl")) { urlToCompare = urlToCompare.replace("sgnl", "https"); } assertEquals(urlToCompare, GroupInviteLinkUrl.createUrl(groupMasterKey, password)); }
protected static @NonNull String createUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password) { GroupInviteLink groupInviteLink = GroupInviteLink.newBuilder() .setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder() .setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize())) .setInviteLinkPassword(ByteString.copyFrom(password.serialize()))) .build(); String encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.toByteArray()); return GROUP_URL_PREFIX + encoding; }
GroupInviteLinkUrl { protected static @NonNull String createUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password) { GroupInviteLink groupInviteLink = GroupInviteLink.newBuilder() .setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder() .setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize())) .setInviteLinkPassword(ByteString.copyFrom(password.serialize()))) .build(); String encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.toByteArray()); return GROUP_URL_PREFIX + encoding; } }
GroupInviteLinkUrl { protected static @NonNull String createUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password) { GroupInviteLink groupInviteLink = GroupInviteLink.newBuilder() .setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder() .setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize())) .setInviteLinkPassword(ByteString.copyFrom(password.serialize()))) .build(); String encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.toByteArray()); return GROUP_URL_PREFIX + encoding; } private  GroupInviteLinkUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password); }
GroupInviteLinkUrl { protected static @NonNull String createUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password) { GroupInviteLink groupInviteLink = GroupInviteLink.newBuilder() .setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder() .setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize())) .setInviteLinkPassword(ByteString.copyFrom(password.serialize()))) .build(); String encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.toByteArray()); return GROUP_URL_PREFIX + encoding; } private  GroupInviteLinkUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password); static GroupInviteLinkUrl forGroup(@NonNull GroupMasterKey groupMasterKey,
                                            @NonNull DecryptedGroup group); static boolean isGroupLink(@NonNull String urlString); static @Nullable GroupInviteLinkUrl fromUri(@NonNull String urlString); @NonNull String getUrl(); @NonNull GroupMasterKey getGroupMasterKey(); @NonNull GroupLinkPassword getPassword(); }
GroupInviteLinkUrl { protected static @NonNull String createUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password) { GroupInviteLink groupInviteLink = GroupInviteLink.newBuilder() .setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder() .setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize())) .setInviteLinkPassword(ByteString.copyFrom(password.serialize()))) .build(); String encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.toByteArray()); return GROUP_URL_PREFIX + encoding; } private  GroupInviteLinkUrl(@NonNull GroupMasterKey groupMasterKey, @NonNull GroupLinkPassword password); static GroupInviteLinkUrl forGroup(@NonNull GroupMasterKey groupMasterKey,
                                            @NonNull DecryptedGroup group); static boolean isGroupLink(@NonNull String urlString); static @Nullable GroupInviteLinkUrl fromUri(@NonNull String urlString); @NonNull String getUrl(); @NonNull GroupMasterKey getGroupMasterKey(); @NonNull GroupLinkPassword getPassword();  }