From efc99c14f638cd1a0731fd3e74f5ae9ac5aa91fd Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Tue, 25 Nov 2025 00:15:13 +0100 Subject: [PATCH] refactor: simplify hashed wallet identifier creation by optimizing seed and address handling logic (#2675) --- lib/entities/hash_wallet_identifier.dart | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/entities/hash_wallet_identifier.dart b/lib/entities/hash_wallet_identifier.dart index 8e593ec79..175063eb6 100644 --- a/lib/entities/hash_wallet_identifier.dart +++ b/lib/entities/hash_wallet_identifier.dart @@ -5,17 +5,12 @@ import 'package:cw_core/wallet_base.dart'; import 'package:hashlib/hashlib.dart'; String createHashedWalletIdentifier(WalletBase wallet) { - if (wallet.seed == null) return ''; + final hashContent = wallet.seed ?? wallet.walletAddresses.primaryAddress; final salt = secrets.walletGroupSalt; - final combined = '$salt.${wallet.seed}'; + final combined = '$salt.$hashContent'; - // Convert to UTF-8 bytes. final bytes = utf8.encode(combined); - - // Perform SHA-256 hash. final digest = sha256.convert(bytes); - - // Return the hex string representation of the hash. return digest.toString(); }