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

    Function splitSecret

    • Split secret into shareCount shares, any threshold of which recover it. The secret must be 16–32 bytes and even-length.

      With threshold 1 every share is a copy of the secret and no randomness is drawn. Otherwise threshold - 2 shares are drawn whole from rng, then secret.length - 4 bytes for the digest share's tail; the remaining shares are interpolated. That draw order is wire. Draws go through rand's fillRandomBytes, so rand's generator contract applies: a generator's own error propagates unwrapped, and one without a callable fillBytes fails at the first draw with rand's RandError InvalidGenerator.

      Parameters

      Returns ShamirShare[]

      InvalidParameter when options is not an object, when threshold or shareCount is not a usize (a safe non-negative integer number or a bigint in [0, 2^64 - 1]), or when secret is not a Uint8Array, in that order; then TooManyShares, InvalidThreshold, SecretTooLong, SecretTooShort, SecretNotEvenLen, checked in that order.