]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/manager/KeyUtils.java
Output json when receiving messages from dbus and --json parameter is given
[signal-cli] / src / main / java / org / asamk / signal / manager / KeyUtils.java
index 6ffc3f36a5be499c55934f86c076aebf02f9c8ae..fff8179cc229ada2cda50ee759e0ee59bb371910 100644 (file)
@@ -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() {
@@ -24,6 +30,14 @@ class KeyUtils {
         return getSecretBytes(16);
     }
 
+    static byte[] createUnrestrictedUnidentifiedAccess() {
+        return getSecretBytes(16);
+    }
+
+    static byte[] createStickerUploadKey() {
+        return getSecretBytes(32);
+    }
+
     private static String getSecret(int size) {
         byte[] secret = getSecretBytes(size);
         return Base64.encodeBytes(secret);