refactor: simplify hashed wallet identifier creation by optimizing seed and address handling logic (#2675)

Konstantin Ullrich committed Nov 25, 2025 at 00:15 UTC efc99c14f638cd1a0731fd3e74f5ae9ac5aa91fd
1 file changed +2 -7
lib/entities/hash_wallet_identifier.dart
+2 -7
@@ -5,17 +5,12 @@ import 'package:cw_core/wallet_base.dart';
5 import 'package:hashlib/hashlib.dart';
6
7 String createHashedWalletIdentifier(WalletBase wallet) {
8 - if (wallet.seed == null) return '';
8 + final hashContent = wallet.seed ?? wallet.walletAddresses.primaryAddress;
9
10 final salt = secrets.walletGroupSalt;
11 - final combined = '$salt.${wallet.seed}';
11 + final combined = '$salt.$hashContent';
12
13 - // Convert to UTF-8 bytes.
13 final bytes = utf8.encode(combined);
15 -
16 - // Perform SHA-256 hash.
14 final digest = sha256.convert(bytes);
18 -
19 - // Return the hex string representation of the hash.
15 return digest.toString();
16 }