test(cloud): golden HMAC vectors proving P1-A Python interop

This commit is contained in:
유창욱 2026-07-11 23:25:15 +09:00
parent 8e62304471
commit 6fbe4015dc

View file

@ -22,4 +22,17 @@ final class HmacTest extends TestCase
$this->assertFalse(Hmac::verify('secret', 'n1', '1000.0', 'body-TAMPERED', $sig));
$this->assertFalse(Hmac::verify('wrong', 'n1', '1000.0', 'body', $sig));
}
public function testMatchesGoldenVectorsFromPythonEdgeSigner(): void
{
// Golden hex produced by running P1-A edge/alert.py::sign — proves cross-language byte-for-byte interop.
$this->assertSame(
'a151bb402f070c3678056776b1bcc5638bd150dec1e516aaa07cac1a089f63b9',
Hmac::sign('secret', 'n1', '1000.0', '{"a":1}')
);
$this->assertSame(
'71865248fe94517dc0305a5c233e2b6c97db95fc9e38815e7c20580d2aa784c9',
Hmac::sign('sekret', 'abc123', '1700000000.5', '{"device_id":"pi-1","event_type":"fall"}')
);
}
}