mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
- Exploratory route to getting more information on the cause of the wallet grouping bug. - Introduces a dev hash change log page that gives information on the changes that occurs on the hashWalletIdentifier and where the change gets triggered.
21 lines
590 B
Dart
21 lines
590 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 || wallet.seed!.isEmpty) 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();
|
|
}
|