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:
+7
-7
@@ -176,15 +176,15 @@ class MessageSerializationInteropTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testAddProposalDeserialization() {
|
fun testAddProposalDeserialization() {
|
||||||
for ((idx, v) in vectors.withIndex()) {
|
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 bytes = v.addProposal.hexToByteArray()
|
||||||
val reader = TlsReader(bytes)
|
val kp = MlsKeyPackage.decodeTls(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)
|
|
||||||
assertNotNull(kp, "Add proposal KeyPackage decode failed at vector $idx")
|
assertNotNull(kp, "Add proposal KeyPackage decode failed at vector $idx")
|
||||||
|
assertContentEquals(
|
||||||
|
bytes,
|
||||||
|
kp.toTlsBytes(),
|
||||||
|
"Add proposal KeyPackage round-trip mismatch at vector $idx",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user