X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/31434ac5ec6cee7d45ab81759de7ae647f675b11..0dc6b1327e1da6f5707d199f2c35eb18bee9e864:/src/main/java/org/asamk/signal/manager/KeyUtils.java diff --git a/src/main/java/org/asamk/signal/manager/KeyUtils.java b/src/main/java/org/asamk/signal/manager/KeyUtils.java index 6ffc3f36..421a32f4 100644 --- a/src/main/java/org/asamk/signal/manager/KeyUtils.java +++ b/src/main/java/org/asamk/signal/manager/KeyUtils.java @@ -1,6 +1,8 @@ package org.asamk.signal.manager; import org.asamk.signal.util.RandomUtils; +import org.signal.zkgroup.InvalidInputException; +import org.signal.zkgroup.profiles.ProfileKey; import org.whispersystems.util.Base64; class KeyUtils { @@ -12,8 +14,12 @@ class KeyUtils { return getSecret(52); } - static byte[] createProfileKey() { - return getSecretBytes(32); + static ProfileKey createProfileKey() { + try { + return new ProfileKey(getSecretBytes(32)); + } catch (InvalidInputException e) { + throw new AssertionError("Profile key is guaranteed to be 32 bytes here"); + } } static String createPassword() {