ecies-wasm
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

ecies-wasm

License NPM Package CI

A WASM binding for eciesrs.

Install

npm install ecies-wasm

Usage

import init, * as ecies from "ecies-wasm";

init(); // if built with vite without plugin

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

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

Check the example for how to use it in browsers.

API

export function generateKeypair(): Array<Uint8Array>; // [sk, pk]
export function encrypt(pk: Uint8Array, msg: Uint8Array): Uint8Array;
export function decrypt(sk: Uint8Array, msg: Uint8Array): Uint8Array;

Build and test

wasm-pack build
wasm-pack test --node

Changelog

See CHANGELOG.md.

Package Sidebar

Install

npm i ecies-wasm

Weekly Downloads

502

Version

0.2.0

License

MIT

Unpacked Size

126 kB

Total Files

6

Last publish

Collaborators

  • kigawas