[wip][demo] uses crypto traits and allows fxa_client to compile to wasm #6159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: