"pattern":"\\Qkotlin/ranges/ranges.kotlin_builtins\\E"
}, {
"pattern":"\\Qkotlin/reflect/reflect.kotlin_builtins\\E"
+ }, {
+ "pattern":"\\Qlibsignal_jni.so\\E"
}, {
"pattern":"\\Qlibsignal_jni_aarch64.dylib\\E"
}, {
"pattern":"\\Qorg/slf4j/impl/StaticLoggerBinder.class\\E"
}, {
"pattern":"\\Qorg/sqlite/native/Linux/x86_64/libsqlitejdbc.so\\E"
+ }, {
+ "pattern":"\\Qsignal_jni.dll\\E"
}, {
"pattern":"\\Qsignal_jni_amd64.dll\\E"
}, {
) throws ProtocolInvalidKeyException, ProtocolInvalidMessageException, UnsupportedDataMessageException, InvalidMessageStructureException {
final var content = cipherResult.getContent();
final var envelopeMetadata = cipherResult.getMetadata();
- final var validationResult = EnvelopeContentValidator.INSTANCE.validate(envelope, content);
+ final var validationResult = EnvelopeContentValidator.INSTANCE.validate(envelope, content, account.getAci());
if (validationResult instanceof EnvelopeContentValidator.Result.Invalid v) {
logger.warn("Invalid content! {}", v.getReason(), v.getThrowable());
import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.internal.push.SyncMessage;
-import org.whispersystems.signalservice.internal.push.http.ResumableUploadSpec;
import java.io.FileInputStream;
import java.io.FileOutputStream;
if (groupsFile.exists() && groupsFile.length() > 0) {
try (var groupsFileStream = new FileInputStream(groupsFile)) {
- final var uploadSpec = context.getDependencies()
- .getMessageSender()
- .getResumableUploadSpec()
- .toProto();
+ final var uploadSpec = context.getDependencies().getMessageSender().getResumableUploadSpec();
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
.withStream(groupsFileStream)
.withContentType(MimeUtils.OCTET_STREAM)
.withLength(groupsFile.length())
- .withResumableUploadSpec(ResumableUploadSpec.from(uploadSpec))
+ .withResumableUploadSpec(uploadSpec)
.build();
context.getSendHelper().sendSyncMessage(SignalServiceSyncMessage.forGroups(attachmentStream));
if (contactsFile.exists() && contactsFile.length() > 0) {
try (var contactsFileStream = new FileInputStream(contactsFile)) {
- final var uploadSpec = context.getDependencies()
- .getMessageSender()
- .getResumableUploadSpec()
- .toProto();
+ final var uploadSpec = context.getDependencies().getMessageSender().getResumableUploadSpec();
var attachmentStream = SignalServiceAttachment.newStreamBuilder()
.withStream(contactsFileStream)
.withContentType(MimeUtils.OCTET_STREAM)
.withLength(contactsFile.length())
- .withResumableUploadSpec(ResumableUploadSpec.from(uploadSpec))
+ .withResumableUploadSpec(uploadSpec)
.build();
context.getSendHelper()
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
+import org.whispersystems.signalservice.internal.push.ProvisioningSocket;
+import org.whispersystems.signalservice.internal.push.PushServiceSocket;
import org.whispersystems.signalservice.internal.util.DynamicCredentialsProvider;
import java.io.IOException;
tempIdentityKey = KeyUtils.generateIdentityKeyPair();
password = KeyUtils.createPassword();
- GroupsV2Operations groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(
- serviceEnvironmentConfig.signalServiceConfiguration()), ServiceConfig.GROUP_MAX_SIZE);
- accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.signalServiceConfiguration(),
- new DynamicCredentialsProvider(null, null, null, password, SignalServiceAddress.DEFAULT_DEVICE_ID),
+ final var clientZkOperations = ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration());
+ final var groupsV2Operations = new GroupsV2Operations(clientZkOperations, ServiceConfig.GROUP_MAX_SIZE);
+ final var credentialsProvider = new DynamicCredentialsProvider(null,
+ null,
+ null,
+ password,
+ SignalServiceAddress.DEFAULT_DEVICE_ID);
+ final var pushServiceSocket = new PushServiceSocket(serviceEnvironmentConfig.signalServiceConfiguration(),
+ credentialsProvider,
userAgent,
- groupsV2Operations,
+ clientZkOperations.getProfileOperations(),
ServiceConfig.AUTOMATIC_NETWORK_RETRY);
+ accountManager = new SignalServiceAccountManager(pushServiceSocket,
+ new ProvisioningSocket(serviceEnvironmentConfig.signalServiceConfiguration(), userAgent),
+ groupsV2Operations);
}
@Override
import org.whispersystems.signalservice.api.push.exceptions.AlreadyVerifiedException;
import org.whispersystems.signalservice.api.push.exceptions.DeprecatedVersionException;
import org.whispersystems.signalservice.api.svr.SecureValueRecovery;
+import org.whispersystems.signalservice.internal.push.PushServiceSocket;
import org.whispersystems.signalservice.internal.push.VerifyAccountResponse;
-import org.whispersystems.signalservice.internal.util.DynamicCredentialsProvider;
import java.io.IOException;
import java.util.function.Consumer;
private final ServiceEnvironmentConfig serviceEnvironmentConfig;
private final String userAgent;
private final Consumer<Manager> newManagerListener;
- private final GroupsV2Operations groupsV2Operations;
- private final SignalServiceAccountManager accountManager;
+ private final SignalServiceAccountManager unauthenticatedAccountManager;
private final PinHelper pinHelper;
private final AccountFileUpdater accountFileUpdater;
this.userAgent = userAgent;
this.newManagerListener = newManagerListener;
- groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration()),
- ServiceConfig.GROUP_MAX_SIZE);
- this.accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.signalServiceConfiguration(),
- new DynamicCredentialsProvider(
- // Using empty UUID, because registering doesn't work otherwise
- null, null, account.getNumber(), account.getPassword(), SignalServiceAddress.DEFAULT_DEVICE_ID),
+ this.unauthenticatedAccountManager = SignalServiceAccountManager.createWithStaticCredentials(
+ serviceEnvironmentConfig.signalServiceConfiguration(),
+ // Using empty UUID, because registering doesn't work otherwise
+ null,
+ null,
+ account.getNumber(),
+ SignalServiceAddress.DEFAULT_DEVICE_ID,
+ account.getPassword(),
userAgent,
- groupsV2Operations,
- ServiceConfig.AUTOMATIC_NETWORK_RETRY);
+ ServiceConfig.AUTOMATIC_NETWORK_RETRY,
+ ServiceConfig.GROUP_MAX_SIZE);
final var secureValueRecoveryV2 = serviceEnvironmentConfig.svr2Mrenclaves()
.stream()
.map(mr -> (SecureValueRecovery) accountManager.getSecureValueRecoveryV2(mr))
return;
}
- String sessionId = NumberVerificationUtils.handleVerificationSession(accountManager,
+ String sessionId = NumberVerificationUtils.handleVerificationSession(unauthenticatedAccountManager,
account.getSessionId(account.getNumber()),
id -> account.setSessionId(account.getNumber(), id),
voiceVerification,
captcha);
- NumberVerificationUtils.requestVerificationCode(accountManager, sessionId, voiceVerification);
+ NumberVerificationUtils.requestVerificationCode(unauthenticatedAccountManager,
+ sessionId,
+ voiceVerification);
account.setRegistered(false);
} catch (DeprecatedVersionException e) {
logger.debug("Signal-Server returned deprecated version exception", e);
final var aciPreKeys = generatePreKeysForType(account.getAccountData(ServiceIdType.ACI));
final var pniPreKeys = generatePreKeysForType(account.getAccountData(ServiceIdType.PNI));
- final var response = Utils.handleResponseException(accountManager.registerAccount(null,
+ final var response = Utils.handleResponseException(unauthenticatedAccountManager.registerAccount(null,
recoveryPassword,
account.getAccountAttributes(null),
aciPreKeys,
private boolean attemptReactivateAccount() {
try {
- final var accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.signalServiceConfiguration(),
- account.getCredentialsProvider(),
- userAgent,
- groupsV2Operations,
- ServiceConfig.AUTOMATIC_NETWORK_RETRY);
+ final var accountManager = createAuthenticatedSignalServiceAccountManager();
accountManager.setAccountAttributes(account.getAccountAttributes(null));
account.setRegistered(true);
logger.info("Reactivated existing account, verify is not necessary.");
return false;
}
+ private SignalServiceAccountManager createAuthenticatedSignalServiceAccountManager() {
+ final var clientZkOperations = ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration());
+ final var pushServiceSocket = new PushServiceSocket(serviceEnvironmentConfig.signalServiceConfiguration(),
+ account.getCredentialsProvider(),
+ userAgent,
+ clientZkOperations.getProfileOperations(),
+ ServiceConfig.AUTOMATIC_NETWORK_RETRY);
+ final var groupsV2Operations = new GroupsV2Operations(clientZkOperations, ServiceConfig.GROUP_MAX_SIZE);
+ return new SignalServiceAccountManager(pushServiceSocket, null, groupsV2Operations);
+ }
+
private VerifyAccountResponse verifyAccountWithCode(
final String sessionId,
final String verificationCode,
final PreKeyCollection pniPreKeys
) throws IOException {
try {
- Utils.handleResponseException(accountManager.verifyAccount(verificationCode, sessionId));
+ Utils.handleResponseException(unauthenticatedAccountManager.verifyAccount(verificationCode, sessionId));
} catch (AlreadyVerifiedException e) {
// Already verified so can continue registering
}
- return Utils.handleResponseException(accountManager.registerAccount(sessionId,
+ return Utils.handleResponseException(unauthenticatedAccountManager.registerAccount(sessionId,
null,
account.getAccountAttributes(registrationLock),
aciPreKeys,
import org.whispersystems.signalservice.api.util.CredentialsProvider;
import org.whispersystems.signalservice.api.util.UptimeSleepTimer;
import org.whispersystems.signalservice.api.websocket.WebSocketFactory;
+import org.whispersystems.signalservice.internal.push.ProvisioningSocket;
import org.whispersystems.signalservice.internal.push.PushServiceSocket;
import org.whispersystems.signalservice.internal.websocket.OkHttpWebSocketConnection;
import org.whispersystems.signalservice.internal.websocket.WebSocketConnection;
private ClientZkOperations clientZkOperations;
private PushServiceSocket pushServiceSocket;
+ private ProvisioningSocket provisioningSocket;
private Network libSignalNetwork;
private SignalWebSocket signalWebSocket;
private SignalServiceMessageReceiver messageReceiver;
ServiceConfig.AUTOMATIC_NETWORK_RETRY));
}
+ public ProvisioningSocket getProvisioningSocket() {
+ return getOrCreate(() -> provisioningSocket,
+ () -> provisioningSocket = new ProvisioningSocket(getServiceEnvironmentConfig().signalServiceConfiguration(),
+ userAgent));
+ }
+
public Network getLibSignalNetwork() {
return getOrCreate(() -> libSignalNetwork,
() -> libSignalNetwork = new Network(serviceEnvironmentConfig.netEnvironment(), userAgent));
public SignalServiceAccountManager getAccountManager() {
return getOrCreate(() -> accountManager,
() -> accountManager = new SignalServiceAccountManager(getPushServiceSocket(),
- null,
- serviceEnvironmentConfig.signalServiceConfiguration(),
- credentialsProvider,
+ getProvisioningSocket(),
getGroupsV2Operations()));
}
public SignalServiceAccountManager createUnauthenticatedAccountManager(String number, String password) {
- return new SignalServiceAccountManager(getServiceEnvironmentConfig().signalServiceConfiguration(),
+ return SignalServiceAccountManager.createWithStaticCredentials(getServiceEnvironmentConfig().signalServiceConfiguration(),
null,
null,
number,
public SignalServiceMessageSender getMessageSender() {
return getOrCreate(() -> messageSender,
- () -> messageSender = new SignalServiceMessageSender(credentialsProvider,
+ () -> messageSender = new SignalServiceMessageSender(getPushServiceSocket(),
dataStore,
sessionLock,
getSignalWebSocket(),
Optional.empty(),
executor,
- ServiceConfig.MAX_ENVELOPE_SIZE,
- getPushServiceSocket()));
+ ServiceConfig.MAX_ENVELOPE_SIZE));
}
public List<SecureValueRecovery> getSecureValueRecoveryV2() {
library("slf4j.jul", "org.slf4j", "jul-to-slf4j").versionRef("slf4j")
library("logback", "ch.qos.logback", "logback-classic").version("1.5.8")
- library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_107")
+ library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_108")
library("sqlite", "org.xerial", "sqlite-jdbc").version("3.46.1.0")
library("hikari", "com.zaxxer", "HikariCP").version("5.1.0")
library("junit.jupiter", "org.junit.jupiter", "junit-jupiter").version("5.11.0")
public static final String PROJECT_VERSION = BaseConfig.class.getPackage().getImplementationVersion();
static final String USER_AGENT_SIGNAL_ANDROID = Optional.ofNullable(System.getenv("SIGNAL_CLI_USER_AGENT"))
- .orElse("Signal-Android/7.16.2");
+ .orElse("Signal-Android/7.18.2");
static final String USER_AGENT_SIGNAL_CLI = PROJECT_NAME == null
? "signal-cli"
: PROJECT_NAME + "/" + PROJECT_VERSION;