improvement: Decrypt empty string as empty string

This commit is contained in:
Artem Chepurnoy 2024-03-09 08:41:02 +02:00
parent f6fbc9da7f
commit 5ea143bdb9
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 5 additions and 0 deletions

View File

@ -87,6 +87,11 @@ fun BitwardenCrCta.transformString(
encoder(env.key).invoke(encryptionType, data)
},
isDecrypt = {
// This should never happen, but just in case to not
// fail the decryption process we fall back to an empty string.
if (value.isEmpty()) {
return@whatIf value
}
val data = decoder(env.key).invoke(value).data
String(data)
},