From 68f7d0236ef51d00e05a3f83d3911698129d6d92 Mon Sep 17 00:00:00 2001 From: Artem Chepurnoy Date: Fri, 19 Jan 2024 12:59:54 +0200 Subject: [PATCH] fix: Unable to delete a Password history item with last used date set to null --- .../keyguard/core/store/bitwarden/BitwardenCipher.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt index b4977f4f..9b7ccb4e 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt @@ -165,7 +165,11 @@ data class BitwardenCipher( val password: String, val lastUsedDate: Instant? = null, ) { - val id = "$password|timestamp=$lastUsedDate" + val id = kotlin.run { + val timestamp = lastUsedDate + ?.takeUnless { it.epochSeconds == 0L } + "$password|timestamp=$timestamp" + } } @Serializable