@timesule/shamirs-secret-sharing
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Sharmir's Secret Sharing

Nodejs CI NPM CD

Implementation of Sharmir's Secret Sharing in Typescript

Installation

npm install

Usage

const { SSS } = require('../lib/index.js');
// or
const { ShamirsSecretSharing } = require('../lib/index.js');
import { SSS } from 'shamirs-secret-sharing';
// or
import { ShamirsSecretSharing } from 'shamirs-secret-sharing';

Check examples/* for more information

Class SharmirsSecretSharing

splitString

Splits a secret string into shards.

Parameters

  • secret (string): The secret to be split.
  • totalShards (number): The total number of shards.
  • threshold (number): The minimum number of shards required to reconstruct the secret.

Returns

  • (string[]): An array of shards.

combineString

Combines shards into the original secret string.

Parameters

  • shards (string[]): The shards to be combined.

Returns

  • (string): The original secret.

splitBuffer

Splits a secret buffer into shards.

Parameters

  • secretBuffer (Buffer): The buffer containing the secret to be split.
  • totalShards (number): The total number of shards.
  • threshold (number): The minimum number of shards required to reconstruct the secret.

Returns

  • (string[]): An array of shards.

combineBuffer

Combines shards into the original secret buffer.

Parameters

  • shards (string[]): The shards to be combined.

Returns

  • (Buffer): The original secret as a buffer.

Readme

Keywords

none

Package Sidebar

Install

npm i @timesule/shamirs-secret-sharing

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

9.24 kB

Total Files

4

Last publish

Collaborators

  • timesule