Add group v2 id to json output

This commit is contained in:
AsamK 2020-12-21 11:45:42 +01:00
parent 4d17e50323
commit 2617757edb
3 changed files with 18 additions and 3 deletions

View file

@ -1,6 +1,8 @@
package org.asamk.signal.json;
import org.asamk.signal.manager.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;
@ -28,6 +30,11 @@ class JsonGroupInfo {
this.type = groupInfo.getType().toString();
}
JsonGroupInfo(SignalServiceGroupV2 groupInfo) {
this.groupId = Base64.encodeBytes(GroupUtils.getGroupId(groupInfo.getMasterKey()));
this.type = groupInfo.hasSignedGroupChange() ? "UPDATE" : "DELIVER";
}
JsonGroupInfo(byte[] groupId) {
this.groupId = Base64.encodeBytes(groupId);
}