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.
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.
Split
secretperspec: one array of shares per group, in spec order.The arguments are checked before the first draw:
specmust be aSpecandsecretaSecret(instances from another copy of this package are rebuilt through this copy's factories),optionsan object or absent. The draw order is wire: two identifier bytes first (through rand'sfillRandomBytes, so a malformed generator fails there with rand'sRandError, 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.