Construct an accumulator object.
Get the accumulated value.
Add a single element to the accumulator
The element to add.
Optional
secretKey: AccumulatorSecretKeyIf secret key is not provided, its expected to find the secret key on the object.
Optional
state: IKBUniversalAccumulatorStateIf state is provided it is checked before computing the new accumulator and updated with new element after computing the new accumulator. Throws error if element present.
Add a batch of elements to the accumulator.
Optional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateIf state is provided it is checked before computing the new accumulator and updated with new elements after computing the new accumulator
Protected
addProtected
If state is provided, add the batch of elements to the state
Optional
state: IAccumulatorStateAdd and remove batches of elements.
The batch to be added
The batch to be removed.
Optional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateIf state is provided it is checked before computing the new accumulator and updated by adding and removing given elements after computing the new accumulator.
Protected
addProtected
If state is provided, add the element to the state
Optional
state: IAccumulatorStateProtected
checkOptional
state: IKBUniversalAccumulatorStateProtected
checkOptional
state: IKBUniversalAccumulatorStateOptional
state: IKBUniversalAccumulatorStateOptional
state: IKBUniversalAccumulatorStateProtected
ensureProtected
Check if element is absent in the state and throws an error if its present. Only checks if the state is passed
Optional
state: IAccumulatorStateProtected
ensureProtected
Check if a batch of elements is absent in the state and throws an error any of them is present. Only checks if the state is passed
Optional
state: IAccumulatorStateProtected
ensureProtected
Check if element is present in the state and throws an error if its absent. Only checks if the state is passed
Optional
state: IAccumulatorStateProtected
ensureProtected
Check if a batch of elements is present in the state and throws an error any of them is absent. Only checks if the state is passed
Optional
state: IAccumulatorStateExtend the domain
Add these elements to the domain. These should not be part of the domain
Optional
state: IKBUniversalAccumulatorStateProtected
getReturn the params if provided as an argument else look for params on this
.
Optional
params: AccumulatorParamsparams or throws error if cannot find params
Protected
getReturn the secret key if provided as an argument else look for secret key on this
.
Optional
secretKey: AccumulatorSecretKeysecret key or throws error if cannot find secret key
Calculate the membership witness for the given element
Optional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateIf state is provided it is checked for presence of the element before calculating the witness
Calculate the membership witnesses for the given batch of elements
Optional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateIf state is provided it is checked for presence of all the elements before calculating the witnesses
Optional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateOptional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateRemove a single element from the accumulator
Optional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateIf state is provided it is checked before computing the new accumulator and element is removed from it after computing the new accumulator. Throws error if element is not present.
Remove a batch of elements from the accumulator.
Optional
secretKey: AccumulatorSecretKeyOptional
state: IKBUniversalAccumulatorStateIf state is provided it is checked before computing the new accumulator and updated by removing those elements after computing the new accumulator
Protected
removeProtected
If state is provided, remove the batch of elements from the state
Optional
state: IAccumulatorStateProtected
removeProtected
If state is provided, remove the element from the state
Optional
state: IAccumulatorStateOptional
secretKey: AccumulatorSecretKeyVerify the membership witness.
Optional
params: AccumulatorParamsOptional
params: AccumulatorParamsOptional
secretKey: AccumulatorSecretKeyOptional
secretKey: AccumulatorSecretKeyOptional
secretKey: AccumulatorSecretKeyOptional
secretKey: AccumulatorSecretKeyStatic
deriveStatic
encodeTo add arbitrary bytes like byte representation of UUID or some other user id or something else as an accumulator member, encode it first using this. This is an irreversible encoding as a hash function is used to convert a message of arbitrary length to a fixed length encoding.
Static
encodeStatic
fromStatic
generateGenerate private and public key from given params and optional seed
.
Optional
seed: Uint8ArrayPass to generate keys deterministically.
Static
generateGenerate proving key for proving membership in an accumulator in zero knowledge. Proving key is public data that must be known to both the prover and verifier. Any prover and verifier pair can mutually agree on a proving key and the manager does not need to be aware of any proving key.
Optional
label: Uint8ArrayThe bytearray that is hashed to deterministically generate the proving key.
Static
generateGenerate proving key for proving non-membership in a universal accumulator in zero knowledge.
Optional
label: Uint8ArrayThe bytearray that is hashed to deterministically generate the proving key.
Static
generateGenerate accumulator parameters. They are needed to generate public key and initialize the accumulator.
Optional
label: Uint8ArrayPass to generate parameters deterministically.
Static
generateGenerate public key from given params and secret key.
Static
generateGenerate secret key for the accumulator manager who updates the accumulator and creates witnesses.
Optional
seed: Uint8ArrayPass to generate key deterministically.
Static
initializeAll possible members or non-members of this accumulator
Optional
state: IKBUniversalAccumulatorState
KB universal accumulator. Its composed of 2 accumulators, one for accumulating elements that are "members" and one for "non-members". But this detail is largely abstracted away. All possible "members" and "non-members" of this accumulator are called its domain and during initialization, the domain needs to be known/passed. The domain can be extended at any point and any number of times.