An array of indexes of the shares to be used for recovering the secret. These are the indexes of the shares returned by splitSecret.
An array of shares of the secret matching the indexes in indexes. These are the shares returned by splitSecret.
A Uint8Array representing the recovered secret.
import { recoverSecret } from "@bcts/shamir";
const indexes = [0, 2];
const shares = [
new Uint8Array([47, 165, 102, 232, ...]),
new Uint8Array([221, 174, 116, 201, ...]),
];
const secret = recoverSecret(indexes, shares);
console.log(new TextDecoder().decode(secret)); // "my secret belongs to me."
Recovers the secret from the given shares using the Shamir secret sharing algorithm.