mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Fix PNI prefixing in provisioning message.
This commit is contained in:
committed by
Alex Hart
parent
f56a65d30d
commit
1cc7b46555
@@ -668,7 +668,7 @@ public class SignalServiceAccountManager {
|
||||
.setPniIdentityKeyPublic(ByteString.copyFrom(pniIdentityKeyPair.getPublicKey().serialize()))
|
||||
.setPniIdentityKeyPrivate(ByteString.copyFrom(pniIdentityKeyPair.getPrivateKey().serialize()))
|
||||
.setAci(aci.toString())
|
||||
.setPni(pni.toString())
|
||||
.setPni(pni.toStringWithoutPrefix())
|
||||
.setNumber(e164)
|
||||
.setProfileKey(ByteString.copyFrom(profileKey.serialize()))
|
||||
.setProvisioningCode(code)
|
||||
|
||||
@@ -182,5 +182,8 @@ sealed class ServiceId(val libSignalServiceId: LibSignalServiceId) {
|
||||
}
|
||||
|
||||
override fun toString(): String = super.toString()
|
||||
|
||||
/** String version without the PNI: prefix. This is only for specific proto fields. For application storage, prefer [toString]. */
|
||||
fun toStringWithoutPrefix(): String = rawUuid.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class SignalContactRecord implements SignalRecord {
|
||||
this.proto = proto;
|
||||
this.hasUnknownFields = ProtoUtil.hasUnknownFields(proto);
|
||||
this.aci = ACI.parseOrUnknown(proto.getAci());
|
||||
this.pni = OptionalUtil.absentIfEmpty(proto.getPni()).map(PNI::parseOrNull);
|
||||
this.pni = OptionalUtil.absentIfEmpty(proto.getPni()).map(PNI::parseUnPrefixedOrNull);
|
||||
this.e164 = OptionalUtil.absentIfEmpty(proto.getE164());
|
||||
this.profileGivenName = OptionalUtil.absentIfEmpty(proto.getGivenName());
|
||||
this.profileFamilyName = OptionalUtil.absentIfEmpty(proto.getFamilyName());
|
||||
@@ -300,7 +300,7 @@ public final class SignalContactRecord implements SignalRecord {
|
||||
}
|
||||
|
||||
public Builder setPni(PNI pni) {
|
||||
builder.setPni(pni == null ? "" : pni.toString());
|
||||
builder.setPni(pni == null ? "" : pni.toStringWithoutPrefix());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user