My team's working on implementing a new web API [1] that lets clients execute certain cryptographic operations alongside outgoing requests. Handling these operations' outputs (e.g. to verify in tests that the client is behaving correctly) involves some nontrivial but not horribly complex server-side work: parse the request's binary format; execute some reasonably basic but low-level elliptic curve operations; serialize a response. We currently only have a C++ implementation for this server-side logic.
We're considering a couple options for integration with layout tests or WPTs:
1. ship a C++ binary in
blink_web_tests_support_data, like imagediff currently is; in tests, use a simple Python wrapper that parses request headers, passes them to the binary, and puts the binary's response in a response header
2. reimplement the server-side functionality in Python (probably 500-1kloc, depending on whether we can use external dependencies)
3. completely mock out the client-side and server-side cryptographic functionality (not preferred unless unavoidable; seems fiddly and less realistic)
We have a couple questions:
- What are your thoughts about the feasibility of approach #1? Adding a new binary dependency in the vein of imagediff seems simple enough, but I'm a little concerned about the gymnastics of calling into the binary during the tests' execution.
- For #2, it would simplify the Python implementation to be able to use a couple dependencies outside the standard library. Would this be possible? (Does the answer vary between WPTs and Blink layout tests?)
We'd also naturally appreciate any general thoughts or advice. Thanks!
David, Charlie, Steven (Trust Tokens team)