X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/e5a67d6ce1312fe118e99b8bc8fb2f55ed1dbcf2..3cd07ae9cd9a1a6f4a2a9d91f84ec4345680ebd4:/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java diff --git a/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java b/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java index da8a3f3a..4072a9df 100644 --- a/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java +++ b/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java @@ -14,7 +14,6 @@ import org.asamk.signal.manager.internal.RegistrationManagerImpl; import org.asamk.signal.manager.storage.SignalAccount; import org.asamk.signal.manager.storage.accounts.AccountsStore; import org.asamk.signal.manager.util.KeyUtils; -import org.signal.libsignal.protocol.util.KeyHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.whispersystems.signalservice.api.push.exceptions.DeprecatedVersionException; @@ -86,7 +85,8 @@ public class SignalAccountFiles { } private Manager initManager( - String number, String accountPath + String number, + String accountPath ) throws IOException, NotRegisteredException, AccountCheckException { if (accountPath == null) { throw new NotRegisteredException(); @@ -153,15 +153,14 @@ public class SignalAccountFiles { } public RegistrationManager initRegistrationManager( - String number, Consumer newManagerListener + String number, + Consumer newManagerListener ) throws IOException { final var accountPath = accountsStore.getPathByNumber(number); if (accountPath == null || !SignalAccount.accountFileExists(pathConfig.dataPath(), accountPath)) { final var newAccountPath = accountPath == null ? accountsStore.addAccount(number, null) : accountPath; var aciIdentityKey = KeyUtils.generateIdentityKeyPair(); var pniIdentityKey = KeyUtils.generateIdentityKeyPair(); - var registrationId = KeyHelper.generateRegistrationId(false); - var pniRegistrationId = KeyHelper.generateRegistrationId(false); var profileKey = KeyUtils.createProfileKey(); var account = SignalAccount.create(pathConfig.dataPath(), @@ -170,10 +169,9 @@ public class SignalAccountFiles { serviceEnvironment, aciIdentityKey, pniIdentityKey, - registrationId, - pniRegistrationId, profileKey, settings); + account.initDatabase(); return new RegistrationManagerImpl(account, pathConfig, @@ -188,6 +186,7 @@ public class SignalAccountFiles { account.close(); throw new IOException("Number in account file doesn't match expected number: " + account.getNumber()); } + account.initDatabase(); return new RegistrationManagerImpl(account, pathConfig,