Replace Base64 class from libsignal with java.util.Base64

This commit is contained in:
AsamK 2021-01-15 22:31:40 +01:00
parent e6ea5d55f8
commit 9a775171b5
17 changed files with 100 additions and 96 deletions

View file

@ -4,9 +4,9 @@ import org.asamk.signal.manager.groups.GroupUtils;
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
import org.whispersystems.signalservice.api.messages.SignalServiceGroupV2;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.util.Base64;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
class JsonGroupInfo {
@ -17,7 +17,7 @@ class JsonGroupInfo {
String type;
JsonGroupInfo(SignalServiceGroup groupInfo) {
this.groupId = Base64.encodeBytes(groupInfo.getGroupId());
this.groupId = Base64.getEncoder().encodeToString(groupInfo.getGroupId());
if (groupInfo.getMembers().isPresent()) {
this.members = new ArrayList<>(groupInfo.getMembers().get().size());
for (SignalServiceAddress address : groupInfo.getMembers().get()) {
@ -36,6 +36,6 @@ class JsonGroupInfo {
}
JsonGroupInfo(byte[] groupId) {
this.groupId = Base64.encodeBytes(groupId);
this.groupId = Base64.getEncoder().encodeToString(groupId);
}
}

View file

@ -1,7 +1,8 @@
package org.asamk.signal.json;
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.util.Base64;
import java.util.Base64;
public class JsonSticker {
@ -10,8 +11,8 @@ public class JsonSticker {
int stickerId;
public JsonSticker(SignalServiceDataMessage.Sticker sticker) {
this.packId = Base64.encodeBytes(sticker.getPackId());
this.packKey = Base64.encodeBytes(sticker.getPackKey());
this.packId = Base64.getEncoder().encodeToString(sticker.getPackId());
this.packKey = Base64.getEncoder().encodeToString(sticker.getPackKey());
this.stickerId = sticker.getStickerId();
// TODO also download sticker image ??
}