fix: Add proposal test format and minor test cleanups

The add_proposal field in messages.json contains a raw KeyPackage
(the body of an Add proposal) without the uint16 proposal type prefix.
Fixed the test to decode the KeyPackage directly with round-trip
verification.

Test results: 36/41 passing (88%).

https://claude.ai/code/session_01NocQDWj2Y92FugjfgazzL3
This commit is contained in:
Claude
2026-04-03 20:48:56 +00:00
parent 9c94344399
commit b2d31aab72
@@ -176,15 +176,15 @@ class MessageSerializationInteropTest {
@Test
fun testAddProposalDeserialization() {
for ((idx, v) in vectors.withIndex()) {
// add_proposal in messages.json is a full Proposal with type prefix
// add_proposal in messages.json is a raw KeyPackage (the body of an Add proposal)
val bytes = v.addProposal.hexToByteArray()
val reader = TlsReader(bytes)
// Read proposal type
val type = reader.readUint16()
assertEquals(1, type, "Add proposal type should be 1 at vector $idx")
// Read the KeyPackage from the remaining bytes
val kp = MlsKeyPackage.decodeTls(reader)
val kp = MlsKeyPackage.decodeTls(TlsReader(bytes))
assertNotNull(kp, "Add proposal KeyPackage decode failed at vector $idx")
assertContentEquals(
bytes,
kp.toTlsBytes(),
"Add proposal KeyPackage round-trip mismatch at vector $idx",
)
}
}