]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/util/ProfileUtils.java
Update libsignal-service
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / util / ProfileUtils.java
index 17e26ee89a80d3ff8c60a75ecbc87edee94df6d7..0b5b418a95bf0746f7309c242d52ae23324192bb 100644 (file)
@@ -23,9 +23,7 @@ public class ProfileUtils {
 
     private static final Logger logger = LoggerFactory.getLogger(ProfileUtils.class);
 
-    public static Profile decryptProfile(
-            final ProfileKey profileKey, final SignalServiceProfile encryptedProfile
-    ) {
+    public static Profile decryptProfile(final ProfileKey profileKey, final SignalServiceProfile encryptedProfile) {
         var profileCipher = new ProfileCipher(profileKey);
         IdentityKey identityKey = null;
         try {
@@ -64,7 +62,8 @@ public class ProfileUtils {
     }
 
     public static Profile.UnidentifiedAccessMode getUnidentifiedAccessMode(
-            final SignalServiceProfile encryptedProfile, final ProfileCipher profileCipher
+            final SignalServiceProfile encryptedProfile,
+            final ProfileCipher profileCipher
     ) {
         if (encryptedProfile.isUnrestrictedUnidentifiedAccess()) {
             return Profile.UnidentifiedAccessMode.UNRESTRICTED;
@@ -85,12 +84,16 @@ public class ProfileUtils {
         if (encryptedProfile.getCapabilities().isStorage()) {
             capabilities.add(Profile.Capability.storage);
         }
+        if (encryptedProfile.getCapabilities().isStorageServiceEncryptionV2()) {
+            capabilities.add(Profile.Capability.storageServiceEncryptionV2Capability);
+        }
 
         return capabilities;
     }
 
     private static String decryptString(
-            final String encrypted, final ProfileCipher profileCipher
+            final String encrypted,
+            final ProfileCipher profileCipher
     ) throws InvalidCiphertextException {
         try {
             return encrypted == null ? null : profileCipher.decryptString(Base64.getDecoder().decode(encrypted));
@@ -100,7 +103,8 @@ public class ProfileUtils {
     }
 
     private static Optional<Boolean> decryptBoolean(
-            final String encrypted, final ProfileCipher profileCipher
+            final String encrypted,
+            final ProfileCipher profileCipher
     ) throws InvalidCiphertextException {
         try {
             return encrypted == null
@@ -112,7 +116,9 @@ public class ProfileUtils {
     }
 
     private static byte[] decryptAndVerifyMobileCoinAddress(
-            final byte[] encryptedPaymentAddress, final ProfileCipher profileCipher, final ECPublicKey publicKey
+            final byte[] encryptedPaymentAddress,
+            final ProfileCipher profileCipher,
+            final ECPublicKey publicKey
     ) throws InvalidCiphertextException {
         byte[] decrypted;
         try {