cake_wallet/lib/entities/hash_wallet_identifier.dart
David Adegoke 09f20b2a7b
CW-843: Enhance Wallet Groups Implementation ()
* feat: Enhance Wallet Groups Implementation by using hashedIdentifiers instead of parentAddresses

* fix: Call updateWalletGroups even if group has an hash identifier

* feat: Add secrets to workflow

* feat: Enhance Wallet Groups Implementation by using hashedIdentifiers instead of parentAddresses

* Handle wallet grouping edgecase where wallet is restored via non seed medium

* fix: Valid wallet/wallet groups not showing up when choosing wallet/groups for creating new wallets
2025-03-06 02:25:38 +02:00

21 lines
566 B
Dart

import 'dart:convert';
import 'package:cake_wallet/.secrets.g.dart' as secrets;
import 'package:cw_core/wallet_base.dart';
import 'package:hashlib/hashlib.dart';
String createHashedWalletIdentifier(WalletBase wallet) {
if (wallet.seed == null) return '';
final salt = secrets.walletGroupSalt;
final combined = '$salt.${wallet.seed}';
// 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();
}