Update to libsignal 2.15.3_unofficial_2

This commit is contained in:
AsamK 2020-02-12 20:36:23 +01:00
parent 2cd6b2b99b
commit 37ed02f4ce
7 changed files with 49 additions and 10 deletions

View file

@ -20,7 +20,7 @@ repositories {
} }
dependencies { dependencies {
compile 'com.github.turasa:signal-service-java:2.15.3_unofficial_1' compile 'com.github.turasa:signal-service-java:2.15.3_unofficial_2'
compile 'org.bouncycastle:bcprov-jdk15on:1.64' compile 'org.bouncycastle:bcprov-jdk15on:1.64'
compile 'net.sourceforge.argparse4j:argparse4j:0.8.1' compile 'net.sourceforge.argparse4j:argparse4j:0.8.1'
compile 'org.freedesktop.dbus:dbus-java:2.7.0' compile 'org.freedesktop.dbus:dbus-java:2.7.0'

View file

@ -3,15 +3,22 @@ package org.asamk.signal.manager;
import org.whispersystems.signalservice.api.push.TrustStore; import org.whispersystems.signalservice.api.push.TrustStore;
import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl; import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl;
import org.whispersystems.signalservice.internal.configuration.SignalContactDiscoveryUrl; import org.whispersystems.signalservice.internal.configuration.SignalContactDiscoveryUrl;
import org.whispersystems.signalservice.internal.configuration.SignalKeyBackupServiceUrl;
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration; import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration;
import org.whispersystems.signalservice.internal.configuration.SignalServiceUrl; import org.whispersystems.signalservice.internal.configuration.SignalServiceUrl;
import org.whispersystems.signalservice.internal.configuration.SignalStorageUrl;
import java.util.Collections;
import java.util.List;
import okhttp3.Interceptor;
public class BaseConfig { public class BaseConfig {
public final static String PROJECT_NAME = Manager.class.getPackage().getImplementationTitle(); public final static String PROJECT_NAME = Manager.class.getPackage().getImplementationTitle();
public final static String PROJECT_VERSION = Manager.class.getPackage().getImplementationVersion(); public final static String PROJECT_VERSION = Manager.class.getPackage().getImplementationVersion();
final static String USER_AGENT = PROJECT_NAME == null ? null : PROJECT_NAME + " " + PROJECT_VERSION; final static String USER_AGENT = PROJECT_NAME == null ? "signal-cli" : PROJECT_NAME + " " + PROJECT_VERSION;
final static String UNIDENTIFIED_SENDER_TRUST_ROOT = "BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF"; final static String UNIDENTIFIED_SENDER_TRUST_ROOT = "BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF";
final static int PREKEY_MINIMUM_COUNT = 20; final static int PREKEY_MINIMUM_COUNT = 20;
final static int PREKEY_BATCH_SIZE = 100; final static int PREKEY_BATCH_SIZE = 100;
@ -19,12 +26,24 @@ public class BaseConfig {
private final static String URL = "https://textsecure-service.whispersystems.org"; private final static String URL = "https://textsecure-service.whispersystems.org";
private final static String CDN_URL = "https://cdn.signal.org"; private final static String CDN_URL = "https://cdn.signal.org";
private final static String SIGNAL_KEY_BACKUP_URL = "https://api.backup.signal.org";
private final static String STORAGE_URL = "https://storage.signal.org";
private final static TrustStore TRUST_STORE = new WhisperTrustStore(); private final static TrustStore TRUST_STORE = new WhisperTrustStore();
private final static Interceptor userAgentInterceptor = chain ->
chain.proceed(chain.request().newBuilder()
.header("User-Agent", USER_AGENT)
.build());
private final static List<Interceptor> interceptors = Collections.singletonList(userAgentInterceptor);
final static SignalServiceConfiguration serviceConfiguration = new SignalServiceConfiguration( final static SignalServiceConfiguration serviceConfiguration = new SignalServiceConfiguration(
new SignalServiceUrl[]{new SignalServiceUrl(URL, TRUST_STORE)}, new SignalServiceUrl[]{new SignalServiceUrl(URL, TRUST_STORE)},
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)}, new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
new SignalContactDiscoveryUrl[0] new SignalContactDiscoveryUrl[0],
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
interceptors
); );
private BaseConfig() { private BaseConfig() {

View file

@ -265,7 +265,7 @@ public class Manager implements Signal {
} }
public void updateAccountAttributes() throws IOException { public void updateAccountAttributes() throws IOException {
accountManager.setAccountAttributes(account.getSignalingKey(), account.getSignalProtocolStore().getLocalRegistrationId(), true, account.getRegistrationLockPin(), getSelfUnidentifiedAccessKey(), false); accountManager.setAccountAttributes(account.getSignalingKey(), account.getSignalProtocolStore().getLocalRegistrationId(), true, account.getRegistrationLockPin(), account.getRegistrationLock(), getSelfUnidentifiedAccessKey(), false);
} }
public void setProfileName(String name) throws IOException { public void setProfileName(String name) throws IOException {
@ -396,7 +396,7 @@ public class Manager implements Signal {
verificationCode = verificationCode.replace("-", ""); verificationCode = verificationCode.replace("-", "");
account.setSignalingKey(KeyUtils.createSignalingKey()); account.setSignalingKey(KeyUtils.createSignalingKey());
// TODO make unrestricted unidentified access configurable // TODO make unrestricted unidentified access configurable
accountManager.verifyAccountWithCode(verificationCode, account.getSignalingKey(), account.getSignalProtocolStore().getLocalRegistrationId(), true, pin, getSelfUnidentifiedAccessKey(), false); accountManager.verifyAccountWithCode(verificationCode, account.getSignalingKey(), account.getSignalProtocolStore().getLocalRegistrationId(), true, pin, null, getSelfUnidentifiedAccessKey(), false);
//accountManager.setGcmId(Optional.of(GoogleCloudMessaging.getInstance(this).register(REGISTRATION_ID))); //accountManager.setGcmId(Optional.of(GoogleCloudMessaging.getInstance(this).register(REGISTRATION_ID)));
account.setRegistered(true); account.setRegistered(true);
@ -407,11 +407,12 @@ public class Manager implements Signal {
} }
public void setRegistrationLockPin(Optional<String> pin) throws IOException { public void setRegistrationLockPin(Optional<String> pin) throws IOException {
accountManager.setPin(pin);
if (pin.isPresent()) { if (pin.isPresent()) {
account.setRegistrationLockPin(pin.get()); account.setRegistrationLockPin(pin.get());
throw new RuntimeException("Not implemented anymore, will be replaced with KBS");
} else { } else {
account.setRegistrationLockPin(null); account.setRegistrationLockPin(null);
accountManager.removeV1Pin();
} }
account.save(); account.save();
} }
@ -1319,6 +1320,8 @@ public class Manager implements Signal {
if (g.getAvatar().isPresent()) { if (g.getAvatar().isPresent()) {
retrieveGroupAvatarAttachment(g.getAvatar().get(), syncGroup.groupId); retrieveGroupAvatarAttachment(g.getAvatar().get(), syncGroup.groupId);
} }
syncGroup.inboxPosition = g.getInboxPosition().orNull();
syncGroup.archived = g.isArchived();
account.getGroupStore().updateGroup(syncGroup); account.getGroupStore().updateGroup(syncGroup);
} }
} }
@ -1396,6 +1399,8 @@ public class Manager implements Signal {
account.getThreadStore().updateThread(thread); account.getThreadStore().updateThread(thread);
} }
contact.blocked = c.isBlocked(); contact.blocked = c.isBlocked();
contact.inboxPosition = c.getInboxPosition().orNull();
contact.archived = c.isArchived();
account.getContactStore().updateContact(contact); account.getContactStore().updateContact(contact);
if (c.getAvatar().isPresent()) { if (c.getAvatar().isPresent()) {
@ -1523,7 +1528,7 @@ public class Manager implements Signal {
out.write(new DeviceGroup(record.groupId, Optional.fromNullable(record.name), out.write(new DeviceGroup(record.groupId, Optional.fromNullable(record.name),
new ArrayList<>(record.getMembers()), createGroupAvatarAttachment(record.groupId), new ArrayList<>(record.getMembers()), createGroupAvatarAttachment(record.groupId),
record.active, Optional.fromNullable(info != null ? info.messageExpirationTime : null), record.active, Optional.fromNullable(info != null ? info.messageExpirationTime : null),
Optional.fromNullable(record.color), record.blocked)); Optional.fromNullable(record.color), record.blocked, Optional.fromNullable(record.inboxPosition), record.archived));
} }
} }
@ -1572,7 +1577,8 @@ public class Manager implements Signal {
out.write(new DeviceContact(record.getAddress(), Optional.fromNullable(record.name), out.write(new DeviceContact(record.getAddress(), Optional.fromNullable(record.name),
createContactAvatarAttachment(record.number), Optional.fromNullable(record.color), createContactAvatarAttachment(record.number), Optional.fromNullable(record.color),
Optional.fromNullable(verifiedMessage), Optional.fromNullable(profileKey), record.blocked, Optional.fromNullable(verifiedMessage), Optional.fromNullable(profileKey), record.blocked,
Optional.fromNullable(info != null ? info.messageExpirationTime : null))); Optional.fromNullable(info != null ? info.messageExpirationTime : null),
Optional.fromNullable(record.inboxPosition), record.archived));
} }
if (account.getProfileKey() != null) { if (account.getProfileKey() != null) {
@ -1581,7 +1587,7 @@ public class Manager implements Signal {
Optional.<String>absent(), Optional.<SignalServiceAttachmentStream>absent(), Optional.<String>absent(), Optional.<SignalServiceAttachmentStream>absent(),
Optional.<String>absent(), Optional.<VerifiedMessage>absent(), Optional.<String>absent(), Optional.<VerifiedMessage>absent(),
Optional.of(account.getProfileKey()), Optional.of(account.getProfileKey()),
false, Optional.<Integer>absent())); false, Optional.<Integer>absent(), Optional.<Integer>absent(), false));
} }
} }

View file

@ -82,7 +82,7 @@ class Utils {
Optional<byte[]> preview = Optional.absent(); Optional<byte[]> preview = Optional.absent();
Optional<String> caption = Optional.absent(); Optional<String> caption = Optional.absent();
Optional<String> blurHash = Optional.absent(); Optional<String> blurHash = Optional.absent();
return new SignalServiceAttachmentStream(attachmentStream, mime, attachmentSize, Optional.of(attachmentFile.getName()), false, preview, 0, 0, caption, blurHash, null); return new SignalServiceAttachmentStream(attachmentStream, mime, attachmentSize, Optional.of(attachmentFile.getName()), false, preview, 0, 0, caption, blurHash, null, null);
} }
static StreamDetails createStreamDetailsFromFile(File file) throws IOException { static StreamDetails createStreamDetailsFromFile(File file) throws IOException {

View file

@ -291,6 +291,10 @@ public class SignalAccount {
return registrationLockPin; return registrationLockPin;
} }
public String getRegistrationLock() {
return null; // TODO implement KBS
}
public void setRegistrationLockPin(final String registrationLockPin) { public void setRegistrationLockPin(final String registrationLockPin) {
this.registrationLockPin = registrationLockPin; this.registrationLockPin = registrationLockPin;
} }

View file

@ -22,6 +22,12 @@ public class ContactInfo {
@JsonProperty(defaultValue = "false") @JsonProperty(defaultValue = "false")
public boolean blocked; public boolean blocked;
@JsonProperty
public Integer inboxPosition;
@JsonProperty(defaultValue = "false")
public boolean archived;
@JsonIgnore @JsonIgnore
public SignalServiceAddress getAddress() { public SignalServiceAddress getAddress() {
return new SignalServiceAddress(null, number); return new SignalServiceAddress(null, number);

View file

@ -25,6 +25,10 @@ public class GroupInfo {
public String color; public String color;
@JsonProperty(defaultValue = "false") @JsonProperty(defaultValue = "false")
public boolean blocked; public boolean blocked;
@JsonProperty
public Integer inboxPosition;
@JsonProperty(defaultValue = "false")
public boolean archived;
private long avatarId; private long avatarId;