Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-27 15:00:33 +03:00
parent c7fcd77eb0
commit 707e2be6a4
2 changed files with 15 additions and 0 deletions

View file

@ -375,6 +375,13 @@ internal class DefaultUserWalletsListRepository(
oldUserWallet is UserWallet.Hot && newUserWallet is UserWallet.Cold
) {
removeHotWalletsFromSDK(walletIds = listOf(oldUserWallet.walletId))
// When upgrading from Hot to Cold, if biometric lock is available, set it
if (hasBiometry()) {
setLock(newUserWallet.walletId, LockMethod.Biometric, changeUnsecured = true)
}
// Remove any encryption keys related to the old hot wallet
userWalletEncryptionKeysRepository.removeEncryptedWithPasswordKey(oldUserWallet.walletId)
userWalletEncryptionKeysRepository.removeUnsecuredKey(oldUserWallet.walletId)
}
}

View file

@ -66,6 +66,14 @@ internal class UserWalletEncryptionKeysRepository(
authenticatedStorage.delete(StorageKey.UserWalletEncryptionKey(userWalletId).name)
}
fun removeEncryptedWithPasswordKey(userWalletId: UserWalletId) {
secureStorage.delete(StorageKey.UserWalletEncryptionKeyEncrypted(userWalletId).name)
}
fun removeUnsecuredKey(userWalletId: UserWalletId) {
secureStorage.delete(StorageKey.UserWalletEncryptionKeyUnsecured(userWalletId).name)
}
suspend fun getAllUnsecured(): List<UserWalletEncryptionKey> = withContext(dispatchers.io) {
getUserWalletsIds().mapNotNull { userWalletId ->
secureStorage.get(account = StorageKey.UserWalletEncryptionKeyUnsecured(userWalletId).name).decodeToKey()