Update dependencies

This commit is contained in:
AsamK 2023-06-11 17:16:38 +02:00
parent 3d5c440aa2
commit aad4b53524
7 changed files with 72 additions and 11 deletions

View file

@ -492,6 +492,11 @@
"allDeclaredMethods":true, "allDeclaredMethods":true,
"allDeclaredClasses":true "allDeclaredClasses":true
}, },
{
"name":"org.asamk.Signal$Identity",
"allDeclaredClasses":true,
"queryAllDeclaredMethods":true
},
{ {
"name":"org.asamk.Signal$MessageReceived", "name":"org.asamk.Signal$MessageReceived",
"allDeclaredConstructors":true, "allDeclaredConstructors":true,
@ -526,6 +531,10 @@
"queryAllDeclaredConstructors":true, "queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":["org.freedesktop.dbus.DBusPath","byte[]","java.lang.String"] }] "methods":[{"name":"<init>","parameterTypes":["org.freedesktop.dbus.DBusPath","byte[]","java.lang.String"] }]
}, },
{
"name":"org.asamk.Signal$StructIdentity",
"allDeclaredFields":true
},
{ {
"name":"org.asamk.Signal$SyncMessageReceived", "name":"org.asamk.Signal$SyncMessageReceived",
"allDeclaredConstructors":true, "allDeclaredConstructors":true,
@ -2790,6 +2799,20 @@
"queryAllDeclaredConstructors":true, "queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }] "methods":[{"name":"<init>","parameterTypes":[] }]
}, },
{
"name":"org.whispersystems.signalservice.internal.push.KyberPreKeyEntity",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"name":"org.whispersystems.signalservice.internal.push.KyberPreKeyEntity$ByteArrayDeserializer",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"org.whispersystems.signalservice.internal.push.KyberPreKeyEntity$KEMPublicKeyDeserializer",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{ {
"name":"org.whispersystems.signalservice.internal.push.MismatchedDevices", "name":"org.whispersystems.signalservice.internal.push.MismatchedDevices",
"allDeclaredFields":true, "allDeclaredFields":true,
@ -2797,6 +2820,13 @@
"allDeclaredConstructors":true, "allDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }] "methods":[{"name":"<init>","parameterTypes":[] }]
}, },
{
"name":"org.whispersystems.signalservice.internal.push.OneTimePreKeyCounts",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{ {
"name":"org.whispersystems.signalservice.internal.push.OutgoingPushMessage", "name":"org.whispersystems.signalservice.internal.push.OutgoingPushMessage",
"allDeclaredFields":true, "allDeclaredFields":true,

View file

@ -28,6 +28,7 @@ import org.whispersystems.signalservice.api.push.exceptions.AlreadyVerifiedExcep
import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException; import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.push.exceptions.DeprecatedVersionException; import org.whispersystems.signalservice.api.push.exceptions.DeprecatedVersionException;
import org.whispersystems.signalservice.api.util.DeviceNameUtil; import org.whispersystems.signalservice.api.util.DeviceNameUtil;
import org.whispersystems.signalservice.internal.push.KyberPreKeyEntity;
import org.whispersystems.signalservice.internal.push.OutgoingPushMessage; import org.whispersystems.signalservice.internal.push.OutgoingPushMessage;
import org.whispersystems.util.Base64UrlSafe; import org.whispersystems.util.Base64UrlSafe;
@ -153,6 +154,7 @@ public class AccountHelper {
// TODO create new PNI identity key // TODO create new PNI identity key
final List<OutgoingPushMessage> deviceMessages = null; final List<OutgoingPushMessage> deviceMessages = null;
final Map<String, SignedPreKeyEntity> devicePniSignedPreKeys = null; final Map<String, SignedPreKeyEntity> devicePniSignedPreKeys = null;
final Map<String, KyberPreKeyEntity> devicePniLastResortKyberPrekeys = null;
final Map<String, Integer> pniRegistrationIds = null; final Map<String, Integer> pniRegistrationIds = null;
var sessionId = account.getSessionId(account.getNumber()); var sessionId = account.getSessionId(account.getNumber());
final var result = NumberVerificationUtils.verifyNumber(sessionId, final var result = NumberVerificationUtils.verifyNumber(sessionId,
@ -174,6 +176,7 @@ public class AccountHelper {
account.getPniIdentityKeyPair().getPublicKey(), account.getPniIdentityKeyPair().getPublicKey(),
deviceMessages, deviceMessages,
devicePniSignedPreKeys, devicePniSignedPreKeys,
devicePniLastResortKyberPrekeys,
pniRegistrationIds))); pniRegistrationIds)));
}); });
// TODO handle response // TODO handle response
@ -193,10 +196,10 @@ public class AccountHelper {
} }
} }
final var candidates = Username.generateCandidates(nickname, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH); final var candidates = Username.candidatesFrom(nickname, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH);
final var candidateHashes = new ArrayList<String>(); final var candidateHashes = new ArrayList<String>();
for (final var candidate : candidates) { for (final var candidate : candidates) {
candidateHashes.add(Base64UrlSafe.encodeBytesWithoutPadding(Username.hash(candidate))); candidateHashes.add(Base64UrlSafe.encodeBytesWithoutPadding(candidate.getHash()));
} }
final var response = dependencies.getAccountManager().reserveUsername(candidateHashes); final var response = dependencies.getAccountManager().reserveUsername(candidateHashes);
@ -207,7 +210,7 @@ public class AccountHelper {
} }
logger.debug("[reserveUsername] Successfully reserved username."); logger.debug("[reserveUsername] Successfully reserved username.");
final var username = candidates.get(hashIndex); final var username = candidates.get(hashIndex).getUsername();
dependencies.getAccountManager().confirmUsername(username, response); dependencies.getAccountManager().confirmUsername(username, response);
account.setUsername(username); account.setUsername(username);
@ -226,7 +229,7 @@ public class AccountHelper {
final var whoAmIResponse = dependencies.getAccountManager().getWhoAmI(); final var whoAmIResponse = dependencies.getAccountManager().getWhoAmI();
final var serverUsernameHash = whoAmIResponse.getUsernameHash(); final var serverUsernameHash = whoAmIResponse.getUsernameHash();
final var hasServerUsername = !isEmpty(serverUsernameHash); final var hasServerUsername = !isEmpty(serverUsernameHash);
final var localUsernameHash = Base64UrlSafe.encodeBytesWithoutPadding(Username.hash(localUsername)); final var localUsernameHash = Base64UrlSafe.encodeBytesWithoutPadding(new Username(localUsername).getHash());
if (!hasServerUsername) { if (!hasServerUsername) {
logger.debug("No remote username is set."); logger.debug("No remote username is set.");

View file

@ -9,6 +9,7 @@ import org.signal.libsignal.protocol.state.PreKeyRecord;
import org.signal.libsignal.protocol.state.SignedPreKeyRecord; import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.account.PreKeyUpload;
import org.whispersystems.signalservice.api.push.ServiceIdType; import org.whispersystems.signalservice.api.push.ServiceIdType;
import java.io.IOException; import java.io.IOException;
@ -34,9 +35,11 @@ public class PreKeyHelper {
} }
public void refreshPreKeysIfNecessary(ServiceIdType serviceIdType) throws IOException { public void refreshPreKeysIfNecessary(ServiceIdType serviceIdType) throws IOException {
if (dependencies.getAccountManager().getPreKeysCount(serviceIdType) < ServiceConfig.PREKEY_MINIMUM_COUNT) { final var preKeyCounts = dependencies.getAccountManager().getPreKeyCounts(serviceIdType);
if (preKeyCounts.getEcCount() < ServiceConfig.PREKEY_MINIMUM_COUNT) {
refreshPreKeys(serviceIdType); refreshPreKeys(serviceIdType);
} }
// TODO kyber pre keys
} }
public void refreshPreKeys() throws IOException { public void refreshPreKeys() throws IOException {
@ -68,8 +71,13 @@ public class PreKeyHelper {
final var oneTimePreKeys = generatePreKeys(serviceIdType); final var oneTimePreKeys = generatePreKeys(serviceIdType);
final var signedPreKeyRecord = generateSignedPreKey(serviceIdType, identityKeyPair); final var signedPreKeyRecord = generateSignedPreKey(serviceIdType, identityKeyPair);
dependencies.getAccountManager() final var preKeyUpload = new PreKeyUpload(serviceIdType,
.setPreKeys(serviceIdType, identityKeyPair.getPublicKey(), signedPreKeyRecord, oneTimePreKeys); identityKeyPair.getPublicKey(),
signedPreKeyRecord,
oneTimePreKeys,
null,
null);
dependencies.getAccountManager().setPreKeys(preKeyUpload);
} }
private List<PreKeyRecord> generatePreKeys(ServiceIdType serviceIdType) { private List<PreKeyRecord> generatePreKeys(ServiceIdType serviceIdType) {

View file

@ -152,8 +152,12 @@ public class ReceiveHelper {
logger.trace("Storing new message from {}", recipientId); logger.trace("Storing new message from {}", recipientId);
// store message on disk, before acknowledging receipt to the server // store message on disk, before acknowledging receipt to the server
cachedMessage[0] = account.getMessageCache().cacheMessage(envelope1, recipientId); cachedMessage[0] = account.getMessageCache().cacheMessage(envelope1, recipientId);
try {
signalWebSocket.sendAck(it);
} catch (IOException e) {
logger.warn("Failed to ack envelope to server after storing it: {}", e.getMessage());
}
} }
return true;
}); });
isWaitingForMessage = false; isWaitingForMessage = false;
backOffCounter = 0; backOffCounter = 0;

View file

@ -180,7 +180,7 @@ public class RecipientHelper {
private ACI getRegisteredUserByUsername(String username) throws IOException, BaseUsernameException { private ACI getRegisteredUserByUsername(String username) throws IOException, BaseUsernameException {
return dependencies.getAccountManager() return dependencies.getAccountManager()
.getAciByUsernameHash(Base64UrlSafe.encodeBytesWithoutPadding(Username.hash(username))); .getAciByUsernameHash(Base64UrlSafe.encodeBytesWithoutPadding(new Username(username).getHash()));
} }
public record RegisteredUser(Optional<ACI> aci, Optional<PNI> pni) { public record RegisteredUser(Optional<ACI> aci, Optional<PNI> pni) {

View file

@ -226,4 +226,20 @@ public class SignalProtocolStore implements SignalServiceAccountDataStore {
public void markKyberPreKeyUsed(final int kyberPreKeyId) { public void markKyberPreKeyUsed(final int kyberPreKeyId) {
// TODO // TODO
} }
@Override
public List<KyberPreKeyRecord> loadLastResortKyberPreKeys() {
// TODO
return List.of();
}
@Override
public void removeKyberPreKey(final int i) {
// TODO
}
@Override
public void storeLastResortKyberPreKey(final int i, final KyberPreKeyRecord kyberPreKeyRecord) {
// TODO
}
} }

View file

@ -7,7 +7,7 @@ dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
create("libs") { create("libs") {
library("bouncycastle", "org.bouncycastle", "bcprov-jdk15on").version("1.70") library("bouncycastle", "org.bouncycastle", "bcprov-jdk15on").version("1.70")
library("jackson.databind", "com.fasterxml.jackson.core", "jackson-databind").version("2.15.1") library("jackson.databind", "com.fasterxml.jackson.core", "jackson-databind").version("2.15.2")
library("argparse4j", "net.sourceforge.argparse4j", "argparse4j").version("0.9.0") library("argparse4j", "net.sourceforge.argparse4j", "argparse4j").version("0.9.0")
library("dbusjava", "com.github.hypfvieh", "dbus-java-transport-native-unixsocket").version("4.3.0") library("dbusjava", "com.github.hypfvieh", "dbus-java-transport-native-unixsocket").version("4.3.0")
version("slf4j", "2.0.7") version("slf4j", "2.0.7")
@ -16,7 +16,7 @@ dependencyResolutionManagement {
library("logback", "ch.qos.logback", "logback-classic").version("1.4.7") library("logback", "ch.qos.logback", "logback-classic").version("1.4.7")
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_72") library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_73")
library("protobuf", "com.google.protobuf", "protobuf-javalite").version("3.23.0") library("protobuf", "com.google.protobuf", "protobuf-javalite").version("3.23.0")
library("sqlite", "org.xerial", "sqlite-jdbc").version("3.42.0.0") library("sqlite", "org.xerial", "sqlite-jdbc").version("3.42.0.0")
library("hikari", "com.zaxxer", "HikariCP").version("5.0.1") library("hikari", "com.zaxxer", "HikariCP").version("5.0.1")