mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Migrate calls to deprecated libsignal methods.
This commit is contained in:
committed by
Michelle Tang
parent
d65954c26f
commit
8b9fc30b97
@@ -5,7 +5,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import org.signal.core.util.DatabaseId;
|
||||
import org.signal.core.util.Hex;
|
||||
import org.signal.libsignal.protocol.kdf.HKDFv3;
|
||||
import org.signal.libsignal.protocol.kdf.HKDF;
|
||||
import org.signal.libsignal.zkgroup.InvalidInputException;
|
||||
import org.signal.libsignal.zkgroup.groups.GroupIdentifier;
|
||||
import org.signal.libsignal.zkgroup.groups.GroupMasterKey;
|
||||
@@ -299,7 +299,7 @@ public abstract class GroupId implements DatabaseId {
|
||||
|
||||
public GroupMasterKey deriveV2MigrationMasterKey() {
|
||||
try {
|
||||
return new GroupMasterKey(new HKDFv3().deriveSecrets(getDecodedId(), "GV2 Migration".getBytes(), GroupMasterKey.SIZE));
|
||||
return new GroupMasterKey(HKDF.deriveSecrets(getDecodedId(), "GV2 Migration".getBytes(), GroupMasterKey.SIZE));
|
||||
} catch (InvalidInputException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class UsernameShareBottomSheet : DSLSettingsBottomSheetFragment() {
|
||||
|
||||
customPref(
|
||||
CopyButton.Model(
|
||||
text = getString(R.string.signal_me_username_url, Base64.encodeUrlSafeWithoutPadding(Username.hash(username))),
|
||||
text = getString(R.string.signal_me_username_url, Base64.encodeUrlSafeWithoutPadding(Username(username).hash)),
|
||||
onClick = {
|
||||
copyToClipboard(it)
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class UsernameShareBottomSheet : DSLSettingsBottomSheetFragment() {
|
||||
|
||||
customPref(
|
||||
ShareButton.Model(
|
||||
text = getString(R.string.signal_me_username_url, Base64.encodeUrlSafeWithoutPadding(Username.hash(username))),
|
||||
text = getString(R.string.signal_me_username_url, Base64.encodeUrlSafeWithoutPadding(Username(username).hash)),
|
||||
onClick = {
|
||||
openShareSheet(it.text)
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class CdsiV2Service {
|
||||
private static CdsiLookupRequest buildLibsignalRequest(Request request) {
|
||||
HashMap<org.signal.libsignal.protocol.ServiceId, ProfileKey> serviceIds = new HashMap<>(request.serviceIds.size());
|
||||
request.serviceIds.forEach((key, value) -> serviceIds.put(key.getLibSignalServiceId(), value));
|
||||
return new CdsiLookupRequest(request.previousE164s, request.newE164s, serviceIds, false, Optional.ofNullable(request.token));
|
||||
return new CdsiLookupRequest(request.previousE164s, request.newE164s, serviceIds, Optional.ofNullable(request.token));
|
||||
}
|
||||
|
||||
private static Response parseLibsignalResponse(CdsiLookupResponse response) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.signal.libsignal.protocol.InvalidKeyException;
|
||||
import org.signal.libsignal.protocol.ecc.Curve;
|
||||
import org.signal.libsignal.protocol.ecc.ECKeyPair;
|
||||
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||
import org.signal.libsignal.protocol.kdf.HKDFv3;
|
||||
import org.signal.libsignal.protocol.kdf.HKDF;
|
||||
import org.signal.libsignal.protocol.util.ByteUtil;
|
||||
|
||||
public class RemoteAttestationKeys {
|
||||
@@ -20,8 +20,7 @@ public class RemoteAttestationKeys {
|
||||
byte[] masterSecret = ByteUtil.combine(ephemeralToEphemeral, ephemeralToStatic );
|
||||
byte[] publicKeys = ByteUtil.combine(keyPair.getPublicKey().getPublicKeyBytes(), serverPublicEphemeral, serverPublicStatic);
|
||||
|
||||
HKDFv3 generator = new HKDFv3();
|
||||
byte[] keys = generator.deriveSecrets(masterSecret, publicKeys, new byte[0], clientKey.length + serverKey.length);
|
||||
byte[] keys = HKDF.deriveSecrets(masterSecret, publicKeys, new byte[0], clientKey.length + serverKey.length);
|
||||
|
||||
System.arraycopy(keys, 0, clientKey, 0, clientKey.length);
|
||||
System.arraycopy(keys, clientKey.length, serverKey, 0, serverKey.length);
|
||||
|
||||
Reference in New Issue
Block a user