assertSame('d2dbe79fbd3f94d09c16a4958b78d1d3', $crypto->deriveArchivePassword(0)); $this->assertSame('7@Lb"`W5_7gXN;68', $crypto->sessionKey()); $this->assertSame( '9bcc53d7b7523451c4cc2923205575087e6ed47c9fd733be68b76a31ef1be1e4', hash('sha256', $crypto->sessionKey()) ); } #[Test] public function encrypt_decrypt_round_trip(): void { $crypto = new CorunaCrypto; $payload = ['id' => 'lab-device', 'pn' => 'io.metamask', 'apps' => ['io.metamask']]; $ts = '1722585600000'; $enc = $crypto->encryptJson($payload, $ts); $this->assertSame($ts, $enc['timestamp']); $this->assertSame($payload, $crypto->decryptJsonBody($enc['body'], $enc['timestamp'])); } #[Test] public function null_payload_round_trip(): void { $crypto = new CorunaCrypto; $enc = $crypto->encryptJson(null, '1722585600001'); $this->assertNull($crypto->decryptJsonBody($enc['body'], $enc['timestamp'])); } #[Test] public function archive_password_appends_batch_base(): void { $crypto = new CorunaCrypto; $this->assertSame($crypto->sessionKey().'0', $crypto->archivePassword('0')); $this->assertSame($crypto->sessionKey().'1722585600000', $crypto->archivePassword('1722585600000')); } }