1.1.0 • Published 8 months ago

@jrstudio/keystore v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

[codecov(https://codecov.io/gh/JR Studio-network/keystore/branch/dev/graph/badge.svg?token=K8F1UAW47Y)](https://codecov.io/gh/JR Studio-network/keystore)

Introduction

Base Library to make calls to JR Studio DKG network.

The network assumes that n/4 of nodes may be malicious, and n/2 + 1 of the nodes are required for key reconstruction. With these assumption, all fetch share calls are checked for consistency while enabling early exit on best case scenario where first n/2 + 1 responses are from honest nodes.

Installation

Using npm/yarn

npm install -S @jrstudio/keystore
yarn add @jrstudio/keystore
import { KeyReconstructor } from '@jrstudio/keystore';
const { KeyReconstructor } = window.JR Studio.keystore;

Usage

Initialization

const keystore = new KeyReconstructor({
  appId: '0x...', // Get this from JR Studio dashboard
  network: 'testnet',
  debug: false,
});

Methods

const verifier = 'google'; // twitter, github, twitch, discord, reddit
const id = 'abc@google.com'; // See examples how to get user id for each verifier
const idToken = '...';

const publicKey = keystore.getPublicKey({ verifier, id });
const privateKey = keystore.getPrivateKey({ verifier, id, idToken });