@blockchaincommons/shamir - v1.0.0-beta.3
    Preparing search index...

    Function recoverSecret

    • Recover the secret from shares; their count is the threshold.

      Each share's index and data are read once, before any check, and the snapshot is what validation and interpolation see.

      Parameters

      Returns Uint8Array<ArrayBuffer>

      InvalidParameter when shares is not an array, a share is not an object, or its data is not a Uint8Array; then InvalidThreshold for no shares, TooManyShares above MAX_SHARE_COUNT, the length codes for malformed share data, SharesUnequalLength, InvalidParameter for an index that is not a usize (a safe non-negative integer number or a bigint in [0, 2^64 - 1]), and ChecksumFailure when the shares do not belong together or have been altered. Indexes 254 and 255 and duplicates are left to the checksum, as the reference leaves them; an index above 255 is narrowed to its low eight bits, and a single share's index is not read.