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

    Function generateShares

    • Split secret per spec: one array of shares per group, in spec order.

      The arguments are checked before the first draw: spec must be a Spec and secret a Secret (instances from another copy of this package are rebuilt through this copy's factories), options an object or absent. The draw order is wire: two identifier bytes first (through rand's fillRandomBytes, so a malformed generator fails there with rand's RandError, unwrapped), then the group-level Shamir split, then each group's member split in group order. A generator's own error propagates unwrapped. The share objects are frozen.

      Parameters

      • spec: Spec
      • secret: Secret
      • Optionaloptions: RngOptions

      Returns SskrShare[][]

      InvalidParameter for an argument of the wrong type; Shamir for a Shamir failure, including a group whose member threshold is 0 (cause InvalidThreshold), after every earlier draw.