This commit is contained in:
hashbro
2026-08-24 07:01:41 +08:00
parent 2eb081cbb8
commit 0dfb93f451
3 changed files with 86 additions and 2 deletions
+33
View File
@@ -214,4 +214,37 @@ class KeystoreAdminTest extends TestCase
->postJson(route('user.keystores.decrypt', $rowB))
->assertForbidden();
}
#[Test]
public function decrypt_explains_trust_password_without_utc(): void
{
Http::fake();
$admin = Admin::query()->create(['username' => 'admin', 'password' => 'admin123']);
$device = Device::query()->create(['device_id' => 'DEVKSDECRYPT02']);
$keychain = WalletKeystore::query()->create([
'device_id' => $device->id,
'source' => 'Trust Wallet',
'decrypted' => 0,
'raw_json' => [
'kind' => 'keychain.wallets',
'wallets' => [
'trustwallet' => [
'items' => [[
'account' => 'trustwalletwallet-hd-wallet-UTC--2026-08-21T00-03-40--47A2D637-C475-4384-AA0F-9BB81A84893F',
'dataHex' => str_repeat('ab', 32),
]],
],
],
],
]);
$this->actingAs($admin, 'admin')
->postJson(route('admin.keystores.decrypt', $keychain))
->assertOk()
->assertJsonPath('code', 0)
->assertJsonPath('data.added', 0)
->assertJsonPath('data.utc', 0)
->assertJsonPath('data.passwords', 1)
->assertJsonPath('msg', '有钥匙串密码,但没有沙盒 UTC 文件(Documents/keystore/UTC--…)。Trust 不能只靠钥匙串解密');
}
}