private-attribution / ipa

A raw implementation of Interoperable Private Attribution
MIT License
41 stars 23 forks source link

Test encrypt decrypt #1216

Closed eriktaubeneck closed 1 month ago

eriktaubeneck commented 1 month ago

This gives us two new CLI commands for secret sharing and encrypting a raw input and then decrypting and reconstructing those encrypted files, respectively.

test_hpke encrypt --input-file tmp/raw_reports.txt --network tmp/keys/network.toml --output-dir tmp/enc
test_hpke decrypt --input-file1 tmp/enc/helper1.enc --input-file2 tmp/enc/helper2.enc --input-file3 tmp/enc/helper3.enc --mk-private-key1 tmp/keys/h1_mk.key --mk-private-key2 tmp/keys/h2_mk.key --mk-private-key3 tmp/keys/h3_mk.key --output-file tmp/output.dec

The decrypt command will allow us to test other implementations (e.g., in python or swift.)

I moved the bulk of the code into ipa-core/src/cli/hpke.rs, however the test doesn't seem to be run. I'm not sure how to fix that, or if I should move it somewhere else.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 94.82759% with 21 lines in your changes missing coverage. Please review.

Project coverage is 93.19%. Comparing base (2da9b09) to head (4e7b6cf). Report is 31 commits behind head on main.

Files Patch % Lines
ipa-core/src/cli/crypto.rs 97.08% 11 Missing :warning:
ipa-core/src/bin/crypto_util.rs 0.00% 8 Missing :warning:
ipa-core/src/bin/report_collector.rs 66.66% 1 Missing :warning:
ipa-core/src/config.rs 94.11% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1216 +/- ## ========================================== + Coverage 92.25% 93.19% +0.94% ========================================== Files 197 201 +4 Lines 29825 33455 +3630 ========================================== + Hits 27514 31179 +3665 + Misses 2311 2276 -35 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.