mlswg / mls-implementations

Coordination of implementation and interop specific details
113 stars 14 forks source link

Add a script to build passive test vectors from transcripts #128

Closed bifurcation closed 1 year ago

bifurcation commented 1 year ago

This PR adds the Node script active_to_passive.js that converts a transcript of a live test into a collection of passive test vectors. The script takes two inputs: A config JSON file of the same format provided to test-runner, and a transcript JSON file of the format output by test-runner (thus node active-to-passive.js config.json transcript.json).

For each test case (combination of clients / encryption / ciphersuite), and for each client that joins via Welcome in that test case, the script emits a passive test vector that covers:

  1. The Welcome that adds the client to the group
  2. Further commits that the client is instructed to handle in the test script
  3. ... until the first time the client emits a message (since it is no longer passive)

For example, consider the following case:

  1. Alice creates a group
  2. Alice adds Bob to the group
  3. Alice adds Charlie to the group
  4. Alice sends an empty Commit
  5. Bob sends an empty Commit
  6. Charlie sends an empty Commit

This would lead to two test vectors, from Bob's and Charlie's perspectives. Bob's test vector would cover steps [2, 3, 4] and Charlie's test vector would cover steps [3, 4, 5].

I have verified that the overall flow works, with the following steps:

bifurcation commented 1 year ago

Note that this will be broken by #130, so maybe we should hold this PR until after that one.