## [Unreleased]
+Requires libsignal-client version 0.58.2
+
## [0.13.7] - 2024-09-28
Requires libsignal-client version 0.58.0
### Added
- New parameters for `updateGroup` command for group v2 features:
- `--description`, `--remove-member`, `--admin`, `--remove-admin`, `--reset-link`, `--link`, `--set-permission-add-member`, `--set-permission-edit-details`, `--expiration`
+ `--description`, `--remove-member`, `--admin`, `--remove-admin`, `--reset-link`, `--link`,
+ `--set-permission-add-member`, `--set-permission-edit-details`, `--expiration`
- New `--admin` parameter for `quitGroup` to set an admin before leaving the group
- New `--delete` parameter for `quitGroup`, to delete the local group data
- New 'sendTyping' command to send typing indicators
{
"name":"[Ljava.sql.Statement;"
},
+{
+ "name":"[Lorg.asamk.signal.json.JsonAttachment;"
+},
+{
+ "name":"[Lorg.asamk.signal.json.JsonMention;"
+},
+{
+ "name":"[Lorg.asamk.signal.json.JsonPreview;"
+},
+{
+ "name":"[Lorg.asamk.signal.json.JsonQuotedAttachment;"
+},
+{
+ "name":"[Lorg.asamk.signal.json.JsonTextStyle;"
+},
+{
+ "name":"[Lorg.asamk.signal.manager.storage.accounts.AccountsStorage$Account;"
+},
{
"name":"[Lorg.whispersystems.signalservice.api.groupsv2.TemporalCredential;"
},
"allDeclaredFields":true,
"allDeclaredMethods":true
},
+{
+ "name":"java.util.AbstractMap",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true
+},
{
"name":"java.util.ArrayList",
"allDeclaredMethods":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
+{
+ "name":"java.util.ImmutableCollections$AbstractImmutableCollection",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true
+},
+{
+ "name":"java.util.ImmutableCollections$AbstractImmutableList",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true
+},
+{
+ "name":"java.util.ImmutableCollections$AbstractImmutableMap",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true
+},
+{
+ "name":"java.util.ImmutableCollections$ListN",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true
+},
+{
+ "name":"java.util.ImmutableCollections$Map1",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true
+},
+{
+ "name":"java.util.ImmutableCollections$MapN",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true
+},
{
"name":"java.util.LinkedHashMap",
"allDeclaredMethods":true,
"methods":[{"name":"getUnicodeLocaleType","parameterTypes":["java.lang.String"] }]
},
{
- "name":"java.util.Map"
+ "name":"java.util.Map",
+ "queryAllDeclaredMethods":true
},
{
"name":"java.util.Optional",
"name":"org.asamk.signal.json.JsonContact",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true,
"methods":[{"name":"color","parameterTypes":[] }, {"name":"familyName","parameterTypes":[] }, {"name":"givenName","parameterTypes":[] }, {"name":"internal","parameterTypes":[] }, {"name":"isBlocked","parameterTypes":[] }, {"name":"isHidden","parameterTypes":[] }, {"name":"messageExpirationTime","parameterTypes":[] }, {"name":"name","parameterTypes":[] }, {"name":"nickFamilyName","parameterTypes":[] }, {"name":"nickGivenName","parameterTypes":[] }, {"name":"nickName","parameterTypes":[] }, {"name":"note","parameterTypes":[] }, {"name":"number","parameterTypes":[] }, {"name":"profile","parameterTypes":[] }, {"name":"profileSharing","parameterTypes":[] }, {"name":"unregistered","parameterTypes":[] }, {"name":"username","parameterTypes":[] }, {"name":"uuid","parameterTypes":[] }]
},
{
"name":"org.asamk.signal.json.JsonContact$JsonInternal",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true,
"methods":[{"name":"capabilities","parameterTypes":[] }, {"name":"discoverableByPhonenumber","parameterTypes":[] }, {"name":"sharesPhoneNumber","parameterTypes":[] }, {"name":"unidentifiedAccessMode","parameterTypes":[] }]
},
{
"name":"org.asamk.signal.json.JsonContact$JsonProfile",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true,
"methods":[{"name":"about","parameterTypes":[] }, {"name":"aboutEmoji","parameterTypes":[] }, {"name":"familyName","parameterTypes":[] }, {"name":"givenName","parameterTypes":[] }, {"name":"hasAvatar","parameterTypes":[] }, {"name":"lastUpdateTimestamp","parameterTypes":[] }, {"name":"mobileCoinAddress","parameterTypes":[] }]
},
{
"name":"org.signal.storageservice.protos.groups.local.DecryptedTimer",
"fields":[{"name":"duration_"}]
},
+{
+ "name":"org.slf4j.Logger"
+},
{
"name":"org.sqlite.JDBC"
},
"allDeclaredFields":true,
"allDeclaredClasses":true,
"queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true,
"methods":[{"name":"accountAttributes","parameterTypes":[] }, {"name":"aciPqLastResortPreKey","parameterTypes":[] }, {"name":"aciSignedPreKey","parameterTypes":[] }, {"name":"pniPqLastResortPreKey","parameterTypes":[] }, {"name":"pniSignedPreKey","parameterTypes":[] }, {"name":"verificationCode","parameterTypes":[] }]
},
{
String newNumber, boolean voiceVerification, String captcha
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethodNotAvailableException {
final var accountManager = dependencies.createUnauthenticatedAccountManager(newNumber, account.getPassword());
- String sessionId = NumberVerificationUtils.handleVerificationSession(accountManager,
+ final var registrationApi = accountManager.getRegistrationApi();
+ String sessionId = NumberVerificationUtils.handleVerificationSession(registrationApi,
account.getSessionId(newNumber),
id -> account.setSessionId(newNumber, id),
voiceVerification,
captcha);
- NumberVerificationUtils.requestVerificationCode(accountManager, sessionId, voiceVerification);
+ NumberVerificationUtils.requestVerificationCode(registrationApi, sessionId, voiceVerification);
}
public void finishChangeNumber(
pin,
context.getPinHelper(),
(sessionId1, verificationCode1, registrationLock) -> {
- final var accountManager = dependencies.getAccountManager();
+ final var registrationApi = dependencies.getRegistrationApi();
try {
- Utils.handleResponseException(accountManager.verifyAccount(verificationCode1, sessionId1));
+ Utils.handleResponseException(registrationApi.verifyAccount(verificationCode1, sessionId1));
} catch (AlreadyVerifiedException e) {
// Already verified so can continue changing number
}
- return Utils.handleResponseException(accountManager.changeNumber(new ChangePhoneNumberRequest(
+ return Utils.handleResponseException(registrationApi.changeNumber(new ChangePhoneNumberRequest(
sessionId1,
null,
newNumber,
return;
}
- String sessionId = NumberVerificationUtils.handleVerificationSession(unauthenticatedAccountManager,
+ final var registrationApi = unauthenticatedAccountManager.getRegistrationApi();
+ String sessionId = NumberVerificationUtils.handleVerificationSession(registrationApi,
account.getSessionId(account.getNumber()),
id -> account.setSessionId(account.getNumber(), id),
voiceVerification,
captcha);
- NumberVerificationUtils.requestVerificationCode(unauthenticatedAccountManager,
- sessionId,
- voiceVerification);
+ NumberVerificationUtils.requestVerificationCode(registrationApi, 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(unauthenticatedAccountManager.registerAccount(null,
+ final var registrationApi = unauthenticatedAccountManager.getRegistrationApi();
+ final var response = Utils.handleResponseException(registrationApi.registerAccount(null,
recoveryPassword,
account.getAccountAttributes(null),
aciPreKeys,
final PreKeyCollection aciPreKeys,
final PreKeyCollection pniPreKeys
) throws IOException {
+ final var registrationApi = unauthenticatedAccountManager.getRegistrationApi();
try {
- Utils.handleResponseException(unauthenticatedAccountManager.verifyAccount(verificationCode, sessionId));
+ Utils.handleResponseException(registrationApi.verifyAccount(verificationCode, sessionId));
} catch (AlreadyVerifiedException e) {
// Already verified so can continue registering
}
- return Utils.handleResponseException(unauthenticatedAccountManager.registerAccount(sessionId,
+ return Utils.handleResponseException(registrationApi.registerAccount(sessionId,
null,
account.getAccountAttributes(registrationLock),
aciPreKeys,
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
import org.whispersystems.signalservice.api.push.ServiceIdType;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
+import org.whispersystems.signalservice.api.registration.RegistrationApi;
import org.whispersystems.signalservice.api.services.ProfileService;
import org.whispersystems.signalservice.api.svr.SecureValueRecovery;
import org.whispersystems.signalservice.api.util.CredentialsProvider;
private SignalServiceAccountManager accountManager;
private GroupsV2Api groupsV2Api;
+ private RegistrationApi registrationApi;
private GroupsV2Operations groupsV2Operations;
private ClientZkOperations clientZkOperations;
if (this.pushServiceSocket != null) {
this.pushServiceSocket.close();
this.pushServiceSocket = null;
+ this.accountManager = null;
+ this.messageReceiver = null;
+ this.messageSender = null;
+ this.profileService = null;
+ this.groupsV2Api = null;
+ this.registrationApi = null;
+ this.secureValueRecovery = null;
}
- this.messageSender = null;
getSignalWebSocket().forceNewWebSockets();
}
return getOrCreate(() -> groupsV2Api, () -> groupsV2Api = getAccountManager().getGroupsV2Api());
}
+ public RegistrationApi getRegistrationApi() {
+ return getOrCreate(() -> registrationApi, () -> registrationApi = getAccountManager().getRegistrationApi());
+ }
+
public GroupsV2Operations getGroupsV2Operations() {
return getOrCreate(() -> groupsV2Operations,
() -> groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration()),
import org.asamk.signal.manager.helper.PinHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.whispersystems.signalservice.api.SignalServiceAccountManager;
+import org.whispersystems.signalservice.api.NetworkResult;
import org.whispersystems.signalservice.api.kbs.MasterKey;
import org.whispersystems.signalservice.api.push.exceptions.NoSuchSessionException;
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
import org.whispersystems.signalservice.api.push.exceptions.PushChallengeRequiredException;
import org.whispersystems.signalservice.api.push.exceptions.TokenNotAcceptedException;
-import org.whispersystems.signalservice.internal.ServiceResponse;
+import org.whispersystems.signalservice.api.registration.RegistrationApi;
import org.whispersystems.signalservice.internal.push.LockedException;
+import org.whispersystems.signalservice.internal.push.PushServiceSocket.VerificationCodeTransport;
import org.whispersystems.signalservice.internal.push.RegistrationSessionMetadataResponse;
import org.whispersystems.signalservice.internal.push.VerifyAccountResponse;
private static final Logger logger = LoggerFactory.getLogger(NumberVerificationUtils.class);
public static String handleVerificationSession(
- SignalServiceAccountManager accountManager,
+ RegistrationApi registrationApi,
String sessionId,
Consumer<String> sessionIdSaver,
boolean voiceVerification,
) throws CaptchaRequiredException, IOException, RateLimitException, VerificationMethodNotAvailableException {
RegistrationSessionMetadataResponse sessionResponse;
try {
- sessionResponse = getValidSession(accountManager, sessionId);
+ sessionResponse = getValidSession(registrationApi, sessionId);
} catch (PushChallengeRequiredException |
org.whispersystems.signalservice.api.push.exceptions.CaptchaRequiredException e) {
if (captcha != null) {
- sessionResponse = submitCaptcha(accountManager, sessionId, captcha);
+ sessionResponse = submitCaptcha(registrationApi, sessionId, captcha);
} else {
throw new CaptchaRequiredException("Captcha Required");
}
if (sessionResponse.getBody().getRequestedInformation().contains("captcha")) {
if (captcha != null) {
- sessionResponse = submitCaptcha(accountManager, sessionId, captcha);
+ sessionResponse = submitCaptcha(registrationApi, sessionId, captcha);
}
if (!sessionResponse.getBody().getAllowedToRequestCode()) {
throw new CaptchaRequiredException("Captcha Required");
}
public static void requestVerificationCode(
- SignalServiceAccountManager accountManager, String sessionId, boolean voiceVerification
+ RegistrationApi registrationApi, String sessionId, boolean voiceVerification
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException {
- final ServiceResponse<RegistrationSessionMetadataResponse> response;
+ final NetworkResult<RegistrationSessionMetadataResponse> response;
final var locale = Utils.getDefaultLocale(Locale.US);
if (voiceVerification) {
- response = accountManager.requestVoiceVerificationCode(sessionId, locale, false);
+ response = registrationApi.requestSmsVerificationCode(sessionId,
+ locale,
+ false,
+ VerificationCodeTransport.VOICE);
} else {
- response = accountManager.requestSmsVerificationCode(sessionId, locale, false);
+ response = registrationApi.requestSmsVerificationCode(sessionId,
+ locale,
+ false,
+ VerificationCodeTransport.SMS);
}
try {
Utils.handleResponseException(response);
}
private static RegistrationSessionMetadataResponse validateSession(
- final SignalServiceAccountManager accountManager, final String sessionId
+ final RegistrationApi registrationApi, final String sessionId
) throws IOException {
if (sessionId == null || sessionId.isEmpty()) {
throw new NoSuchSessionException();
}
- return Utils.handleResponseException(accountManager.getRegistrationSession(sessionId));
+ return Utils.handleResponseException(registrationApi.getRegistrationSessionStatus(sessionId));
}
private static RegistrationSessionMetadataResponse requestValidSession(
- final SignalServiceAccountManager accountManager
+ final RegistrationApi registrationApi
) throws IOException {
- return Utils.handleResponseException(accountManager.createRegistrationSession(null, "", ""));
+ return Utils.handleResponseException(registrationApi.createRegistrationSession(null, "", ""));
}
private static RegistrationSessionMetadataResponse getValidSession(
- final SignalServiceAccountManager accountManager, final String sessionId
+ final RegistrationApi registrationApi, final String sessionId
) throws IOException {
try {
- return validateSession(accountManager, sessionId);
+ return validateSession(registrationApi, sessionId);
} catch (NoSuchSessionException e) {
logger.debug("No registration session, creating new one.");
- return requestValidSession(accountManager);
+ return requestValidSession(registrationApi);
}
}
private static RegistrationSessionMetadataResponse submitCaptcha(
- SignalServiceAccountManager accountManager, String sessionId, String captcha
+ RegistrationApi registrationApi, String sessionId, String captcha
) throws IOException, CaptchaRequiredException {
captcha = captcha == null ? null : captcha.replace("signalcaptcha://", "");
try {
- return Utils.handleResponseException(accountManager.submitCaptchaToken(sessionId, captcha));
+ return Utils.handleResponseException(registrationApi.submitCaptchaToken(sessionId, captcha));
} catch (PushChallengeRequiredException |
org.whispersystems.signalservice.api.push.exceptions.CaptchaRequiredException |
TokenNotAcceptedException _e) {
import org.signal.libsignal.protocol.fingerprint.NumericFingerprintGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.whispersystems.signalservice.api.NetworkResult;
import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.util.StreamDetails;
-import org.whispersystems.signalservice.internal.ServiceResponse;
import java.io.ByteArrayInputStream;
import java.io.File;
return map;
}
- public static <T> T handleResponseException(final ServiceResponse<T> response) throws IOException {
- final var throwableOptional = response.getExecutionError().or(response::getApplicationError);
- if (throwableOptional.isPresent()) {
- if (throwableOptional.get() instanceof IOException) {
- throw (IOException) throwableOptional.get();
+ public static <T> T handleResponseException(final NetworkResult<T> response) throws IOException {
+ final var throwableOptional = response.getCause();
+ if (throwableOptional != null) {
+ if (throwableOptional instanceof IOException ioException) {
+ throw ioException;
} else {
- throw new IOException(throwableOptional.get());
+ throw new IOException(throwableOptional);
}
}
- return response.getResult().orElse(null);
+ return response.successOrThrow();
}
}
versionCatalogs {
create("libs") {
library("bouncycastle", "org.bouncycastle", "bcprov-jdk18on").version("1.78.1")
- library("jackson.databind", "com.fasterxml.jackson.core", "jackson-databind").version("2.17.2")
+ library("jackson.databind", "com.fasterxml.jackson.core", "jackson-databind").version("2.18.0")
library("argparse4j", "net.sourceforge.argparse4j", "argparse4j").version("0.9.0")
library("dbusjava", "com.github.hypfvieh", "dbus-java-transport-native-unixsocket").version("5.0.0")
version("slf4j", "2.0.16")
library("slf4j.api", "org.slf4j", "slf4j-api").versionRef("slf4j")
library("slf4j.jul", "org.slf4j", "jul-to-slf4j").versionRef("slf4j")
- library("logback", "ch.qos.logback", "logback-classic").version("1.5.8")
+ library("logback", "ch.qos.logback", "logback-classic").version("1.5.11")
- library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_109")
- 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")
- library("junit.launcher", "org.junit.platform", "junit-platform-launcher").version("1.11.0")
+ library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_110")
+ library("sqlite", "org.xerial", "sqlite-jdbc").version("3.47.0.0")
+ library("hikari", "com.zaxxer", "HikariCP").version("6.0.0")
+ library("junit.jupiter", "org.junit.jupiter", "junit-jupiter").version("5.11.3")
+ library("junit.launcher", "org.junit.platform", "junit-platform-launcher").version("1.11.3")
}
}
}
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.18.2");
+ .orElse("Signal-Android/7.21.4");
static final String USER_AGENT_SIGNAL_CLI = PROJECT_NAME == null
? "signal-cli"
: PROJECT_NAME + "/" + PROJECT_VERSION;