Update libsignal-service-java

This commit is contained in:
AsamK 2023-07-14 19:25:32 +02:00
parent 2487fff44a
commit 02d4cb4a14
8 changed files with 116 additions and 41 deletions

View file

@ -15,6 +15,18 @@
{
"name":"[J"
},
{
"name":"[Lcom.fasterxml.jackson.databind.deser.Deserializers;"
},
{
"name":"[Lcom.fasterxml.jackson.databind.deser.KeyDeserializers;"
},
{
"name":"[Lcom.fasterxml.jackson.databind.deser.ValueInstantiators;"
},
{
"name":"[Lcom.fasterxml.jackson.databind.ser.Serializers;"
},
{
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
},
@ -68,6 +80,12 @@
{
"name":"char[]"
},
{
"name":"com.fasterxml.jackson.annotation.JsonIgnore"
},
{
"name":"com.fasterxml.jackson.annotation.JsonProperty"
},
{
"name":"com.fasterxml.jackson.databind.ext.Java7HandlersImpl",
"methods":[{"name":"<init>","parameterTypes":[] }]
@ -257,6 +275,9 @@
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.lang.Object"
},
{
"name":"java.lang.Record",
"allDeclaredFields":true,
@ -286,10 +307,18 @@
"name":"java.lang.constant.ConstantDesc",
"queryAllDeclaredMethods":true
},
{
"name":"java.lang.reflect.Executable",
"methods":[{"name":"getParameters","parameterTypes":[] }]
},
{
"name":"java.lang.reflect.Method",
"methods":[{"name":"isDefault","parameterTypes":[] }]
},
{
"name":"java.lang.reflect.Parameter",
"methods":[{"name":"getName","parameterTypes":[] }]
},
{
"name":"java.lang.reflect.RecordComponent",
"methods":[{"name":"getName","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }]
@ -424,6 +453,50 @@
{
"name":"javax.smartcardio.CardPermission"
},
{
"name":"kotlin.Any"
},
{
"name":"kotlin.Boolean"
},
{
"name":"kotlin.ByteArray"
},
{
"name":"kotlin.Int"
},
{
"name":"kotlin.Long"
},
{
"name":"kotlin.Metadata",
"queryAllDeclaredMethods":true,
"methods":[{"name":"bv","parameterTypes":[] }, {"name":"d1","parameterTypes":[] }, {"name":"d2","parameterTypes":[] }, {"name":"k","parameterTypes":[] }, {"name":"mv","parameterTypes":[] }, {"name":"pn","parameterTypes":[] }, {"name":"xi","parameterTypes":[] }, {"name":"xs","parameterTypes":[] }]
},
{
"name":"kotlin.SafePublicationLazyImpl",
"fields":[{"name":"_value"}]
},
{
"name":"kotlin.String"
},
{
"name":"kotlin.collections.List"
},
{
"name":"kotlin.collections.MutableList"
},
{
"name":"kotlin.jvm.internal.DefaultConstructorMarker"
},
{
"name":"kotlin.reflect.jvm.internal.ReflectionFactoryImpl",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"kotlin.reflect.jvm.internal.impl.resolve.scopes.DescriptorKindFilter",
"allPublicFields":true
},
{
"name":"libcore.io.Memory"
},
@ -2230,6 +2303,7 @@
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true,
"allDeclaredClasses":true,
"methods":[{"name":"getDestinationDeviceId","parameterTypes":[] }]
},
{
@ -2237,6 +2311,7 @@
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true,
"allDeclaredClasses":true,
"methods":[{"name":"getDestination","parameterTypes":[] }, {"name":"getMessages","parameterTypes":[] }, {"name":"getTimestamp","parameterTypes":[] }, {"name":"isOnline","parameterTypes":[] }, {"name":"isUrgent","parameterTypes":[] }]
},
{
@ -2372,7 +2447,7 @@
},
{
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$AttachmentPointer",
"fields":[{"name":"attachmentIdentifierCase_"}, {"name":"attachmentIdentifier_"}, {"name":"bitField0_"}, {"name":"blurHash_"}, {"name":"caption_"}, {"name":"cdnNumber_"}, {"name":"contentType_"}, {"name":"digest_"}, {"name":"fileName_"}, {"name":"flags_"}, {"name":"height_"}, {"name":"key_"}, {"name":"size_"}, {"name":"thumbnail_"}, {"name":"uploadTimestamp_"}, {"name":"width_"}]
"fields":[{"name":"attachmentIdentifierCase_"}, {"name":"attachmentIdentifier_"}, {"name":"bitField0_"}, {"name":"blurHash_"}, {"name":"caption_"}, {"name":"cdnNumber_"}, {"name":"contentType_"}, {"name":"digest_"}, {"name":"fileName_"}, {"name":"flags_"}, {"name":"height_"}, {"name":"incrementalDigest_"}, {"name":"key_"}, {"name":"size_"}, {"name":"thumbnail_"}, {"name":"uploadTimestamp_"}, {"name":"width_"}]
},
{
"name":"org.whispersystems.signalservice.internal.push.SignalServiceProtos$BodyRange",

View file

@ -6,6 +6,10 @@
"pattern":"\\QMETA-INF/services/ch.qos.logback.classic.spi.Configurator\\E"
}, {
"pattern":"\\QMETA-INF/services/java.sql.Driver\\E"
}, {
"pattern":"\\QMETA-INF/services/kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader\\E"
}, {
"pattern":"\\QMETA-INF/services/kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition\\E"
}, {
"pattern":"\\QMETA-INF/services/org.freedesktop.dbus.spi.transport.ITransportProvider\\E"
}, {
@ -140,6 +144,20 @@
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_XK\\E"
}, {
"pattern":"\\Qjni/x86_64-Linux/libjffi-1.2.so\\E"
}, {
"pattern":"\\Qkotlin/annotation/annotation.kotlin_builtins\\E"
}, {
"pattern":"\\Qkotlin/collections/collections.kotlin_builtins\\E"
}, {
"pattern":"\\Qkotlin/coroutines/coroutines.kotlin_builtins\\E"
}, {
"pattern":"\\Qkotlin/internal/internal.kotlin_builtins\\E"
}, {
"pattern":"\\Qkotlin/kotlin.kotlin_builtins\\E"
}, {
"pattern":"\\Qkotlin/ranges/ranges.kotlin_builtins\\E"
}, {
"pattern":"\\Qkotlin/reflect/reflect.kotlin_builtins\\E"
}, {
"pattern":"\\Qlibsignal_jni.dylib\\E"
}, {

View file

@ -5,14 +5,15 @@ import org.asamk.signal.manager.api.Pair;
import org.signal.libsignal.protocol.InvalidKeyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.KbsPinData;
import org.whispersystems.signalservice.api.KeyBackupService;
import org.whispersystems.signalservice.api.KeyBackupServicePinException;
import org.whispersystems.signalservice.api.KeyBackupSystemNoDataException;
import org.whispersystems.signalservice.api.SvrNoDataException;
import org.whispersystems.signalservice.api.SvrPinData;
import org.whispersystems.signalservice.api.kbs.MasterKey;
import org.whispersystems.signalservice.api.kbs.PinHashUtil;
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import org.whispersystems.signalservice.internal.contacts.entities.TokenResponse;
import org.whispersystems.signalservice.internal.push.AuthCredentials;
import org.whispersystems.signalservice.internal.push.LockedException;
import java.io.IOException;
@ -70,26 +71,27 @@ public class PinHelper {
}
}
public KbsPinData getRegistrationLockData(
public SvrPinData getRegistrationLockData(
String pin, LockedException e
) throws IOException, IncorrectPinException {
var basicStorageCredentials = e.getBasicStorageCredentials();
var basicStorageCredentials = e.getSvr1Credentials();
if (basicStorageCredentials == null) {
return null;
}
try {
return getRegistrationLockData(pin, basicStorageCredentials);
} catch (KeyBackupSystemNoDataException ex) {
} catch (SvrNoDataException ex) {
throw new IOException(e);
} catch (KeyBackupServicePinException ex) {
throw new IncorrectPinException(ex.getTriesRemaining());
}
}
private KbsPinData getRegistrationLockData(
String pin, String basicStorageCredentials
) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
private SvrPinData getRegistrationLockData(
String pin, AuthCredentials authCredentials
) throws IOException, SvrNoDataException, KeyBackupServicePinException {
final var basicStorageCredentials = authCredentials.asBasic();
var tokenResponsePair = getTokenResponse(basicStorageCredentials);
final var tokenResponse = tokenResponsePair.first();
final var keyBackupService = tokenResponsePair.second();
@ -113,12 +115,12 @@ public class PinHelper {
throw new IOException("KBS Account locked, maximum pin attempts reached.");
}
private KbsPinData restoreMasterKey(
private SvrPinData restoreMasterKey(
String pin,
String basicStorageCredentials,
TokenResponse tokenResponse,
final KeyBackupService keyBackupService
) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
) throws IOException, SvrNoDataException, KeyBackupServicePinException {
if (pin == null) return null;
if (basicStorageCredentials == null) {

View file

@ -163,6 +163,7 @@ public class RecipientHelper {
useCompat,
Optional.empty(),
serviceEnvironmentConfig.getCdsiMrenclave(),
null,
token -> {
// Not storing for partial refresh
});

View file

@ -51,8 +51,6 @@ import org.whispersystems.signalservice.internal.util.DynamicCredentialsProvider
import java.io.IOException;
import java.util.function.Consumer;
import static org.asamk.signal.manager.config.ServiceConfig.PREKEY_MAXIMUM_ID;
public class RegistrationManagerImpl implements RegistrationManager {
private final static Logger logger = LoggerFactory.getLogger(RegistrationManagerImpl.class);
@ -267,28 +265,14 @@ public class RegistrationManagerImpl implements RegistrationManager {
final var keyPair = accountData.getIdentityKeyPair();
final var preKeyMetadata = accountData.getPreKeyMetadata();
final var preKeyIdOffset = preKeyMetadata.getPreKeyIdOffset();
final var oneTimeEcPreKeys = KeyUtils.generatePreKeyRecords(preKeyIdOffset);
final var nextSignedPreKeyId = preKeyMetadata.getNextSignedPreKeyId();
final var signedPreKey = KeyUtils.generateSignedPreKeyRecord(nextSignedPreKeyId, keyPair);
final var privateKey = keyPair.getPrivateKey();
final var kyberPreKeyIdOffset = preKeyMetadata.getKyberPreKeyIdOffset();
final var oneTimeKyberPreKeys = KeyUtils.generateKyberPreKeyRecords(kyberPreKeyIdOffset, privateKey);
final var lastResortKyberPreKeyId = (kyberPreKeyIdOffset + oneTimeKyberPreKeys.size()) % PREKEY_MAXIMUM_ID;
final var lastResortKyberPreKey = KeyUtils.generateKyberPreKeyRecord(lastResortKyberPreKeyId, privateKey);
final var lastResortKyberPreKey = KeyUtils.generateKyberPreKeyRecord(kyberPreKeyIdOffset, privateKey);
return new PreKeyCollection(keyPair,
nextSignedPreKeyId,
preKeyIdOffset,
lastResortKyberPreKeyId,
kyberPreKeyIdOffset,
serviceIdType,
keyPair.getPublicKey(),
signedPreKey,
oneTimeEcPreKeys,
lastResortKyberPreKey,
oneTimeKyberPreKeys);
return new PreKeyCollection(keyPair.getPublicKey(), signedPreKey, lastResortKyberPreKey);
}
@Override

View file

@ -303,18 +303,14 @@ public class SignalAccount implements Closeable {
private void setPreKeys(ServiceIdType serviceIdType, PreKeyCollection preKeyCollection) {
final var accountData = getAccountData(serviceIdType);
final var preKeyMetadata = accountData.getPreKeyMetadata();
preKeyMetadata.nextSignedPreKeyId = preKeyCollection.getNextSignedPreKeyId();
preKeyMetadata.preKeyIdOffset = preKeyCollection.getEcOneTimePreKeyIdOffset();
preKeyMetadata.kyberPreKeyIdOffset = preKeyCollection.getOneTimeKyberPreKeyIdOffset();
preKeyMetadata.activeLastResortKyberPreKeyId = preKeyCollection.getLastResortKyberPreKeyId();
preKeyMetadata.nextSignedPreKeyId = preKeyCollection.getSignedPreKey().getId();
preKeyMetadata.kyberPreKeyIdOffset = preKeyCollection.getLastResortKyberPreKey().getId();
accountData.getPreKeyStore().removeAllPreKeys();
accountData.getSignedPreKeyStore().removeAllSignedPreKeys();
accountData.getKyberPreKeyStore().removeAllKyberPreKeys();
addPreKeys(serviceIdType, preKeyCollection.getOneTimeEcPreKeys());
addSignedPreKey(serviceIdType, preKeyCollection.getSignedPreKey());
addKyberPreKeys(serviceIdType, preKeyCollection.getOneTimeKyberPreKeys());
addLastResortKyberPreKey(serviceIdType, preKeyCollection.getLastResortKyberPreKey());
save();
@ -1335,13 +1331,14 @@ public class SignalAccount implements Closeable {
public AccountAttributes getAccountAttributes(String registrationLock) {
return new AccountAttributes(null,
getLocalRegistrationId(),
false,
false,
true,
null,
registrationLock != null ? registrationLock : getRegistrationLock(),
getSelfUnidentifiedAccessKey(),
isUnrestrictedUnidentifiedAccess(),
getAccountCapabilities(),
isDiscoverableByPhoneNumber(),
getAccountCapabilities(),
encryptedDeviceName,
getLocalPniRegistrationId(),
null); // TODO recoveryPassword?

View file

@ -7,7 +7,6 @@ import org.asamk.signal.manager.api.Pair;
import org.asamk.signal.manager.api.PinLockedException;
import org.asamk.signal.manager.api.RateLimitException;
import org.asamk.signal.manager.helper.PinHelper;
import org.whispersystems.signalservice.api.KbsPinData;
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
import org.whispersystems.signalservice.api.kbs.MasterKey;
import org.whispersystems.signalservice.api.push.exceptions.NoSuchSessionException;
@ -116,8 +115,7 @@ public class NumberVerificationUtils {
throw new PinLockedException(e.getTimeRemaining());
}
KbsPinData registrationLockData;
registrationLockData = pinHelper.getRegistrationLockData(pin, e);
final var registrationLockData = pinHelper.getRegistrationLockData(pin, e);
if (registrationLockData == null) {
throw e;
}

View file

@ -16,7 +16,7 @@ dependencyResolutionManagement {
library("logback", "ch.qos.logback", "logback-classic").version("1.4.8")
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_74")
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_75")
library("protobuf", "com.google.protobuf", "protobuf-javalite").version("3.23.0")
library("sqlite", "org.xerial", "sqlite-jdbc").version("3.42.0.0")
library("hikari", "com.zaxxer", "HikariCP").version("5.0.1")