Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip][demo] uses crypto traits and allows fxa_client to compile to wasm #6159

Closed
wants to merge 7 commits into from

Conversation

tarikeshaq
Copy link
Contributor

What is this

Historically we've only used a single backend for crypto, NSS. Overtime, nss found its way to so many of our crates. That's ok for our existing use cases because we are building binareis for Firefox and we should only be using NSS in firefox.

However, if we ever want to make some of our crates available for the web as wasm, our dependency on NSS becomes a problem (I don't think there is any desire to make NSS compile to wasm)

This is a draft PR that acts as a starting point to create pluggable crypto into our components.

Crypto traits

At its core, I'm suggesting defining traits that represent all the crypto operations we are currently using through NSS, and then having our individual crates depend on those traits. We have two types of crates, supporting non-exposed crates (eg: sync15), and exposed crates (sync_manager, fxa_client, places, etc). I'm suggesting the following:

  • For supporting crates, they should not have a direct dependency on any crypto library, and instead depend on crypto_traits and be generic over any implementation of the crypto operations the crate needs
  • For exposed crates, they should make nss (and rc_crypto) an optional dependency that is enabled by default but enable easily switching the crypto implementation by making private APIs generic over any crypto backend, but have public APIs use whichever backend is enabled

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.08%. Comparing base (01a52c7) to head (e19a3fc).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6159   +/-   ##
=======================================
  Coverage   84.08%   84.08%           
=======================================
  Files         117      117           
  Lines       15629    15629           
=======================================
  Hits        13141    13141           
  Misses       2488     2488           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tarikeshaq tarikeshaq changed the title [wip][demo] Adds AEAD traits and converts sync15 to use it [wip][demo] uses crypto crates and allows fxa_client to compile to wasm Mar 12, 2024
@tarikeshaq tarikeshaq changed the title [wip][demo] uses crypto crates and allows fxa_client to compile to wasm [wip][demo] uses crypto traits and allows fxa_client to compile to wasm Mar 12, 2024
@tarikeshaq tarikeshaq closed this May 30, 2024
@tarikeshaq tarikeshaq deleted the crypto_traits branch May 30, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants