Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.05 KB

README.md

File metadata and controls

42 lines (29 loc) · 1.05 KB

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