1.0.0 • Published 10 months ago

@timesule/shamirs-secret-sharing v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

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.
1.0.0

10 months ago