Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-22 20:31:03 +05:00
parent 5ef3837bd5
commit 8d3c2b1cd8
23 changed files with 413 additions and 46 deletions

View file

@ -100,6 +100,11 @@ internal class DefaultColdMapDerivationsRepository @Inject constructor(
}
}
override fun mergeDerivedKeys(
userWallet: UserWallet.Cold,
keys: Map<ByteArrayKey, ExtendedPublicKeysMap>,
): UserWallet.Cold = userWallet.updateDerivedKeys(keys)
override suspend fun hasMissedDerivations(
userWallet: UserWallet.Cold,
networksWithDerivationPath: Map<BackendId, String?>,

View file

@ -77,6 +77,24 @@ internal class DefaultDerivationsRepository @Inject constructor(
}
}
override suspend fun storeDerivedKeys(
userWalletId: UserWalletId,
derivedKeys: Map<ByteArrayKey, ExtendedPublicKeysMap>,
) {
if (derivedKeys.isEmpty()) {
TangemLogger.d("Nothing to store")
return
}
val userWallet = userWalletsListRepository.getSyncStrict(userWalletId)
val updatedUserWallet = when (userWallet) {
is UserWallet.Cold -> coldDerivationsRepository.mergeDerivedKeys(userWallet, derivedKeys)
is UserWallet.Hot -> hotDerivationsRepository.mergeDerivedKeys(userWallet, derivedKeys)
}
userWallet.update(updatedUserWallet)
}
override suspend fun getExistingDerivedKeys(
userWalletId: UserWalletId,
seedKey: ByteArrayKey,

View file

@ -101,6 +101,11 @@ internal class DefaultHotMapDerivationsRepository @Inject constructor(
return updatedUserWallet.updateWithNewKeys(newKeys) to newKeys
}
override fun mergeDerivedKeys(
userWallet: UserWallet.Hot,
keys: Map<ByteArrayKey, ExtendedPublicKeysMap>,
): UserWallet.Hot = userWallet.updateWithNewKeys(keys)
override suspend fun hasMissedDerivations(
userWallet: UserWallet.Hot,
networksWithDerivationPath: Map<BackendId, String?>,