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 . 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: AccountAttributes.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
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
Source File: PushServiceSocket.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: PushServiceSocket.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: RecipientDatabase.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: RefreshOwnProfileJob.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private void setProfileCapabilities(@Nullable SignalServiceProfile.Capabilities capabilities) {
  if (capabilities == null) {
    return;
  }

  DatabaseFactory.getRecipientDatabase(context).setCapabilities(Recipient.self().getId(), capabilities);
}
 
Example 6
Source File: RetrieveProfileJob.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private void setProfileCapabilities(@NonNull Recipient recipient, @Nullable SignalServiceProfile.Capabilities capabilities) {
  if (capabilities == null) {
    return;
  }

  DatabaseFactory.getRecipientDatabase(context).setCapabilities(recipient.getId(), capabilities);
}
 
Example 7
Source File: AccountAttributes.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalServiceProfile.Capabilities getCapabilities() {
  return capabilities;
}
 
Example 8
Source File: SignalServiceAccountManager.java    From mollyim-android with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 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
Source File: SignalServiceAccountManager.java    From mollyim-android with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 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
Source File: AppCapabilities.java    From mollyim-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * @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);
}