Skip to content

Commit 5ea143b

Browse files
committedMar 9, 2024
improvement: Decrypt empty string as empty string
1 parent f6fbc9d commit 5ea143b

File tree

1 file changed

+5
-0
lines changed
  • common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/crypto

1 file changed

+5
-0
lines changed
 

‎common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/crypto/BitwardenCrypto.kt

+5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ fun BitwardenCrCta.transformString(
8787
encoder(env.key).invoke(encryptionType, data)
8888
},
8989
isDecrypt = {
90+
// This should never happen, but just in case to not
91+
// fail the decryption process we fall back to an empty string.
92+
if (value.isEmpty()) {
93+
return@whatIf value
94+
}
9095
val data = decoder(env.key).invoke(value).data
9196
String(data)
9297
},

0 commit comments

Comments
 (0)