account.save();
}
- public void verifyAccount(
+ public Manager verifyAccount(
String verificationCode, String pin
) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
verificationCode = verificationCode.replace("-", "");
account.setRegistered(true);
account.setUuid(UuidUtil.parseOrNull(response.getUuid()));
account.setRegistrationLockPin(pin);
- account.getSignalProtocolStore().archiveAllSessions();
+ account.getSessionStore().archiveAllSessions();
account.getSignalProtocolStore()
.saveIdentity(account.getSelfAddress(),
- account.getSignalProtocolStore().getIdentityKeyPair().getPublicKey(),
+ account.getIdentityKeyPair().getPublicKey(),
TrustLevel.TRUSTED_VERIFIED);
- try (var m = new Manager(account, pathConfig, serviceEnvironmentConfig, userAgent)) {
+ Manager m = null;
+ try {
+ m = new Manager(account, pathConfig, serviceEnvironmentConfig, userAgent);
m.refreshPreKeys();
- m.close(false);
- }
+ account.save();
- account.save();
+ final var result = m;
+ account = null;
+ m = null;
+
+ return result;
+ } finally {
+ if (m != null) {
+ m.close();
+ }
+ }
}
private VerifyAccountResponse verifyAccountWithCode(
) throws IOException {
return accountManager.verifyAccountWithCode(verificationCode,
null,
- account.getSignalProtocolStore().getLocalRegistrationId(),
+ account.getLocalRegistrationId(),
true,
legacyPin,
registrationLock,