Java Code Examples for org.whispersystems.signalservice.internal.util.Base64#decode()

The following examples show how to use org.whispersystems.signalservice.internal.util.Base64#decode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SocketHandler.java    From signald with GNU General Public License v3.0 5 votes vote down vote up
private void updateGroup(JsonRequest request) throws IOException, EncapsulatedExceptions, UntrustedIdentityException, GroupNotFoundException, AttachmentInvalidException, NotAGroupMemberException, NoSuchAccountException {
  Manager m = Manager.get(request.username);

  byte[] groupId = null;
  if(request.recipientGroupId != null) {
    groupId = Base64.decode(request.recipientGroupId);
  }
  if (groupId == null) {
      groupId = new byte[0];
  }

  String groupName = request.groupName;
  if(groupName == null) {
      groupName = "";
  }

  List<String> groupMembers = request.members;
  if (groupMembers == null) {
      groupMembers = new ArrayList<>();
  }

  String groupAvatar = request.avatar;
  if (groupAvatar == null) {
      groupAvatar = "";
  }

  byte[] newGroupId = m.updateGroup(groupId, groupName, groupMembers, groupAvatar);

  if (groupId.length != newGroupId.length) {
      this.reply("group_created", new JsonStatusMessage(5, "Created new group " + groupName + "."), request.id);
  } else {
      this.reply("group_updated", new JsonStatusMessage(6, "Updated group"), request.id);
  }
}
 
Example 2
Source File: SocketHandler.java    From signald with GNU General Public License v3.0 5 votes vote down vote up
private void setExpiration(JsonRequest request) throws IOException, GroupNotFoundException, NotAGroupMemberException, AttachmentInvalidException, UntrustedIdentityException, EncapsulatedExceptions, NoSuchAccountException {
  Manager m = Manager.get(request.username);

  if(request.recipientGroupId != null) {
    byte[] groupId = Base64.decode(request.recipientGroupId);
    m.setExpiration(groupId, request.expiresInSeconds);
  } else {
    m.setExpiration(request.recipientNumber, request.expiresInSeconds);
  }

  this.reply("expiration_updated", null, request.id);
}
 
Example 3
Source File: FriendMessageEnvelop.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
public FriendMessageEnvelop(String message) throws IOException {
    this(Base64.decode(message));
}
 
Example 4
Source File: SocketHandler.java    From signald with GNU General Public License v3.0 4 votes vote down vote up
private void leaveGroup(JsonRequest request) throws IOException, GroupNotFoundException, UntrustedIdentityException, NotAGroupMemberException, EncapsulatedExceptions, NoSuchAccountException {
  Manager m = Manager.get(request.username);
  byte[] groupId = Base64.decode(request.recipientGroupId);
  m.sendQuitGroupMessage(groupId);
  this.reply("left_group", new JsonStatusMessage(7, "Successfully left group"), request.id);
}
 
Example 5
Source File: AccountData.java    From signald with GNU General Public License v3.0 4 votes vote down vote up
public byte[] getProfileKey() throws IOException {
    if(profileKey == null || profileKey.equals("")) {
        return null;
    }
    return Base64.decode(profileKey);
}