0.3.0 • Published 6 years ago

rusty-secrets v0.3.0

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
6 years ago

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.
ParamTypeDescription
kNumberMinimum number of shares to be provided to recover the secret (1 <= k <= 255).
nNumberNumber of shares to emit (2 <= n <= 255).
secretBufferThe secret to split.
signSharesBooleanSign 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.
ParamTypeDescription
sharesArray.<String>The shares to recover the secret from.
verifySignaturesBooleanVerify 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

ParamTypeDescription
kNumberMinimum number of shares to be provided to recover the secret (1 <= k <= 255).
nNumberNumber of shares to emit (2 <= n <= 255).
secretBufferThe secret to split.
mimeTypeBufferThe MIME type of the secret (or null).
signSharesBooleanSign the shares using Merkle signing.
cbfunctionThe 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

ParamTypeDescription
sharesArray.<String>The shares to recover the secret from.
verifySignaturesBooleanVerify the signatures. Must be set to true if they are signed, false otherwise
cbfunctionThe 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

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago