import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;
import org.whispersystems.signalservice.api.push.ContactTokenDetails;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
-import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
import org.whispersystems.signalservice.api.push.exceptions.NetworkFailureException;
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
migrateLegacyConfigs();
accountManager = getSignalServiceAccountManager();
- try {
- if (account.isRegistered()) {
- if (accountManager.getPreKeysCount() < BaseConfig.PREKEY_MINIMUM_COUNT) {
- refreshPreKeys();
- account.save();
- }
- if (account.getUuid() == null) {
- account.setUuid(accountManager.getOwnUuid());
- account.save();
- }
+ if (account.isRegistered()) {
+ if (accountManager.getPreKeysCount() < BaseConfig.PREKEY_MINIMUM_COUNT) {
+ refreshPreKeys();
+ account.save();
+ }
+ if (account.getUuid() == null) {
+ account.setUuid(accountManager.getOwnUuid());
+ account.save();
}
- } catch (AuthorizationFailedException e) {
- System.err.println("Authorization failed, was the number registered elsewhere?");
- throw e;
}
}
if (username == null) {
account = SignalAccount.createTemporaryAccount(identityKey, registrationId);
} else {
+ account.getSignalProtocolStore().saveIdentity(username, identityKey.getPublicKey(), TrustLevel.TRUSTED_VERIFIED);
+
ProfileKey profileKey = KeyUtils.createProfileKey();
account = SignalAccount.create(dataPath, username, identityKey, registrationId, profileKey);
account.save();
createNewIdentity();
}
account.setPassword(KeyUtils.createPassword());
+ account.setUuid(null);
accountManager = getSignalServiceAccountManager();
if (voiceVerification) {
}
private byte[] getSenderCertificate() throws IOException {
- byte[] certificate = accountManager.getSenderCertificate();
+ // TODO support UUID capable sender certificates
+ // byte[] certificate = accountManager.getSenderCertificate();
+ byte[] certificate = accountManager.getSenderCertificateLegacy();
// TODO cache for a day
return certificate;
}