Skip to content

Alternative export API for optimized delivery #4

@benoneal

Description

@benoneal

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions