mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Fix issues with pni parsing
This commit is contained in:
parent
86e1079195
commit
6bde5960aa
7 changed files with 85 additions and 57 deletions
|
@ -29,6 +29,7 @@ import org.whispersystems.signalservice.api.push.exceptions.AlreadyVerifiedExcep
|
|||
import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.DeprecatedVersionException;
|
||||
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.push.KyberPreKeyEntity;
|
||||
import org.whispersystems.signalservice.internal.push.OutgoingPushMessage;
|
||||
import org.whispersystems.util.Base64UrlSafe;
|
||||
|
@ -101,8 +102,8 @@ public class AccountHelper {
|
|||
public void checkWhoAmiI() throws IOException {
|
||||
final var whoAmI = dependencies.getAccountManager().getWhoAmI();
|
||||
final var number = whoAmI.getNumber();
|
||||
final var aci = ACI.parseOrNull(whoAmI.getAci());
|
||||
final var pni = PNI.parseOrNull(whoAmI.getPni());
|
||||
final var aci = ACI.parseOrThrow(whoAmI.getAci());
|
||||
final var pni = PNI.from(UuidUtil.parseOrThrow(whoAmI.getPni()));
|
||||
if (number.equals(account.getNumber()) && aci.equals(account.getAci()) && pni.equals(account.getPni())) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.whispersystems.signalservice.api.push.ServiceIdType;
|
|||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.AlreadyVerifiedException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.DeprecatedVersionException;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.push.VerifyAccountResponse;
|
||||
import org.whispersystems.signalservice.internal.util.DynamicCredentialsProvider;
|
||||
|
||||
|
@ -164,8 +165,8 @@ public class RegistrationManagerImpl implements RegistrationManager {
|
|||
}
|
||||
|
||||
//accountManager.setGcmId(Optional.of(GoogleCloudMessaging.getInstance(this).register(REGISTRATION_ID)));
|
||||
final var aci = ACI.parseOrNull(response.getUuid());
|
||||
final var pni = PNI.parseOrNull(response.getPni());
|
||||
final var aci = ACI.parseOrThrow(response.getUuid());
|
||||
final var pni = PNI.from(UuidUtil.parseOrThrow(response.getPni()));
|
||||
account.finishRegistration(aci, pni, masterKey, pin, aciPreKeys, pniPreKeys);
|
||||
accountFileUpdater.updateAccountIdentifiers(account.getNumber(), aci);
|
||||
|
||||
|
|
|
@ -975,8 +975,10 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
|||
}
|
||||
|
||||
private RecipientAddress getRecipientAddressFromResultSet(ResultSet resultSet) throws SQLException {
|
||||
final var serviceId = Optional.ofNullable(resultSet.getBytes("uuid")).map(ServiceId::parseOrNull);
|
||||
final var pni = Optional.ofNullable(resultSet.getBytes("pni")).map(PNI::parseOrNull);
|
||||
final var pni = Optional.ofNullable(resultSet.getBytes("pni")).map(UuidUtil::parseOrNull).map(PNI::from);
|
||||
final var serviceIdUuid = Optional.ofNullable(resultSet.getBytes("uuid")).map(UuidUtil::parseOrNull);
|
||||
final var serviceId = serviceIdUuid.isPresent() && pni.isPresent() && serviceIdUuid.get()
|
||||
.equals(pni.get().getRawUuid()) ? pni.<ServiceId>map(p -> p) : serviceIdUuid.<ServiceId>map(ACI::from);
|
||||
final var number = Optional.ofNullable(resultSet.getString("number"));
|
||||
final var username = Optional.ofNullable(resultSet.getString("username"));
|
||||
return new RecipientAddress(serviceId, pni, number, username);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue