npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

secretkeysharing

v0.0.7

Published

library for shamir sceret sharing implementation with qna

Downloads

9

Readme

Secret Key Sharing Library

dependencies Status devDependencies Status License: MIT

important for demo

try

npm install
npm start //source example/example.js

(it might be breaking some time coz its a PoC only)

this library is the implementation of Shamir Secret sharing and developed in and for NodeJS.

Installation

npm install --save secretkeysharing

Usages

1.Secure private key using QnA

eg. 0xC2D7CF95645D33006175B78989035C7c9061d3F9

//import functions from the library
import { split_qna , combine_qna, questions } from 'secretkeysharing'

// questions
const questions_list = [questions[0], questions[1], questions[2], questions[3], questions[4]];

// answers
const answers = ['bigbang', 'go', 'study', 'skydiving', 'swimming'];
// calling split_qna
// public share, can be store anywhere
const public_share = split_qna('0xC2D7CF95645D33006175B78989035C7c9061d3F9', 3, questions_list, answers, 'hex');
    
// calling combine
const secret = combine_qna( public_share, [questions[0], questions[1], questions[2]], ['bigbang', 'go', 'study'] , 'hex');
console.log('recoverd secret is : ' + secret);

// mnemonic
const mnemonic = "media badge grid crunch pair captain add cigar ridge either crack private";

// public share, can be store anywhere
const public_share_mnemonic = split_qna( mnemonic, 3, questions_list, answers, 'mnemonic');
    
// calling combine
const recovered_mnemonic = combine_qna( public_share_mnemonic, questions_recovery, answers_recovery , 'mnemonic');

console.log('recoverd mnemonic is : ' + recovered_mnemonic);

2.Secure and share the private key

eg. 0xC2D7CF95645D33006175B78989035C7c9061d3F9

import { split , combine } from 'secretkeysharing'
import { prime512 , prime3217 , prime19937 } from 'secretkeysharing'

// split function
var splits = split('0xC2D7CF95645D33006175B78989035C7c9061d3F9', 6, 3 , prime512 );

// splits
console.log('splits are : '+JSON.stringify(splits, 4, 2));


 // combime function
var privatekey = combine([splits[1],splits[3],splits[2]],prime512).toHex();

// recoverd key
console.log('recovery key is : '+ privatekey);

3. Secure and share the Mnemonic

eg. witch collapse practice feed shame open despair creek road again ice least

import { split , combine } from 'secretkeysharing'
import { prime512 , prime3217 , prime19937 } from 'secretkeysharing'
import { encode , decode } from 'secretkeysharing'

//Encode the string
var encoded_string = encode('witch collapse practice feed shame open despair creek road again ice least');

//Spit function
var splits = split(encoded_string, 6, 3 , prime512 );

//combine function
var privatekey = combine([splits[1],splits[3],splits[2]],prime512).toHex();

//Decode the key
var decoded_string = decode(privatekey)
// output
console.log(decoded_string);