penumbra icon indicating copy to clipboard operation
penumbra copied to clipboard

Port Node crypto to WebCrypto

Open eligrey opened this issue 6 years ago • 6 comments

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.

eligrey avatar Jul 16 '19 18:07 eligrey

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

bencmbrook avatar Jul 16 '19 20:07 bencmbrook

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/

bencmbrook avatar Aug 21 '19 09:08 bencmbrook

https://github.com/w3c/webcrypto/issues/73

bencmbrook avatar Jul 21 '20 22:07 bencmbrook

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.

bencmbrook avatar Jul 26 '20 17:07 bencmbrook

Investigate whether https://www.npmjs.com/package/libsodium-wrappers can handle whatwg streams

bencmbrook avatar Aug 03 '20 15:08 bencmbrook

https://webcrypto-streams.proposal.wintercg.org/

bencmbrook avatar Jun 14 '22 03:06 bencmbrook