trampi / node-libhydrogen-binding

A lightweight, secure, easy-to-use crypto library suitable for constrained environments.
Other
4 stars 0 forks source link

Is there any plan to make this library isomorphic or universal? #1

Open saxxi opened 6 years ago

saxxi commented 6 years ago

Hi, I understand this library encapsulates the C API. As I'd like to have E2E encryption I was looking to encrypt directly in the browser. Is this possible or in a project roadmap?

Thank you.

trampi commented 6 years ago

Hi! At the moment no browser usage is planned, the scope of this project is indeed just to provide bindings to the C library for the usage in nodejs.

However, I could take a look at a vanilla JavaScript implementation of libhydrogen at the weekend. In which functions of libhydrogen are you interested in most? I can of course not promise anything.

All the best, Fabian

saxxi commented 6 years ago

Hi Fabian, thanks for your interest and quick reply.

I'd just need to do a really basic encryption with symmetric key:

import { encryptFunction, decryptFunction } from 'libhydrogen'

const encryptedString = encryptFunction('my message here', 'password01')
const decryptedString = decryptFunction(encryptedString, 'password01')

Here is the equivalent code I made for AES:

Maybe you could help me out somehow forking that.

Kind regards, Adit

jedisct1 commented 6 years ago

The library can be compiled using Emscripten, and the performance using WebAssembly is really good. The Gimli permutation is a perfect fit for WebAssembly.

But a pure Javascript version would be awesome, if only because it would be way smaller.

trampi commented 6 years ago

Hi! Just wanted to note that I did not find time on the weekend. I can not promise when and if I will take a look at a native JS implementation, but I certainly want to.

stevecrozz commented 5 days ago

I began work on a JavaScript package to expose libhydrogen by way of emscripten/wasm: https://github.com/stevecrozz/libhydrogen-wasm https://www.npmjs.com/package/libhydrogen-wasm

It is pretty early at this point but it should be runnable in a browser.