ecies-wasm

A WASM binding for eciesrs

Usage no npm install needed!

<script type="module">
  import eciesWasm from 'https://cdn.skypack.dev/ecies-wasm';
</script>

README

ecies-wasm

License NPM Package CI

A WASM binding for eciesrs.

Install

npm install ecies-wasm

Usage

import * as ecies from "ecies-wasm";

const [sk, pk] = ecies.generate_keypair();
const data = Uint8Array.from([1, 2, 3, 4]);

const encrypted = ecies.encrypt(pk, data);
const decrypted = ecies.decrypt(sk, encrypted);
alert("decrypted: " + decrypted);

Check this example for how to use it in browsers.

API

function encrypt(receiver_pub: Uint8Array, msg: Uint8Array): Uint8Array | undefined;
function decrypt(receiver_sec: Uint8Array, msg: Uint8Array): Uint8Array | undefined;

Build and test

wasm-pack build
wasm-pack test --node