-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Just found this library, and I think you guys have nailed the problem that is isomorphic crypto, and the approach appears really well researched and developed. In the interest of optimising real-world application use and making it a bit more user-friendly, I've got some suggestions:
For most projects I've worked on, only one, possibly two crypto methods are required. For these projects, modern tree-shaking build systems can optimise application code by removing unused code paths.
Unfortunately, right now Enigma's module pattern appears to prevent that, as destructured imports (import {AES} from '@cubbit/enigma) aren't valid, and import Enigma means bundling the entire library, even though the vast majority of that code will never be used.
On a related note, the new Enigma.AES().init({key}).then(aes => aes.encrypt(message)) API seems unnecessarily unwieldy. Surely static async methods such as AES.encrypt(message, key) should be possible?
Otherwise I'd hazard that most people, like me, will have to write our own convenience wrappers around that API.
But the tree-shaking thing is more important, as it's not possible to address in userland, and some applications (like ours!) are very sensitive to the size of our script payloads.