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

rusty-secrets

v0.3.0

Published

Node.js bindings to RustySecrets, a secret sharing scheme implementation in Rust.

Downloads

7

Readme

rustysecrets-node

Build Status npm License

Node.js bindings to RustySecrets, a secret sharing scheme library written in Rust.

Requirements

  • Node.js v8.x LTS (Carbon) or Electron >= 1.7.x
  • Rust stable (eg. via rustup)

Installation

$ npm install --save rusty-secrets

Usage

var rustysecrets = require('rusty-secrets').wrapped;

var threshold   = 7;
var sharesCount = 10;
var secret      = "Hello, World";

var shares = rustysecrets.splitSecret(threshold, sharesCount, secret);
// > [ '7-1-CgyDwB3wLPHL4hinb1o',
// >   '7-2-CgzDMo5J6YvrIIHFahg',
// >   '7-3-CgwIl//VqlYAlfYQaSY',
// >   '7-4-CgxDy7Umfn+rua4BYJw',
// >   '7-5-CgyIbsS6PaJADNnUY6I',
// >   '7-6-CgzInFcD+NhgzkC2ZuA',
// >   '7-7-CgwDOSafuwWLezdjZd4',
// >   '7-8-CgxeJMP4TYorlvCUdIk',
// >   '7-9-CgyVgbJkDlfAI4dBd7c',
// >   '7-10-CgzVcyHdyy3g4R4jcvU' ]

var someShares = shares.slice(1, 8);
var recovered = rustysecrets.recoverSecret(someShares);
// > Hello, World!

API

rustysecrets : object

rustysecrets.sss : object

Provides an API to perform Shamir's secret sharing, with optional signatures

Kind: static namespace of rustysecrets

sss.splitSecret(k, n, secret, signShares) ⇒ Array.<String>

Performs k-out-of-n Shamir's secret sharing.

Kind: static method of sss Returns: Array.<String> - An array of shares Throws:

  • Will throw an error if the parameters are invalid.

| Param | Type | Description | | --- | --- | --- | | k | Number | Minimum number of shares to be provided to recover the secret (1 <= k <= 255). | | n | Number | Number of shares to emit (2 <= n <= 255). | | secret | Buffer | The secret to split. | | signShares | Boolean | Sign the shares using Merkle signing. |

sss.recoverSecret(shares, verifySignatures) ⇒ String

Recovers the secret from a k-out-of-n Shamir's secret sharing scheme.

At least k distinct shares need to be provided to recover the secret.

Kind: static method of sss Returns: String - The recovered secret Throws:

  • Will throw an error if there are not enough shares.
  • Will throw an error if the shares are invalid.
  • Will throw an error if the shares data is not well-formed.
  • Will throw an error if verifySignatures is not set to the proper value.

| Param | Type | Description | | --- | --- | --- | | shares | Array.<String> | The shares to recover the secret from. | | verifySignatures | Boolean | Verify the signatures. Must be set to true if they are signed, false otherwise |

rustysecrets.wrapped : object

Provides an API to perform Shamir's secret sharing, with MIME types

Kind: static namespace of rustysecrets

wrapped.splitSecret(k, n, secret, mimeType, signShares, cb)

Performs k-out-of-n Shamir's secret sharing.

Kind: static method of wrapped

| Param | Type | Description | | --- | --- | --- | | k | Number | Minimum number of shares to be provided to recover the secret (1 <= k <= 255). | | n | Number | Number of shares to emit (2 <= n <= 255). | | secret | Buffer | The secret to split. | | mimeType | Buffer | The MIME type of the secret (or null). | | signShares | Boolean | Sign the shares using Merkle signing. | | cb | function | The callback to call with the result. |

wrapped.recoverSecret(shares, verifySignatures, cb)

Recovers the secret from a k-out-of-n Shamir's secret sharing scheme.

At least k distinct shares need to be provided to recover the secret.

Kind: static method of wrapped

| Param | Type | Description | | --- | --- | --- | | shares | Array.<String> | The shares to recover the secret from. | | verifySignatures | Boolean | Verify the signatures. Must be set to true if they are signed, false otherwise | | cb | function | The callback to call with the result. |

Bug Reporting

Please report bugs either as pull requests or as issues in the issue tracker. rustysecrets-node has a full disclosure vulnerability policy. Please do NOT attempt to report any security vulnerability in this code privately to anybody.

License

See LICENSE