X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/a7b414a8703d27a012811f5621ecab28b329351f..2935b96070ee687c7a17382c64e3f85730b9f706:/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java diff --git a/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java b/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java index 6ded4d0b..aad731a0 100644 --- a/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java +++ b/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java @@ -128,7 +128,7 @@ public class RegistrationManager implements Closeable { account.save(); } - public void verifyAccount( + public Manager verifyAccount( String verificationCode, String pin ) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException { verificationCode = verificationCode.replace("-", ""); @@ -169,14 +169,24 @@ public class RegistrationManager implements Closeable { account.getSignalProtocolStore().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(