feat: app

This commit is contained in:
hashbro
2026-10-05 06:12:43 +08:00
parent e654f65cf9
commit cb92baa395
32 changed files with 3583 additions and 1019 deletions
+49
View File
@@ -84,4 +84,53 @@ class WalletKeystoreTest extends TestCase
$this->assertSame('钥匙串', $row->kindLabel());
$this->assertNotSame('', $row->summary());
}
#[Test]
public function list_stats_match_listed_items_without_hashing_blobs(): void
{
$json = [
'kind' => 'keychain.wallets',
'wallets' => [
'trustwallet' => [
'items' => [
['account' => 'trust.account', 'dataHex' => bin2hex('777350')],
['account' => 'other', 'dataHex' => '00'],
],
],
],
];
$stats = WalletKeystore::computeListStatsFromJson($json);
$this->assertSame(2, $stats['item_count']);
$this->assertSame('钥匙串', $stats['kind']);
$this->assertSame('trust.account · other', $stats['summary']);
$this->assertFalse($stats['has_web3_keystore']);
}
#[Test]
public function nested_sandbox_utc_counts_as_web3_keystore(): void
{
$row = new WalletKeystore([
'source' => 'Trust Wallet',
'raw_json' => [
'kind' => 'sandbox',
'sandbox' => [
'Trust Wallet' => [
'Documents' => [
'keystore' => [
'UTC--demo' => [
'crypto' => [
'ciphertext' => 'aa',
'mac' => 'bb',
],
],
],
],
],
],
],
]);
$this->assertTrue($row->hasWeb3Keystore());
$this->assertSame('沙盒文件', $row->kindLabel());
}
}