Search in sources :

Example 1 with AvatarUploadAttributes

use of org.signal.storageservice.protos.groups.AvatarUploadAttributes 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();
}
Also used : AvatarUploadAttributes(org.signal.storageservice.protos.groups.AvatarUploadAttributes) ClientZkGroupCipher(org.signal.zkgroup.groups.ClientZkGroupCipher) VerificationFailedException(org.signal.zkgroup.VerificationFailedException)

Aggregations

AvatarUploadAttributes (org.signal.storageservice.protos.groups.AvatarUploadAttributes)1 VerificationFailedException (org.signal.zkgroup.VerificationFailedException)1 ClientZkGroupCipher (org.signal.zkgroup.groups.ClientZkGroupCipher)1