X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/4f578c26452dbc84e83b97b1e548cb973abe910a..30690785fd51f9ba841f6f57d5f403bd970f26e3:/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 b6d12e29..88cba97b 100644 --- a/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java +++ b/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java @@ -107,7 +107,7 @@ public class RegistrationManager implements Closeable { return new RegistrationManager(account, pathConfig, serviceConfiguration, userAgent); } - var account = SignalAccount.load(pathConfig.getDataPath(), username); + var account = SignalAccount.load(pathConfig.getDataPath(), username, true); return new RegistrationManager(account, pathConfig, serviceConfiguration, userAgent); } @@ -129,9 +129,10 @@ public class RegistrationManager implements Closeable { VerifyAccountResponse response; MasterKey masterKey; try { - response = verifyAccountWithCode(verificationCode, pin, null); + response = verifyAccountWithCode(verificationCode, null, null); masterKey = null; + pin = null; } catch (LockedException e) { if (pin == null) { throw e; @@ -139,16 +140,17 @@ public class RegistrationManager implements Closeable { var registrationLockData = pinHelper.getRegistrationLockData(pin, e); if (registrationLockData == null) { - throw e; - } - - var registrationLock = registrationLockData.getMasterKey().deriveRegistrationLock(); - try { - response = verifyAccountWithCode(verificationCode, null, registrationLock); - } catch (LockedException _e) { - throw new AssertionError("KBS Pin appeared to matched but reg lock still failed!"); + response = verifyAccountWithCode(verificationCode, pin, null); + masterKey = null; + } else { + var registrationLock = registrationLockData.getMasterKey().deriveRegistrationLock(); + try { + response = verifyAccountWithCode(verificationCode, null, registrationLock); + } catch (LockedException _e) { + throw new AssertionError("KBS Pin appeared to matched but reg lock still failed!"); + } + masterKey = registrationLockData.getMasterKey(); } - masterKey = registrationLockData.getMasterKey(); } // TODO response.isStorageCapable() @@ -162,7 +164,7 @@ public class RegistrationManager implements Closeable { m.refreshPreKeys(); // Set an initial empty profile so user can be added to groups - m.setProfile(null, null, null, null); + m.setProfile(null, null, null, null, null); final var result = m; m = null;