penumbra
penumbra copied to clipboard
Port Node crypto to WebCrypto
In order to reduce the worker script bundle size, we should look into porting our Node crypto usage to WebCrypto. This is a low priority task.
This might be useful when we do https://github.com/mozilla/send/blob/master/app/fileReceiver.js#L115 https://github.com/mozilla/send/blob/master/app/serviceWorker.js#L117
GitHub
Simple, private file sharing from the makers of Firefox - mozilla/send
I imagine there’s a ton of unused code in this dependency. We should first try tree shaking. It’s definitely not on since webpack is in development mode https://webpack.js.org/guides/tree-shaking/
https://github.com/w3c/webcrypto/issues/73
I think this will be difficult because authentication checks are done under the hood for each call to crypto.subtle.decrypt, meaning we can't perform decryption on chunks (AFAIK).
https://github.com/jedisct1/libsodium.js has a web assembly that might have a similar perf gain.
Investigate whether https://www.npmjs.com/package/libsodium-wrappers can handle whatwg streams
https://webcrypto-streams.proposal.wintercg.org/