UNPKG

@oraichain/multifactors.js

Version:

Handle communication with multifactors nodes

64 lines (40 loc) 2.26 kB
# Multifactors.js [![npm version](https://badge.fury.io/js/%40oraichain%2Fmultifactors.js.svg)](https://badge.fury.io/js/%40oraichain%2Fmultifactors.js) ![npm](https://img.shields.io/npm/dw/@oraichain/multifactors.js) ## Introduction A JS utility library (w/ typescript bindings!) to make calls to the Web3 Multifactors network The Web3 Multifactors network assumes that n/4 of nodes may be malicious, and n/2 + 1 of the nodes are required for key reconstruction. Given these threshold assumptions, all API calls to the Web3 Mutlfactor nodes need to be checked for consistency while still allowing for early exits in optimistic scenarios where the first n/2 + 1 responses are from honest nodes. Also, in order to prevent front-running by nodes, a commit-reveal process is also necessary for share retrieval. This library handles these checks and allows you to query the Web3 Mutlifactor network easily through these APIs: - retrieveShares - getPublicAddress ## Features - Typescript compatible. Includes Type definitions - All API's return `Promises` ## Installation ### Bundling This module is distributed in 5 formats - `esm` build `dist/torusUtils.esm.js` in es6 format - `commonjs` build `dist/torusUtils.cjs.js` in es5 format - `commonjs` build `dist/torusUtils-bundled.cjs.js` in es5 format with problematic packages bundled (benfits non-webpack users) - `umd` build `dist/torusUtils.umd.min.js` in es5 format without polyfilling corejs minified - `nodejs` build `dist/torusUtils-node.js` in es5 format By default, the appropriate format is used for your specified usecase You can use a different format (if you know what you're doing eg. node) by referencing the correct file The cjs build is not polyfilled with core-js. It is upto the user to polyfill based on the browserlist they target ### Directly in Browser CDN's serve the non-core-js polyfilled version by default. You can use a different jsdeliver ```js <script src="https://cdn.jsdelivr.net/npm/@oraichain/torus.js"></script> ``` unpkg ```js <script src="https://unpkg.com/@oraichain/torus.js"></script> ``` ### Notes This is a plugin that works [only on the client side](https://nuxtjs.org/guide/plugins/#client-side-only). So please register it as a ssr-free plugin.