"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[
- {"name":"date","parameterTypes":[] },
{"name":"description","parameterTypes":[] },
{"name":"image","parameterTypes":[] },
{"name":"title","parameterTypes":[] },
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
-{
- "name":"org.asamk.signal.manager.storage.profiles.SignalProfile",
- "allDeclaredFields":true,
- "allDeclaredMethods":true,
- "allDeclaredConstructors":true
-},
-{
- "name":"org.asamk.signal.manager.storage.profiles.SignalProfile$Capabilities",
- "allDeclaredFields":true,
- "allDeclaredMethods":true,
- "allDeclaredConstructors":true
-},
{
"name":"org.asamk.signal.manager.storage.protocol.LegacyJsonIdentityKeyStore$JsonIdentityKeyStoreDeserializer",
"methods":[{"name":"<init>","parameterTypes":[] }]
"queryAllDeclaredMethods":true
},
{
- "name":"org.signal.libsignal.zkgroup.profiles.ProfileKey",
+ "name":"org.signal.libsignal.zkgroup.profiles.ExpiringProfileKeyCredential",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
- "name":"org.signal.libsignal.zkgroup.profiles.ProfileKeyCredential",
+ "name":"org.signal.libsignal.zkgroup.profiles.ProfileKey",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
{"name":"modifyMemberRoles_"},
{"name":"modifyTitle_"},
{"name":"promotePendingMembers_"},
+ {"name":"promotePendingPniAciMembers_"},
{"name":"promoteRequestingMembers_"},
{"name":"revision_"},
{"name":"sourceUuid_"}
},
{
"name":"org.signal.storageservice.protos.groups.GroupChange$Actions$ModifyMemberProfileKeyAction",
- "fields":[{"name":"presentation_"}]
+ "fields":[
+ {"name":"presentation_"},
+ {"name":"profileKey_"},
+ {"name":"userId_"}
+ ]
},
{
"name":"org.signal.storageservice.protos.groups.GroupChange$Actions$ModifyMemberRoleAction",
},
{
"name":"org.signal.storageservice.protos.groups.GroupChange$Actions$PromotePendingMemberAction",
- "fields":[{"name":"presentation_"}]
+ "fields":[
+ {"name":"presentation_"},
+ {"name":"profileKey_"},
+ {"name":"userId_"}
+ ]
+},
+{
+ "name":"org.signal.storageservice.protos.groups.GroupChange$Actions$PromotePendingPniAciMemberProfileKeyAction",
+ "fields":[
+ {"name":"pni_"},
+ {"name":"presentation_"},
+ {"name":"profileKey_"},
+ {"name":"userId_"}
+ ]
},
{
"name":"org.signal.storageservice.protos.groups.GroupChange$Actions$PromoteRequestingMemberAction",
{"name":"newTimer_"},
{"name":"newTitle_"},
{"name":"promotePendingMembers_"},
+ {"name":"promotePendingPniAciMembers_"},
{"name":"promoteRequestingMembers_"},
{"name":"revision_"}
]
"name":"org.signal.storageservice.protos.groups.local.DecryptedMember",
"fields":[
{"name":"joinedAtRevision_"},
+ {"name":"pni_"},
{"name":"profileKey_"},
{"name":"role_"},
{"name":"uuid_"}
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
- "methods":[{"name":"<init>","parameterTypes":[] }]
+ "methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String"] }]
},
{
"name":"org.whispersystems.signalservice.api.storage.StorageAuthResponse",
}
dependencies {
- implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_51")
+ implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_52")
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.3")
implementation("com.google.protobuf", "protobuf-javalite", "3.11.4")
implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")
private final static Optional<SignalProxy> proxy = Optional.empty();
private final static byte[] zkGroupServerPublicParams = Base64.getDecoder()
- .decode("AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X36nOoGPs54XsEGzPdEV+itQNGUFEjY6X9Uv+Acuks7NpyGvCoKxGwgKgE5XyJ+nNKlyHHOLb6N1NuHyBrZrgtY/JYJHRooo5CEqYKBqdFnmbTVGEkCvJKxLnjwKWf+fEPoWeQFj5ObDjcKMZf2Jm2Ae69x+ikU5gBXsRmoF94GXQ==");
+ .decode("AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X36nOoGPs54XsEGzPdEV+itQNGUFEjY6X9Uv+Acuks7NpyGvCoKxGwgKgE5XyJ+nNKlyHHOLb6N1NuHyBrZrgtY/JYJHRooo5CEqYKBqdFnmbTVGEkCvJKxLnjwKWf+fEPoWeQFj5ObDjcKMZf2Jm2Ae69x+ikU5gBXsRmoF94GXTLfN0/vLt98KDPnxwAQL9j5V1jGOY8jQl6MLxEs56cwXN0dqCnImzVH3TZT1cJ8SW1BRX6qIVxEzjsSGx3yxF3suAilPMqGRp4ffyopjMD1JXiKR2RwLKzizUe5e8XyGOy9fplzhw3jVzTRyUZTRSZKkMLWcQ/gv0E4aONNqs4P");
static SignalServiceConfiguration createDefaultServiceConfiguration(
final List<Interceptor> interceptors
private final static Optional<SignalProxy> proxy = Optional.empty();
private final static byte[] zkGroupServerPublicParams = Base64.getDecoder()
- .decode("ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdlukrpzzsCIvEwjwQlJYVPOQPj4V0F4UXXBdHSLK05uoPBCQG8G9rYIGedYsClJXnbrgGYG3eMTG5hnx4X4ntARBgELuMWWUEEfSK0mjXg+/2lPmWcTZWR9nkqgQQP0tbzuiPm74H2wMO4u1Wafe+UwyIlIT9L7KLS19Aw8r4sPrXQ==");
+ .decode("ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdlukrpzzsCIvEwjwQlJYVPOQPj4V0F4UXXBdHSLK05uoPBCQG8G9rYIGedYsClJXnbrgGYG3eMTG5hnx4X4ntARBgELuMWWUEEfSK0mjXg+/2lPmWcTZWR9nkqgQQP0tbzuiPm74H2wMO4u1Wafe+UwyIlIT9L7KLS19Aw8r4sPrXZSSsOZ6s7M1+rTJN0bI5CKY2PX29y5Ok3jSWufIKcgKOnWoP67d5b2du2ZVJjpjfibNIHbT/cegy/sBLoFwtHogVYUewANUAXIaMPyCLRArsKhfJ5wBtTminG/PAvuBdJ70Z/bXVPf8TVsR292zQ65xwvWTejROW6AZX6aqucUj");
static SignalServiceConfiguration createDefaultServiceConfiguration(
final List<Interceptor> interceptors
import org.asamk.signal.manager.util.Utils;
import org.signal.libsignal.zkgroup.InvalidInputException;
import org.signal.libsignal.zkgroup.VerificationFailedException;
-import org.signal.libsignal.zkgroup.auth.AuthCredentialResponse;
+import org.signal.libsignal.zkgroup.auth.AuthCredentialWithPniResponse;
import org.signal.libsignal.zkgroup.groups.GroupMasterKey;
import org.signal.libsignal.zkgroup.groups.GroupSecretParams;
import org.signal.libsignal.zkgroup.groups.UuidCiphertext;
import org.whispersystems.signalservice.api.groupsv2.InvalidGroupStateException;
import org.whispersystems.signalservice.api.groupsv2.NotAbleToApplyGroupV2ChangeException;
import org.whispersystems.signalservice.api.push.ACI;
+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.push.exceptions.NonSuccessfulResponseCodeException;
private final SignalDependencies dependencies;
private final Context context;
- private HashMap<Integer, AuthCredentialResponse> groupApiCredentials;
+ private HashMap<Long, AuthCredentialWithPniResponse> groupApiCredentials;
GroupV2Helper(final Context context) {
this.dependencies = context.getDependencies();
String name, Set<RecipientId> members, byte[] avatar
) {
final var profileKeyCredential = context.getProfileHelper()
- .getRecipientProfileKeyCredential(context.getAccount().getSelfRecipientId());
+ .getExpiringProfileKeyCredential(context.getAccount().getSelfRecipientId());
if (profileKeyCredential == null) {
logger.warn("Cannot create a V2 group as self does not have a versioned profile");
return null;
final var self = new GroupCandidate(getSelfAci().uuid(), Optional.of(profileKeyCredential));
final var memberList = new ArrayList<>(members);
- final var credentials = context.getProfileHelper().getRecipientProfileKeyCredential(memberList).stream();
+ final var credentials = context.getProfileHelper().getExpiringProfileKeyCredential(memberList).stream();
final var uuids = memberList.stream()
.map(member -> context.getRecipientHelper().resolveSignalServiceAddress(member).getServiceId().uuid());
var candidates = Utils.zip(uuids,
GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
final var memberList = new ArrayList<>(newMembers);
- final var credentials = context.getProfileHelper().getRecipientProfileKeyCredential(memberList).stream();
+ final var credentials = context.getProfileHelper().getExpiringProfileKeyCredential(memberList).stream();
final var uuids = memberList.stream()
.map(member -> context.getRecipientHelper().resolveSignalServiceAddress(member).getServiceId().uuid());
var candidates = Utils.zip(uuids,
logger.debug("Updating own profile key in group " + groupInfoV2.getGroupId().toBase64());
final var selfRecipientId = context.getAccount().getSelfRecipientId();
- final var profileKeyCredential = context.getProfileHelper().getRecipientProfileKeyCredential(selfRecipientId);
+ final var profileKeyCredential = context.getProfileHelper().getExpiringProfileKeyCredential(selfRecipientId);
if (profileKeyCredential == null) {
logger.trace("Cannot update profile key as self does not have a versioned profile");
return null;
final var groupOperations = dependencies.getGroupsV2Operations().forGroup(groupSecretParams);
final var selfRecipientId = context.getAccount().getSelfRecipientId();
- final var profileKeyCredential = context.getProfileHelper().getRecipientProfileKeyCredential(selfRecipientId);
+ final var profileKeyCredential = context.getProfileHelper().getExpiringProfileKeyCredential(selfRecipientId);
if (profileKeyCredential == null) {
throw new IOException("Cannot join a V2 group as self does not have a versioned profile");
}
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
final var selfRecipientId = context.getAccount().getSelfRecipientId();
- final var profileKeyCredential = context.getProfileHelper().getRecipientProfileKeyCredential(selfRecipientId);
+ final var profileKeyCredential = context.getProfileHelper().getExpiringProfileKeyCredential(selfRecipientId);
if (profileKeyCredential == null) {
throw new IOException("Cannot join a V2 group as self does not have a versioned profile");
}
return null;
}
- private static int currentTimeDays() {
- return (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis());
+ private static long currentDaySeconds() {
+ return TimeUnit.DAYS.toSeconds(TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis()));
}
private GroupsV2AuthorizationString getGroupAuthForToday(
final GroupSecretParams groupSecretParams
) throws IOException {
- final var today = currentTimeDays();
- if (groupApiCredentials == null || !groupApiCredentials.containsKey(today)) {
+ final var todaySeconds = currentDaySeconds();
+ if (groupApiCredentials == null || !groupApiCredentials.containsKey(todaySeconds)) {
// Returns credentials for the next 7 days
- final var isAci = true; // TODO enable group handling with PNI
- groupApiCredentials = dependencies.getGroupsV2Api().getCredentials(today, isAci);
+ groupApiCredentials = dependencies.getGroupsV2Api().getCredentials(todaySeconds);
// TODO cache credentials on disk until they expire
}
- var authCredentialResponse = groupApiCredentials.get(today);
- final var aci = getSelfAci();
try {
- return dependencies.getGroupsV2Api()
- .getGroupsV2AuthorizationString(aci, today, groupSecretParams, authCredentialResponse);
+ return getAuthorizationString(groupSecretParams, todaySeconds);
+ } catch (VerificationFailedException e) {
+ logger.debug("Group api credentials invalid, renewing and trying again.");
+ groupApiCredentials.clear();
+ }
+
+ groupApiCredentials = dependencies.getGroupsV2Api().getCredentials(todaySeconds);
+ try {
+ return getAuthorizationString(groupSecretParams, todaySeconds);
} catch (VerificationFailedException e) {
throw new IOException(e);
}
}
+ private GroupsV2AuthorizationString getAuthorizationString(
+ final GroupSecretParams groupSecretParams, final long todaySeconds
+ ) throws VerificationFailedException {
+ var authCredentialResponse = groupApiCredentials.get(todaySeconds);
+ final var aci = getSelfAci();
+ final var pni = getSelfPni();
+ return dependencies.getGroupsV2Api()
+ .getGroupsV2AuthorizationString(aci, pni, todaySeconds, groupSecretParams, authCredentialResponse);
+ }
+
private ACI getSelfAci() {
return context.getAccount().getAci();
}
+
+ private PNI getSelfPni() {
+ return context.getAccount().getPni();
+ }
}
import org.asamk.signal.manager.util.Utils;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.InvalidKeyException;
+import org.signal.libsignal.zkgroup.profiles.ExpiringProfileKeyCredential;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
-import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.crypto.UnidentifiedAccess;
import org.whispersystems.signalservice.api.push.exceptions.NotFoundException;
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
import org.whispersystems.signalservice.api.services.ProfileService;
+import org.whispersystems.signalservice.api.util.ExpiringProfileCredentialUtil;
import java.io.File;
import java.io.IOException;
getRecipientProfiles(recipientIds, true);
}
- public List<ProfileKeyCredential> getRecipientProfileKeyCredential(List<RecipientId> recipientIds) {
+ public List<ExpiringProfileKeyCredential> getExpiringProfileKeyCredential(List<RecipientId> recipientIds) {
try {
account.getRecipientStore().setBulkUpdating(true);
final var profileFetches = Flowable.fromIterable(recipientIds)
- .filter(recipientId -> account.getProfileStore().getProfileKeyCredential(recipientId) == null)
+ .filter(recipientId -> !ExpiringProfileCredentialUtil.isValid(account.getProfileStore()
+ .getExpiringProfileKeyCredential(recipientId)))
.map(recipientId -> retrieveProfile(recipientId,
SignalServiceProfile.RequestType.PROFILE_AND_CREDENTIAL).onErrorComplete());
Maybe.merge(profileFetches, 10).blockingSubscribe();
account.getRecipientStore().setBulkUpdating(false);
}
- return recipientIds.stream().map(r -> account.getProfileStore().getProfileKeyCredential(r)).toList();
+ return recipientIds.stream().map(r -> account.getProfileStore().getExpiringProfileKeyCredential(r)).toList();
}
- public ProfileKeyCredential getRecipientProfileKeyCredential(RecipientId recipientId) {
- var profileKeyCredential = account.getProfileStore().getProfileKeyCredential(recipientId);
- if (profileKeyCredential != null) {
+ public ExpiringProfileKeyCredential getExpiringProfileKeyCredential(RecipientId recipientId) {
+ var profileKeyCredential = account.getProfileStore().getExpiringProfileKeyCredential(recipientId);
+ if (ExpiringProfileCredentialUtil.isValid(profileKeyCredential)) {
return profileKeyCredential;
}
return null;
}
- return account.getProfileStore().getProfileKeyCredential(recipientId);
+ return account.getProfileStore().getExpiringProfileKeyCredential(recipientId);
}
/**
final var encryptedProfile = p.getProfile();
if (requestType == SignalServiceProfile.RequestType.PROFILE_AND_CREDENTIAL
- || account.getProfileStore().getProfileKeyCredential(recipientId) == null) {
+ || !ExpiringProfileCredentialUtil.isValid(account.getProfileStore()
+ .getExpiringProfileKeyCredential(recipientId))) {
logger.trace("Storing profile credential");
- final var profileKeyCredential = p.getProfileKeyCredential().orElse(null);
- account.getProfileStore().storeProfileKeyCredential(recipientId, profileKeyCredential);
+ final var profileKeyCredential = p.getExpiringProfileKeyCredential().orElse(null);
+ account.getProfileStore().storeExpiringProfileKeyCredential(recipientId, profileKeyCredential);
}
final var profile = account.getProfileStore().getProfile(recipientId);
final var legacyProfileStore = jsonProcessor.convertValue(profileStoreNode, LegacyProfileStore.class);
for (var profileEntry : legacyProfileStore.getProfileEntries()) {
var recipientId = getRecipientResolver().resolveRecipient(profileEntry.getAddress());
- getProfileStore().storeProfileKeyCredential(recipientId, profileEntry.getProfileKeyCredential());
+ // Not migrating profile key credential here, it was changed to expiring profile key credentials
getProfileStore().storeProfileKey(recipientId, profileEntry.getProfileKey());
final var profile = profileEntry.getProfile();
if (profile != null) {
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
import org.signal.libsignal.zkgroup.InvalidInputException;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
-import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredential;
import org.whispersystems.signalservice.api.util.UuidUtil;
import java.io.IOException;
profileKey = new ProfileKey(Base64.getDecoder().decode(entry.get("profileKey").asText()));
} catch (InvalidInputException ignored) {
}
- ProfileKeyCredential profileKeyCredential = null;
- if (entry.hasNonNull("profileKeyCredential")) {
- try {
- profileKeyCredential = new ProfileKeyCredential(Base64.getDecoder()
- .decode(entry.get("profileKeyCredential").asText()));
- } catch (Throwable ignored) {
- }
- }
var lastUpdateTimestamp = entry.get("lastUpdateTimestamp").asLong();
var profile = jsonProcessor.treeToValue(entry.get("profile"), LegacySignalProfile.class);
- profileEntries.add(new LegacySignalProfileEntry(address,
- profileKey,
- lastUpdateTimestamp,
- profile,
- profileKeyCredential));
+ profileEntries.add(new LegacySignalProfileEntry(address, profileKey, lastUpdateTimestamp, profile));
}
}
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
-import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredential;
public class LegacySignalProfileEntry {
private final LegacySignalProfile profile;
- private final ProfileKeyCredential profileKeyCredential;
-
public LegacySignalProfileEntry(
final RecipientAddress address,
final ProfileKey profileKey,
final long lastUpdateTimestamp,
- final LegacySignalProfile profile,
- final ProfileKeyCredential profileKeyCredential
+ final LegacySignalProfile profile
) {
this.address = address;
this.profileKey = profileKey;
this.lastUpdateTimestamp = lastUpdateTimestamp;
this.profile = profile;
- this.profileKeyCredential = profileKeyCredential;
}
public RecipientAddress getAddress() {
public LegacySignalProfile getProfile() {
return profile;
}
-
- public ProfileKeyCredential getProfileKeyCredential() {
- return profileKeyCredential;
- }
}
import org.asamk.signal.manager.storage.recipients.Profile;
import org.asamk.signal.manager.storage.recipients.RecipientId;
+import org.signal.libsignal.zkgroup.profiles.ExpiringProfileKeyCredential;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
-import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredential;
public interface ProfileStore {
ProfileKey getProfileKey(RecipientId recipientId);
- ProfileKeyCredential getProfileKeyCredential(RecipientId recipientId);
+ ExpiringProfileKeyCredential getExpiringProfileKeyCredential(RecipientId recipientId);
void storeProfile(RecipientId recipientId, Profile profile);
void storeProfileKey(RecipientId recipientId, ProfileKey profileKey);
- void storeProfileKeyCredential(RecipientId recipientId, ProfileKeyCredential profileKeyCredential);
+ void storeExpiringProfileKeyCredential(
+ RecipientId recipientId,
+ ExpiringProfileKeyCredential expiringProfileKeyCredential
+ );
}
package org.asamk.signal.manager.storage.recipients;
+import org.signal.libsignal.zkgroup.profiles.ExpiringProfileKeyCredential;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
-import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredential;
import java.util.Objects;
private final ProfileKey profileKey;
- private final ProfileKeyCredential profileKeyCredential;
+ private final ExpiringProfileKeyCredential expiringProfileKeyCredential;
private final Profile profile;
final RecipientAddress address,
final Contact contact,
final ProfileKey profileKey,
- final ProfileKeyCredential profileKeyCredential,
+ final ExpiringProfileKeyCredential expiringProfileKeyCredential,
final Profile profile
) {
this.recipientId = recipientId;
this.address = address;
this.contact = contact;
this.profileKey = profileKey;
- this.profileKeyCredential = profileKeyCredential;
+ this.expiringProfileKeyCredential = expiringProfileKeyCredential;
this.profile = profile;
}
address = builder.address;
contact = builder.contact;
profileKey = builder.profileKey;
- profileKeyCredential = builder.profileKeyCredential;
+ expiringProfileKeyCredential = builder.expiringProfileKeyCredential1;
profile = builder.profile;
}
builder.address = copy.getAddress();
builder.contact = copy.getContact();
builder.profileKey = copy.getProfileKey();
- builder.profileKeyCredential = copy.getProfileKeyCredential();
+ builder.expiringProfileKeyCredential1 = copy.getExpiringProfileKeyCredential();
builder.profile = copy.getProfile();
return builder;
}
return profileKey;
}
- public ProfileKeyCredential getProfileKeyCredential() {
- return profileKeyCredential;
+ public ExpiringProfileKeyCredential getExpiringProfileKeyCredential() {
+ return expiringProfileKeyCredential;
}
public Profile getProfile() {
&& Objects.equals(address, recipient.address)
&& Objects.equals(contact, recipient.contact)
&& Objects.equals(profileKey, recipient.profileKey)
- && Objects.equals(profileKeyCredential, recipient.profileKeyCredential)
+ && Objects.equals(expiringProfileKeyCredential, recipient.expiringProfileKeyCredential)
&& Objects.equals(profile, recipient.profile);
}
@Override
public int hashCode() {
- return Objects.hash(recipientId, address, contact, profileKey, profileKeyCredential, profile);
+ return Objects.hash(recipientId, address, contact, profileKey, expiringProfileKeyCredential, profile);
}
public static final class Builder {
private RecipientAddress address;
private Contact contact;
private ProfileKey profileKey;
- private ProfileKeyCredential profileKeyCredential;
+ private ExpiringProfileKeyCredential expiringProfileKeyCredential1;
private Profile profile;
private Builder() {
return this;
}
- public Builder withProfileKeyCredential(final ProfileKeyCredential val) {
- profileKeyCredential = val;
+ public Builder withExpiringProfileKeyCredential(final ExpiringProfileKeyCredential val) {
+ expiringProfileKeyCredential1 = val;
return this;
}
import org.asamk.signal.manager.storage.contacts.ContactsStore;
import org.asamk.signal.manager.storage.profiles.ProfileStore;
import org.signal.libsignal.zkgroup.InvalidInputException;
+import org.signal.libsignal.zkgroup.profiles.ExpiringProfileKeyCredential;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
-import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.push.ACI;
}
}
- ProfileKeyCredential profileKeyCredential = null;
- if (r.profileKeyCredential != null) {
+ ExpiringProfileKeyCredential expiringProfileKeyCredential = null;
+ if (r.expiringProfileKeyCredential != null) {
try {
- profileKeyCredential = new ProfileKeyCredential(Base64.getDecoder()
- .decode(r.profileKeyCredential));
+ expiringProfileKeyCredential = new ExpiringProfileKeyCredential(Base64.getDecoder()
+ .decode(r.expiringProfileKeyCredential));
} catch (Throwable ignored) {
}
}
.collect(Collectors.toSet()));
}
- return new Recipient(recipientId, address, contact, profileKey, profileKeyCredential, profile);
+ return new Recipient(recipientId, address, contact, profileKey, expiringProfileKeyCredential, profile);
}).collect(Collectors.toMap(Recipient::getRecipientId, r -> r));
recipientStore.addRecipients(recipients);
}
@Override
- public ProfileKeyCredential getProfileKeyCredential(final RecipientId recipientId) {
+ public ExpiringProfileKeyCredential getExpiringProfileKeyCredential(final RecipientId recipientId) {
final var recipient = getRecipient(recipientId);
- return recipient == null ? null : recipient.getProfileKeyCredential();
+ return recipient == null ? null : recipient.getExpiringProfileKeyCredential();
}
@Override
final var builder = Recipient.newBuilder(recipient)
.withProfileKey(profileKey)
- .withProfileKeyCredential(null);
+ .withExpiringProfileKeyCredential(null);
if (resetProfile) {
builder.withProfile(recipient.getProfile() == null
? null
}
@Override
- public void storeProfileKeyCredential(RecipientId recipientId, final ProfileKeyCredential profileKeyCredential) {
+ public void storeExpiringProfileKeyCredential(
+ RecipientId recipientId, final ExpiringProfileKeyCredential expiringProfileKeyCredential
+ ) {
synchronized (recipients) {
final var recipient = recipients.get(recipientId);
storeRecipientLocked(recipientId,
- Recipient.newBuilder(recipient).withProfileKeyCredential(profileKeyCredential).build());
+ Recipient.newBuilder(recipient)
+ .withExpiringProfileKeyCredential(expiringProfileKeyCredential)
+ .build());
}
}
recipient.getProfileKey() != null
? recipient.getProfileKey()
: toBeMergedRecipient.getProfileKey(),
- recipient.getProfileKeyCredential() != null
- ? recipient.getProfileKeyCredential()
- : toBeMergedRecipient.getProfileKeyCredential(),
+ recipient.getExpiringProfileKeyCredential() != null
+ ? recipient.getExpiringProfileKeyCredential()
+ : toBeMergedRecipient.getExpiringProfileKeyCredential(),
recipient.getProfile() != null ? recipient.getProfile() : toBeMergedRecipient.getProfile()));
recipients.remove(toBeMergedRecipientId);
recipientsMerged.put(toBeMergedRecipientId.id(), recipientId.id());
recipient.getProfileKey() == null
? null
: base64.encodeToString(recipient.getProfileKey().serialize()),
- recipient.getProfileKeyCredential() == null
+ recipient.getExpiringProfileKeyCredential() == null
? null
- : base64.encodeToString(recipient.getProfileKeyCredential().serialize()),
+ : base64.encodeToString(recipient.getExpiringProfileKeyCredential().serialize()),
contact,
profile);
}).toList(), lastId);
String number,
String uuid,
String profileKey,
- String profileKeyCredential,
+ String expiringProfileKeyCredential,
Storage.Recipient.Contact contact,
Storage.Recipient.Profile profile
) {