Skip to content

Commit

Permalink
Fix npr when upgrading old accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
AsamK committed Aug 20, 2023
1 parent 98a8c99 commit 795c5f6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,7 @@ private void setProvisioningData(
this.setStorageManifest(null);
this.storageKey = null;
trustSelfIdentity(ServiceIdType.ACI);
if (getPniIdentityKeyPair() != null) {
trustSelfIdentity(ServiceIdType.PNI);
}
trustSelfIdentity(ServiceIdType.PNI);
}

private void migrateLegacyConfigs() {
Expand Down Expand Up @@ -1373,6 +1371,7 @@ public void setPni(final PNI updatedPni) {
}

this.pni = updatedPni;
trustSelfIdentity(ServiceIdType.PNI);
save();
}

Expand Down Expand Up @@ -1676,7 +1675,11 @@ public void finishRegistration(
private void trustSelfIdentity(ServiceIdType serviceIdType) {
final var accountData = getAccountData(serviceIdType);
final var serviceId = accountData.getServiceId();
final var publicKey = accountData.getIdentityKeyPair().getPublicKey();
final var identityKeyPair = accountData.getIdentityKeyPair();
if (serviceId == null || identityKeyPair == null) {
return;
}
final var publicKey = identityKeyPair.getPublicKey();
getIdentityKeyStore().saveIdentity(serviceId, publicKey);
getIdentityKeyStore().setIdentityTrustLevel(serviceId, publicKey, TrustLevel.TRUSTED_VERIFIED);
}
Expand Down

0 comments on commit 795c5f6

Please sign in to comment.