Improve handling of unregistered users in storage service.

This commit is contained in:
Greyson Parrelli
2022-09-16 11:36:32 -04:00
committed by Cody Henthorne
parent ffa249885e
commit 115d1fcf63
14 changed files with 213 additions and 64 deletions

View File

@@ -6,7 +6,6 @@ import com.google.protobuf.InvalidProtocolBufferException;
import org.signal.libsignal.protocol.logging.Log;
import org.whispersystems.signalservice.api.push.PNI;
import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.util.OptionalUtil;
import org.whispersystems.signalservice.api.util.ProtoUtil;
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord;
@@ -130,6 +129,10 @@ public final class SignalContactRecord implements SignalRecord {
diff.add("HideStory");
}
if (getUnregisteredTimestamp() != that.getUnregisteredTimestamp()) {
diff.add("UnregisteredTimestamp");
}
if (!Objects.equals(this.hasUnknownFields(), that.hasUnknownFields())) {
diff.add("UnknownFields");
}
@@ -208,6 +211,10 @@ public final class SignalContactRecord implements SignalRecord {
return proto.getHideStory();
}
public long getUnregisteredTimestamp() {
return proto.getUnregisteredAtTimestamp();
}
/**
* Returns the same record, but stripped of the PNI field. Only used while PNP is in development.
*/
@@ -319,6 +326,11 @@ public final class SignalContactRecord implements SignalRecord {
return this;
}
public Builder setUnregisteredTimestamp(long timestamp) {
builder.setUnregisteredAtTimestamp(timestamp);
return this;
}
private static ContactRecord.Builder parseUnknowns(byte[] serializedUnknowns) {
try {
return ContactRecord.parseFrom(serializedUnknowns).toBuilder();

View File

@@ -71,21 +71,23 @@ message ContactRecord {
UNVERIFIED = 2;
}
string serviceId = 1;
string serviceE164 = 2;
string servicePni = 15;
bytes profileKey = 3;
bytes identityKey = 4;
IdentityState identityState = 5;
string givenName = 6;
string familyName = 7;
string username = 8;
bool blocked = 9;
bool whitelisted = 10;
bool archived = 11;
bool markedUnread = 12;
uint64 mutedUntilTimestamp = 13;
bool hideStory = 14;
string serviceId = 1;
string serviceE164 = 2;
string servicePni = 15;
bytes profileKey = 3;
bytes identityKey = 4;
IdentityState identityState = 5;
string givenName = 6;
string familyName = 7;
string username = 8;
bool blocked = 9;
bool whitelisted = 10;
bool archived = 11;
bool markedUnread = 12;
uint64 mutedUntilTimestamp = 13;
bool hideStory = 14;
uint64 unregisteredAtTimestamp = 16;
// NEXT ID: 17
}
message GroupV1Record {