mirror of
https://github.com/signalapp/libsignal.git
synced 2026-05-12 18:07:08 +02:00
Expose ProfileKey.deriveAccessKey()
Client apps will be able to switch over to this at their leisure.
This commit is contained in:
@@ -784,6 +784,16 @@ public final class ZkGroupTest extends SecureRandomTest {
|
||||
assertArrayEquals(plaintext, plaintext257);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeriveAccessKey() throws Exception {
|
||||
byte[] expectedAccessKey = Hex.fromStringCondensedAssert("5a723acee52c5ea02b92a3a360c09595");
|
||||
byte[] profileKey = new byte[32];
|
||||
Arrays.fill(profileKey, (byte)0x02);
|
||||
|
||||
byte[] result = new ProfileKey(profileKey).deriveAccessKey();
|
||||
assertArrayEquals(result, expectedAccessKey);
|
||||
}
|
||||
|
||||
private void assertByteArray(String expectedAsHex, byte[] actual) {
|
||||
byte[] expectedBytes = Hex.fromStringCondensedAssert(expectedAsHex);
|
||||
|
||||
|
||||
@@ -311,6 +311,7 @@ public final class Native {
|
||||
public static native void ProfileKeyCredentialRequest_CheckValidContents(byte[] buffer);
|
||||
|
||||
public static native void ProfileKey_CheckValidContents(byte[] buffer);
|
||||
public static native byte[] ProfileKey_DeriveAccessKey(byte[] profileKey);
|
||||
public static native byte[] ProfileKey_GetCommitment(byte[] profileKey, UUID uuid);
|
||||
public static native byte[] ProfileKey_GetProfileKeyVersion(byte[] profileKey, UUID uuid);
|
||||
|
||||
|
||||
@@ -38,4 +38,8 @@ public final class ProfileKey extends ByteArray {
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] deriveAccessKey() {
|
||||
return Native.ProfileKey_DeriveAccessKey(contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user