WASM Port of OPENFHE Wasm
openfhe-wasm
is the official web-assembly port of
the OpenFHE homomorphic library. openfhe-wasm
supports all homomorphic encryption
schemes supported by OpenFHE and exposes an API similar to the C++ API for OpenFHE.
openfhe-wasm
is licensed under the BSD-3 license.
@TODO: port and release after library finished
- Install
emscripten
using the instructions at https://emscripten.org/docs/getting_started/downloads.html. - Install
NodeJs
if not already installed. - Clone OpenFHE-development @TODO: once OpenFHE repo (stable version)
- NOTE: As of 04/05/2023, only the
dev
branch works for the moment. If you see an issue about the math backend not being specified, make sure you're on the right branch
cd
into the cloned directory and createembuild
directory.- Run
export PREFIX=~/install/location
mkdir embuild
cd embuild
emcmake cmake .. -DCMAKE_INSTALL_PREFIX=${PREFIX} -DMATHBACKEND=4
emmake make -jN
emmake make install
Note:
N
is number of cores available on your system.~/install/location
can be any empty directory location where openfhe binaries should be installed.- To include the unit tests, examples, or benchmarks, the corresponding cmake flags can be set to "ON" instead of "OFF".
-
Clone the
openfhe-wasm
repository and cd into it -
Run the following commands to build the NodeJS bindings.
mkdir build
cd build
emcmake cmake .. -DOpenFHE_DIR=${PREFIX}/lib/OpenFHE
emmake make
This should install emscripten libraries in openfhe-wasm/lib
directory.
3Now run the examples in the following directories using nodejs
examples/js/binfhe/
examples/js/pke/
Note that there have been a few notable differences from the original PALISADE-WASM
cc.MakePackedPlaintext
now requires the user to specify both the vector to pack, the depth, and the level. Previously only the first argument was necessary