From 8ce13c855c59736aa645936c8cfbfa58f35776d2 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Tue, 4 Feb 2020 14:22:01 +1100 Subject: [PATCH] fix friend request with sealed sender --- .../crypto/UnidentifiedAccessUtil.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/org/thoughtcrime/securesms/crypto/UnidentifiedAccessUtil.java b/src/org/thoughtcrime/securesms/crypto/UnidentifiedAccessUtil.java index b54d81b11f..7618e9db71 100644 --- a/src/org/thoughtcrime/securesms/crypto/UnidentifiedAccessUtil.java +++ b/src/org/thoughtcrime/securesms/crypto/UnidentifiedAccessUtil.java @@ -107,20 +107,9 @@ public class UnidentifiedAccessUtil { private static @Nullable byte[] getTargetUnidentifiedAccessKey(@NonNull Recipient recipient) { byte[] theirProfileKey = recipient.resolve().getProfileKey(); - switch (recipient.resolve().getUnidentifiedAccessMode()) { - case UNKNOWN: - if (theirProfileKey == null) return Util.getSecretBytes(16); - else return UnidentifiedAccess.deriveAccessKeyFrom(theirProfileKey); - case DISABLED: - return null; - case ENABLED: - if (theirProfileKey == null) return null; - else return UnidentifiedAccess.deriveAccessKeyFrom(theirProfileKey); - case UNRESTRICTED: - return Util.getSecretBytes(16); - default: - throw new AssertionError("Unknown mode: " + recipient.getUnidentifiedAccessMode().getMode()); - } + if (theirProfileKey == null) return Util.getSecretBytes(16); + else return UnidentifiedAccess.deriveAccessKeyFrom(theirProfileKey); + } private static @Nullable byte[] getUnidentifiedAccessCertificate(Context context) {