mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Update dependencies
This commit is contained in:
parent
9da6f3a702
commit
6e61bc2000
14 changed files with 55 additions and 98 deletions
|
@ -1,20 +0,0 @@
|
|||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
|
||||
public class SendPniIdentityKeyAction implements HandleAction {
|
||||
|
||||
private static final SendPniIdentityKeyAction INSTANCE = new SendPniIdentityKeyAction();
|
||||
|
||||
private SendPniIdentityKeyAction() {
|
||||
}
|
||||
|
||||
public static SendPniIdentityKeyAction create() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getSyncHelper().sendPniIdentity();
|
||||
}
|
||||
}
|
|
@ -44,17 +44,7 @@ public class ServiceConfig {
|
|||
|
||||
public static AccountAttributes.Capabilities getCapabilities(boolean isPrimaryDevice) {
|
||||
final var giftBadges = !isPrimaryDevice;
|
||||
return new AccountAttributes.Capabilities(false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
giftBadges,
|
||||
false,
|
||||
false);
|
||||
return new AccountAttributes.Capabilities(false, true, true, true, true, giftBadges, false, false);
|
||||
}
|
||||
|
||||
public static boolean isSignalClientAvailable() {
|
||||
|
|
|
@ -73,7 +73,7 @@ public class IdentityHelper {
|
|||
final var recipientId = account.getRecipientResolver().resolveRecipient(serviceId);
|
||||
final var address = account.getRecipientAddressResolver().resolveRecipientAddress(recipientId);
|
||||
|
||||
if (account.getAccountCapabilities().getUuid()) {
|
||||
if (false) {
|
||||
if (serviceId.isUnknown()) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.asamk.signal.manager.actions.RetrieveProfileAction;
|
|||
import org.asamk.signal.manager.actions.RetrieveStorageDataAction;
|
||||
import org.asamk.signal.manager.actions.SendGroupInfoAction;
|
||||
import org.asamk.signal.manager.actions.SendGroupInfoRequestAction;
|
||||
import org.asamk.signal.manager.actions.SendPniIdentityKeyAction;
|
||||
import org.asamk.signal.manager.actions.SendProfileKeyAction;
|
||||
import org.asamk.signal.manager.actions.SendReceiptAction;
|
||||
import org.asamk.signal.manager.actions.SendRetryMessageRequestAction;
|
||||
|
@ -35,7 +34,6 @@ import org.asamk.signal.manager.storage.groups.GroupInfoV1;
|
|||
import org.asamk.signal.manager.storage.recipients.Profile;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
import org.asamk.signal.manager.storage.stickers.StickerPack;
|
||||
import org.asamk.signal.manager.util.KeyUtils;
|
||||
import org.signal.libsignal.metadata.ProtocolInvalidKeyException;
|
||||
import org.signal.libsignal.metadata.ProtocolInvalidKeyIdException;
|
||||
import org.signal.libsignal.metadata.ProtocolInvalidMessageException;
|
||||
|
@ -525,9 +523,6 @@ public final class IncomingMessageHandler {
|
|||
if (rm.isConfigurationRequest()) {
|
||||
actions.add(SendSyncConfigurationAction.create());
|
||||
}
|
||||
if (rm.isPniIdentityRequest()) {
|
||||
actions.add(SendPniIdentityKeyAction.create());
|
||||
}
|
||||
}
|
||||
if (syncMessage.getGroups().isPresent()) {
|
||||
try {
|
||||
|
@ -631,12 +626,6 @@ public final class IncomingMessageHandler {
|
|||
.get());
|
||||
}
|
||||
}
|
||||
if (syncMessage.getPniIdentity().isPresent()) {
|
||||
final var pniIdentity = syncMessage.getPniIdentity().get();
|
||||
account.setPniIdentityKeyPair(KeyUtils.getIdentityKeyPair(pniIdentity.getPublicKey().toByteArray(),
|
||||
pniIdentity.getPrivateKey().toByteArray()));
|
||||
actions.add(RefreshPreKeysAction.create());
|
||||
}
|
||||
if (syncMessage.getPniChangeNumber().isPresent()) {
|
||||
final var pniChangeNumber = syncMessage.getPniChangeNumber().get();
|
||||
logger.debug("Received PNI change number sync message, applying.");
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.asamk.signal.manager.helper;
|
|||
|
||||
import org.asamk.signal.manager.api.IncorrectPinException;
|
||||
import org.asamk.signal.manager.api.Pair;
|
||||
import org.asamk.signal.manager.util.PinHashing;
|
||||
import org.signal.libsignal.protocol.InvalidKeyException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -11,6 +10,7 @@ import org.whispersystems.signalservice.api.KeyBackupService;
|
|||
import org.whispersystems.signalservice.api.KeyBackupServicePinException;
|
||||
import org.whispersystems.signalservice.api.KeyBackupSystemNoDataException;
|
||||
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.LockedException;
|
||||
|
@ -37,7 +37,7 @@ public class PinHelper {
|
|||
String pin, MasterKey masterKey
|
||||
) throws IOException {
|
||||
final var pinChangeSession = keyBackupService.newPinChangeSession();
|
||||
final var hashedPin = PinHashing.hashPin(pin, pinChangeSession);
|
||||
final var hashedPin = PinHashUtil.hashPin(pin, pinChangeSession.hashSalt());
|
||||
|
||||
try {
|
||||
pinChangeSession.setPin(hashedPin, masterKey);
|
||||
|
@ -128,7 +128,7 @@ public class PinHelper {
|
|||
var session = keyBackupService.newRegistrationSession(basicStorageCredentials, tokenResponse);
|
||||
|
||||
try {
|
||||
var hashedPin = PinHashing.hashPin(pin, session);
|
||||
var hashedPin = PinHashUtil.hashPin(pin, session.hashSalt());
|
||||
var kbsData = session.restorePin(hashedPin);
|
||||
if (kbsData == null) {
|
||||
throw new AssertionError("Null not expected");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.asamk.signal.manager.helper;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
import org.asamk.signal.manager.api.TrustLevel;
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.storage.SignalAccount;
|
||||
|
@ -233,15 +231,6 @@ public class SyncHelper {
|
|||
context.getSendHelper().sendSyncMessage(SignalServiceSyncMessage.forConfiguration(configurationMessage));
|
||||
}
|
||||
|
||||
public void sendPniIdentity() {
|
||||
final var pniIdentityKeyPair = account.getPniIdentityKeyPair();
|
||||
var pniIdentity = SignalServiceProtos.SyncMessage.PniIdentity.newBuilder()
|
||||
.setPrivateKey(ByteString.copyFrom(pniIdentityKeyPair.getPrivateKey().serialize()))
|
||||
.setPublicKey(ByteString.copyFrom(pniIdentityKeyPair.getPublicKey().serialize()))
|
||||
.build();
|
||||
context.getSendHelper().sendSyncMessage(SignalServiceSyncMessage.forPniIdentity(pniIdentity));
|
||||
}
|
||||
|
||||
public void handleSyncDeviceGroups(final InputStream input) {
|
||||
final var s = new DeviceGroupsInputStream(input);
|
||||
DeviceGroup g;
|
||||
|
|
|
@ -71,7 +71,8 @@ public class UnidentifiedAccessHelper {
|
|||
|
||||
try {
|
||||
return Optional.of(new UnidentifiedAccessPair(new UnidentifiedAccess(recipientUnidentifiedAccessKey,
|
||||
senderCertificate), new UnidentifiedAccess(selfUnidentifiedAccessKey, senderCertificate)));
|
||||
senderCertificate,
|
||||
false), new UnidentifiedAccess(selfUnidentifiedAccessKey, senderCertificate, false)));
|
||||
} catch (InvalidCertificateException e) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
@ -87,8 +88,9 @@ public class UnidentifiedAccessHelper {
|
|||
|
||||
try {
|
||||
return Optional.of(new UnidentifiedAccessPair(new UnidentifiedAccess(selfUnidentifiedAccessKey,
|
||||
selfUnidentifiedAccessCertificate),
|
||||
new UnidentifiedAccess(selfUnidentifiedAccessKey, selfUnidentifiedAccessCertificate)));
|
||||
selfUnidentifiedAccessCertificate,
|
||||
false),
|
||||
new UnidentifiedAccess(selfUnidentifiedAccessKey, selfUnidentifiedAccessCertificate, false)));
|
||||
} catch (InvalidCertificateException e) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.signal.libsignal.protocol.NoSessionException;
|
|||
import org.signal.libsignal.protocol.SignalProtocolAddress;
|
||||
import org.signal.libsignal.protocol.groups.state.SenderKeyRecord;
|
||||
import org.signal.libsignal.protocol.state.IdentityKeyStore;
|
||||
import org.signal.libsignal.protocol.state.KyberPreKeyRecord;
|
||||
import org.signal.libsignal.protocol.state.PreKeyRecord;
|
||||
import org.signal.libsignal.protocol.state.PreKeyStore;
|
||||
import org.signal.libsignal.protocol.state.SessionRecord;
|
||||
|
@ -197,4 +198,32 @@ public class SignalProtocolStore implements SignalServiceAccountDataStore {
|
|||
public boolean isMultiDevice() {
|
||||
return isMultiDevice.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KyberPreKeyRecord loadKyberPreKey(final int kyberPreKeyId) throws InvalidKeyIdException {
|
||||
// TODO
|
||||
throw new InvalidKeyIdException("Missing kyber prekey with ID: $kyberPreKeyId");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KyberPreKeyRecord> loadKyberPreKeys() {
|
||||
// TODO
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeKyberPreKey(final int kyberPreKeyId, final KyberPreKeyRecord record) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKyberPreKey(final int kyberPreKeyId) {
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markKyberPreKeyUsed(final int kyberPreKeyId) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package org.asamk.signal.manager.util;
|
||||
|
||||
import org.bouncycastle.crypto.generators.Argon2BytesGenerator;
|
||||
import org.bouncycastle.crypto.params.Argon2Parameters;
|
||||
import org.whispersystems.signalservice.api.KeyBackupService;
|
||||
import org.whispersystems.signalservice.api.kbs.HashedPin;
|
||||
import org.whispersystems.signalservice.internal.registrationpin.PinHasher;
|
||||
|
||||
public final class PinHashing {
|
||||
|
||||
private PinHashing() {
|
||||
}
|
||||
|
||||
public static HashedPin hashPin(String pin, KeyBackupService.HashSession hashSession) {
|
||||
final var params = new Argon2Parameters.Builder(Argon2Parameters.ARGON2_id).withParallelism(1)
|
||||
.withIterations(32)
|
||||
.withVersion(Argon2Parameters.ARGON2_VERSION_13)
|
||||
.withMemoryAsKB(16 * 1024)
|
||||
.withSalt(hashSession.hashSalt())
|
||||
.build();
|
||||
|
||||
final var generator = new Argon2BytesGenerator();
|
||||
generator.init(params);
|
||||
|
||||
return PinHasher.hashPin(PinHasher.normalize(pin), password -> {
|
||||
var output = new byte[64];
|
||||
generator.generateBytes(password, output);
|
||||
return output;
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue