Search in sources :

Example 1 with AccountAttributes

use of org.whispersystems.signalservice.api.account.AccountAttributes in project Signal-Android by WhisperSystems.

the class PushServiceSocket method setAccountAttributes.

public void setAccountAttributes(String signalingKey, int registrationId, boolean fetchesMessages, String pin, String registrationLock, byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess, AccountAttributes.Capabilities capabilities, boolean discoverableByPhoneNumber, byte[] encryptedDeviceName) throws IOException {
    if (registrationLock != null && pin != null) {
        throw new AssertionError("Pin should be null if registrationLock is set.");
    }
    String name = (encryptedDeviceName == null) ? null : Base64.encodeBytes(encryptedDeviceName);
    AccountAttributes accountAttributes = new AccountAttributes(signalingKey, registrationId, fetchesMessages, pin, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities, discoverableByPhoneNumber, name);
    makeServiceRequest(SET_ACCOUNT_ATTRIBUTES, "PUT", JsonUtil.toJson(accountAttributes));
}
Also used : AccountAttributes(org.whispersystems.signalservice.api.account.AccountAttributes) GroupsV2AuthorizationString(org.whispersystems.signalservice.api.groupsv2.GroupsV2AuthorizationString)

Example 2 with AccountAttributes

use of org.whispersystems.signalservice.api.account.AccountAttributes in project Signal-Android by WhisperSystems.

the class PushServiceSocket method verifyAccountCode.

public VerifyAccountResponse verifyAccountCode(String verificationCode, String signalingKey, int registrationId, boolean fetchesMessages, String pin, String registrationLock, byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess, AccountAttributes.Capabilities capabilities, boolean discoverableByPhoneNumber) throws IOException {
    AccountAttributes signalingKeyEntity = new AccountAttributes(signalingKey, registrationId, fetchesMessages, pin, registrationLock, unidentifiedAccessKey, unrestrictedUnidentifiedAccess, capabilities, discoverableByPhoneNumber, null);
    String requestBody = JsonUtil.toJson(signalingKeyEntity);
    String responseBody = makeServiceRequest(String.format(VERIFY_ACCOUNT_CODE_PATH, verificationCode), "PUT", requestBody);
    return JsonUtil.fromJson(responseBody, VerifyAccountResponse.class);
}
Also used : AccountAttributes(org.whispersystems.signalservice.api.account.AccountAttributes) GroupsV2AuthorizationString(org.whispersystems.signalservice.api.groupsv2.GroupsV2AuthorizationString)

Aggregations

AccountAttributes (org.whispersystems.signalservice.api.account.AccountAttributes)2 GroupsV2AuthorizationString (org.whispersystems.signalservice.api.groupsv2.GroupsV2AuthorizationString)2