mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-25 20:57:41 +00:00
Phone number privacy settings and certificate support behind feature flag.
This commit is contained in:

committed by
Cody Henthorne

parent
abd3d4b546
commit
7b24e66ed3
@@ -9,7 +9,6 @@ package org.whispersystems.signalservice.api;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
import org.signal.zkgroup.VerificationFailedException;
|
||||
import org.signal.zkgroup.profiles.ProfileKey;
|
||||
import org.signal.zkgroup.profiles.ProfileKeyCredential;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
@@ -80,13 +79,10 @@ import java.security.KeyStore;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SignatureException;
|
||||
import java.sql.Time;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -148,8 +144,8 @@ public class SignalServiceAccountManager {
|
||||
return this.pushServiceSocket.getSenderCertificate();
|
||||
}
|
||||
|
||||
public byte[] getSenderCertificateLegacy() throws IOException {
|
||||
return this.pushServiceSocket.getSenderCertificateLegacy();
|
||||
public byte[] getSenderCertificateForPhoneNumberPrivacy() throws IOException {
|
||||
return this.pushServiceSocket.getUuidOnlySenderCertificate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -586,6 +586,7 @@ public class SignalServiceMessageSender {
|
||||
quoteBuilder.setAuthorUuid(message.getQuote().get().getAuthor().getUuid().get().toString());
|
||||
}
|
||||
|
||||
// TODO [Alan] PhoneNumberPrivacy: Do not set this number
|
||||
if (message.getQuote().get().getAuthor().getNumber().isPresent()) {
|
||||
quoteBuilder.setAuthorE164(message.getQuote().get().getAuthor().getNumber().get());
|
||||
}
|
||||
@@ -682,6 +683,7 @@ public class SignalServiceMessageSender {
|
||||
.setRemove(message.getReaction().get().isRemove())
|
||||
.setTargetSentTimestamp(message.getReaction().get().getTargetSentTimestamp());
|
||||
|
||||
// TODO [Alan] PhoneNumberPrivacy: Do not set this number
|
||||
if (message.getReaction().get().getTargetAuthor().getNumber().isPresent()) {
|
||||
reactionBuilder.setTargetAuthorE164(message.getReaction().get().getTargetAuthor().getNumber().get());
|
||||
}
|
||||
|
@@ -80,6 +80,14 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
return proto.getLinkPreviews();
|
||||
}
|
||||
|
||||
public AccountRecord.PhoneNumberSharingMode getPhoneNumberSharingMode() {
|
||||
return proto.getPhoneNumberSharingMode();
|
||||
}
|
||||
|
||||
public boolean isPhoneNumberUnlisted() {
|
||||
return proto.getUnlistedPhoneNumber();
|
||||
}
|
||||
|
||||
AccountRecord toProto() {
|
||||
return proto;
|
||||
}
|
||||
@@ -159,6 +167,16 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPhoneNumberSharingMode(AccountRecord.PhoneNumberSharingMode mode) {
|
||||
builder.setPhoneNumberSharingMode(mode);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUnlistedPhoneNumber(boolean unlisted) {
|
||||
builder.setUnlistedPhoneNumber(unlisted);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SignalAccountRecord build() {
|
||||
AccountRecord proto = builder.build();
|
||||
|
||||
|
@@ -181,8 +181,8 @@ public class PushServiceSocket {
|
||||
private static final String PROFILE_PATH = "/v1/profile/%s";
|
||||
private static final String PROFILE_USERNAME_PATH = "/v1/profile/username/%s";
|
||||
|
||||
private static final String SENDER_CERTIFICATE_LEGACY_PATH = "/v1/certificate/delivery";
|
||||
private static final String SENDER_CERTIFICATE_PATH = "/v1/certificate/delivery?includeUuid=true";
|
||||
private static final String SENDER_CERTIFICATE_PATH = "/v1/certificate/delivery?includeUuid=true";
|
||||
private static final String SENDER_CERTIFICATE_NO_E164_PATH = "/v1/certificate/delivery?includeUuid=true&includeE164=false";
|
||||
|
||||
private static final String KBS_AUTH_PATH = "/v1/backup/auth";
|
||||
|
||||
@@ -363,13 +363,13 @@ public class PushServiceSocket {
|
||||
makeServiceRequest(REGISTRATION_LOCK_PATH, "DELETE", null);
|
||||
}
|
||||
|
||||
public byte[] getSenderCertificateLegacy() throws IOException {
|
||||
String responseText = makeServiceRequest(SENDER_CERTIFICATE_LEGACY_PATH, "GET", null);
|
||||
public byte[] getSenderCertificate() throws IOException {
|
||||
String responseText = makeServiceRequest(SENDER_CERTIFICATE_PATH, "GET", null);
|
||||
return JsonUtil.fromJson(responseText, SenderCertificate.class).getCertificate();
|
||||
}
|
||||
|
||||
public byte[] getSenderCertificate() throws IOException {
|
||||
String responseText = makeServiceRequest(SENDER_CERTIFICATE_PATH, "GET", null);
|
||||
public byte[] getUuidOnlySenderCertificate() throws IOException {
|
||||
String responseText = makeServiceRequest(SENDER_CERTIFICATE_NO_E164_PATH, "GET", null);
|
||||
return JsonUtil.fromJson(responseText, SenderCertificate.class).getCertificate();
|
||||
}
|
||||
|
||||
|
@@ -97,15 +97,24 @@ message GroupV2Record {
|
||||
}
|
||||
|
||||
message AccountRecord {
|
||||
bytes profileKey = 1;
|
||||
string givenName = 2;
|
||||
string familyName = 3;
|
||||
string avatarUrlPath = 4;
|
||||
bool noteToSelfArchived = 5;
|
||||
bool readReceipts = 6;
|
||||
bool sealedSenderIndicators = 7;
|
||||
bool typingIndicators = 8;
|
||||
bool proxiedLinkPreviews = 9;
|
||||
|
||||
enum PhoneNumberSharingMode {
|
||||
EVERYBODY = 0;
|
||||
CONTACTS_ONLY = 1;
|
||||
NOBODY = 2;
|
||||
}
|
||||
|
||||
bytes profileKey = 1;
|
||||
string givenName = 2;
|
||||
string familyName = 3;
|
||||
string avatarUrlPath = 4;
|
||||
bool noteToSelfArchived = 5;
|
||||
bool readReceipts = 6;
|
||||
bool sealedSenderIndicators = 7;
|
||||
bool typingIndicators = 8;
|
||||
bool proxiedLinkPreviews = 9;
|
||||
// 10 is reserved for unread
|
||||
bool linkPreviews = 11;
|
||||
bool linkPreviews = 11;
|
||||
PhoneNumberSharingMode phoneNumberSharingMode = 12;
|
||||
bool unlistedPhoneNumber = 13;
|
||||
}
|
||||
|
Reference in New Issue
Block a user