use of org.signal.zkgroup.groups.ClientZkGroupCipher in project Signal-Android by WhisperSystems.
the class GroupManagerV2 method getUuidCipherTexts.
@WorkerThread
@NonNull
Map<UUID, UuidCiphertext> getUuidCipherTexts(@NonNull GroupId.V2 groupId) {
GroupDatabase.GroupRecord groupRecord = SignalDatabase.groups().requireGroup(groupId);
GroupDatabase.V2GroupProperties v2GroupProperties = groupRecord.requireV2GroupProperties();
GroupMasterKey groupMasterKey = v2GroupProperties.getGroupMasterKey();
ClientZkGroupCipher clientZkGroupCipher = new ClientZkGroupCipher(GroupSecretParams.deriveFromMasterKey(groupMasterKey));
List<Recipient> recipients = v2GroupProperties.getMemberRecipients(GroupDatabase.MemberSet.FULL_MEMBERS_INCLUDING_SELF);
Map<UUID, UuidCiphertext> uuidCipherTexts = new HashMap<>();
for (Recipient recipient : recipients) {
uuidCipherTexts.put(recipient.requireServiceId().uuid(), clientZkGroupCipher.encryptUuid(recipient.requireServiceId().uuid()));
}
return uuidCipherTexts;
}
use of org.signal.zkgroup.groups.ClientZkGroupCipher in project Signal-Android by WhisperSystems.
the class GroupsV2Api method uploadAvatar.
public String uploadAvatar(byte[] avatar, GroupSecretParams groupSecretParams, GroupsV2AuthorizationString authorization) throws IOException {
AvatarUploadAttributes form = socket.getGroupsV2AvatarUploadForm(authorization.toString());
byte[] cipherText;
try {
cipherText = new ClientZkGroupCipher(groupSecretParams).encryptBlob(GroupAttributeBlob.newBuilder().setAvatar(ByteString.copyFrom(avatar)).build().toByteArray());
} catch (VerificationFailedException e) {
throw new AssertionError(e);
}
socket.uploadGroupV2Avatar(cipherText, form);
return form.getKey();
}
Aggregations