Java Code Examples for org.whispersystems.signalservice.api.profiles.SignalServiceProfile#Capabilities

The following examples show how to use org.whispersystems.signalservice.api.profiles.SignalServiceProfile#Capabilities . These examples are extracted from open source projects. 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
public AccountAttributes(String signalingKey,
                         int registrationId,
                         boolean fetchesMessages,
                         String pin,
                         String registrationLock,
                         byte[] unidentifiedAccessKey,
                         boolean unrestrictedUnidentifiedAccess,
                         SignalServiceProfile.Capabilities capabilities)
{
  this.signalingKey                   = signalingKey;
  this.registrationId                 = registrationId;
  this.voice                          = true;
  this.video                          = true;
  this.fetchesMessages                = fetchesMessages;
  this.pin                            = pin;
  this.registrationLock               = registrationLock;
  this.unidentifiedAccessKey          = unidentifiedAccessKey;
  this.unrestrictedUnidentifiedAccess = unrestrictedUnidentifiedAccess;
  this.capabilities                   = capabilities;
}
 
Example 2
public VerifyAccountResponse verifyAccountCode(String verificationCode, String signalingKey, int registrationId, boolean fetchesMessages,
                              String pin, String registrationLock,
                              byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess,
                              SignalServiceProfile.Capabilities capabilities)
    throws IOException
{
  AccountAttributes signalingKeyEntity = new AccountAttributes(signalingKey, registrationId, fetchesMessages, pin, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities);
  String            requestBody        = JsonUtil.toJson(signalingKeyEntity);
  String            responseBody       = makeServiceRequest(String.format(VERIFY_ACCOUNT_CODE_PATH, verificationCode), "PUT", requestBody);

  return JsonUtil.fromJson(responseBody, VerifyAccountResponse.class);
}
 
Example 3
public void setAccountAttributes(String signalingKey, int registrationId, boolean fetchesMessages,
                                 String pin, String registrationLock,
                                 byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess,
                                 SignalServiceProfile.Capabilities capabilities)
    throws IOException
{
  if (registrationLock != null && pin != null) {
    throw new AssertionError("Pin should be null if registrationLock is set.");
  }

  AccountAttributes accountAttributes = new AccountAttributes(signalingKey, registrationId, fetchesMessages, pin, registrationLock,
                                                              unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities);
  makeServiceRequest(SET_ACCOUNT_ATTRIBUTES, "PUT", JsonUtil.toJson(accountAttributes));
}
 
Example 4
public void setCapabilities(@NonNull RecipientId id, @NonNull SignalServiceProfile.Capabilities capabilities) {
  ContentValues values = new ContentValues(2);
  values.put(UUID_CAPABILITY,      Recipient.Capability.fromBoolean(capabilities.isUuid()).serialize());
  values.put(GROUPS_V2_CAPABILITY, Recipient.Capability.fromBoolean(capabilities.isGv2()).serialize());
  if (update(id, values)) {
    Recipient.live(id).refresh();
  }
}
 
Example 5
private void setProfileCapabilities(@Nullable SignalServiceProfile.Capabilities capabilities) {
  if (capabilities == null) {
    return;
  }

  DatabaseFactory.getRecipientDatabase(context).setCapabilities(Recipient.self().getId(), capabilities);
}
 
Example 6
private void setProfileCapabilities(@NonNull Recipient recipient, @Nullable SignalServiceProfile.Capabilities capabilities) {
  if (capabilities == null) {
    return;
  }

  DatabaseFactory.getRecipientDatabase(context).setCapabilities(recipient.getId(), capabilities);
}
 
Example 7
public SignalServiceProfile.Capabilities getCapabilities() {
  return capabilities;
}
 
Example 8
/**
 * Verify a Signal Service account with a received SMS or voice verification code.
 *
 * @param verificationCode The verification code received via SMS or Voice
 *                         (see {@link #requestSmsVerificationCode} and
 *                         {@link #requestVoiceVerificationCode}).
 * @param signalingKey 52 random bytes.  A 32 byte AES key and a 20 byte Hmac256 key,
 *                     concatenated.
 * @param signalProtocolRegistrationId A random 14-bit number that identifies this Signal install.
 *                                     This value should remain consistent across registrations for the
 *                                     same install, but probabilistically differ across registrations
 *                                     for separate installs.
 * @param pin Deprecated, only supply the pin if you did not find a registrationLock on KBS.
 * @param registrationLock Only supply if found on KBS.
 * @return The UUID of the user that was registered.
 * @throws IOException
 */
public VerifyAccountResponse verifyAccountWithCode(String verificationCode, String signalingKey, int signalProtocolRegistrationId, boolean fetchesMessages,
                                                   String pin, String registrationLock,
                                                   byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess,
                                                   SignalServiceProfile.Capabilities capabilities)
    throws IOException
{
  return this.pushServiceSocket.verifyAccountCode(verificationCode, signalingKey,
                                                  signalProtocolRegistrationId,
                                                  fetchesMessages,
                                                  pin, registrationLock,
                                                  unidentifiedAccessKey,
                                                  unrestrictedUnidentifiedAccess,
                                                  capabilities);
}
 
Example 9
/**
 * Refresh account attributes with server.
 *
 * @param signalingKey 52 random bytes.  A 32 byte AES key and a 20 byte Hmac256 key, concatenated.
 * @param signalProtocolRegistrationId A random 14-bit number that identifies this Signal install.
 *                                     This value should remain consistent across registrations for the same
 *                                     install, but probabilistically differ across registrations for
 *                                     separate installs.
 * @param pin Only supply if pin has not yet been migrated to KBS.
 * @param registrationLock Only supply if found on KBS.
 *
 * @throws IOException
 */
public void setAccountAttributes(String signalingKey, int signalProtocolRegistrationId, boolean fetchesMessages,
                                 String pin, String registrationLock,
                                 byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess,
                                 SignalServiceProfile.Capabilities capabilities)
    throws IOException
{
  this.pushServiceSocket.setAccountAttributes(signalingKey, signalProtocolRegistrationId, fetchesMessages,
                                              pin, registrationLock,
                                              unidentifiedAccessKey, unrestrictedUnidentifiedAccess,
                                              capabilities);
}
 
Example 10
/**
 * @param storageCapable Whether or not the user can use storage service. This is another way of
 *                       asking if the user has set a Signal PIN or not.
 */
public static SignalServiceProfile.Capabilities getCapabilities(boolean storageCapable) {
  return new SignalServiceProfile.Capabilities(UUID_CAPABLE, FeatureFlags.groupsV2(), storageCapable);
}