Fix issue with missing pni identity key

Fixes #1176
This commit is contained in:
AsamK 2023-02-05 12:49:12 +01:00
parent 15da210de7
commit 7816325e63

View file

@ -1378,7 +1378,7 @@ public class SignalAccount implements Closeable {
public void setPniIdentityKeyPair(final IdentityKeyPair identityKeyPair) {
pniIdentityKeyPair = identityKeyPair;
final var pniPublicKey = getPniIdentityKeyPair().getPublicKey();
final var pniPublicKey = identityKeyPair.getPublicKey();
getIdentityKeyStore().saveIdentity(getPni(), pniPublicKey);
getIdentityKeyStore().setIdentityTrustLevel(getPni(), pniPublicKey, TrustLevel.TRUSTED_VERIFIED);
save();
@ -1594,9 +1594,13 @@ public class SignalAccount implements Closeable {
final var aciPublicKey = getAciIdentityKeyPair().getPublicKey();
getIdentityKeyStore().saveIdentity(getAci(), aciPublicKey);
getIdentityKeyStore().setIdentityTrustLevel(getAci(), aciPublicKey, TrustLevel.TRUSTED_VERIFIED);
final var pniPublicKey = getPniIdentityKeyPair().getPublicKey();
getIdentityKeyStore().saveIdentity(getPni(), pniPublicKey);
getIdentityKeyStore().setIdentityTrustLevel(getPni(), pniPublicKey, TrustLevel.TRUSTED_VERIFIED);
if (getPniIdentityKeyPair() == null) {
setPniIdentityKeyPair(KeyUtils.generateIdentityKeyPair());
} else {
final var pniPublicKey = getPniIdentityKeyPair().getPublicKey();
getIdentityKeyStore().saveIdentity(getPni(), pniPublicKey);
getIdentityKeyStore().setIdentityTrustLevel(getPni(), pniPublicKey, TrustLevel.TRUSTED_VERIFIED);
}
}
public void deleteAccountData() throws IOException {