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;
}
private Manager initManager(
- String number, String accountPath
+ String number,
+ String accountPath
) throws IOException, NotRegisteredException, AccountCheckException {
if (accountPath == null) {
throw new NotRegisteredException();
}
public RegistrationManager initRegistrationManager(
- String number, Consumer<Manager> newManagerListener
+ String number,
+ Consumer<Manager> 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(),
serviceEnvironment,
aciIdentityKey,
pniIdentityKey,
- registrationId,
- pniRegistrationId,
profileKey,
settings);
+ account.initDatabase();
return new RegistrationManagerImpl(account,
pathConfig,
account.close();
throw new IOException("Number in account file doesn't match expected number: " + account.getNumber());
}
+ account.initDatabase();
return new RegistrationManagerImpl(account,
pathConfig,