mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Update libsignal-service-java
This commit is contained in:
parent
ec3d2346ef
commit
609ebf024b
9 changed files with 79 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
**Attention**: Now requires native libsignal-client version 0.5.1
|
**Attention**: Now requires native libsignal-client version 0.8.1
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added new parameters to `updateGroup` for group v2 features:
|
- Added new parameters to `updateGroup` for group v2 features:
|
||||||
|
|
|
@ -1787,8 +1787,10 @@
|
||||||
{"name":"bitField0_", "allowUnsafeAccess":true},
|
{"name":"bitField0_", "allowUnsafeAccess":true},
|
||||||
{"name":"callMessage_", "allowUnsafeAccess":true},
|
{"name":"callMessage_", "allowUnsafeAccess":true},
|
||||||
{"name":"dataMessage_", "allowUnsafeAccess":true},
|
{"name":"dataMessage_", "allowUnsafeAccess":true},
|
||||||
|
{"name":"decryptionErrorMessage_", "allowUnsafeAccess":true},
|
||||||
{"name":"nullMessage_", "allowUnsafeAccess":true},
|
{"name":"nullMessage_", "allowUnsafeAccess":true},
|
||||||
{"name":"receiptMessage_", "allowUnsafeAccess":true},
|
{"name":"receiptMessage_", "allowUnsafeAccess":true},
|
||||||
|
{"name":"senderKeyDistributionMessage_", "allowUnsafeAccess":true},
|
||||||
{"name":"syncMessage_", "allowUnsafeAccess":true},
|
{"name":"syncMessage_", "allowUnsafeAccess":true},
|
||||||
{"name":"typingMessage_", "allowUnsafeAccess":true}
|
{"name":"typingMessage_", "allowUnsafeAccess":true}
|
||||||
]
|
]
|
||||||
|
@ -2139,6 +2141,7 @@
|
||||||
"fields":[
|
"fields":[
|
||||||
{"name":"address_", "allowUnsafeAccess":true},
|
{"name":"address_", "allowUnsafeAccess":true},
|
||||||
{"name":"bitField0_", "allowUnsafeAccess":true},
|
{"name":"bitField0_", "allowUnsafeAccess":true},
|
||||||
|
{"name":"groupId_", "allowUnsafeAccess":true},
|
||||||
{"name":"needsReceipt_", "allowUnsafeAccess":true},
|
{"name":"needsReceipt_", "allowUnsafeAccess":true},
|
||||||
{"name":"senderDevice_", "allowUnsafeAccess":true},
|
{"name":"senderDevice_", "allowUnsafeAccess":true},
|
||||||
{"name":"serverDeliveredTimestamp_", "allowUnsafeAccess":true},
|
{"name":"serverDeliveredTimestamp_", "allowUnsafeAccess":true},
|
||||||
|
|
|
@ -14,7 +14,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("com.github.turasa:signal-service-java:2.15.3_unofficial_23")
|
api("com.github.turasa:signal-service-java:2.15.3_unofficial_24")
|
||||||
implementation("com.google.protobuf:protobuf-javalite:3.10.0")
|
implementation("com.google.protobuf:protobuf-javalite:3.10.0")
|
||||||
implementation("org.bouncycastle:bcprov-jdk15on:1.68")
|
implementation("org.bouncycastle:bcprov-jdk15on:1.68")
|
||||||
implementation("org.slf4j:slf4j-api:1.7.30")
|
implementation("org.slf4j:slf4j-api:1.7.30")
|
||||||
|
|
|
@ -87,6 +87,7 @@ import org.whispersystems.signalservice.api.SignalServiceMessagePipe;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
|
import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||||
import org.whispersystems.signalservice.api.SignalSessionLock;
|
import org.whispersystems.signalservice.api.SignalSessionLock;
|
||||||
|
import org.whispersystems.signalservice.api.crypto.ContentHint;
|
||||||
import org.whispersystems.signalservice.api.crypto.SignalServiceCipher;
|
import org.whispersystems.signalservice.api.crypto.SignalServiceCipher;
|
||||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||||
import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
|
import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
|
||||||
|
@ -1534,7 +1535,7 @@ public class Manager implements Closeable {
|
||||||
|
|
||||||
private void sendSyncMessage(SignalServiceSyncMessage message) throws IOException, UntrustedIdentityException {
|
private void sendSyncMessage(SignalServiceSyncMessage message) throws IOException, UntrustedIdentityException {
|
||||||
var messageSender = createMessageSender();
|
var messageSender = createMessageSender();
|
||||||
messageSender.sendMessage(message, unidentifiedAccessHelper.getAccessForSync());
|
messageSender.sendSyncMessage(message, unidentifiedAccessHelper.getAccessForSync());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<RecipientId> getSignalServiceAddresses(Collection<String> numbers) throws InvalidNumberException {
|
private Set<RecipientId> getSignalServiceAddresses(Collection<String> numbers) throws InvalidNumberException {
|
||||||
|
@ -1614,9 +1615,10 @@ public class Manager implements Closeable {
|
||||||
final var addresses = recipientIdList.stream()
|
final var addresses = recipientIdList.stream()
|
||||||
.map(this::resolveSignalServiceAddress)
|
.map(this::resolveSignalServiceAddress)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
var result = messageSender.sendMessage(addresses,
|
var result = messageSender.sendDataMessage(addresses,
|
||||||
unidentifiedAccessHelper.getAccessFor(recipientIdList),
|
unidentifiedAccessHelper.getAccessFor(recipientIdList),
|
||||||
isRecipientUpdate,
|
isRecipientUpdate,
|
||||||
|
ContentHint.DEFAULT,
|
||||||
message);
|
message);
|
||||||
|
|
||||||
for (var r : result) {
|
for (var r : result) {
|
||||||
|
@ -1691,7 +1693,7 @@ public class Manager implements Closeable {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var startTime = System.currentTimeMillis();
|
var startTime = System.currentTimeMillis();
|
||||||
messageSender.sendMessage(syncMessage, unidentifiedAccess);
|
messageSender.sendSyncMessage(syncMessage, unidentifiedAccess);
|
||||||
return SendMessageResult.success(recipient,
|
return SendMessageResult.success(recipient,
|
||||||
unidentifiedAccess.isPresent(),
|
unidentifiedAccess.isPresent(),
|
||||||
false,
|
false,
|
||||||
|
@ -1709,11 +1711,15 @@ public class Manager implements Closeable {
|
||||||
final var address = resolveSignalServiceAddress(recipientId);
|
final var address = resolveSignalServiceAddress(recipientId);
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
return messageSender.sendMessage(address, unidentifiedAccessHelper.getAccessFor(recipientId), message);
|
return messageSender.sendDataMessage(address,
|
||||||
|
unidentifiedAccessHelper.getAccessFor(recipientId),
|
||||||
|
ContentHint.DEFAULT,
|
||||||
|
message);
|
||||||
} catch (UnregisteredUserException e) {
|
} catch (UnregisteredUserException e) {
|
||||||
final var newRecipientId = refreshRegisteredUser(recipientId);
|
final var newRecipientId = refreshRegisteredUser(recipientId);
|
||||||
return messageSender.sendMessage(resolveSignalServiceAddress(newRecipientId),
|
return messageSender.sendDataMessage(resolveSignalServiceAddress(newRecipientId),
|
||||||
unidentifiedAccessHelper.getAccessFor(newRecipientId),
|
unidentifiedAccessHelper.getAccessFor(newRecipientId),
|
||||||
|
ContentHint.DEFAULT,
|
||||||
message);
|
message);
|
||||||
}
|
}
|
||||||
} catch (UntrustedIdentityException e) {
|
} catch (UntrustedIdentityException e) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ServiceConfig {
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
zkGroupAvailable = false;
|
zkGroupAvailable = false;
|
||||||
}
|
}
|
||||||
capabilities = new AccountAttributes.Capabilities(false, zkGroupAvailable, false, zkGroupAvailable);
|
capabilities = new AccountAttributes.Capabilities(false, zkGroupAvailable, false, zkGroupAvailable, false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TrustStore contactTrustStore = new IasTrustStore();
|
TrustStore contactTrustStore = new IasTrustStore();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.asamk.signal.manager.storage.protocol;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.whispersystems.libsignal.IdentityKey;
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair;
|
import org.whispersystems.libsignal.IdentityKeyPair;
|
||||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||||
|
import org.whispersystems.libsignal.NoSessionException;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.groups.state.SenderKeyRecord;
|
import org.whispersystems.libsignal.groups.state.SenderKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.IdentityKeyStore;
|
import org.whispersystems.libsignal.state.IdentityKeyStore;
|
||||||
|
@ -13,8 +14,11 @@ import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceProtocolStore;
|
import org.whispersystems.signalservice.api.SignalServiceProtocolStore;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceSessionStore;
|
import org.whispersystems.signalservice.api.SignalServiceSessionStore;
|
||||||
|
import org.whispersystems.signalservice.api.push.DistributionId;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SignalProtocolStore implements SignalServiceProtocolStore {
|
public class SignalProtocolStore implements SignalServiceProtocolStore {
|
||||||
|
@ -86,6 +90,11 @@ public class SignalProtocolStore implements SignalServiceProtocolStore {
|
||||||
return sessionStore.loadSession(address);
|
return sessionStore.loadSession(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SessionRecord> loadExistingSessions(final List<SignalProtocolAddress> addresses) throws NoSessionException {
|
||||||
|
return sessionStore.loadExistingSessions(addresses);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> getSubDeviceSessions(String name) {
|
public List<Integer> getSubDeviceSessions(String name) {
|
||||||
return sessionStore.getSubDeviceSessions(name);
|
return sessionStore.getSubDeviceSessions(name);
|
||||||
|
@ -145,10 +154,32 @@ public class SignalProtocolStore implements SignalServiceProtocolStore {
|
||||||
public void storeSenderKey(
|
public void storeSenderKey(
|
||||||
final SignalProtocolAddress sender, final UUID distributionId, final SenderKeyRecord record
|
final SignalProtocolAddress sender, final UUID distributionId, final SenderKeyRecord record
|
||||||
) {
|
) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SenderKeyRecord loadSenderKey(final SignalProtocolAddress sender, final UUID distributionId) {
|
public SenderKeyRecord loadSenderKey(final SignalProtocolAddress sender, final UUID distributionId) {
|
||||||
|
// TODO
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<SignalProtocolAddress> getSenderKeySharedWith(final DistributionId distributionId) {
|
||||||
|
// TODO
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markSenderKeySharedWith(
|
||||||
|
final DistributionId distributionId, final Collection<SignalProtocolAddress> addresses
|
||||||
|
) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearSenderKeySharedWith(
|
||||||
|
final DistributionId distributionId, final Collection<SignalProtocolAddress> addresses
|
||||||
|
) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,8 @@ public class Profile {
|
||||||
public enum Capability {
|
public enum Capability {
|
||||||
gv2,
|
gv2,
|
||||||
storage,
|
storage,
|
||||||
gv1Migration;
|
gv1Migration,
|
||||||
|
senderKey;
|
||||||
|
|
||||||
static Capability valueOfOrNull(String value) {
|
static Capability valueOfOrNull(String value) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.asamk.signal.manager.util.IOUtils;
|
||||||
import org.asamk.signal.manager.util.Utils;
|
import org.asamk.signal.manager.util.Utils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.whispersystems.libsignal.NoSessionException;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.protocol.CiphertextMessage;
|
import org.whispersystems.libsignal.protocol.CiphertextMessage;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.whispersystems.libsignal.state.SessionRecord;
|
||||||
|
@ -21,6 +22,7 @@ import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -55,6 +57,30 @@ public class SessionStore implements SignalServiceSessionStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SessionRecord> loadExistingSessions(final List<SignalProtocolAddress> addresses) throws NoSessionException {
|
||||||
|
final var keys = addresses.stream().map(this::getKey).collect(Collectors.toList());
|
||||||
|
|
||||||
|
synchronized (cachedSessions) {
|
||||||
|
final var sessions = keys.stream()
|
||||||
|
.map(this::loadSessionLocked)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (sessions.size() != addresses.size()) {
|
||||||
|
String message = "Mismatch! Asked for "
|
||||||
|
+ addresses.size()
|
||||||
|
+ " sessions, but only found "
|
||||||
|
+ sessions.size()
|
||||||
|
+ "!";
|
||||||
|
logger.warn(message);
|
||||||
|
throw new NoSessionException(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sessions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> getSubDeviceSessions(String name) {
|
public List<Integer> getSubDeviceSessions(String name) {
|
||||||
final var recipientId = resolveRecipient(name);
|
final var recipientId = resolveRecipient(name);
|
||||||
|
|
|
@ -62,6 +62,9 @@ public class ProfileUtils {
|
||||||
if (encryptedProfile.getCapabilities().isStorage()) {
|
if (encryptedProfile.getCapabilities().isStorage()) {
|
||||||
capabilities.add(Profile.Capability.storage);
|
capabilities.add(Profile.Capability.storage);
|
||||||
}
|
}
|
||||||
|
if (encryptedProfile.getCapabilities().isSenderKey()) {
|
||||||
|
capabilities.add(Profile.Capability.senderKey);
|
||||||
|
}
|
||||||
return capabilities;
|
return capabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue