mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Update libsignal-service-java
This commit is contained in:
parent
d690b35ed9
commit
b0bb602eb5
7 changed files with 43 additions and 22 deletions
|
@ -14,7 +14,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_39")
|
implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_41")
|
||||||
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.1")
|
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.1")
|
||||||
implementation("com.google.protobuf", "protobuf-javalite", "3.11.4")
|
implementation("com.google.protobuf", "protobuf-javalite", "3.11.4")
|
||||||
implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")
|
implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")
|
||||||
|
|
|
@ -133,7 +133,7 @@ class ManagerImpl implements Manager {
|
||||||
this.dependencies = new SignalDependencies(serviceEnvironmentConfig,
|
this.dependencies = new SignalDependencies(serviceEnvironmentConfig,
|
||||||
userAgent,
|
userAgent,
|
||||||
account.getCredentialsProvider(),
|
account.getCredentialsProvider(),
|
||||||
account.getSignalProtocolStore(),
|
account.getSignalServiceDataStore(),
|
||||||
executor,
|
executor,
|
||||||
sessionLock);
|
sessionLock);
|
||||||
final var avatarStore = new AvatarStore(pathConfig.avatarsPath());
|
final var avatarStore = new AvatarStore(pathConfig.avatarsPath());
|
||||||
|
|
|
@ -153,8 +153,7 @@ class RegistrationManagerImpl implements RegistrationManager {
|
||||||
userAgent,
|
userAgent,
|
||||||
null,
|
null,
|
||||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY);
|
ServiceConfig.AUTOMATIC_NETWORK_RETRY);
|
||||||
accountManager.setAccountAttributes(account.getEncryptedDeviceName(),
|
accountManager.setAccountAttributes(null,
|
||||||
null,
|
|
||||||
account.getLocalRegistrationId(),
|
account.getLocalRegistrationId(),
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
|
@ -162,7 +161,8 @@ class RegistrationManagerImpl implements RegistrationManager {
|
||||||
account.getSelfUnidentifiedAccessKey(),
|
account.getSelfUnidentifiedAccessKey(),
|
||||||
account.isUnrestrictedUnidentifiedAccess(),
|
account.isUnrestrictedUnidentifiedAccess(),
|
||||||
capabilities,
|
capabilities,
|
||||||
account.isDiscoverableByPhoneNumber());
|
account.isDiscoverableByPhoneNumber(),
|
||||||
|
account.getEncryptedDeviceName());
|
||||||
account.setRegistered(true);
|
account.setRegistered(true);
|
||||||
logger.info("Reactivated existing account, verify is not necessary.");
|
logger.info("Reactivated existing account, verify is not necessary.");
|
||||||
if (newManagerListener != null) {
|
if (newManagerListener != null) {
|
||||||
|
|
|
@ -90,8 +90,8 @@ public class SignalDependencies {
|
||||||
return new SignalServiceAccountManager(getServiceEnvironmentConfig().getSignalServiceConfiguration(),
|
return new SignalServiceAccountManager(getServiceEnvironmentConfig().getSignalServiceConfiguration(),
|
||||||
null,
|
null,
|
||||||
number,
|
number,
|
||||||
password,
|
|
||||||
SignalServiceAddress.DEFAULT_DEVICE_ID,
|
SignalServiceAddress.DEFAULT_DEVICE_ID,
|
||||||
|
password,
|
||||||
userAgent,
|
userAgent,
|
||||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY);
|
ServiceConfig.AUTOMATIC_NETWORK_RETRY);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ public class SignalDependencies {
|
||||||
final var certificateValidator = new CertificateValidator(serviceEnvironmentConfig.getUnidentifiedSenderTrustRoot());
|
final var certificateValidator = new CertificateValidator(serviceEnvironmentConfig.getUnidentifiedSenderTrustRoot());
|
||||||
final var address = new SignalServiceAddress(credentialsProvider.getAci(), credentialsProvider.getE164());
|
final var address = new SignalServiceAddress(credentialsProvider.getAci(), credentialsProvider.getE164());
|
||||||
final var deviceId = credentialsProvider.getDeviceId();
|
final var deviceId = credentialsProvider.getDeviceId();
|
||||||
cipher = new SignalServiceCipher(address, deviceId, dataStore, sessionLock, certificateValidator);
|
cipher = new SignalServiceCipher(address, deviceId, dataStore.aci(), sessionLock, certificateValidator);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,7 @@ public class AccountHelper {
|
||||||
|
|
||||||
public void updateAccountAttributes() throws IOException {
|
public void updateAccountAttributes() throws IOException {
|
||||||
dependencies.getAccountManager()
|
dependencies.getAccountManager()
|
||||||
.setAccountAttributes(account.getEncryptedDeviceName(),
|
.setAccountAttributes(null,
|
||||||
null,
|
|
||||||
account.getLocalRegistrationId(),
|
account.getLocalRegistrationId(),
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
|
@ -123,7 +122,8 @@ public class AccountHelper {
|
||||||
account.getSelfUnidentifiedAccessKey(),
|
account.getSelfUnidentifiedAccessKey(),
|
||||||
account.isUnrestrictedUnidentifiedAccess(),
|
account.isUnrestrictedUnidentifiedAccess(),
|
||||||
ServiceConfig.capabilities,
|
ServiceConfig.capabilities,
|
||||||
account.isDiscoverableByPhoneNumber());
|
account.isDiscoverableByPhoneNumber(),
|
||||||
|
account.getEncryptedDeviceName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDevice(DeviceLinkInfo deviceLinkInfo) throws IOException, InvalidDeviceLinkException {
|
public void addDevice(DeviceLinkInfo deviceLinkInfo) throws IOException, InvalidDeviceLinkException {
|
||||||
|
|
|
@ -44,9 +44,12 @@ import org.whispersystems.libsignal.state.PreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.whispersystems.libsignal.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||||
import org.whispersystems.libsignal.util.Medium;
|
import org.whispersystems.libsignal.util.Medium;
|
||||||
|
import org.whispersystems.signalservice.api.SignalServiceAccountDataStore;
|
||||||
|
import org.whispersystems.signalservice.api.SignalServiceDataStore;
|
||||||
import org.whispersystems.signalservice.api.crypto.UnidentifiedAccess;
|
import org.whispersystems.signalservice.api.crypto.UnidentifiedAccess;
|
||||||
import org.whispersystems.signalservice.api.kbs.MasterKey;
|
import org.whispersystems.signalservice.api.kbs.MasterKey;
|
||||||
import org.whispersystems.signalservice.api.push.ACI;
|
import org.whispersystems.signalservice.api.push.ACI;
|
||||||
|
import org.whispersystems.signalservice.api.push.AccountIdentifier;
|
||||||
import org.whispersystems.signalservice.api.push.DistributionId;
|
import org.whispersystems.signalservice.api.push.DistributionId;
|
||||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||||
import org.whispersystems.signalservice.api.storage.StorageKey;
|
import org.whispersystems.signalservice.api.storage.StorageKey;
|
||||||
|
@ -814,7 +817,31 @@ public class SignalAccount implements Closeable {
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SignalProtocolStore getSignalProtocolStore() {
|
public SignalServiceDataStore getSignalServiceDataStore() {
|
||||||
|
return new SignalServiceDataStore() {
|
||||||
|
@Override
|
||||||
|
public SignalServiceAccountDataStore get(final AccountIdentifier accountIdentifier) {
|
||||||
|
return getSignalServiceAccountDataStore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SignalServiceAccountDataStore aci() {
|
||||||
|
return getSignalServiceAccountDataStore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SignalServiceAccountDataStore pni() {
|
||||||
|
return getSignalServiceAccountDataStore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMultiDevice() {
|
||||||
|
return SignalAccount.this.isMultiDevice();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalServiceAccountDataStore getSignalServiceAccountDataStore() {
|
||||||
return getOrCreate(() -> signalProtocolStore,
|
return getOrCreate(() -> signalProtocolStore,
|
||||||
() -> signalProtocolStore = new SignalProtocolStore(getPreKeyStore(),
|
() -> signalProtocolStore = new SignalProtocolStore(getPreKeyStore(),
|
||||||
getSignedPreKeyStore(),
|
getSignedPreKeyStore(),
|
||||||
|
@ -957,8 +984,8 @@ public class SignalAccount implements Closeable {
|
||||||
return getRecipientStore().resolveRecipient(getSelfRecipientAddress());
|
return getRecipientStore().resolveRecipient(getSelfRecipientAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEncryptedDeviceName() {
|
public byte[] getEncryptedDeviceName() {
|
||||||
return encryptedDeviceName;
|
return encryptedDeviceName == null ? null : Base64.getDecoder().decode(encryptedDeviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEncryptedDeviceName(final String encryptedDeviceName) {
|
public void setEncryptedDeviceName(final String encryptedDeviceName) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.whispersystems.libsignal.state.PreKeyStore;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.whispersystems.libsignal.state.SessionRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
import org.whispersystems.libsignal.state.SignedPreKeyStore;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceDataStore;
|
import org.whispersystems.signalservice.api.SignalServiceAccountDataStore;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceSenderKeyStore;
|
import org.whispersystems.signalservice.api.SignalServiceSenderKeyStore;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceSessionStore;
|
import org.whispersystems.signalservice.api.SignalServiceSessionStore;
|
||||||
import org.whispersystems.signalservice.api.push.DistributionId;
|
import org.whispersystems.signalservice.api.push.DistributionId;
|
||||||
|
@ -23,7 +23,7 @@ import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class SignalProtocolStore implements SignalServiceDataStore {
|
public class SignalProtocolStore implements SignalServiceAccountDataStore {
|
||||||
|
|
||||||
private final PreKeyStore preKeyStore;
|
private final PreKeyStore preKeyStore;
|
||||||
private final SignedPreKeyStore signedPreKeyStore;
|
private final SignedPreKeyStore signedPreKeyStore;
|
||||||
|
@ -131,6 +131,7 @@ public class SignalProtocolStore implements SignalServiceDataStore {
|
||||||
@Override
|
@Override
|
||||||
public void archiveSession(final SignalProtocolAddress address) {
|
public void archiveSession(final SignalProtocolAddress address) {
|
||||||
sessionStore.archiveSession(address);
|
sessionStore.archiveSession(address);
|
||||||
|
senderKeyStore.clearSenderKeySharedWith(List.of(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,11 +197,4 @@ public class SignalProtocolStore implements SignalServiceDataStore {
|
||||||
public boolean isMultiDevice() {
|
public boolean isMultiDevice() {
|
||||||
return isMultiDevice.get();
|
return isMultiDevice.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Transaction beginTransaction() {
|
|
||||||
return () -> {
|
|
||||||
// No-op transaction should be safe, as it's only a performance improvement
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue