utils

Namespace

utils

Description:
  • Contains utility functions (higher order combinators)

Source:
See:

Methods

(static) jiffClient.utils.bit_combinator(deferrednon-null, startnon-null, lengthnon-null, initialnullable, funcnon-null, promisifyopt, nullable, valufyopt, nullable)

Description:
  • A high level combinator for iteration of bit arrays It executes a round of (func) starting from index start to the length (supports backwards if start > length) excluding length Every round is blocked until the previous one finishes and the promise produced by it is resolved The final value is used to resolve deferred

Source:
Parameters:
Name Type Attributes Description
deferred Deferred

the deferred to resolve with the final output

start number

the index to start from

length number

the index to stop at (excluding it)

initial object <nullable>

an initial aggregator value

func function

the aggregator function to apply to the elements in order, takes the index and the aggregator value so far

promisify function <optional>
<nullable>

if initial is not null, this is called prior to starting combinator, to turn initial into a promise of the actually used initial value(in case it has to be resolved), defaults to promisifying a SecretShare with .wThen

valufy function <optional>
<nullable>

applied to the final result to turn it into a value, which is then used to resolve deferred, defaults to getting value of a SecretShare

(static) jiffClient.utils.many_secret_shares(count, holders, threshold, Zp) → {object}

Description:
  • Create an array of secret shares and associated deferred.

Source:
Parameters:
Name Type Description
count number

number of secret shares

holders Array

the parties that hold all the corresponding shares (must be sorted)

threshold number

the min number of parties needed to reconstruct the secret

Zp number

the mod under which this share was created

Returns:

the secret share object containing the give value

Type
object

(static) jiffClient.utils.resolve_many_secrets(deferreds, shares)

Description:
  • Resolve the array of deferreds with the values of the given shares when ready, matched by index

Source:
Parameters:
Name Type Description
deferreds Array.<Deferred>

the deferred to resolve

shares Array.<SecretShare>

the shares to resolve with