mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
fix: wownero P0s, fail-closed RNG, iOS scheme, dep pins
- resetToDefault omitted Wownero: the reset button null-crashed and left WOW wallets with an empty node list - accountLabel was missing a return and rendered blank for WOW wallets - sec_random now throws instead of returning empty bytes when the native entropy channel fails or under-delivers - iOS builds no longer register the leftover cakewallet:// URL scheme - WOW fee estimate now fetched from the connected daemon's get_fee_estimate RPC and cached; the inherited XMR constant table remains only as a pre-fetch fallback - pin cake_backup, flutter_local_authentication, and bech32 git deps to their locked SHAs for reproducible builds
This commit is contained in:
@@ -14,8 +14,14 @@ Future<Uint8List> secRandom(int count) async {
|
||||
final rng = Random.secure();
|
||||
return Uint8List.fromList(List<int>.generate(count, (_) => rng.nextInt(byteSize)));
|
||||
}
|
||||
return await utils.invokeMethod<Uint8List>('sec_random', {'count': count}) ?? Uint8List.fromList([]);
|
||||
} on PlatformException catch (_) {
|
||||
return Uint8List.fromList([]);
|
||||
final bytes = await utils.invokeMethod<Uint8List>('sec_random', {'count': count});
|
||||
if (bytes == null || bytes.length != count) {
|
||||
throw StateError('sec_random returned ${bytes?.length ?? 0} bytes, expected $count');
|
||||
}
|
||||
return bytes;
|
||||
} on PlatformException catch (e) {
|
||||
// Never fail open: an entropy source that cannot deliver must throw,
|
||||
// not hand back an empty buffer for key material.
|
||||
throw StateError('sec_random platform call failed: ${e.message}');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user