Implementation of Sharmir's Secret Sharing in Typescript
npm i @timesule/shamirs-secret-sharing
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
Splits a secret string into shards.
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.
- (string[]): An array of shards.
Combines shards into the original secret string.
shards
(string[]): The shards to be combined.
- (string): The original secret.
Splits a secret buffer into shards.
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.
- (string[]): An array of shards.
Combines shards into the original secret buffer.
shards
(string[]): The shards to be combined.
- (Buffer): The original secret as a buffer.