cubbit / enigma Goto Github PK
View Code? Open in Web Editor NEWA fast, native, cryptographic engine for the web
Home Page: https://www.cubbit.io
License: MIT License
A fast, native, cryptographic engine for the web
Home Page: https://www.cubbit.io
License: MIT License
I installed it with NPM
after in my component:
import Enigma from '@cubbit/enigma';
but what is next?
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.
In the documentation we do not know the format on witch the public and private key is formatted.
Like pem, PKIX or something else.
Could really be helpful for compatibility resons include it in the doc.
Hi! Looks promising. I tried it out as :
git clone https://github.com/cubbit/enigma.git
cd enigma
npm install
everything seem to go alright until the install runs node-gyp rebuild
:
make: Entering directory `/var/www/html/valg/lib/enigma/build'
ACTION Prepare dependencies /var/www/html/valg/lib/enigma/dependencies
Error: Unsupported arch: ia32 - linux
at dependencies (/var/www/html/valg/lib/enigma/scripts/node/dependencies.js:70:27)
at Object.<anonymous> (/var/www/html/valg/lib/enigma/scripts/node/dependencies.js:106:3)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
Not sure what it is, and how to solve it. Just runnng on a laptup with ubuntu 14.04.
Hi,
I am trying to implement the Enigma module in a simple React project, but I keep getting TypeError: context is undefined
thrown by the em_array_malloc
function.
I followed the guide in the readme but can't figure out why context is undefined.
Hello, I've tried to test the AES encryption in GCM mode on Microsoft Edge 44.18362.449.0 (CRT is not supported on Edge) but does not work.
This is the example I've tried:
new Enigma.AES().init({algorithm: Enigma.AES.Algorithm.GCM}).then(async (aes: Enigma.AES) =>
{
const my_secret = 'My secret';
try
{
const cipher = await aes.encrypt(my_secret);
console.log(cipher);
}
catch(error)
{
console.error(error.message);
}
});
And this is the error logged:
Could not complete the operation due to error 8070000b.
After a quick search on the error, it is perhaps related to an incompatibility of the WebCrypto API implemented on Edge.
Here is another issue encountered for the WebCrypto API on Edge:
https://stackoverflow.com/questions/33043091/public-key-encryption-in-microsoft-edge
Such as crypto
does with createHmac
function, we should implement our own implementation in Enigma.
We could implement this into Hash module. It could take as arguments an algorithm (e.g. SHA256), a key and the information to hash.
Where exactly is WASM used in this library? The description says "In a web environment, Enigma leverages on a WebAssembly-compiled version of OpenSSL to boost performances." but it seems to me it is just using Web Crypto?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.