From d811296367960b7a30bbcaedd8caac0eab39b6d2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:34:34 +0000 Subject: [PATCH] Deploy to GitHub pages --- .nojekyll | 0 CNAME | 1 + assets/highlight.css | 134 ++ assets/icons.js | 15 + assets/icons.svg | 1 + assets/main.js | 59 + assets/navigation.js | 1 + assets/search.js | 1 + assets/style.css | 1412 +++++++++++++++++ classes/_zk_kit_imt.IMT.html | 94 ++ classes/_zk_kit_lean_imt.LeanIMT.html | 105 ++ classes/_zk_kit_smt.SMT.html | 95 ++ classes/_zk_kit_utils.F1Field.html | 101 ++ functions/_zk_kit_baby_jubjub.addPoint.html | 10 + functions/_zk_kit_baby_jubjub.inCurve.html | 5 + .../_zk_kit_baby_jubjub.mulPointEscalar.html | 6 + functions/_zk_kit_baby_jubjub.packPoint.html | 6 + .../_zk_kit_baby_jubjub.unpackPoint.html | 6 + ...zk_kit_eddsa_poseidon.derivePublicKey.html | 13 + ...kit_eddsa_poseidon.deriveSecretScalar.html | 13 + .../_zk_kit_eddsa_poseidon.packPublicKey.html | 5 + .../_zk_kit_eddsa_poseidon.packSignature.html | 9 + .../_zk_kit_eddsa_poseidon.signMessage.html | 11 + ...zk_kit_eddsa_poseidon.unpackPublicKey.html | 5 + ...zk_kit_eddsa_poseidon.unpackSignature.html | 5 + ...zk_kit_eddsa_poseidon.verifySignature.html | 6 + ...ytower.LazyTowerHashChainProofBuilder.html | 13 + ...kit_logical_expressions.applyOperator.html | 9 + .../_zk_kit_logical_expressions.evaluate.html | 18 + ...zk_kit_logical_expressions.precedence.html | 9 + .../_zk_kit_logical_expressions.tokenize.html | 6 + .../_zk_kit_poseidon_cipher.checkEqual.html | 5 + .../_zk_kit_poseidon_cipher.normalize.html | 5 + ...k_kit_poseidon_cipher.poseidonDecrypt.html | 7 + ...on_cipher.poseidonDecryptWithoutCheck.html | 8 + ...k_kit_poseidon_cipher.poseidonEncrypt.html | 6 + .../_zk_kit_poseidon_cipher.poseidonPerm.html | 4 + functions/_zk_kit_poseidon_cipher.pow5.html | 4 + ...it_poseidon_cipher.unstringifyBigInts.html | 5 + ..._zk_kit_poseidon_cipher.validateNonce.html | 3 + .../_zk_kit_poseidon_proof.generate.html | 14 + functions/_zk_kit_poseidon_proof.verify.html | 4 + functions/_zk_kit_smt.checkHex.html | 4 + .../_zk_kit_smt.getFirstCommonElements.html | 5 + ..._kit_smt.getIndexOfLastNonZeroElement.html | 5 + functions/_zk_kit_smt.hexToBin.html | 4 + functions/_zk_kit_smt.keyToPath.html | 5 + ..._kit_utils.conversions.base64ToBuffer.html | 6 + ...zk_kit_utils.conversions.base64ToText.html | 6 + ...it_utils.conversions.beBigIntToBuffer.html | 9 + ...it_utils.conversions.beBufferToBigInt.html | 5 + ..._kit_utils.conversions.bigIntToBuffer.html | 4 + ...utils.conversions.bigIntToHexadecimal.html | 4 + ...tils.conversions.bigNumberishToBigInt.html | 6 + ...tils.conversions.bigNumberishToBuffer.html | 6 + ..._kit_utils.conversions.bufferToBase64.html | 4 + ..._kit_utils.conversions.bufferToBigInt.html | 4 + ...utils.conversions.bufferToHexadecimal.html | 5 + ...utils.conversions.hexadecimalToBigInt.html | 5 + ...utils.conversions.hexadecimalToBuffer.html | 5 + ...it_utils.conversions.leBigIntToBuffer.html | 9 + ...it_utils.conversions.leBufferToBigInt.html | 5 + ...zk_kit_utils.conversions.textToBase64.html | 4 + .../_zk_kit_utils.crypto.getRandomValues.html | 4 + ..._kit_utils.errorHandlers.requireArray.html | 4 + ...kit_utils.errorHandlers.requireBigInt.html | 4 + ..._utils.errorHandlers.requireBigNumber.html | 4 + ...ils.errorHandlers.requireBigNumberish.html | 4 + ...kit_utils.errorHandlers.requireBuffer.html | 4 + ...it_utils.errorHandlers.requireDefined.html | 4 + ...t_utils.errorHandlers.requireFunction.html | 4 + ...tils.errorHandlers.requireHexadecimal.html | 8 + ...kit_utils.errorHandlers.requireNumber.html | 4 + ...kit_utils.errorHandlers.requireObject.html | 5 + ...kit_utils.errorHandlers.requireString.html | 4 + ...rrorHandlers.requireStringifiedBigInt.html | 4 + ..._kit_utils.errorHandlers.requireTypes.html | 4 + ...utils.errorHandlers.requireUint8Array.html | 4 + ...zk_kit_utils.packing.packGroth16Proof.html | 4 + ..._kit_utils.packing.unpackGroth16Proof.html | 4 + functions/_zk_kit_utils.scalar.bits.html | 7 + functions/_zk_kit_utils.scalar.gt.html | 5 + functions/_zk_kit_utils.scalar.isOdd.html | 4 + functions/_zk_kit_utils.scalar.isZero.html | 4 + functions/_zk_kit_utils.scalar.mul.html | 5 + .../_zk_kit_utils.scalar.shiftRight.html | 7 + .../_zk_kit_utils.typeChecks.isArray.html | 3 + .../_zk_kit_utils.typeChecks.isBigInt.html | 3 + .../_zk_kit_utils.typeChecks.isBigNumber.html | 5 + ...k_kit_utils.typeChecks.isBigNumberish.html | 7 + .../_zk_kit_utils.typeChecks.isBuffer.html | 3 + .../_zk_kit_utils.typeChecks.isDefined.html | 3 + .../_zk_kit_utils.typeChecks.isFunction.html | 3 + ...zk_kit_utils.typeChecks.isHexadecimal.html | 7 + .../_zk_kit_utils.typeChecks.isNumber.html | 3 + .../_zk_kit_utils.typeChecks.isObject.html | 4 + .../_zk_kit_utils.typeChecks.isString.html | 3 + ..._utils.typeChecks.isStringifiedBigInt.html | 3 + ..._kit_utils.typeChecks.isSupportedType.html | 4 + .../_zk_kit_utils.typeChecks.isType.html | 4 + ..._zk_kit_utils.typeChecks.isUint8Array.html | 3 + hierarchy.html | 1 + index.html | 557 +++++++ interfaces/_zk_kit_smt.EntryResponse.html | 4 + interfaces/_zk_kit_smt.MerkleProof.html | 6 + interfaces/_zk_kit_utils.Buffer.html | 749 +++++++++ modules/_zk_kit_baby_jubjub.html | 78 + modules/_zk_kit_eddsa_poseidon.html | 91 ++ modules/_zk_kit_imt.html | 67 + modules/_zk_kit_lazytower.html | 67 + modules/_zk_kit_lean_imt.html | 66 + modules/_zk_kit_logical_expressions.html | 89 ++ modules/_zk_kit_poseidon_cipher.html | 80 + modules/_zk_kit_poseidon_proof.html | 92 ++ modules/_zk_kit_smt.html | 82 + modules/_zk_kit_utils.conversions.html | 17 + modules/_zk_kit_utils.crypto.html | 2 + modules/_zk_kit_utils.errorHandlers.html | 15 + modules/_zk_kit_utils.html | 123 ++ modules/_zk_kit_utils.packing.html | 3 + modules/_zk_kit_utils.scalar.html | 7 + modules/_zk_kit_utils.typeChecks.html | 18 + types/_zk_kit_baby_jubjub.Point.html | 1 + types/_zk_kit_eddsa_poseidon.Signature.html | 1 + types/_zk_kit_imt.IMTHashFunction.html | 3 + types/_zk_kit_imt.IMTMerkleProof.html | 9 + types/_zk_kit_imt.IMTNode.html | 2 + ...kit_lazytower.LazyTowerHashChainProof.html | 1 + .../_zk_kit_lean_imt.LeanIMTHashFunction.html | 3 + .../_zk_kit_lean_imt.LeanIMTMerkleProof.html | 9 + .../_zk_kit_poseidon_cipher.BigIntOutput.html | 1 + types/_zk_kit_poseidon_cipher.CipherText.html | 1 + ..._zk_kit_poseidon_cipher.EncryptionKey.html | 1 + types/_zk_kit_poseidon_cipher.Nonce.html | 1 + types/_zk_kit_poseidon_cipher.PlainText.html | 1 + ..._kit_poseidon_cipher.StringifiedInput.html | 1 + .../_zk_kit_poseidon_proof.PoseidonProof.html | 1 + types/_zk_kit_smt.ChildNodes.html | 1 + types/_zk_kit_smt.Entry.html | 1 + types/_zk_kit_smt.EntryMark.html | 1 + types/_zk_kit_smt.HashFunction.html | 1 + types/_zk_kit_smt.Key.html | 1 + types/_zk_kit_smt.Node.html | 1 + types/_zk_kit_smt.Siblings.html | 1 + types/_zk_kit_smt.Value.html | 1 + types/_zk_kit_utils.BigNumber.html | 1 + types/_zk_kit_utils.BigNumberish.html | 1 + types/_zk_kit_utils.PackedGroth16Proof.html | 1 + ...zk_kit_utils.typeChecks.SupportedType.html | 1 + variables/_zk_kit_baby_jubjub.Base8.html | 1 + variables/_zk_kit_baby_jubjub.Fr.html | 1 + variables/_zk_kit_baby_jubjub.order.html | 1 + variables/_zk_kit_baby_jubjub.r.html | 3 + variables/_zk_kit_baby_jubjub.subOrder.html | 1 + .../_zk_kit_eddsa_poseidon.EdDSAPoseidon.html | 1 + variables/_zk_kit_poseidon_cipher.C.html | 1 + variables/_zk_kit_poseidon_cipher.M.html | 1 + variables/_zk_kit_utils.Buffer-1.html | 1 + ...k_kit_utils.typeChecks.supportedTypes.html | 1 + 159 files changed, 4786 insertions(+) create mode 100644 .nojekyll create mode 100644 CNAME create mode 100644 assets/highlight.css create mode 100644 assets/icons.js create mode 100644 assets/icons.svg create mode 100644 assets/main.js create mode 100644 assets/navigation.js create mode 100644 assets/search.js create mode 100644 assets/style.css create mode 100644 classes/_zk_kit_imt.IMT.html create mode 100644 classes/_zk_kit_lean_imt.LeanIMT.html create mode 100644 classes/_zk_kit_smt.SMT.html create mode 100644 classes/_zk_kit_utils.F1Field.html create mode 100644 functions/_zk_kit_baby_jubjub.addPoint.html create mode 100644 functions/_zk_kit_baby_jubjub.inCurve.html create mode 100644 functions/_zk_kit_baby_jubjub.mulPointEscalar.html create mode 100644 functions/_zk_kit_baby_jubjub.packPoint.html create mode 100644 functions/_zk_kit_baby_jubjub.unpackPoint.html create mode 100644 functions/_zk_kit_eddsa_poseidon.derivePublicKey.html create mode 100644 functions/_zk_kit_eddsa_poseidon.deriveSecretScalar.html create mode 100644 functions/_zk_kit_eddsa_poseidon.packPublicKey.html create mode 100644 functions/_zk_kit_eddsa_poseidon.packSignature.html create mode 100644 functions/_zk_kit_eddsa_poseidon.signMessage.html create mode 100644 functions/_zk_kit_eddsa_poseidon.unpackPublicKey.html create mode 100644 functions/_zk_kit_eddsa_poseidon.unpackSignature.html create mode 100644 functions/_zk_kit_eddsa_poseidon.verifySignature.html create mode 100644 functions/_zk_kit_lazytower.LazyTowerHashChainProofBuilder.html create mode 100644 functions/_zk_kit_logical_expressions.applyOperator.html create mode 100644 functions/_zk_kit_logical_expressions.evaluate.html create mode 100644 functions/_zk_kit_logical_expressions.precedence.html create mode 100644 functions/_zk_kit_logical_expressions.tokenize.html create mode 100644 functions/_zk_kit_poseidon_cipher.checkEqual.html create mode 100644 functions/_zk_kit_poseidon_cipher.normalize.html create mode 100644 functions/_zk_kit_poseidon_cipher.poseidonDecrypt.html create mode 100644 functions/_zk_kit_poseidon_cipher.poseidonDecryptWithoutCheck.html create mode 100644 functions/_zk_kit_poseidon_cipher.poseidonEncrypt.html create mode 100644 functions/_zk_kit_poseidon_cipher.poseidonPerm.html create mode 100644 functions/_zk_kit_poseidon_cipher.pow5.html create mode 100644 functions/_zk_kit_poseidon_cipher.unstringifyBigInts.html create mode 100644 functions/_zk_kit_poseidon_cipher.validateNonce.html create mode 100644 functions/_zk_kit_poseidon_proof.generate.html create mode 100644 functions/_zk_kit_poseidon_proof.verify.html create mode 100644 functions/_zk_kit_smt.checkHex.html create mode 100644 functions/_zk_kit_smt.getFirstCommonElements.html create mode 100644 functions/_zk_kit_smt.getIndexOfLastNonZeroElement.html create mode 100644 functions/_zk_kit_smt.hexToBin.html create mode 100644 functions/_zk_kit_smt.keyToPath.html create mode 100644 functions/_zk_kit_utils.conversions.base64ToBuffer.html create mode 100644 functions/_zk_kit_utils.conversions.base64ToText.html create mode 100644 functions/_zk_kit_utils.conversions.beBigIntToBuffer.html create mode 100644 functions/_zk_kit_utils.conversions.beBufferToBigInt.html create mode 100644 functions/_zk_kit_utils.conversions.bigIntToBuffer.html create mode 100644 functions/_zk_kit_utils.conversions.bigIntToHexadecimal.html create mode 100644 functions/_zk_kit_utils.conversions.bigNumberishToBigInt.html create mode 100644 functions/_zk_kit_utils.conversions.bigNumberishToBuffer.html create mode 100644 functions/_zk_kit_utils.conversions.bufferToBase64.html create mode 100644 functions/_zk_kit_utils.conversions.bufferToBigInt.html create mode 100644 functions/_zk_kit_utils.conversions.bufferToHexadecimal.html create mode 100644 functions/_zk_kit_utils.conversions.hexadecimalToBigInt.html create mode 100644 functions/_zk_kit_utils.conversions.hexadecimalToBuffer.html create mode 100644 functions/_zk_kit_utils.conversions.leBigIntToBuffer.html create mode 100644 functions/_zk_kit_utils.conversions.leBufferToBigInt.html create mode 100644 functions/_zk_kit_utils.conversions.textToBase64.html create mode 100644 functions/_zk_kit_utils.crypto.getRandomValues.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireArray.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireBigInt.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireBigNumber.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireBigNumberish.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireBuffer.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireDefined.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireFunction.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireHexadecimal.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireNumber.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireObject.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireString.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireStringifiedBigInt.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireTypes.html create mode 100644 functions/_zk_kit_utils.errorHandlers.requireUint8Array.html create mode 100644 functions/_zk_kit_utils.packing.packGroth16Proof.html create mode 100644 functions/_zk_kit_utils.packing.unpackGroth16Proof.html create mode 100644 functions/_zk_kit_utils.scalar.bits.html create mode 100644 functions/_zk_kit_utils.scalar.gt.html create mode 100644 functions/_zk_kit_utils.scalar.isOdd.html create mode 100644 functions/_zk_kit_utils.scalar.isZero.html create mode 100644 functions/_zk_kit_utils.scalar.mul.html create mode 100644 functions/_zk_kit_utils.scalar.shiftRight.html create mode 100644 functions/_zk_kit_utils.typeChecks.isArray.html create mode 100644 functions/_zk_kit_utils.typeChecks.isBigInt.html create mode 100644 functions/_zk_kit_utils.typeChecks.isBigNumber.html create mode 100644 functions/_zk_kit_utils.typeChecks.isBigNumberish.html create mode 100644 functions/_zk_kit_utils.typeChecks.isBuffer.html create mode 100644 functions/_zk_kit_utils.typeChecks.isDefined.html create mode 100644 functions/_zk_kit_utils.typeChecks.isFunction.html create mode 100644 functions/_zk_kit_utils.typeChecks.isHexadecimal.html create mode 100644 functions/_zk_kit_utils.typeChecks.isNumber.html create mode 100644 functions/_zk_kit_utils.typeChecks.isObject.html create mode 100644 functions/_zk_kit_utils.typeChecks.isString.html create mode 100644 functions/_zk_kit_utils.typeChecks.isStringifiedBigInt.html create mode 100644 functions/_zk_kit_utils.typeChecks.isSupportedType.html create mode 100644 functions/_zk_kit_utils.typeChecks.isType.html create mode 100644 functions/_zk_kit_utils.typeChecks.isUint8Array.html create mode 100644 hierarchy.html create mode 100644 index.html create mode 100644 interfaces/_zk_kit_smt.EntryResponse.html create mode 100644 interfaces/_zk_kit_smt.MerkleProof.html create mode 100644 interfaces/_zk_kit_utils.Buffer.html create mode 100644 modules/_zk_kit_baby_jubjub.html create mode 100644 modules/_zk_kit_eddsa_poseidon.html create mode 100644 modules/_zk_kit_imt.html create mode 100644 modules/_zk_kit_lazytower.html create mode 100644 modules/_zk_kit_lean_imt.html create mode 100644 modules/_zk_kit_logical_expressions.html create mode 100644 modules/_zk_kit_poseidon_cipher.html create mode 100644 modules/_zk_kit_poseidon_proof.html create mode 100644 modules/_zk_kit_smt.html create mode 100644 modules/_zk_kit_utils.conversions.html create mode 100644 modules/_zk_kit_utils.crypto.html create mode 100644 modules/_zk_kit_utils.errorHandlers.html create mode 100644 modules/_zk_kit_utils.html create mode 100644 modules/_zk_kit_utils.packing.html create mode 100644 modules/_zk_kit_utils.scalar.html create mode 100644 modules/_zk_kit_utils.typeChecks.html create mode 100644 types/_zk_kit_baby_jubjub.Point.html create mode 100644 types/_zk_kit_eddsa_poseidon.Signature.html create mode 100644 types/_zk_kit_imt.IMTHashFunction.html create mode 100644 types/_zk_kit_imt.IMTMerkleProof.html create mode 100644 types/_zk_kit_imt.IMTNode.html create mode 100644 types/_zk_kit_lazytower.LazyTowerHashChainProof.html create mode 100644 types/_zk_kit_lean_imt.LeanIMTHashFunction.html create mode 100644 types/_zk_kit_lean_imt.LeanIMTMerkleProof.html create mode 100644 types/_zk_kit_poseidon_cipher.BigIntOutput.html create mode 100644 types/_zk_kit_poseidon_cipher.CipherText.html create mode 100644 types/_zk_kit_poseidon_cipher.EncryptionKey.html create mode 100644 types/_zk_kit_poseidon_cipher.Nonce.html create mode 100644 types/_zk_kit_poseidon_cipher.PlainText.html create mode 100644 types/_zk_kit_poseidon_cipher.StringifiedInput.html create mode 100644 types/_zk_kit_poseidon_proof.PoseidonProof.html create mode 100644 types/_zk_kit_smt.ChildNodes.html create mode 100644 types/_zk_kit_smt.Entry.html create mode 100644 types/_zk_kit_smt.EntryMark.html create mode 100644 types/_zk_kit_smt.HashFunction.html create mode 100644 types/_zk_kit_smt.Key.html create mode 100644 types/_zk_kit_smt.Node.html create mode 100644 types/_zk_kit_smt.Siblings.html create mode 100644 types/_zk_kit_smt.Value.html create mode 100644 types/_zk_kit_utils.BigNumber.html create mode 100644 types/_zk_kit_utils.BigNumberish.html create mode 100644 types/_zk_kit_utils.PackedGroth16Proof.html create mode 100644 types/_zk_kit_utils.typeChecks.SupportedType.html create mode 100644 variables/_zk_kit_baby_jubjub.Base8.html create mode 100644 variables/_zk_kit_baby_jubjub.Fr.html create mode 100644 variables/_zk_kit_baby_jubjub.order.html create mode 100644 variables/_zk_kit_baby_jubjub.r.html create mode 100644 variables/_zk_kit_baby_jubjub.subOrder.html create mode 100644 variables/_zk_kit_eddsa_poseidon.EdDSAPoseidon.html create mode 100644 variables/_zk_kit_poseidon_cipher.C.html create mode 100644 variables/_zk_kit_poseidon_cipher.M.html create mode 100644 variables/_zk_kit_utils.Buffer-1.html create mode 100644 variables/_zk_kit_utils.typeChecks.supportedTypes.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/CNAME b/CNAME new file mode 100644 index 000000000..92ad0ab8e --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +zkkit.pse.dev \ No newline at end of file diff --git a/assets/highlight.css b/assets/highlight.css new file mode 100644 index 000000000..21e1c42c8 --- /dev/null +++ b/assets/highlight.css @@ -0,0 +1,134 @@ +:root { + --light-hl-0: #795E26; + --dark-hl-0: #DCDCAA; + --light-hl-1: #000000; + --dark-hl-1: #D4D4D4; + --light-hl-2: #A31515; + --dark-hl-2: #CE9178; + --light-hl-3: #008000; + --dark-hl-3: #6A9955; + --light-hl-4: #0000FF; + --dark-hl-4: #569CD6; + --light-hl-5: #800000; + --dark-hl-5: #808080; + --light-hl-6: #800000; + --dark-hl-6: #569CD6; + --light-hl-7: #000000FF; + --dark-hl-7: #D4D4D4; + --light-hl-8: #E50000; + --dark-hl-8: #9CDCFE; + --light-hl-9: #0000FF; + --dark-hl-9: #CE9178; + --light-hl-10: #AF00DB; + --dark-hl-10: #C586C0; + --light-hl-11: #001080; + --dark-hl-11: #9CDCFE; + --light-hl-12: #0070C1; + --dark-hl-12: #4FC1FF; + --light-hl-13: #267F99; + --dark-hl-13: #4EC9B0; + --light-hl-14: #098658; + --dark-hl-14: #B5CEA8; + --light-hl-15: #EE0000; + --dark-hl-15: #D7BA7D; + --light-code-background: #FFFFFF; + --dark-code-background: #1E1E1E; +} + +@media (prefers-color-scheme: light) { :root { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); + --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); + --code-background: var(--light-code-background); +} } + +@media (prefers-color-scheme: dark) { :root { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); + --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); + --code-background: var(--dark-code-background); +} } + +:root[data-theme='light'] { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); + --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); + --code-background: var(--light-code-background); +} + +:root[data-theme='dark'] { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); + --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); + --code-background: var(--dark-code-background); +} + +.hl-0 { color: var(--hl-0); } +.hl-1 { color: var(--hl-1); } +.hl-2 { color: var(--hl-2); } +.hl-3 { color: var(--hl-3); } +.hl-4 { color: var(--hl-4); } +.hl-5 { color: var(--hl-5); } +.hl-6 { color: var(--hl-6); } +.hl-7 { color: var(--hl-7); } +.hl-8 { color: var(--hl-8); } +.hl-9 { color: var(--hl-9); } +.hl-10 { color: var(--hl-10); } +.hl-11 { color: var(--hl-11); } +.hl-12 { color: var(--hl-12); } +.hl-13 { color: var(--hl-13); } +.hl-14 { color: var(--hl-14); } +.hl-15 { color: var(--hl-15); } +pre, code { background: var(--code-background); } diff --git a/assets/icons.js b/assets/icons.js new file mode 100644 index 000000000..b79c9e89f --- /dev/null +++ b/assets/icons.js @@ -0,0 +1,15 @@ +(function(svg) { + svg.innerHTML = ``; + svg.style.display = 'none'; + if (location.protocol === 'file:') { + if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', updateUseElements); + else updateUseElements() + function updateUseElements() { + document.querySelectorAll('use').forEach(el => { + if (el.getAttribute('href').includes('#icon-')) { + el.setAttribute('href', el.getAttribute('href').replace(/.*#/, '#')); + } + }); + } + } +})(document.body.appendChild(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))) \ No newline at end of file diff --git a/assets/icons.svg b/assets/icons.svg new file mode 100644 index 000000000..7dead6118 --- /dev/null +++ b/assets/icons.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/main.js b/assets/main.js new file mode 100644 index 000000000..d6f138860 --- /dev/null +++ b/assets/main.js @@ -0,0 +1,59 @@ +"use strict"; +"use strict";(()=>{var Ce=Object.create;var ne=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Ce(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),y=s.str.charAt(1),p;y in s.node.edges?p=s.node.edges[y]:(p=new t.TokenSet,s.node.edges[y]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(console.log("Show page"),document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){console.log("Scorlling");let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!e.checkVisibility()){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ve(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ne(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ve(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` + ${ce(l.parent,i)}.${d}`);let y=document.createElement("li");y.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=u+d,y.append(p),e.appendChild(y)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ne(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var He={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>He[e])}var I=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",fe="mousemove",H="mouseup",J={x:0,y:0},pe=!1,ee=!1,Be=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(Be=!0,F="touchstart",fe="touchmove",H="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(fe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(H,()=>{ee=!1});document.addEventListener("click",t=>{pe&&(t.preventDefault(),t.stopImmediatePropagation(),pe=!1)});var X=class extends I{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(H,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(H,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ye=document.head.appendChild(document.createElement("style"));ye.dataset.for="filters";var Y=class extends I{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ye.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.app.updateIndexVisibility()}};var Z=class extends I{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ve(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ve(t.value)})}function ve(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.pathname===r.pathname&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); +/*! Bundled license information: + +lunr/lunr.js: + (** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 + * Copyright (C) 2020 Oliver Nightingale + * @license MIT + *) + (*! + * lunr.utils + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Set + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.tokenizer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Pipeline + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Vector + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.stemmer + * Copyright (C) 2020 Oliver Nightingale + * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt + *) + (*! + * lunr.stopWordFilter + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.trimmer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.TokenSet + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Index + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Builder + * Copyright (C) 2020 Oliver Nightingale + *) +*/ diff --git a/assets/navigation.js b/assets/navigation.js new file mode 100644 index 000000000..bcfdef8a7 --- /dev/null +++ b/assets/navigation.js @@ -0,0 +1 @@ +window.navigationData = "data:application/octet-stream;base64,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" \ No newline at end of file diff --git a/assets/search.js b/assets/search.js new file mode 100644 index 000000000..9cb3c048d --- /dev/null +++ b/assets/search.js @@ -0,0 +1 @@ +window.searchData = "data:application/octet-stream;base64,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"; \ No newline at end of file diff --git a/assets/style.css b/assets/style.css new file mode 100644 index 000000000..778b94927 --- /dev/null +++ b/assets/style.css @@ -0,0 +1,1412 @@ +:root { + /* Light */ + --light-color-background: #f2f4f8; + --light-color-background-secondary: #eff0f1; + --light-color-warning-text: #222; + --light-color-background-warning: #e6e600; + --light-color-icon-background: var(--light-color-background); + --light-color-accent: #c5c7c9; + --light-color-active-menu-item: var(--light-color-accent); + --light-color-text: #222; + --light-color-text-aside: #6e6e6e; + --light-color-link: #1f70c2; + + --light-color-ts-keyword: #056bd6; + --light-color-ts-project: #b111c9; + --light-color-ts-module: var(--light-color-ts-project); + --light-color-ts-namespace: var(--light-color-ts-project); + --light-color-ts-enum: #7e6f15; + --light-color-ts-enum-member: var(--light-color-ts-enum); + --light-color-ts-variable: #4760ec; + --light-color-ts-function: #572be7; + --light-color-ts-class: #1f70c2; + --light-color-ts-interface: #108024; + --light-color-ts-constructor: var(--light-color-ts-class); + --light-color-ts-property: var(--light-color-ts-variable); + --light-color-ts-method: var(--light-color-ts-function); + --light-color-ts-call-signature: var(--light-color-ts-method); + --light-color-ts-index-signature: var(--light-color-ts-property); + --light-color-ts-constructor-signature: var(--light-color-ts-constructor); + --light-color-ts-parameter: var(--light-color-ts-variable); + /* type literal not included as links will never be generated to it */ + --light-color-ts-type-parameter: #a55c0e; + --light-color-ts-accessor: var(--light-color-ts-property); + --light-color-ts-get-signature: var(--light-color-ts-accessor); + --light-color-ts-set-signature: var(--light-color-ts-accessor); + --light-color-ts-type-alias: #d51270; + /* reference not included as links will be colored with the kind that it points to */ + + --light-external-icon: url("data:image/svg+xml;utf8,"); + --light-color-scheme: light; + + /* Dark */ + --dark-color-background: #2b2e33; + --dark-color-background-secondary: #1e2024; + --dark-color-background-warning: #bebe00; + --dark-color-warning-text: #222; + --dark-color-icon-background: var(--dark-color-background-secondary); + --dark-color-accent: #9096a2; + --dark-color-active-menu-item: #5d5d6a; + --dark-color-text: #f5f5f5; + --dark-color-text-aside: #dddddd; + --dark-color-link: #00aff4; + + --dark-color-ts-keyword: #3399ff; + --dark-color-ts-project: #e358ff; + --dark-color-ts-module: var(--dark-color-ts-project); + --dark-color-ts-namespace: var(--dark-color-ts-project); + --dark-color-ts-enum: #f4d93e; + --dark-color-ts-enum-member: var(--dark-color-ts-enum); + --dark-color-ts-variable: #798dff; + --dark-color-ts-function: #a280ff; + --dark-color-ts-class: #8ac4ff; + --dark-color-ts-interface: #6cff87; + --dark-color-ts-constructor: var(--dark-color-ts-class); + --dark-color-ts-property: var(--dark-color-ts-variable); + --dark-color-ts-method: var(--dark-color-ts-function); + --dark-color-ts-call-signature: var(--dark-color-ts-method); + --dark-color-ts-index-signature: var(--dark-color-ts-property); + --dark-color-ts-constructor-signature: var(--dark-color-ts-constructor); + --dark-color-ts-parameter: var(--dark-color-ts-variable); + /* type literal not included as links will never be generated to it */ + --dark-color-ts-type-parameter: #e07d13; + --dark-color-ts-accessor: var(--dark-color-ts-property); + --dark-color-ts-get-signature: var(--dark-color-ts-accessor); + --dark-color-ts-set-signature: var(--dark-color-ts-accessor); + --dark-color-ts-type-alias: #ff6492; + /* reference not included as links will be colored with the kind that it points to */ + + --dark-external-icon: url("data:image/svg+xml;utf8,"); + --dark-color-scheme: dark; +} + +@media (prefers-color-scheme: light) { + :root { + --color-background: var(--light-color-background); + --color-background-secondary: var(--light-color-background-secondary); + --color-background-warning: var(--light-color-background-warning); + --color-warning-text: var(--light-color-warning-text); + --color-icon-background: var(--light-color-icon-background); + --color-accent: var(--light-color-accent); + --color-active-menu-item: var(--light-color-active-menu-item); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + --color-link: var(--light-color-link); + + --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-module: var(--light-color-ts-module); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-enum-member: var(--light-color-ts-enum-member); + --color-ts-variable: var(--light-color-ts-variable); + --color-ts-function: var(--light-color-ts-function); + --color-ts-class: var(--light-color-ts-class); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-constructor: var(--light-color-ts-constructor); + --color-ts-property: var(--light-color-ts-property); + --color-ts-method: var(--light-color-ts-method); + --color-ts-call-signature: var(--light-color-ts-call-signature); + --color-ts-index-signature: var(--light-color-ts-index-signature); + --color-ts-constructor-signature: var( + --light-color-ts-constructor-signature + ); + --color-ts-parameter: var(--light-color-ts-parameter); + --color-ts-type-parameter: var(--light-color-ts-type-parameter); + --color-ts-accessor: var(--light-color-ts-accessor); + --color-ts-get-signature: var(--light-color-ts-get-signature); + --color-ts-set-signature: var(--light-color-ts-set-signature); + --color-ts-type-alias: var(--light-color-ts-type-alias); + + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); + } +} + +@media (prefers-color-scheme: dark) { + :root { + --color-background: var(--dark-color-background); + --color-background-secondary: var(--dark-color-background-secondary); + --color-background-warning: var(--dark-color-background-warning); + --color-warning-text: var(--dark-color-warning-text); + --color-icon-background: var(--dark-color-icon-background); + --color-accent: var(--dark-color-accent); + --color-active-menu-item: var(--dark-color-active-menu-item); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + --color-link: var(--dark-color-link); + + --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-module: var(--dark-color-ts-module); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-enum-member: var(--dark-color-ts-enum-member); + --color-ts-variable: var(--dark-color-ts-variable); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-constructor: var(--dark-color-ts-constructor); + --color-ts-property: var(--dark-color-ts-property); + --color-ts-method: var(--dark-color-ts-method); + --color-ts-call-signature: var(--dark-color-ts-call-signature); + --color-ts-index-signature: var(--dark-color-ts-index-signature); + --color-ts-constructor-signature: var( + --dark-color-ts-constructor-signature + ); + --color-ts-parameter: var(--dark-color-ts-parameter); + --color-ts-type-parameter: var(--dark-color-ts-type-parameter); + --color-ts-accessor: var(--dark-color-ts-accessor); + --color-ts-get-signature: var(--dark-color-ts-get-signature); + --color-ts-set-signature: var(--dark-color-ts-set-signature); + --color-ts-type-alias: var(--dark-color-ts-type-alias); + + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); + } +} + +html { + color-scheme: var(--color-scheme); +} + +body { + margin: 0; +} + +:root[data-theme="light"] { + --color-background: var(--light-color-background); + --color-background-secondary: var(--light-color-background-secondary); + --color-background-warning: var(--light-color-background-warning); + --color-warning-text: var(--light-color-warning-text); + --color-icon-background: var(--light-color-icon-background); + --color-accent: var(--light-color-accent); + --color-active-menu-item: var(--light-color-active-menu-item); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + --color-link: var(--light-color-link); + + --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-module: var(--light-color-ts-module); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-enum-member: var(--light-color-ts-enum-member); + --color-ts-variable: var(--light-color-ts-variable); + --color-ts-function: var(--light-color-ts-function); + --color-ts-class: var(--light-color-ts-class); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-constructor: var(--light-color-ts-constructor); + --color-ts-property: var(--light-color-ts-property); + --color-ts-method: var(--light-color-ts-method); + --color-ts-call-signature: var(--light-color-ts-call-signature); + --color-ts-index-signature: var(--light-color-ts-index-signature); + --color-ts-constructor-signature: var( + --light-color-ts-constructor-signature + ); + --color-ts-parameter: var(--light-color-ts-parameter); + --color-ts-type-parameter: var(--light-color-ts-type-parameter); + --color-ts-accessor: var(--light-color-ts-accessor); + --color-ts-get-signature: var(--light-color-ts-get-signature); + --color-ts-set-signature: var(--light-color-ts-set-signature); + --color-ts-type-alias: var(--light-color-ts-type-alias); + + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); +} + +:root[data-theme="dark"] { + --color-background: var(--dark-color-background); + --color-background-secondary: var(--dark-color-background-secondary); + --color-background-warning: var(--dark-color-background-warning); + --color-warning-text: var(--dark-color-warning-text); + --color-icon-background: var(--dark-color-icon-background); + --color-accent: var(--dark-color-accent); + --color-active-menu-item: var(--dark-color-active-menu-item); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + --color-link: var(--dark-color-link); + + --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-module: var(--dark-color-ts-module); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-enum-member: var(--dark-color-ts-enum-member); + --color-ts-variable: var(--dark-color-ts-variable); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-constructor: var(--dark-color-ts-constructor); + --color-ts-property: var(--dark-color-ts-property); + --color-ts-method: var(--dark-color-ts-method); + --color-ts-call-signature: var(--dark-color-ts-call-signature); + --color-ts-index-signature: var(--dark-color-ts-index-signature); + --color-ts-constructor-signature: var( + --dark-color-ts-constructor-signature + ); + --color-ts-parameter: var(--dark-color-ts-parameter); + --color-ts-type-parameter: var(--dark-color-ts-type-parameter); + --color-ts-accessor: var(--dark-color-ts-accessor); + --color-ts-get-signature: var(--dark-color-ts-get-signature); + --color-ts-set-signature: var(--dark-color-ts-set-signature); + --color-ts-type-alias: var(--dark-color-ts-type-alias); + + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); +} + +.always-visible, +.always-visible .tsd-signatures { + display: inherit !important; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + line-height: 1.2; +} + +h1 > a:not(.link), +h2 > a:not(.link), +h3 > a:not(.link), +h4 > a:not(.link), +h5 > a:not(.link), +h6 > a:not(.link) { + text-decoration: none; + color: var(--color-text); +} + +h1 { + font-size: 1.875rem; + margin: 0.67rem 0; +} + +h2 { + font-size: 1.5rem; + margin: 0.83rem 0; +} + +h3 { + font-size: 1.25rem; + margin: 1rem 0; +} + +h4 { + font-size: 1.05rem; + margin: 1.33rem 0; +} + +h5 { + font-size: 1rem; + margin: 1.5rem 0; +} + +h6 { + font-size: 0.875rem; + margin: 2.33rem 0; +} + +.uppercase { + text-transform: uppercase; +} + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +.container { + max-width: 1700px; + padding: 0 2rem; +} + +/* Footer */ +footer { + border-top: 1px solid var(--color-accent); + padding-top: 1rem; + padding-bottom: 1rem; + max-height: 3.5rem; +} +.tsd-generator { + margin: 0 1em; +} + +.container-main { + margin: 0 auto; + /* toolbar, footer, margin */ + min-height: calc(100vh - 41px - 56px - 4rem); +} + +@keyframes fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +@keyframes fade-out { + from { + opacity: 1; + visibility: visible; + } + to { + opacity: 0; + } +} +@keyframes fade-in-delayed { + 0% { + opacity: 0; + } + 33% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes fade-out-delayed { + 0% { + opacity: 1; + visibility: visible; + } + 66% { + opacity: 0; + } + 100% { + opacity: 0; + } +} +@keyframes pop-in-from-right { + from { + transform: translate(100%, 0); + } + to { + transform: translate(0, 0); + } +} +@keyframes pop-out-to-right { + from { + transform: translate(0, 0); + visibility: visible; + } + to { + transform: translate(100%, 0); + } +} +body { + background: var(--color-background); + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", + Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; + font-size: 16px; + color: var(--color-text); +} + +a { + color: var(--color-link); + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +a.external[target="_blank"] { + background-image: var(--external-icon); + background-position: top 3px right; + background-repeat: no-repeat; + padding-right: 13px; +} + +code, +pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + padding: 0.2em; + margin: 0; + font-size: 0.875rem; + border-radius: 0.8em; +} + +pre { + position: relative; + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; + padding: 10px; + border: 1px solid var(--color-accent); +} +pre code { + padding: 0; + font-size: 100%; +} +pre > button { + position: absolute; + top: 10px; + right: 10px; + opacity: 0; + transition: opacity 0.1s; + box-sizing: border-box; +} +pre:hover > button, +pre > button.visible { + opacity: 1; +} + +blockquote { + margin: 1em 0; + padding-left: 1em; + border-left: 4px solid gray; +} + +.tsd-typography { + line-height: 1.333em; +} +.tsd-typography ul { + list-style: square; + padding: 0 0 0 20px; + margin: 0; +} +.tsd-typography .tsd-index-panel h3, +.tsd-index-panel .tsd-typography h3, +.tsd-typography h4, +.tsd-typography h5, +.tsd-typography h6 { + font-size: 1em; +} +.tsd-typography h5, +.tsd-typography h6 { + font-weight: normal; +} +.tsd-typography p, +.tsd-typography ul, +.tsd-typography ol { + margin: 1em 0; +} +.tsd-typography table { + border-collapse: collapse; + border: none; +} +.tsd-typography td, +.tsd-typography th { + padding: 6px 13px; + border: 1px solid var(--color-accent); +} +.tsd-typography thead, +.tsd-typography tr:nth-child(even) { + background-color: var(--color-background-secondary); +} + +.tsd-breadcrumb { + margin: 0; + padding: 0; + color: var(--color-text-aside); +} +.tsd-breadcrumb a { + color: var(--color-text-aside); + text-decoration: none; +} +.tsd-breadcrumb a:hover { + text-decoration: underline; +} +.tsd-breadcrumb li { + display: inline; +} +.tsd-breadcrumb li:after { + content: " / "; +} + +.tsd-comment-tags { + display: flex; + flex-direction: column; +} +dl.tsd-comment-tag-group { + display: flex; + align-items: center; + overflow: hidden; + margin: 0.5em 0; +} +dl.tsd-comment-tag-group dt { + display: flex; + margin-right: 0.5em; + font-size: 0.875em; + font-weight: normal; +} +dl.tsd-comment-tag-group dd { + margin: 0; +} +code.tsd-tag { + padding: 0.25em 0.4em; + border: 0.1em solid var(--color-accent); + margin-right: 0.25em; + font-size: 70%; +} +h1 code.tsd-tag:first-of-type { + margin-left: 0.25em; +} + +dl.tsd-comment-tag-group dd:before, +dl.tsd-comment-tag-group dd:after { + content: " "; +} +dl.tsd-comment-tag-group dd pre, +dl.tsd-comment-tag-group dd:after { + clear: both; +} +dl.tsd-comment-tag-group p { + margin: 0; +} + +.tsd-panel.tsd-comment .lead { + font-size: 1.1em; + line-height: 1.333em; + margin-bottom: 2em; +} +.tsd-panel.tsd-comment .lead:last-child { + margin-bottom: 0; +} + +.tsd-filter-visibility h4 { + font-size: 1rem; + padding-top: 0.75rem; + padding-bottom: 0.5rem; + margin: 0; +} +.tsd-filter-item:not(:last-child) { + margin-bottom: 0.5rem; +} +.tsd-filter-input { + display: flex; + width: fit-content; + width: -moz-fit-content; + align-items: center; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + cursor: pointer; +} +.tsd-filter-input input[type="checkbox"] { + cursor: pointer; + position: absolute; + width: 1.5em; + height: 1.5em; + opacity: 0; +} +.tsd-filter-input input[type="checkbox"]:disabled { + pointer-events: none; +} +.tsd-filter-input svg { + cursor: pointer; + width: 1.5em; + height: 1.5em; + margin-right: 0.5em; + border-radius: 0.33em; + /* Leaving this at full opacity breaks event listeners on Firefox. + Don't remove unless you know what you're doing. */ + opacity: 0.99; +} +.tsd-filter-input input[type="checkbox"]:focus + svg { + transform: scale(0.95); +} +.tsd-filter-input input[type="checkbox"]:focus:not(:focus-visible) + svg { + transform: scale(1); +} +.tsd-checkbox-background { + fill: var(--color-accent); +} +input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { + stroke: var(--color-text); +} +.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-background { + fill: var(--color-background); + stroke: var(--color-accent); + stroke-width: 0.25rem; +} +.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-checkmark { + stroke: var(--color-accent); +} + +.tsd-theme-toggle { + padding-top: 0.75rem; +} +.tsd-theme-toggle > h4 { + display: inline; + vertical-align: middle; + margin-right: 0.75rem; +} + +.tsd-hierarchy { + list-style: square; + margin: 0; +} +.tsd-hierarchy .target { + font-weight: bold; +} + +.tsd-full-hierarchy:not(:last-child) { + margin-bottom: 1em; + padding-bottom: 1em; + border-bottom: 1px solid var(--color-accent); +} +.tsd-full-hierarchy, +.tsd-full-hierarchy ul { + list-style: none; + margin: 0; + padding: 0; +} +.tsd-full-hierarchy ul { + padding-left: 1.5rem; +} +.tsd-full-hierarchy a { + padding: 0.25rem 0 !important; + font-size: 1rem; + display: inline-flex; + align-items: center; + color: var(--color-text); +} + +.tsd-panel-group.tsd-index-group { + margin-bottom: 0; +} +.tsd-index-panel .tsd-index-list { + list-style: none; + line-height: 1.333em; + margin: 0; + padding: 0.25rem 0 0 0; + overflow: hidden; + display: grid; + grid-template-columns: repeat(3, 1fr); + column-gap: 1rem; + grid-template-rows: auto; +} +@media (max-width: 1024px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(2, 1fr); + } +} +@media (max-width: 768px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(1, 1fr); + } +} +.tsd-index-panel .tsd-index-list li { + -webkit-page-break-inside: avoid; + -moz-page-break-inside: avoid; + -ms-page-break-inside: avoid; + -o-page-break-inside: avoid; + page-break-inside: avoid; +} + +.tsd-flag { + display: inline-block; + padding: 0.25em 0.4em; + border-radius: 4px; + color: var(--color-comment-tag-text); + background-color: var(--color-comment-tag); + text-indent: 0; + font-size: 75%; + line-height: 1; + font-weight: normal; +} + +.tsd-anchor { + position: relative; + top: -100px; +} + +.tsd-member { + position: relative; +} +.tsd-member .tsd-anchor + h3 { + display: flex; + align-items: center; + margin-top: 0; + margin-bottom: 0; + border-bottom: none; +} + +.tsd-navigation.settings { + margin: 1rem 0; +} +.tsd-navigation > a, +.tsd-navigation .tsd-accordion-summary { + width: calc(100% - 0.25rem); + display: flex; + align-items: center; +} +.tsd-navigation a, +.tsd-navigation summary > span, +.tsd-page-navigation a { + display: flex; + width: calc(100% - 0.25rem); + align-items: center; + padding: 0.25rem; + color: var(--color-text); + text-decoration: none; + box-sizing: border-box; +} +.tsd-navigation a.current, +.tsd-page-navigation a.current { + background: var(--color-active-menu-item); +} +.tsd-navigation a:hover, +.tsd-page-navigation a:hover { + text-decoration: underline; +} +.tsd-navigation ul, +.tsd-page-navigation ul { + margin-top: 0; + margin-bottom: 0; + padding: 0; + list-style: none; +} +.tsd-navigation li, +.tsd-page-navigation li { + padding: 0; + max-width: 100%; +} +.tsd-nested-navigation { + margin-left: 3rem; +} +.tsd-nested-navigation > li > details { + margin-left: -1.5rem; +} +.tsd-small-nested-navigation { + margin-left: 1.5rem; +} +.tsd-small-nested-navigation > li > details { + margin-left: -1.5rem; +} + +.tsd-page-navigation ul { + padding-left: 1.75rem; +} + +#tsd-sidebar-links a { + margin-top: 0; + margin-bottom: 0.5rem; + line-height: 1.25rem; +} +#tsd-sidebar-links a:last-of-type { + margin-bottom: 0; +} + +a.tsd-index-link { + padding: 0.25rem 0 !important; + font-size: 1rem; + line-height: 1.25rem; + display: inline-flex; + align-items: center; + color: var(--color-text); +} +.tsd-accordion-summary { + list-style-type: none; /* hide marker on non-safari */ + outline: none; /* broken on safari, so just hide it */ +} +.tsd-accordion-summary::-webkit-details-marker { + display: none; /* hide marker on safari */ +} +.tsd-accordion-summary, +.tsd-accordion-summary a { + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + + cursor: pointer; +} +.tsd-accordion-summary a { + width: calc(100% - 1.5rem); +} +.tsd-accordion-summary > * { + margin-top: 0; + margin-bottom: 0; + padding-top: 0; + padding-bottom: 0; +} +.tsd-index-accordion .tsd-accordion-summary > svg { + margin-left: 0.25rem; +} +.tsd-index-content > :not(:first-child) { + margin-top: 0.75rem; +} +.tsd-index-heading { + margin-top: 1.5rem; + margin-bottom: 0.75rem; +} + +.tsd-kind-icon { + margin-right: 0.5rem; + width: 1.25rem; + height: 1.25rem; + min-width: 1.25rem; + min-height: 1.25rem; +} +.tsd-kind-icon path { + transform-origin: center; + transform: scale(1.1); +} +.tsd-signature > .tsd-kind-icon { + margin-right: 0.8rem; +} + +.tsd-panel { + margin-bottom: 2.5rem; +} +.tsd-panel.tsd-member { + margin-bottom: 4rem; +} +.tsd-panel:empty { + display: none; +} +.tsd-panel > h1, +.tsd-panel > h2, +.tsd-panel > h3 { + margin: 1.5rem -1.5rem 0.75rem -1.5rem; + padding: 0 1.5rem 0.75rem 1.5rem; +} +.tsd-panel > h1.tsd-before-signature, +.tsd-panel > h2.tsd-before-signature, +.tsd-panel > h3.tsd-before-signature { + margin-bottom: 0; + border-bottom: none; +} + +.tsd-panel-group { + margin: 4rem 0; +} +.tsd-panel-group.tsd-index-group { + margin: 2rem 0; +} +.tsd-panel-group.tsd-index-group details { + margin: 2rem 0; +} + +#tsd-search { + transition: background-color 0.2s; +} +#tsd-search .title { + position: relative; + z-index: 2; +} +#tsd-search .field { + position: absolute; + left: 0; + top: 0; + right: 2.5rem; + height: 100%; +} +#tsd-search .field input { + box-sizing: border-box; + position: relative; + top: -50px; + z-index: 1; + width: 100%; + padding: 0 10px; + opacity: 0; + outline: 0; + border: 0; + background: transparent; + color: var(--color-text); +} +#tsd-search .field label { + position: absolute; + overflow: hidden; + right: -40px; +} +#tsd-search .field input, +#tsd-search .title, +#tsd-toolbar-links a { + transition: opacity 0.2s; +} +#tsd-search .results { + position: absolute; + visibility: hidden; + top: 40px; + width: 100%; + margin: 0; + padding: 0; + list-style: none; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); +} +#tsd-search .results li { + background-color: var(--color-background); + line-height: initial; + padding: 4px; +} +#tsd-search .results li:nth-child(even) { + background-color: var(--color-background-secondary); +} +#tsd-search .results li.state { + display: none; +} +#tsd-search .results li.current:not(.no-results), +#tsd-search .results li:hover:not(.no-results) { + background-color: var(--color-accent); +} +#tsd-search .results a { + display: flex; + align-items: center; + padding: 0.25rem; + box-sizing: border-box; +} +#tsd-search .results a:before { + top: 10px; +} +#tsd-search .results span.parent { + color: var(--color-text-aside); + font-weight: normal; +} +#tsd-search.has-focus { + background-color: var(--color-accent); +} +#tsd-search.has-focus .field input { + top: 0; + opacity: 1; +} +#tsd-search.has-focus .title, +#tsd-search.has-focus #tsd-toolbar-links a { + z-index: 0; + opacity: 0; +} +#tsd-search.has-focus .results { + visibility: visible; +} +#tsd-search.loading .results li.state.loading { + display: block; +} +#tsd-search.failure .results li.state.failure { + display: block; +} + +#tsd-toolbar-links { + position: absolute; + top: 0; + right: 2rem; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-end; +} +#tsd-toolbar-links a { + margin-left: 1.5rem; +} +#tsd-toolbar-links a:hover { + text-decoration: underline; +} + +.tsd-signature { + margin: 0 0 1rem 0; + padding: 1rem 0.5rem; + border: 1px solid var(--color-accent); + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 14px; + overflow-x: auto; +} + +.tsd-signature-keyword { + color: var(--color-ts-keyword); + font-weight: normal; +} + +.tsd-signature-symbol { + color: var(--color-text-aside); + font-weight: normal; +} + +.tsd-signature-type { + font-style: italic; + font-weight: normal; +} + +.tsd-signatures { + padding: 0; + margin: 0 0 1em 0; + list-style-type: none; +} +.tsd-signatures .tsd-signature { + margin: 0; + border-color: var(--color-accent); + border-width: 1px 0; + transition: background-color 0.1s; +} +.tsd-description .tsd-signatures .tsd-signature { + border-width: 1px; +} + +ul.tsd-parameter-list, +ul.tsd-type-parameter-list { + list-style: square; + margin: 0; + padding-left: 20px; +} +ul.tsd-parameter-list > li.tsd-parameter-signature, +ul.tsd-type-parameter-list > li.tsd-parameter-signature { + list-style: none; + margin-left: -20px; +} +ul.tsd-parameter-list h5, +ul.tsd-type-parameter-list h5 { + font-size: 16px; + margin: 1em 0 0.5em 0; +} +.tsd-sources { + margin-top: 1rem; + font-size: 0.875em; +} +.tsd-sources a { + color: var(--color-text-aside); + text-decoration: underline; +} +.tsd-sources ul { + list-style: none; + padding: 0; +} + +.tsd-page-toolbar { + position: sticky; + z-index: 1; + top: 0; + left: 0; + width: 100%; + color: var(--color-text); + background: var(--color-background-secondary); + border-bottom: 1px var(--color-accent) solid; + transition: transform 0.3s ease-in-out; +} +.tsd-page-toolbar a { + color: var(--color-text); + text-decoration: none; +} +.tsd-page-toolbar a.title { + font-weight: bold; +} +.tsd-page-toolbar a.title:hover { + text-decoration: underline; +} +.tsd-page-toolbar .tsd-toolbar-contents { + display: flex; + justify-content: space-between; + height: 2.5rem; + margin: 0 auto; +} +.tsd-page-toolbar .table-cell { + position: relative; + white-space: nowrap; + line-height: 40px; +} +.tsd-page-toolbar .table-cell:first-child { + width: 100%; +} +.tsd-page-toolbar .tsd-toolbar-icon { + box-sizing: border-box; + line-height: 0; + padding: 12px 0; +} + +.tsd-widget { + display: inline-block; + overflow: hidden; + opacity: 0.8; + height: 40px; + transition: + opacity 0.1s, + background-color 0.2s; + vertical-align: bottom; + cursor: pointer; +} +.tsd-widget:hover { + opacity: 0.9; +} +.tsd-widget.active { + opacity: 1; + background-color: var(--color-accent); +} +.tsd-widget.no-caption { + width: 40px; +} +.tsd-widget.no-caption:before { + margin: 0; +} + +.tsd-widget.options, +.tsd-widget.menu { + display: none; +} +input[type="checkbox"] + .tsd-widget:before { + background-position: -120px 0; +} +input[type="checkbox"]:checked + .tsd-widget:before { + background-position: -160px 0; +} + +img { + max-width: 100%; +} + +.tsd-anchor-icon { + display: inline-flex; + align-items: center; + margin-left: 0.5rem; + vertical-align: middle; + color: var(--color-text); +} + +.tsd-anchor-icon svg { + width: 1em; + height: 1em; + visibility: hidden; +} + +.tsd-anchor-link:hover > .tsd-anchor-icon svg { + visibility: visible; +} + +.deprecated { + text-decoration: line-through !important; +} + +.warning { + padding: 1rem; + color: var(--color-warning-text); + background: var(--color-background-warning); +} + +.tsd-kind-project { + color: var(--color-ts-project); +} +.tsd-kind-module { + color: var(--color-ts-module); +} +.tsd-kind-namespace { + color: var(--color-ts-namespace); +} +.tsd-kind-enum { + color: var(--color-ts-enum); +} +.tsd-kind-enum-member { + color: var(--color-ts-enum-member); +} +.tsd-kind-variable { + color: var(--color-ts-variable); +} +.tsd-kind-function { + color: var(--color-ts-function); +} +.tsd-kind-class { + color: var(--color-ts-class); +} +.tsd-kind-interface { + color: var(--color-ts-interface); +} +.tsd-kind-constructor { + color: var(--color-ts-constructor); +} +.tsd-kind-property { + color: var(--color-ts-property); +} +.tsd-kind-method { + color: var(--color-ts-method); +} +.tsd-kind-call-signature { + color: var(--color-ts-call-signature); +} +.tsd-kind-index-signature { + color: var(--color-ts-index-signature); +} +.tsd-kind-constructor-signature { + color: var(--color-ts-constructor-signature); +} +.tsd-kind-parameter { + color: var(--color-ts-parameter); +} +.tsd-kind-type-literal { + color: var(--color-ts-type-literal); +} +.tsd-kind-type-parameter { + color: var(--color-ts-type-parameter); +} +.tsd-kind-accessor { + color: var(--color-ts-accessor); +} +.tsd-kind-get-signature { + color: var(--color-ts-get-signature); +} +.tsd-kind-set-signature { + color: var(--color-ts-set-signature); +} +.tsd-kind-type-alias { + color: var(--color-ts-type-alias); +} + +/* if we have a kind icon, don't color the text by kind */ +.tsd-kind-icon ~ span { + color: var(--color-text); +} + +* { + scrollbar-width: thin; + scrollbar-color: var(--color-accent) var(--color-icon-background); +} + +*::-webkit-scrollbar { + width: 0.75rem; +} + +*::-webkit-scrollbar-track { + background: var(--color-icon-background); +} + +*::-webkit-scrollbar-thumb { + background-color: var(--color-accent); + border-radius: 999rem; + border: 0.25rem solid var(--color-icon-background); +} + +/* mobile */ +@media (max-width: 769px) { + .tsd-widget.options, + .tsd-widget.menu { + display: inline-block; + } + + .container-main { + display: flex; + } + html .col-content { + float: none; + max-width: 100%; + width: 100%; + } + html .col-sidebar { + position: fixed !important; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 1024; + top: 0 !important; + bottom: 0 !important; + left: auto !important; + right: 0 !important; + padding: 1.5rem 1.5rem 0 0; + width: 75vw; + visibility: hidden; + background-color: var(--color-background); + transform: translate(100%, 0); + } + html .col-sidebar > *:last-child { + padding-bottom: 20px; + } + html .overlay { + content: ""; + display: block; + position: fixed; + z-index: 1023; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.75); + visibility: hidden; + } + + .to-has-menu .overlay { + animation: fade-in 0.4s; + } + + .to-has-menu .col-sidebar { + animation: pop-in-from-right 0.4s; + } + + .from-has-menu .overlay { + animation: fade-out 0.4s; + } + + .from-has-menu .col-sidebar { + animation: pop-out-to-right 0.4s; + } + + .has-menu body { + overflow: hidden; + } + .has-menu .overlay { + visibility: visible; + } + .has-menu .col-sidebar { + visibility: visible; + transform: translate(0, 0); + display: flex; + flex-direction: column; + gap: 1.5rem; + max-height: 100vh; + padding: 1rem 2rem; + } + .has-menu .tsd-navigation { + max-height: 100%; + } +} + +/* one sidebar */ +@media (min-width: 770px) { + .container-main { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); + grid-template-areas: "sidebar content"; + margin: 2rem auto; + } + + .col-sidebar { + grid-area: sidebar; + } + .col-content { + grid-area: content; + padding: 0 1rem; + } +} +@media (min-width: 770px) and (max-width: 1399px) { + .col-sidebar { + max-height: calc(100vh - 2rem - 42px); + overflow: auto; + position: sticky; + top: 42px; + padding-top: 1rem; + } + .site-menu { + margin-top: 1rem; + } +} + +/* two sidebars */ +@media (min-width: 1200px) { + .container-main { + grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax(0, 20rem); + grid-template-areas: "sidebar content toc"; + } + + .col-sidebar { + display: contents; + } + + .page-menu { + grid-area: toc; + padding-left: 1rem; + } + .site-menu { + grid-area: sidebar; + } + + .site-menu { + margin-top: 1rem 0; + } + + .page-menu, + .site-menu { + max-height: calc(100vh - 2rem - 42px); + overflow: auto; + position: sticky; + top: 42px; + } +} diff --git a/classes/_zk_kit_imt.IMT.html b/classes/_zk_kit_imt.IMT.html new file mode 100644 index 000000000..27f69e8dd --- /dev/null +++ b/classes/_zk_kit_imt.IMT.html @@ -0,0 +1,94 @@ +IMT | zk-kit

An IMT (aka Incremental Merkle Tree) is a type of data structure used in cryptography and +computer science for efficiently verifying the integrity of a large set of data, +especially in situations where new data is added over time. It is based on the concept +of a Merkle tree, and its key feature is its ability to efficiently update the tree +when new data is added or existing data is modified. +In this implementation, the tree is constructed using a fixed IMT#depth +value, and a list of IMT#zeroes (one for each level) is used to compute the +hash of a node when not all of its children are defined. The number of children for each +node can also be specified with the IMT#arity parameter.

+

Constructors

  • It initializes the tree with an hash function, the depth, the zero value to use for zeroes +and the arity (i.e. the number of children for each node). It also takes an optional parameter +to initialize the tree with a list of leaves.

    +

    Parameters

    • hash: IMTHashFunction

      The hash function used to create nodes.

      +
    • depth: number

      The tree depth.

      +
    • zeroValue: any

      The zero value used to create zeroes.

      +
    • arity: number = 2

      The number of children for each node.

      +
    • leaves: any[] = []

      The list of initial leaves.

      +

    Returns IMT

Properties

_arity: number

The number of children per node.

+
_depth: number

The depth of the tree, which is the number of edges from the node to the +tree's root node.

+

The hash function used to compute the tree nodes.

+
_nodes: any[][]

The matrix where all the tree nodes are stored. The first index indicates +the level of the tree, while the second index represents the node's +position within that specific level.

+
_zeroes: any[]

A list of zero values calculated during the initialization of the tree. +The list contains one value for each level of the tree, and the value for +a given level is equal to the hash of the previous level's value. +The first value is the zero hash provided by the user. +These values are used to calculate the hash of a node in case some of its +children are missing.

+

Accessors

  • get arity(): number
  • The number of children per node.

    +

    Returns number

    The number of children per node.

    +
  • get depth(): number
  • The depth of the tree, which equals the number of levels - 1.

    +

    Returns number

    The depth of the tree.

    +
  • get leaves(): any[]
  • The leaves of the tree. They can be retrieved from the first +level of the tree using IMT#_nodes. The returned +value is a copy of the array and not the original object.

    +

    Returns any[]

    The list of tree leaves.

    +
  • get root(): any
  • The root of the tree. This value doesn't need to be stored as +it is always the first and unique element of the last level of the tree. +Its value can be retrieved in IMT#_nodes.

    +

    Returns any

    The root hash of the tree.

    +
  • get zeroes(): any[]
  • The list of zero values calculated during the initialization of the tree.

    +

    Returns any[]

    The list of pre-computed zeroes.

    +

Methods

  • It creates a IMTMerkleProof for a leaf of the tree. +That proof can be verified by this tree using the same hash function.

    +

    Parameters

    • index: number

      The index of the leaf for which a Merkle proof will be generated.

      +

    Returns IMTMerkleProof

    The Merkle proof of the leaf.

    +
  • It deletes a leaf from the tree. It does not remove the leaf from +the data structure, but rather it sets the leaf to be deleted to the zero value.

    +

    Parameters

    • index: number

      The index of the leaf to be deleted.

      +

    Returns void

  • It returns the index of a leaf. If the leaf does not exist it returns -1.

    +

    Parameters

    • leaf: any

      A leaf of the tree.

      +

    Returns number

    The index of the leaf.

    +
  • The leaves are inserted incrementally. If 'i' is the index of the last +leaf, the new one will be inserted at position 'i + 1'. Every time a +new leaf is inserted, the nodes that separate the new leaf from the root +of the tree are created or updated if they already exist, from bottom to top. +When a node has only one child (the left one), its value is the hash of that +node and the zero value of that level. Otherwise, the hash of the children +is calculated.

    +

    Parameters

    • leaf: any

      The new leaf to be inserted in the tree.

      +

    Returns void

  • It updates a leaf in the tree. It's very similar to the IMT#insert function.

    +

    Parameters

    • index: number

      The index of the leaf to be updated.

      +
    • newLeaf: any

      The new leaf to be inserted.

      +

    Returns void

  • It verifies a IMTMerkleProof to confirm that a leaf indeed +belongs to a tree. Does not verify that the node belongs to this +tree in particular. Equivalent to IMT.verifyProof(proof, this._hash).

    +

    Parameters

    Returns boolean

    True if the leaf is part of the tree, and false otherwise.

    +
  • It verifies a IMTMerkleProof to confirm that a leaf indeed +belongs to a tree.

    +

    Parameters

    Returns boolean

    True if the leaf is part of the tree, and false otherwise.

    +
\ No newline at end of file diff --git a/classes/_zk_kit_lean_imt.LeanIMT.html b/classes/_zk_kit_lean_imt.LeanIMT.html new file mode 100644 index 000000000..3e92d5d6e --- /dev/null +++ b/classes/_zk_kit_lean_imt.LeanIMT.html @@ -0,0 +1,105 @@ +LeanIMT | zk-kit

The LeanIMT is an optimized binary version of the IMT. +This implementation exclusively supports binary trees, eliminates the use of +zeroes, and the tree's LeanIMT#depth is dynamic. When a node doesn't have the right child, +instead of using a zero hash as in the IMT, the node's value becomes that +of its left child. Furthermore, rather than utilizing a static tree depth, +it is updated based on the number of LeanIMT#leaves in the tree. This approach +results in the calculation of significantly fewer hashes, making the tree more efficient.

+

Type Parameters

  • N = bigint

Constructors

  • It initializes the tree with a given hash function and an optional list of leaves.

    +

    Type Parameters

    • N = bigint

    Parameters

    • hash: LeanIMTHashFunction<N>

      The hash function used to create nodes.

      +
    • leaves: N[] = []

      The list of leaves.

      +

    Returns LeanIMT<N>

Properties

The hash function used to compute the tree nodes.

+
_nodes: N[][]

The matrix where all the tree nodes are stored. The first index indicates +the level of the tree, while the second index represents the node's +position within that specific level. The last level will always contain +a list with a single element, which is the root. +Most of the attributes of this class are getters which can retrieve +their values from this matrix.

+

Accessors

  • get depth(): number
  • The depth of the tree, which equals the number of levels - 1.

    +

    Returns number

    The depth of the tree.

    +
  • get leaves(): N[]
  • The leaves of the tree. They can be retrieved from the first +level of the tree using LeanIMT#_nodes. The returned +value is a copy of the array and not the original object.

    +

    Returns N[]

    The list of tree leaves.

    +
  • get root(): N
  • The root of the tree. This value doesn't need to be stored as +it is always the first and unique element of the last level of the tree. +Its value can be retrieved in LeanIMT#_nodes.

    +

    Returns N

    The root hash of the tree.

    +
  • get size(): number
  • The size of the tree, which the number of its leaves. +It's the length of the first level's list.

    +

    Returns number

    The number of leaves of the tree.

    +

Methods

  • It enables the conversion of the full tree structure into a JSON string, +facilitating future imports of the tree. This approach is beneficial for +large trees, as it saves time by storing hashes instead of recomputing them

    +

    Returns string

    The stringified JSON of the tree.

    +
  • It returns true if the leaf exists, and false otherwise

    +

    Parameters

    • leaf: N

      A leaf of the tree.

      +

    Returns boolean

    True if the tree has the leaf, and false otherwise.

    +
  • It returns the index of a leaf. If the leaf does not exist it returns -1.

    +

    Parameters

    • leaf: N

      A leaf of the tree.

      +

    Returns number

    The index of the leaf.

    +
  • The leaves are inserted incrementally. If 'i' is the index of the last +leaf, the new one will be inserted at position 'i + 1'. Every time a +new leaf is inserted, the nodes that separate the new leaf from the root +of the tree are created or updated if they already exist, from bottom to top. +When a node has only one child (the left one), its value takes on the value +of the child. Otherwise, the hash of the children is calculated.

    +

    Parameters

    • leaf: N

      The new leaf to be inserted in the tree.

      +

    Returns void

  • This function is useful when you want to insert N leaves all at once. +It is more efficient than using the LeanIMT#insert method N times because it +significantly reduces the number of cases where a node has only one +child, which is a common occurrence in gradual insertion.

    +

    Parameters

    • leaves: N[]

      The list of leaves to be inserted.

      +

    Returns void

  • It updates a leaf in the tree. It's very similar to the LeanIMT#insert function.

    +

    Parameters

    • index: number

      The index of the leaf to be updated.

      +
    • newLeaf: N

      The new leaf to be inserted.

      +

    Returns void

  • Updates m leaves all at once. +It is more efficient than using the LeanIMT#update method m times because it +prevents updating middle nodes several times. This would happen when updating leaves +with common ancestors. The naive approach of calling 'update' m times has complexity +O(mlog(n)) (where n is the number of leaves of the tree), which ends up in +O(nlog(n)) when m ~ n. With this new approach, this ends up being O(n) because every +node is updated at most once and there are around 2*n nodes in the tree.

    +

    Parameters

    • indices: number[]

      The list of indices of the respective leaves.

      +
    • leaves: N[]

      The list of leaves to be updated.

      +

    Returns void

  • It verifies a LeanIMTMerkleProof to confirm that a leaf indeed +belongs to a tree. Does not verify that the node belongs to this +tree in particular. Equivalent to +LeanIMT.verifyProof(proof, this._hash).

    +

    Parameters

    Returns boolean

    True if the leaf is part of the tree, and false otherwise.

    +
  • It imports an entire tree by initializing the nodes without calculating +any hashes. Note that it is crucial to ensure the integrity of the tree +before or after importing it. If the map function is not defined, node +values will be converted to bigints by default.

    +

    Type Parameters

    • N = bigint

    Parameters

    • hash: LeanIMTHashFunction<N>

      The hash function used to create nodes.

      +
    • nodes: string

      The stringified JSON of the tree.

      +
    • Optional map: ((value) => N)

      A function to map each node of the tree and convert their types.

      +
        • (value): N
        • Parameters

          • value: string

          Returns N

    Returns LeanIMT<N>

    A LeanIMT instance.

    +
\ No newline at end of file diff --git a/classes/_zk_kit_smt.SMT.html b/classes/_zk_kit_smt.SMT.html new file mode 100644 index 000000000..6a62cc9af --- /dev/null +++ b/classes/_zk_kit_smt.SMT.html @@ -0,0 +1,95 @@ +SMT | zk-kit

SparseMerkleTree class provides all the functions to create a sparse Merkle tree +and to take advantage of its features: SMT.add, SMT.get, +SMT.update, SMT.delete, SMT.createProof, +SMT.verifyProof. +To better understand the code below it may be useful to describe the terminology used:

+
    +
  • nodes: every node in the tree is the hash of the two child nodes (H(x, y));
  • +
  • root node: the root node is the top hash and since it represents the whole data +structure it can be used to certify its integrity;
  • +
  • leaf nodes: every leaf node is the hash of a key/value pair and an additional +value to mark the node as leaf node (H(x, y, 1));
  • +
  • entry: a tree entry is a key/value pair used to create the leaf nodes;
  • +
  • zero nodes: a zero node is an hash of zeros and in this implementation H(0,0) = 0;
  • +
  • siblings: the children of a parent node are siblings;
  • +
  • path: every entry key is a number < 2^256 that can be converted in a binary number, +and this binary number is the path used to place the entry in the tree (1 or 0 define the +child node to choose);
  • +
  • matching node: when an entry is not found and the path leads to another existing entry, +this entry is a matching entry and it has some of the first bits in common with the entry not found;
  • +
  • depth: the depth of a node is the length of the path to its root.
  • +
+

Constructors

  • Initializes the SparseMerkleTree attributes.

    +

    Parameters

    • hash: HashFunction

      Hash function used to hash the child nodes.

      +
    • bigNumbers: boolean = false

      BigInt type enabling.

      +

    Returns SMT

Properties

bigNumbers: boolean
entryMark: Node
nodes: Map<Node, ChildNodes>
root: Node
zeroNode: Node

Methods

  • Adds a new entry in the tree. It retrieves a matching entry +or a zero node with a top-down approach and then it updates all the +hashes of the nodes in the path of the new entry with a bottom-up approach.

    +

    Parameters

    • key: Node

      The key of the new entry.

      +
    • value: Node

      The value of the new entry.

      +

    Returns void

  • Adds new nodes in the tree with a bottom-up approach until it reaches the root node.

    +

    Parameters

    • node: Node

      The node to start from.

      +
    • path: number[]

      The path of the key.

      +
    • siblings: Siblings

      The siblings of the path.

      +
    • i: number = ...

      The index to start from.

      +

    Returns Node

    The root node.

    +
  • Calculates nodes with a bottom-up approach until it reaches the root node.

    +

    Parameters

    • node: Node

      The node to start from.

      +
    • path: number[]

      The path of the key.

      +
    • siblings: Siblings

      The siblings of the path.

      +

    Returns Node

    The root node.

    +
  • Checks the parameter type.

    +

    Parameters

    • parameter: Node

      The parameter to check.

      +

    Returns void

  • Creates a proof to prove the membership or the non-membership +of a tree entry.

    +

    Parameters

    • key: Node

      A key of an existing or a non-existing entry.

      +

    Returns MerkleProof

    The membership or the non-membership proof.

    +
  • Deletes an entry in the tree. Also in this case all the hashes of +the nodes in the path of the entry are updated with a bottom-up approach.

    +

    Parameters

    • key: Node

      The key of the entry.

      +

    Returns void

  • Deletes nodes in the tree with a bottom-up approach until it reaches the root node.

    +

    Parameters

    • node: Node

      The node to start from.

      +
    • path: number[]

      The path of the key.

      +
    • siblings: Siblings

      The siblings of the path.

      +

    Returns void

  • Gets a key and if the key exists in the tree the function returns the +value, otherwise it returns 'undefined'.

    +

    Parameters

    • key: Node

      A key of a tree entry.

      +

    Returns undefined | Node

    A value of a tree entry or 'undefined'.

    +
  • Checks if a node is a leaf node.

    +

    Parameters

    • node: Node

      A node of the tree.

      +

    Returns boolean

    True if the node is a leaf, false otherwise.

    +
  • Searches for an entry in the tree. If the key passed as parameter exists in +the tree, the function returns the entry, otherwise it returns the entry +with only the key, and when there is another existing entry +in the same path it returns also this entry as 'matching entry'. +In any case the function returns the siblings of the path.

    +

    Parameters

    • key: Node

      The key of the entry to search for.

      +

    Returns EntryResponse

    The entry response.

    +
  • Updates a value of an entry in the tree. Also in this case +all the hashes of the nodes in the path of the entry are updated +with a bottom-up approach.

    +

    Parameters

    • key: Node

      The key of the entry.

      +
    • value: Node

      The value of the entry.

      +

    Returns void

  • Verifies a membership or a non-membership proof.

    +

    Parameters

    Returns boolean

    True if the proof is valid, false otherwise.

    +
\ No newline at end of file diff --git a/classes/_zk_kit_utils.F1Field.html b/classes/_zk_kit_utils.F1Field.html new file mode 100644 index 000000000..46d4d7256 --- /dev/null +++ b/classes/_zk_kit_utils.F1Field.html @@ -0,0 +1,101 @@ +F1Field | zk-kit

F1Field +Represents a finite field of order 'order' providing arithmetic operations under modulus. +This class includes operations such as addition, subtraction, multiplication, division, +and inversion, all performed modulo the field's order. It's designed to work with bigints, +supporting large numbers for cryptographic purposes and other applications requiring +modular arithmetic. +Note that the outputs of the functions will always be within the field if and only if +the input values are within the field. Devs need to make sure of that.

+

Constructors

Properties

Methods

Constructors

Properties

_half: bigint

Half the order of the field, used for certain comparisons.

+
_negone: bigint

The scalar value -1 in the field, represented positively.

+
_order: bigint

The order of the finite field (i.e., the modulus).

+
one: bigint = ...

Represents the scalar value 1 in the field.

+
zero: bigint = ...

Represents the scalar value 0 in the field.

+

Methods

  • Adds two bigint values together under modulus. +It ensures the result is within the field if and only if the input values are within the field.

    +

    Parameters

    • a: bigint

      The first value.

      +
    • b: bigint

      The second value.

      +

    Returns bigint

    The sum of 'a' and 'b' modulo the field's order.

    +
  • Divides one bigint by another within the field by multiplying the first value +by the multiplicative inverse of the second.

    +

    Parameters

    • a: bigint

      The dividend.

      +
    • b: bigint

      The divisor.

      +

    Returns bigint

    The result of the division of 'a' by 'b' modulo the field's order.

    +
  • Ensures a given result falls within the field by applying modular reduction. +This method also handles negative inputs, correctly mapping them into the field.

    +

    Parameters

    • res: bigint

      The result to be normalized to the field.

      +

    Returns bigint

    The equivalent value within the field.

    +
  • Checks if two bigint values are equal within the context of the field. +It ensures the result is within the field if and only if the input values are within the field.

    +

    Parameters

    • a: bigint

      The first value to compare.

      +
    • b: bigint

      The second value to compare.

      +

    Returns boolean

    True if 'a' equals 'b', false otherwise.

    +
  • Compares two bigint values to determine if the first is greater than or equal to the second, +considering the field's modular context. +It ensures the result is within the field if and only if the input values are within the field.

    +

    Parameters

    • a: bigint

      The first value to compare.

      +
    • b: bigint

      The second value to compare.

      +

    Returns boolean

    True if 'a' is greater than or equal to 'b', false otherwise.

    +
  • Computes the multiplicative inverse of a given value within the field. +This method uses the Extended Euclidean Algorithm to find the inverse, +ensuring the result is always a positive value less than the field's order. +If the input value is zero, which has no inverse, an error is thrown.

    +

    Parameters

    • a: bigint

      The value for which to compute the inverse.

      +

    Returns bigint

    The multiplicative inverse of 'a' modulo the field's order.

    +

    Throws

    if 'a' is zero.

    +
  • Checks if a bigint value is zero within the context of the field.

    +

    Parameters

    • a: bigint

      The value to check.

      +

    Returns boolean

    True if 'a' is zero, false otherwise.

    +
  • Compares two bigint values to determine if the first is less than the second, +taking into account the field's order for modular comparison. +It ensures the result is within the field if and only if the input values are within the field.

    +

    Parameters

    • a: bigint

      The first value to compare.

      +
    • b: bigint

      The second value to compare.

      +

    Returns boolean

    True if 'a' is less than 'b', false otherwise.

    +
  • Performs modular multiplication of two bigint values within the field.

    +

    Parameters

    • a: bigint

      The first value.

      +
    • b: bigint

      The second value.

      +

    Returns bigint

    The product of 'a' and 'b' modulo the field's order.

    +
  • Computes the negation of a bigint value within the field. +The result is the modular additive inverse that, when added to the original value, +yields zero in the field's modulus. +It ensures the result is within the field if and only if the input values are within the field.

    +

    Parameters

    • a: bigint

      The value to negate.

      +

    Returns bigint

    The negation of 'a' modulo the field's order.

    +
  • Raises a base to an exponent within the field, efficiently computing +scalar exponentiation using the square-and-multiply algorithm. +Supports both positive and negative exponents through the use of the inv method for negatives.

    +

    Parameters

    • base: bigint

      The base to be exponentiated.

      +
    • e: bigint

      The exponent.

      +

    Returns bigint

    The result of raising 'base' to the power 'e' modulo the field's order.

    +
  • Squares a bigint value within the field. +This is a specific case of multiplication where the value is multiplied by itself, +optimized for performance where applicable. +It ensures the result is within the field if and only if the input values are within the field.

    +

    Parameters

    • a: bigint

      The value to square.

      +

    Returns bigint

    The square of 'a' modulo the field's order.

    +
  • Subtracts one bigint from another under modulus. +It ensures the result is within the field if and only if the input values are within the field.

    +

    Parameters

    • a: bigint

      The value from which to subtract.

      +
    • b: bigint

      The value to be subtracted.

      +

    Returns bigint

    The difference of 'a' and 'b' modulo the field's order.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_baby_jubjub.addPoint.html b/functions/_zk_kit_baby_jubjub.addPoint.html new file mode 100644 index 000000000..4a23e7aac --- /dev/null +++ b/functions/_zk_kit_baby_jubjub.addPoint.html @@ -0,0 +1,10 @@ +addPoint | zk-kit
  • Performs point addition on the Baby Jubjub elliptic curve, +calculating a third point from two given points. +Let P1 = (x1, y1) and P2 = (x2, y2) be two arbitrary points of the curve. +Then P1 + P2 = (x3, y3) is calculated in the following way: +x3 = (x1y2 + y1x2)/(1 + dx1x2y1y2) +y3 = (y1y2 - ax1x2)/(1 - dx1x2y1*y2)

    +

    Parameters

    • p1: Point<bigint>

      First point on the curve.

      +
    • p2: Point<bigint>

      Second point on the curve.

      +

    Returns Point<bigint>

    Resultant third point on the curve.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_baby_jubjub.inCurve.html b/functions/_zk_kit_baby_jubjub.inCurve.html new file mode 100644 index 000000000..2ab8c8863 --- /dev/null +++ b/functions/_zk_kit_baby_jubjub.inCurve.html @@ -0,0 +1,5 @@ +inCurve | zk-kit
  • Determines if a given point lies on the Baby Jubjub elliptic curve by verifying the curve equation. +This function checks if the point satisfies the curve equation ax^2 + y^2 = 1 + dx^2y^2.

    +

    Parameters

    • p: Point

      The point to check, represented as a pair of bigint values.

      +

    Returns boolean

    True if the point is on the curve, otherwise false.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_baby_jubjub.mulPointEscalar.html b/functions/_zk_kit_baby_jubjub.mulPointEscalar.html new file mode 100644 index 000000000..e890fbec4 --- /dev/null +++ b/functions/_zk_kit_baby_jubjub.mulPointEscalar.html @@ -0,0 +1,6 @@ +mulPointEscalar | zk-kit
  • Performs a scalar multiplication by starting from the 'base' point and 'adding' +it to itself 'e' times.

    +

    Parameters

    • base: Point<bigint>

      The base point used as a starting point.

      +
    • e: bigint

      A secret number representing the private key.

      +

    Returns Point<bigint>

    The resulting point representing the public key.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_baby_jubjub.packPoint.html b/functions/_zk_kit_baby_jubjub.packPoint.html new file mode 100644 index 000000000..a3ff1f495 --- /dev/null +++ b/functions/_zk_kit_baby_jubjub.packPoint.html @@ -0,0 +1,6 @@ +packPoint | zk-kit
  • Packs a point on the Baby Jubjub elliptic curve into a bigint. +This process involves converting the y-coordinate to a buffer and conditionally modifying the last byte +to encode the sign of the x-coordinate, following a specific compact representation format.

    +

    Parameters

    • unpackedPoint: Point<bigint>

      The point to be packed, consisting of x and y coordinates.

      +

    Returns bigint

    The packed representation of the point as a bigint.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_baby_jubjub.unpackPoint.html b/functions/_zk_kit_baby_jubjub.unpackPoint.html new file mode 100644 index 000000000..dd59c8d1a --- /dev/null +++ b/functions/_zk_kit_baby_jubjub.unpackPoint.html @@ -0,0 +1,6 @@ +unpackPoint | zk-kit
  • Unpacks a bigint back into a point on the Baby Jubjub elliptic curve, reversing the packing process. +This involves interpreting the bigint as the y-coordinate and extracting the sign of the x-coordinate +from the encoded format. The function then calculates the x-coordinate using the curve equation.

    +

    Parameters

    • packedPoint: bigint

      The packed point as a bigint.

      +

    Returns Point<bigint> | null

    The unpacked point as a pair of bigint values, or null if the point is invalid.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.derivePublicKey.html b/functions/_zk_kit_eddsa_poseidon.derivePublicKey.html new file mode 100644 index 000000000..47c8e3e90 --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.derivePublicKey.html @@ -0,0 +1,13 @@ +derivePublicKey | zk-kit
  • Derives a public key from a given private key using the +Jubjub elliptic curve. +This function utilizes the Baby Jubjub elliptic curve for cryptographic operations. +The private key should be securely stored and managed, and it should never be exposed +or transmitted in an unsecured manner.

    +

    The private key must be an instance of Buffer, Uint8Array or a string. The input will be used to +generate entropy and there is no limit in size. +The string is used as a set of raw bytes (in UTF-8) and is typically used to pass passwords or secret messages. +If you want to pass a bigint, a number or a hexadecimal, be sure to convert them to one of the supported types first. +The 'conversions' module in @zk-kit/utils provides a set of functions that may be useful in case you need to convert types.

    +

    Parameters

    • privateKey: string | Buffer | Uint8Array

      The private key used for generating the public key.

      +

    Returns Point<bigint>

    The derived public key.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.deriveSecretScalar.html b/functions/_zk_kit_eddsa_poseidon.deriveSecretScalar.html new file mode 100644 index 000000000..be21f49af --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.deriveSecretScalar.html @@ -0,0 +1,13 @@ +deriveSecretScalar | zk-kit
  • Derives a public key from a given private key using the +Jubjub elliptic curve. +This function utilizes the Baby Jubjub elliptic curve for cryptographic operations. +The private key should be securely stored and managed, and it should never be exposed +or transmitted in an unsecured manner.

    +

    The private key must be an instance of Buffer, Uint8Array or a string. The input will be used to +generate entropy and there is no limit in size. +The string is used as a set of raw bytes (in UTF-8) and is typically used to pass passwords or secret messages. +If you want to pass a bigint, a number or a hexadecimal, be sure to convert them to one of the supported types first. +The 'conversions' module in @zk-kit/utils provides a set of functions that may be useful in case you need to convert types.

    +

    Parameters

    • privateKey: string | Buffer | Uint8Array

      The private key used for generating the public key.

      +

    Returns bigint

    The derived public key.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.packPublicKey.html b/functions/_zk_kit_eddsa_poseidon.packPublicKey.html new file mode 100644 index 000000000..f135f093c --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.packPublicKey.html @@ -0,0 +1,5 @@ +packPublicKey | zk-kit
  • Converts a given public key into a packed (compressed) string format for efficient transmission and storage. +This method ensures the public key is valid and within the Baby Jubjub curve before packing.

    +

    Parameters

    • publicKey: Point

      The public key to be packed.

      +

    Returns bigint

    A string representation of the packed public key.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.packSignature.html b/functions/_zk_kit_eddsa_poseidon.packSignature.html new file mode 100644 index 000000000..7595adb01 --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.packSignature.html @@ -0,0 +1,9 @@ +packSignature | zk-kit
  • Packs an EdDSA signature into a buffer of 64 bytes for efficient storage. +Use unpackSignature to reverse the process without needing to know +the details of the format.

    +

    The buffer contains the R8 point packed int 32 bytes (via +packSignature) followed by the S scalar. All encodings are +little-endian.

    +

    Parameters

    Returns Buffer

    a 64 byte buffer containing the packed signature

    +
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.signMessage.html b/functions/_zk_kit_eddsa_poseidon.signMessage.html new file mode 100644 index 000000000..dede656c3 --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.signMessage.html @@ -0,0 +1,11 @@ +signMessage | zk-kit
  • Signs a message using the provided private key, employing Poseidon hashing and +EdDSA with the Baby Jubjub elliptic curve.

    +

    The private key must be an instance of Buffer, Uint8Array or a string. The input will be used to +generate entropy and there is no limit in size. +The string is used as a set of raw bytes (in UTF-8) and is typically used to pass passwords or secret messages. +If you want to pass a bigint, a number or a hexadecimal, be sure to convert them to one of the supported types first. +The 'conversions' module in @zk-kit/utils provides a set of functions that may be useful in case you need to convert types.

    +

    Parameters

    • privateKey: string | Buffer | Uint8Array

      The private key used to sign the message.

      +
    • message: BigNumberish

      The message to be signed.

      +

    Returns Signature<bigint>

    The signature object, containing properties relevant to EdDSA signatures, such as 'R8' and 'S' values.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.unpackPublicKey.html b/functions/_zk_kit_eddsa_poseidon.unpackPublicKey.html new file mode 100644 index 000000000..778532537 --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.unpackPublicKey.html @@ -0,0 +1,5 @@ +unpackPublicKey | zk-kit
  • Unpacks a public key from its packed string representation back to its original point form on the Baby Jubjub curve. +This function checks for the validity of the input format before attempting to unpack.

    +

    Parameters

    • publicKey: BigNumberish

      The packed public key as a bignumberish.

      +

    Returns Point<bigint>

    The unpacked public key as a point.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.unpackSignature.html b/functions/_zk_kit_eddsa_poseidon.unpackSignature.html new file mode 100644 index 000000000..db91dfc09 --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.unpackSignature.html @@ -0,0 +1,5 @@ +unpackSignature | zk-kit
\ No newline at end of file diff --git a/functions/_zk_kit_eddsa_poseidon.verifySignature.html b/functions/_zk_kit_eddsa_poseidon.verifySignature.html new file mode 100644 index 000000000..aec4bf0c9 --- /dev/null +++ b/functions/_zk_kit_eddsa_poseidon.verifySignature.html @@ -0,0 +1,6 @@ +verifySignature | zk-kit
  • Verifies an EdDSA signature using the Baby Jubjub elliptic curve and Poseidon hash function.

    +

    Parameters

    • message: BigNumberish

      The original message that was be signed.

      +
    • signature: Signature

      The EdDSA signature to be verified.

      +
    • publicKey: Point

      The public key associated with the private key used to sign the message.

      +

    Returns boolean

    Returns true if the signature is valid and corresponds to the message and public key, false otherwise.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_lazytower.LazyTowerHashChainProofBuilder.html b/functions/_zk_kit_lazytower.LazyTowerHashChainProofBuilder.html new file mode 100644 index 000000000..aa135c0e8 --- /dev/null +++ b/functions/_zk_kit_lazytower.LazyTowerHashChainProofBuilder.html @@ -0,0 +1,13 @@ +LazyTowerHashChainProofBuilder | zk-kit

Function LazyTowerHashChainProofBuilder

  • LazyTowerHashChainProofBuilder is a TypeScript implementation of LazyTower to generate proofs of membership.

    +

    Parameters

    • H: number

      Height of tower of the proving circuit. It can be less than the H in the contract.

      +
    • W: number

      Width of tower.

      +
    • hash: ((a, b) => bigint) = defaultHash

      A hash function which supports 2 input values.

      +
        • (a, b): bigint
        • Parameters

          • a: bigint
          • b: bigint

          Returns bigint

    Returns {
        add: ((item) => void);
        build: ((idx) => LazyTowerHashChainProof);
        indexOf: ((item) => number);
    }

    • add: ((item) => void)
        • (item): void
        • Adds a new item in the LazyTower.

          +

          Parameters

          • item: bigint

            Item to be added.

            +

          Returns void

    • build: ((idx) => LazyTowerHashChainProof)
    • indexOf: ((item) => number)
        • (item): number
        • Returns the index of a item. If the item does not exist it returns -1.

          +

          Parameters

          • item: bigint

            Added item.

            +

          Returns number

          Index of the item.

          +
\ No newline at end of file diff --git a/functions/_zk_kit_logical_expressions.applyOperator.html b/functions/_zk_kit_logical_expressions.applyOperator.html new file mode 100644 index 000000000..2464ad06a --- /dev/null +++ b/functions/_zk_kit_logical_expressions.applyOperator.html @@ -0,0 +1,9 @@ +applyOperator | zk-kit
  • Function to apply unary or binary operators to boolean values. +Logical operators supported: and, or, not, xor.

    +

    Parameters

    • operator: string

      Operator to apply.

      +
    • a: boolean

      First boolean value.

      +
    • Optional b: boolean

      Second boolean value (optional, only used for binary operators).

      +

    Returns boolean

    The boolean value after applying the operator.

    +

    Example

    // Example usage:
    import { applyOperator } from "@zk-kit/logical-expressions"

    // Unary operator
    const result1 = applyOperator("not", true)
    console.log(result1) // Output: false

    // Binary operator
    const result2 = applyOperator("and", true, false)
    console.log(result2) // Output: false +
    +
\ No newline at end of file diff --git a/functions/_zk_kit_logical_expressions.evaluate.html b/functions/_zk_kit_logical_expressions.evaluate.html new file mode 100644 index 000000000..85c5e24b9 --- /dev/null +++ b/functions/_zk_kit_logical_expressions.evaluate.html @@ -0,0 +1,18 @@ +evaluate | zk-kit
  • Function to evaluate a tokenized expression. +This algorithm is an adaptation of the +Shunting Yard +algorithm to evaluate expressions with logical operators.

    +

    There is no need to verify the correctness of the logical expression +before calling the evaluate function, as this will be checked during +the evaluation. If the expression is incorrect, an error will be thrown automatically.

    +

    Example of correct logical expression: "true and false".

    +

    Example of incorrect logical expression: "true true and false".

    +

    Logical operators supported: and, or, not, xor. +All other existing logical operators (nand, nor, xnor) +can be generated using the supported logical operators.

    +

    Parameters

    • tokens: string[]

      Tokens of the expression. +The tokens can be boolean values, logical operators or parentheses.

      +

    Returns boolean

    The boolean value after evaluating the expression.

    +

    Example

    // Example usage:
    import { evaluate } from "@zk-kit/logical-expressions"

    const expression = ["true", "and", "false"]

    const result = evaluate(expression)

    console.log(result) // Output: false +
    +
\ No newline at end of file diff --git a/functions/_zk_kit_logical_expressions.precedence.html b/functions/_zk_kit_logical_expressions.precedence.html new file mode 100644 index 000000000..20e6c617f --- /dev/null +++ b/functions/_zk_kit_logical_expressions.precedence.html @@ -0,0 +1,9 @@ +precedence | zk-kit
  • Function to determine the precedence of operators. +Unary operators have higher precedence. +Binary operators have the same precedence.

    +

    Parameters

    • operator: string

      Operator to check the precedence.

      +

    Returns number

    The precedence of the operator or 0 if +the operator is not supported

    +

    Example

    // Example usage:
    import { precedence } from "@zk-kit/logical-expressions"

    const result = precedence("and")

    console.log(result) // Output: 1 +
    +
\ No newline at end of file diff --git a/functions/_zk_kit_logical_expressions.tokenize.html b/functions/_zk_kit_logical_expressions.tokenize.html new file mode 100644 index 000000000..f0829bbcb --- /dev/null +++ b/functions/_zk_kit_logical_expressions.tokenize.html @@ -0,0 +1,6 @@ +tokenize | zk-kit
  • Tokenization function to split the expression into meaningful tokens.

    +

    Parameters

    • expression: string

      The expression to tokenize.

      +

    Returns string[]

    A list with the tokens of the expression.

    +

    Example

    // Example usage:
    import { tokenize } from "@zk-kit/logical-expressions"

    const expression = "true and false or ( true and true )"

    const tokens = tokenize(expression)

    console.log(tokens)
    // Output: ["true", "and", "false", "or", "(", "true", "and", "true", ")"] +
    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.checkEqual.html b/functions/_zk_kit_poseidon_cipher.checkEqual.html new file mode 100644 index 000000000..23c800056 --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.checkEqual.html @@ -0,0 +1,5 @@ +checkEqual | zk-kit
  • Check if two field values are equal

    +

    Parameters

    • a: bigint

      the first value

      +
    • b: bigint

      the second value

      +
    • error: string

      the error to throw if the values are not equal

      +

    Returns void

\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.normalize.html b/functions/_zk_kit_poseidon_cipher.normalize.html new file mode 100644 index 000000000..ceded7f60 --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.normalize.html @@ -0,0 +1,5 @@ +normalize | zk-kit
  • Given a bigint a, returns a normalized value of a.

    +

    Parameters

    • a: bigint

      the value to normalize

      +

    Returns bigint

    the normalized value of a

    +

    Dev

    r is 'r' is the alt_bn128 prime order, so we can use it to normalize values

    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.poseidonDecrypt.html b/functions/_zk_kit_poseidon_cipher.poseidonDecrypt.html new file mode 100644 index 000000000..ebdaaa4ed --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.poseidonDecrypt.html @@ -0,0 +1,7 @@ +poseidonDecrypt | zk-kit
  • Decrypt some ciphertext using poseidon encryption

    +

    Parameters

    • ciphertext: CipherText<bigint>

      the ciphertext to decrypt

      +
    • key: EncryptionKey<bigint>

      the key to decrypt with

      +
    • nonce: bigint

      the nonce used to encrypt

      +
    • length: number

      the length of the plaintext

      +

    Returns PlainText<bigint>

    the plaintext

    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.poseidonDecryptWithoutCheck.html b/functions/_zk_kit_poseidon_cipher.poseidonDecryptWithoutCheck.html new file mode 100644 index 000000000..6961d6668 --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.poseidonDecryptWithoutCheck.html @@ -0,0 +1,8 @@ +poseidonDecryptWithoutCheck | zk-kit
  • Decrypt some ciphertext using poseidon encryption

    +

    Parameters

    • ciphertext: CipherText<bigint>

      the ciphertext to decrypt

      +
    • key: EncryptionKey<bigint>

      the key to decrypt with

      +
    • nonce: bigint

      the nonce used to encrypt

      +
    • length: number

      the length of the plaintext

      +

    Returns PlainText<bigint>

    the plaintext

    +

    Dev

    Do not throw if the plaintext is invalid

    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.poseidonEncrypt.html b/functions/_zk_kit_poseidon_cipher.poseidonEncrypt.html new file mode 100644 index 000000000..a4e6cac27 --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.poseidonEncrypt.html @@ -0,0 +1,6 @@ +poseidonEncrypt | zk-kit
  • Encrypt some plaintext using poseidon encryption

    +

    Parameters

    • msg: PlainText<bigint>

      the message to encrypt

      +
    • key: EncryptionKey<bigint>

      the key to encrypt with

      +
    • nonce: bigint

      the nonce to avoid replay attacks

      +

    Returns CipherText<bigint>

    the ciphertext

    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.poseidonPerm.html b/functions/_zk_kit_poseidon_cipher.poseidonPerm.html new file mode 100644 index 000000000..5009a7276 --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.poseidonPerm.html @@ -0,0 +1,4 @@ +poseidonPerm | zk-kit
  • Apply the Poseidon permutation to the given inputs

    +

    Parameters

    • inputs: bigint[]

      the inputs to the permutation

      +

    Returns bigint[]

    an array of bigint representing the output of the permutation

    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.pow5.html b/functions/_zk_kit_poseidon_cipher.pow5.html new file mode 100644 index 000000000..e1a5fd16a --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.pow5.html @@ -0,0 +1,4 @@ +pow5 | zk-kit
  • Given a bigint a, returns a^5.

    +

    Parameters

    • a: bigint

      the value to exponentiate

      +

    Returns bigint

    the result of a^5

    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.unstringifyBigInts.html b/functions/_zk_kit_poseidon_cipher.unstringifyBigInts.html new file mode 100644 index 000000000..df989f24f --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.unstringifyBigInts.html @@ -0,0 +1,5 @@ +unstringifyBigInts | zk-kit
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_cipher.validateNonce.html b/functions/_zk_kit_poseidon_cipher.validateNonce.html new file mode 100644 index 000000000..769a90301 --- /dev/null +++ b/functions/_zk_kit_poseidon_cipher.validateNonce.html @@ -0,0 +1,3 @@ +validateNonce | zk-kit
  • Validate that the nonce is less than 2 ^ 128 (sqrt of the field size)

    +

    Parameters

    • nonce: bigint

      the nonce to validate

      +

    Returns void

\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_proof.generate.html b/functions/_zk_kit_poseidon_proof.generate.html new file mode 100644 index 000000000..0add0f49f --- /dev/null +++ b/functions/_zk_kit_poseidon_proof.generate.html @@ -0,0 +1,14 @@ +generate | zk-kit
  • Creates a zero-knowledge proof to prove that you have the preimages of a hash, +without disclosing the actual preimages themselves. +The use of a scope parameter helps ensure the uniqueness +and non-reusability of the proofs, enhancing security in applications like +blockchain transactions or private data verification. +If, for example, this package were used with Semaphore to demonstrate possession +of a Semaphore identity of a group of voters, the scope could be the poll's ID.

    +

    Parameters

    • preimages: BigNumberish[]

      The preimages of the hash.

      +
    • scope: BigNumberish | Uint8Array

      A public value used to contextualize the cryptographic proof +and calculate the nullifier.

      +
    • Optional snarkArtifacts: SnarkArtifacts

      The Snark artifacts (wasm and zkey files) generated in +a trusted setup of the circuit are necessary to generate valid proofs

      +

    Returns Promise<PoseidonProof>

    The Poseidon zero-knowledge proof.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_poseidon_proof.verify.html b/functions/_zk_kit_poseidon_proof.verify.html new file mode 100644 index 000000000..114036505 --- /dev/null +++ b/functions/_zk_kit_poseidon_proof.verify.html @@ -0,0 +1,4 @@ +verify | zk-kit
  • Verifies that a Poseidon proof is valid.

    +

    Parameters

    Returns Promise<boolean>

    True if the proof is valid, false otherwise.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_smt.checkHex.html b/functions/_zk_kit_smt.checkHex.html new file mode 100644 index 000000000..984a6a4ac --- /dev/null +++ b/functions/_zk_kit_smt.checkHex.html @@ -0,0 +1,4 @@ +checkHex | zk-kit

Function checkHex

  • Checks if a number is a hexadecimal number.

    +

    Parameters

    • n: string

      A hexadecimal number.

      +

    Returns boolean

    True if the number is a hexadecimal, false otherwise.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_smt.getFirstCommonElements.html b/functions/_zk_kit_smt.getFirstCommonElements.html new file mode 100644 index 000000000..d6a7a9db5 --- /dev/null +++ b/functions/_zk_kit_smt.getFirstCommonElements.html @@ -0,0 +1,5 @@ +getFirstCommonElements | zk-kit

Function getFirstCommonElements

  • Returns the first common elements of two arrays.

    +

    Parameters

    • array1: any[]

      The first array.

      +
    • array2: any[]

      The second array.

      +

    Returns any[]

    The array of the first common elements.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_smt.getIndexOfLastNonZeroElement.html b/functions/_zk_kit_smt.getIndexOfLastNonZeroElement.html new file mode 100644 index 000000000..039f3f7c0 --- /dev/null +++ b/functions/_zk_kit_smt.getIndexOfLastNonZeroElement.html @@ -0,0 +1,5 @@ +getIndexOfLastNonZeroElement | zk-kit

Function getIndexOfLastNonZeroElement

  • Returns the index of the last non-zero element of an array. +If there are only zero elements the function returns -1.

    +

    Parameters

    • array: any[]

      An array of hexadecimal or big numbers.

      +

    Returns number

    The index of the last non-zero element.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_smt.hexToBin.html b/functions/_zk_kit_smt.hexToBin.html new file mode 100644 index 000000000..fc742324c --- /dev/null +++ b/functions/_zk_kit_smt.hexToBin.html @@ -0,0 +1,4 @@ +hexToBin | zk-kit

Function hexToBin

  • Converts a hexadecimal number to a binary number.

    +

    Parameters

    • n: string

      A hexadecimal number.

      +

    Returns string

    The relative binary number.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_smt.keyToPath.html b/functions/_zk_kit_smt.keyToPath.html new file mode 100644 index 000000000..e018cf257 --- /dev/null +++ b/functions/_zk_kit_smt.keyToPath.html @@ -0,0 +1,5 @@ +keyToPath | zk-kit

Function keyToPath

  • Returns the binary representation of a key. For each key it is possible +to obtain an array of 256 padded bits.

    +

    Parameters

    • key: string | bigint

      The key of a tree entry.

      +

    Returns number[]

    The relative array of bits.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.base64ToBuffer.html b/functions/_zk_kit_utils.conversions.base64ToBuffer.html new file mode 100644 index 000000000..d641f5372 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.base64ToBuffer.html @@ -0,0 +1,6 @@ +base64ToBuffer | zk-kit
  • Converts a base64 string to bytes (i.e. a buffer). This function does not check +if the input value is a valid base64 string. If there are unsupported characters +they will be ignored.

    +

    Parameters

    • value: string

      The base64 string to convert.

      +

    Returns Buffer

    The converted buffer.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.base64ToText.html b/functions/_zk_kit_utils.conversions.base64ToText.html new file mode 100644 index 000000000..fe1d05adb --- /dev/null +++ b/functions/_zk_kit_utils.conversions.base64ToText.html @@ -0,0 +1,6 @@ +base64ToText | zk-kit
  • Converts a base64 string to text (utf8). This function does not check +if the input value is a valid base64 string. If there are unsupported characters +they could be ignored and the result may be unexpected.

    +

    Parameters

    • value: string

      The base64 string to convert.

      +

    Returns string

    The converted text.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.beBigIntToBuffer.html b/functions/_zk_kit_utils.conversions.beBigIntToBuffer.html new file mode 100644 index 000000000..389aafe8e --- /dev/null +++ b/functions/_zk_kit_utils.conversions.beBigIntToBuffer.html @@ -0,0 +1,9 @@ +beBigIntToBuffer | zk-kit
  • Converts a bigint to a buffer and fills with zeros if a valid +size (i.e. number of bytes) is specified. If the size is not defined, +it gets the size from the given bigint. If the specified size is smaller than +the size of the bigint (i.e. minSize), an error is thrown. +It uses big-endian byte order.

    +

    Parameters

    • value: bigint

      The bigint to convert.

      +
    • Optional size: number

      The number of bytes of the buffer to return.

      +

    Returns Buffer

    The buffer representation of the bigint.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.beBufferToBigInt.html b/functions/_zk_kit_utils.conversions.beBufferToBigInt.html new file mode 100644 index 000000000..b3cbc7e3a --- /dev/null +++ b/functions/_zk_kit_utils.conversions.beBufferToBigInt.html @@ -0,0 +1,5 @@ +beBufferToBigInt | zk-kit
  • Converts a buffer of bytes to a bigint using big-endian byte order. +It accepts 'Buffer' or 'Uint8Array'.

    +

    Parameters

    • value: Uint8Array | Buffer

      The buffer to convert.

      +

    Returns bigint

    The bigint representation of the buffer's contents.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.bigIntToBuffer.html b/functions/_zk_kit_utils.conversions.bigIntToBuffer.html new file mode 100644 index 000000000..93a2f39bf --- /dev/null +++ b/functions/_zk_kit_utils.conversions.bigIntToBuffer.html @@ -0,0 +1,4 @@ +bigIntToBuffer | zk-kit
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.bigIntToHexadecimal.html b/functions/_zk_kit_utils.conversions.bigIntToHexadecimal.html new file mode 100644 index 000000000..539981e7e --- /dev/null +++ b/functions/_zk_kit_utils.conversions.bigIntToHexadecimal.html @@ -0,0 +1,4 @@ +bigIntToHexadecimal | zk-kit
  • Converts a bigint to a hexadecimal string.

    +

    Parameters

    • value: bigint

      The bigint value to convert.

      +

    Returns string

    The hexadecimal representation of the bigint.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.bigNumberishToBigInt.html b/functions/_zk_kit_utils.conversions.bigNumberishToBigInt.html new file mode 100644 index 000000000..b848daf75 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.bigNumberishToBigInt.html @@ -0,0 +1,6 @@ +bigNumberishToBigInt | zk-kit
  • Converts a BigNumberish type to a bigint. If the input is already a bigint, +the return value will be the bigint itself, otherwise it will be converted +to a bigint using big-endian byte order.

    +

    Parameters

    Returns bigint

    The bigint representation of the BigNumberish value.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.bigNumberishToBuffer.html b/functions/_zk_kit_utils.conversions.bigNumberishToBuffer.html new file mode 100644 index 000000000..3b9201d5c --- /dev/null +++ b/functions/_zk_kit_utils.conversions.bigNumberishToBuffer.html @@ -0,0 +1,6 @@ +bigNumberishToBuffer | zk-kit
  • Converts a BigNumberish type to a buffer. If the input is already a buffer, +the return value will be the buffer itself, otherwise it will be converted +to a buffer using big-endian byte order.

    +

    Parameters

    Returns Buffer

    The buffer representation of the BigNumberish value.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.bufferToBase64.html b/functions/_zk_kit_utils.conversions.bufferToBase64.html new file mode 100644 index 000000000..d629cbb36 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.bufferToBase64.html @@ -0,0 +1,4 @@ +bufferToBase64 | zk-kit
  • Converts bytes to a base64 string. It accepts 'Buffer' or 'Uint8Array'.

    +

    Parameters

    • value: Uint8Array | Buffer

      The bytes to convert.

      +

    Returns string

    The converted base64 string.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.bufferToBigInt.html b/functions/_zk_kit_utils.conversions.bufferToBigInt.html new file mode 100644 index 000000000..aea41cf29 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.bufferToBigInt.html @@ -0,0 +1,4 @@ +bufferToBigInt | zk-kit
  • Converts a buffer to a bigint. Alias for beBufferToBigInt.

    +

    Parameters

    • value: Uint8Array | Buffer

      The buffer to convert.

      +

    Returns bigint

    The bigint representation of the buffer's contents.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.bufferToHexadecimal.html b/functions/_zk_kit_utils.conversions.bufferToHexadecimal.html new file mode 100644 index 000000000..c93f5a482 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.bufferToHexadecimal.html @@ -0,0 +1,5 @@ +bufferToHexadecimal | zk-kit
  • Converts a buffer to a hexadecimal string. It accepts 'Buffer' or 'Uint8Array'. +The hexadecimal string will not start with '0x' or '0X'. It keeps the bytes in the same order.

    +

    Parameters

    • value: Uint8Array | Buffer

      The buffer to convert.

      +

    Returns string

    The converted hexadecimal string.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.hexadecimalToBigInt.html b/functions/_zk_kit_utils.conversions.hexadecimalToBigInt.html new file mode 100644 index 000000000..d783cf143 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.hexadecimalToBigInt.html @@ -0,0 +1,5 @@ +hexadecimalToBigInt | zk-kit
  • Converts a hexadecimal string to a bigint. The input is interpreted as hexadecimal +with or without a '0x' prefix. It uses big-endian byte order.

    +

    Parameters

    • value: string

      The hexadecimal string to convert.

      +

    Returns bigint

    The bigint representation of the hexadecimal string.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.hexadecimalToBuffer.html b/functions/_zk_kit_utils.conversions.hexadecimalToBuffer.html new file mode 100644 index 000000000..a090a216a --- /dev/null +++ b/functions/_zk_kit_utils.conversions.hexadecimalToBuffer.html @@ -0,0 +1,5 @@ +hexadecimalToBuffer | zk-kit
  • Converts an hexadecimal string to a buffer. The hexadecimal string +should not start with '0x' or '0X'. It keeps the bytes in the same order.

    +

    Parameters

    • value: string

      The hexadecimal string to convert.

      +

    Returns Buffer

    The buffer representation of the hexadecimal string.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.leBigIntToBuffer.html b/functions/_zk_kit_utils.conversions.leBigIntToBuffer.html new file mode 100644 index 000000000..1a6b1e25f --- /dev/null +++ b/functions/_zk_kit_utils.conversions.leBigIntToBuffer.html @@ -0,0 +1,9 @@ +leBigIntToBuffer | zk-kit
  • Converts a bigint to a buffer and fills with zeros if a valid +size (i.e. number of bytes) is specified. If the size is not defined, +it gets the size from the given bigint. If the specified size is smaller than +the size of the bigint (i.e. minSize), an error is thrown. +It uses little-endian byte order.

    +

    Parameters

    • value: bigint

      The bigint to convert.

      +
    • Optional size: number

      The number of bytes of the buffer to return.

      +

    Returns Buffer

    The buffer representation of the bigint in little-endian.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.leBufferToBigInt.html b/functions/_zk_kit_utils.conversions.leBufferToBigInt.html new file mode 100644 index 000000000..781027021 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.leBufferToBigInt.html @@ -0,0 +1,5 @@ +leBufferToBigInt | zk-kit
  • Converts a buffer to a bigint using little-endian byte order. +It accepts 'Buffer' or 'Uint8Array'.

    +

    Parameters

    • value: Uint8Array | Buffer

      The buffer to convert.

      +

    Returns bigint

    The bigint representation of the buffer's contents in little-endian.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.conversions.textToBase64.html b/functions/_zk_kit_utils.conversions.textToBase64.html new file mode 100644 index 000000000..c5f0256b0 --- /dev/null +++ b/functions/_zk_kit_utils.conversions.textToBase64.html @@ -0,0 +1,4 @@ +textToBase64 | zk-kit
  • Converts text (utf8) to a base64 string.

    +

    Parameters

    • value: string

      The text to convert.

      +

    Returns string

    The converted base64 string.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.crypto.getRandomValues.html b/functions/_zk_kit_utils.crypto.getRandomValues.html new file mode 100644 index 000000000..86f1a2611 --- /dev/null +++ b/functions/_zk_kit_utils.crypto.getRandomValues.html @@ -0,0 +1,4 @@ +getRandomValues | zk-kit
  • Generates a random sequence of bytes securely using Node.js's crypto module.

    +

    Parameters

    • size: number

      The number of bytes to generate.

      +

    Returns Uint8Array

    A Uint8Array containing the generated random bytes.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireArray.html b/functions/_zk_kit_utils.errorHandlers.requireArray.html new file mode 100644 index 000000000..85eca1db8 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireArray.html @@ -0,0 +1,4 @@ +requireArray | zk-kit
  • Parameters

    • parameterValue: any[]

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not an Array.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireBigInt.html b/functions/_zk_kit_utils.errorHandlers.requireBigInt.html new file mode 100644 index 000000000..fa34597e4 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireBigInt.html @@ -0,0 +1,4 @@ +requireBigInt | zk-kit
  • Parameters

    • parameterValue: bigint

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a bigint.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireBigNumber.html b/functions/_zk_kit_utils.errorHandlers.requireBigNumber.html new file mode 100644 index 000000000..4229e1ddc --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireBigNumber.html @@ -0,0 +1,4 @@ +requireBigNumber | zk-kit
  • Parameters

    • parameterValue: any

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a bignumber.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireBigNumberish.html b/functions/_zk_kit_utils.errorHandlers.requireBigNumberish.html new file mode 100644 index 000000000..9b0437400 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireBigNumberish.html @@ -0,0 +1,4 @@ +requireBigNumberish | zk-kit
  • Parameters

    • parameterValue: any

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a bignumber-ish.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireBuffer.html b/functions/_zk_kit_utils.errorHandlers.requireBuffer.html new file mode 100644 index 000000000..3e8c6f149 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireBuffer.html @@ -0,0 +1,4 @@ +requireBuffer | zk-kit
  • Parameters

    • parameterValue: Buffer

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a Buffer.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireDefined.html b/functions/_zk_kit_utils.errorHandlers.requireDefined.html new file mode 100644 index 000000000..fd946b33e --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireDefined.html @@ -0,0 +1,4 @@ +requireDefined | zk-kit
  • Parameters

    • parameterValue: any

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value has not been defined.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireFunction.html b/functions/_zk_kit_utils.errorHandlers.requireFunction.html new file mode 100644 index 000000000..f6e43fea4 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireFunction.html @@ -0,0 +1,4 @@ +requireFunction | zk-kit
  • Parameters

    • parameterValue: Function

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a function.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireHexadecimal.html b/functions/_zk_kit_utils.errorHandlers.requireHexadecimal.html new file mode 100644 index 000000000..834d7240a --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireHexadecimal.html @@ -0,0 +1,8 @@ +requireHexadecimal | zk-kit
  • Parameters

    • parameterValue: string

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +
    • prefix: boolean = true

      A boolean to include or not a '0x' or '0X' prefix.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a hexadecimal string. +If 'prefix' is 'true', the string must start with '0x' or '0X' followed by one or more +hexadecimal digits (0-9, a-f, A-F), otherwise no prefix is expected. 'prefix' is optional and +if its value it is not explicitly defined it will be set to 'true' by default.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireNumber.html b/functions/_zk_kit_utils.errorHandlers.requireNumber.html new file mode 100644 index 000000000..8875455af --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireNumber.html @@ -0,0 +1,4 @@ +requireNumber | zk-kit
  • Parameters

    • parameterValue: number

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a number.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireObject.html b/functions/_zk_kit_utils.errorHandlers.requireObject.html new file mode 100644 index 000000000..9e241c1ee --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireObject.html @@ -0,0 +1,5 @@ +requireObject | zk-kit
  • Parameters

    • parameterValue: object

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not an object. +Please, note that arrays are also objects in JavaScript.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireString.html b/functions/_zk_kit_utils.errorHandlers.requireString.html new file mode 100644 index 000000000..3f0e5ae49 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireString.html @@ -0,0 +1,4 @@ +requireString | zk-kit
  • Parameters

    • parameterValue: string

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a string.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireStringifiedBigInt.html b/functions/_zk_kit_utils.errorHandlers.requireStringifiedBigInt.html new file mode 100644 index 000000000..f56b38252 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireStringifiedBigInt.html @@ -0,0 +1,4 @@ +requireStringifiedBigInt | zk-kit
  • Parameters

    • parameterValue: string

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a stringified bigint.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireTypes.html b/functions/_zk_kit_utils.errorHandlers.requireTypes.html new file mode 100644 index 000000000..77fa12476 --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireTypes.html @@ -0,0 +1,4 @@ +requireTypes | zk-kit
  • Parameters

    • parameterValue: any

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +
    • types: ("string" | "number" | "bigint" | "object" | "function" | "Array" | "Uint8Array" | "Buffer" | "stringified-bigint" | "hexadecimal" | "bignumber" | "bignumberish")[]

    Returns void

    Throws

    Throws a type error if the parameter value type is not part of the list of types.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.errorHandlers.requireUint8Array.html b/functions/_zk_kit_utils.errorHandlers.requireUint8Array.html new file mode 100644 index 000000000..faff1c38f --- /dev/null +++ b/functions/_zk_kit_utils.errorHandlers.requireUint8Array.html @@ -0,0 +1,4 @@ +requireUint8Array | zk-kit
  • Parameters

    • parameterValue: Uint8Array

      The parameter value.

      +
    • parameterName: string

      The parameter name.

      +

    Returns void

    Throws

    Throws a type error if the parameter value is not a Uint8Array.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.packing.packGroth16Proof.html b/functions/_zk_kit_utils.packing.packGroth16Proof.html new file mode 100644 index 000000000..7892c5a2d --- /dev/null +++ b/functions/_zk_kit_utils.packing.packGroth16Proof.html @@ -0,0 +1,4 @@ +packGroth16Proof | zk-kit
\ No newline at end of file diff --git a/functions/_zk_kit_utils.packing.unpackGroth16Proof.html b/functions/_zk_kit_utils.packing.unpackGroth16Proof.html new file mode 100644 index 000000000..37187a82e --- /dev/null +++ b/functions/_zk_kit_utils.packing.unpackGroth16Proof.html @@ -0,0 +1,4 @@ +unpackGroth16Proof | zk-kit
  • Unpacks a PackedGroth16Proof Solidity calldata into its original form which is a SnarkJS Groth16 proof.

    +

    Parameters

    Returns Groth16Proof

    The Groth16 proof compatible with SnarkJS.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.scalar.bits.html b/functions/_zk_kit_utils.scalar.bits.html new file mode 100644 index 000000000..3116c693c --- /dev/null +++ b/functions/_zk_kit_utils.scalar.bits.html @@ -0,0 +1,7 @@ +bits | zk-kit
  • Converts a bigint scalar value into an array of bits, represented as numbers. +This function is particularly useful for examining the binary structure of bigints, +which can be necessary for bit manipulation and understanding the representation +of numbers at a lower level.

    +

    Parameters

    • n: bigint

      The bigint scalar value to convert into bits.

      +

    Returns number[]

    An array of numbers representing the bits of 'n', starting from the least significant bit.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.scalar.gt.html b/functions/_zk_kit_utils.scalar.gt.html new file mode 100644 index 000000000..23a890298 --- /dev/null +++ b/functions/_zk_kit_utils.scalar.gt.html @@ -0,0 +1,5 @@ +gt | zk-kit
  • Compares two bigint scalar values to determine if the first is greater than the second.

    +

    Parameters

    • a: bigint

      The first bigint scalar value to compare.

      +
    • b: bigint

      The second bigint scalar value to compare.

      +

    Returns boolean

    True if 'a' is greater than 'b', false otherwise.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.scalar.isOdd.html b/functions/_zk_kit_utils.scalar.isOdd.html new file mode 100644 index 000000000..3e52658e8 --- /dev/null +++ b/functions/_zk_kit_utils.scalar.isOdd.html @@ -0,0 +1,4 @@ +isOdd | zk-kit
  • Determines whether a bigint scalar value is odd.

    +

    Parameters

    • a: bigint

      The bigint scalar value to check.

      +

    Returns boolean

    True if 'a' is odd, false if it is even.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.scalar.isZero.html b/functions/_zk_kit_utils.scalar.isZero.html new file mode 100644 index 000000000..bbecf005b --- /dev/null +++ b/functions/_zk_kit_utils.scalar.isZero.html @@ -0,0 +1,4 @@ +isZero | zk-kit
  • Checks if a bigint scalar value is zero.

    +

    Parameters

    • a: bigint

      The bigint scalar value to check.

      +

    Returns boolean

    True if 'a' is zero, false otherwise.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.scalar.mul.html b/functions/_zk_kit_utils.scalar.mul.html new file mode 100644 index 000000000..a0637d7e9 --- /dev/null +++ b/functions/_zk_kit_utils.scalar.mul.html @@ -0,0 +1,5 @@ +mul | zk-kit
  • Multiplies two bigint scalar values.

    +

    Parameters

    • a: bigint

      The first bigint scalar value.

      +
    • b: bigint

      The second bigint scalar value.

      +

    Returns bigint

    The product of 'a' and 'b'.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.scalar.shiftRight.html b/functions/_zk_kit_utils.scalar.shiftRight.html new file mode 100644 index 000000000..45c320dea --- /dev/null +++ b/functions/_zk_kit_utils.scalar.shiftRight.html @@ -0,0 +1,7 @@ +shiftRight | zk-kit
  • Performs a bitwise right shift on a bigint scalar value. +This operation is equivalent to dividing by 2^n, but it operates directly +on the binary representation, making it efficient for certain types of calculations.

    +

    Parameters

    • a: bigint

      The bigint scalar value to shift.

      +
    • n: bigint

      The number of bits to shift 'a' by.

      +

    Returns bigint

    The result of shifting 'a' right by 'n' bits.

    +
\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isArray.html b/functions/_zk_kit_utils.typeChecks.isArray.html new file mode 100644 index 000000000..362b93bae --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isArray.html @@ -0,0 +1,3 @@ +isArray | zk-kit
  • Returns true if the value is an Array instance, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isBigInt.html b/functions/_zk_kit_utils.typeChecks.isBigInt.html new file mode 100644 index 000000000..48ed10a85 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isBigInt.html @@ -0,0 +1,3 @@ +isBigInt | zk-kit
  • Returns true if the value is a bigint, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isBigNumber.html b/functions/_zk_kit_utils.typeChecks.isBigNumber.html new file mode 100644 index 000000000..17ce4ebd2 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isBigNumber.html @@ -0,0 +1,5 @@ +isBigNumber | zk-kit
  • Checks if the given value can be considered as BigNumber. +A value is considered a BigNumber if it is a bigint or a string +that can be converted to a bigint (via Bigint(s)).

    +

    Parameters

    • value: any

      The value to check.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isBigNumberish.html b/functions/_zk_kit_utils.typeChecks.isBigNumberish.html new file mode 100644 index 000000000..b4a501006 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isBigNumberish.html @@ -0,0 +1,7 @@ +isBigNumberish | zk-kit
  • Checks if the given value can be considered as BigNumberish. +A value is considered BigNumberish if it meets +any of the following conditions: it's a number, a bigint, a string +that can be converted to a bigint, a hexadecimal +string, or a Buffer object.

    +

    Parameters

    • value: any

      The value to check.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isBuffer.html b/functions/_zk_kit_utils.typeChecks.isBuffer.html new file mode 100644 index 000000000..a89d57d30 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isBuffer.html @@ -0,0 +1,3 @@ +isBuffer | zk-kit
  • Returns true if the value is a Buffer instance, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isDefined.html b/functions/_zk_kit_utils.typeChecks.isDefined.html new file mode 100644 index 000000000..387b7777b --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isDefined.html @@ -0,0 +1,3 @@ +isDefined | zk-kit
  • Returns true if the value is defined, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isFunction.html b/functions/_zk_kit_utils.typeChecks.isFunction.html new file mode 100644 index 000000000..40a498420 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isFunction.html @@ -0,0 +1,3 @@ +isFunction | zk-kit
  • Returns true if the value is a function, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isHexadecimal.html b/functions/_zk_kit_utils.typeChecks.isHexadecimal.html new file mode 100644 index 000000000..c51554598 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isHexadecimal.html @@ -0,0 +1,7 @@ +isHexadecimal | zk-kit
  • Checks if a string is a valid hexadecimal string representation. +If 'prefix' is 'true', the string must start with '0x' or '0X' followed by one or more +hexadecimal digits (0-9, a-f, A-F), otherwise no prefix is expected. 'prefix' is optional and +if its value it is not explicitly defined it will be set to 'true' by default.

    +

    Parameters

    • value: any

      The string to be tested.

      +
    • prefix: boolean = true

      A boolean to include or not a '0x' or '0X' prefix.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isNumber.html b/functions/_zk_kit_utils.typeChecks.isNumber.html new file mode 100644 index 000000000..96f9cce9f --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isNumber.html @@ -0,0 +1,3 @@ +isNumber | zk-kit
  • Returns true if the value is a number, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isObject.html b/functions/_zk_kit_utils.typeChecks.isObject.html new file mode 100644 index 000000000..c4496d5d4 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isObject.html @@ -0,0 +1,4 @@ +isObject | zk-kit
  • Returns true if the value is an object, false otherwise. +Please, note that arrays are also objects in JavaScript.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isString.html b/functions/_zk_kit_utils.typeChecks.isString.html new file mode 100644 index 000000000..f87348c06 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isString.html @@ -0,0 +1,3 @@ +isString | zk-kit
  • Returns true if the value is a string, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isStringifiedBigInt.html b/functions/_zk_kit_utils.typeChecks.isStringifiedBigInt.html new file mode 100644 index 000000000..d75090b09 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isStringifiedBigInt.html @@ -0,0 +1,3 @@ +isStringifiedBigInt | zk-kit
  • Checks if the given value is a string that represents a valid bigint.

    +

    Parameters

    • value: any

      The value to be checked if it's a stringified bigint.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isSupportedType.html b/functions/_zk_kit_utils.typeChecks.isSupportedType.html new file mode 100644 index 000000000..4534c870a --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isSupportedType.html @@ -0,0 +1,4 @@ +isSupportedType | zk-kit
  • Returns true if the type is being supported by this utility +functions, false otherwise.

    +

    Parameters

    • type: string

      The type to be checked.

      +

    Returns type is "string" | "number" | "bigint" | "object" | "function" | "Array" | "Uint8Array" | "Buffer" | "stringified-bigint" | "hexadecimal" | "bignumber" | "bignumberish"

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isType.html b/functions/_zk_kit_utils.typeChecks.isType.html new file mode 100644 index 000000000..fc390bf77 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isType.html @@ -0,0 +1,4 @@ +isType | zk-kit
  • Returns true if the value type is the same as the type passed +as the second parameter, false otherwise.

    +

    Parameters

    • value: any
    • type: "string" | "number" | "bigint" | "object" | "function" | "Array" | "Uint8Array" | "Buffer" | "stringified-bigint" | "hexadecimal" | "bignumber" | "bignumberish"

      The expected type.

      +

    Returns boolean

\ No newline at end of file diff --git a/functions/_zk_kit_utils.typeChecks.isUint8Array.html b/functions/_zk_kit_utils.typeChecks.isUint8Array.html new file mode 100644 index 000000000..bd50006a9 --- /dev/null +++ b/functions/_zk_kit_utils.typeChecks.isUint8Array.html @@ -0,0 +1,3 @@ +isUint8Array | zk-kit
  • Returns true if the value is a Uint8Array instance, false otherwise.

    +

    Parameters

    • value: any

      The value to be checked.

      +

    Returns boolean

\ No newline at end of file diff --git a/hierarchy.html b/hierarchy.html new file mode 100644 index 000000000..c3bf1ee8b --- /dev/null +++ b/hierarchy.html @@ -0,0 +1 @@ +zk-kit

zk-kit

Class Hierarchy

\ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 000000000..0bac317f0 --- /dev/null +++ b/index.html @@ -0,0 +1,557 @@ +zk-kit

zk-kit

+

+ + + + ZK-Kit logo + + JS +

+

+ +

+ + + + + Github license + + + GitHub Workflow Tests + + + Coveralls + + + Linter eslint + + + Code style prettier + + + Commitizen friendly + +

+ + + + + + + + + +
ZK-Kit is a set of libraries (algorithms or utility functions) that can be reused in different projects and zero-knowledge protocols, making it easier for developers to access user-friendly, tested, and documented code for common tasks. ZK-Kit provides different repositories for each language - this one contains JavaScript code only.
+

Yarn workspaces: minimal monorepo package management (yarn, yarn build, yarn docs)
Conventional Commits: human and machine readable meaning to commit messages (yarn commit)
Jest: tests and test coverage for all libraries (yarn test:libraries)
ESLint, Prettier: code quality and formatting (yarn prettier & yarn lint)
Typedocs: documentation generator for TypeScript (yarn docs)
Benny: simple benchmarking framework for JavaScript/TypeScript (yarn benchmarks)
Github actions: software workflows for automatic testing, documentation deploy and code quality checks

+

🗂️ Repositories

+

📄 Papers

+

📦 Packages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PackageVersionDownloadsSizeAudited
+ + @zk-kit/eddsa-poseidon + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + + ✔️ + +
+ + @zk-kit/poseidon-cipher + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + ❌ +
+ + @zk-kit/baby-jubjub + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + + ✔️ + +
+ + @zk-kit/utils + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + + ✔️ + +
+ + @zk-kit/imt + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + ❌ +
+ + @zk-kit/lean-imt + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + + ✔️ + +
+ + @zk-kit/smt + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + ❌ +
+ + @zk-kit/poseidon-proof + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + ❌ +
+ + @zk-kit/logical-expressions + + + (docs) + + + + + NPM version + + + + + Downloads + + + + + npm bundle size (scoped) + + + ❌ +
+ +

👥 Ways to contribute

+

🛠 Install

Clone this repository:

+
git clone https://github.com/privacy-scaling-explorations/zk-kit.git
+
+

and install the dependencies:

+
cd zk-kit && yarn
+
+

📜 Usage

Code quality and formatting

Run ESLint to analyze the code and catch bugs:

+
yarn lint
+
+

Run Prettier to check formatting rules:

+
yarn format
+
+

or to automatically format the code:

+
yarn format:write
+
+

Conventional commits

ZK-Kit uses conventional commits. A command line utility to commit using the correct syntax can be used by running:

+
yarn commit
+
+

It will also automatically check that the modified files comply with ESLint and Prettier rules.

+

Testing

Test the code:

+
yarn test
+
+

Build

Build all the packages:

+
yarn build
+
+

A dist folder will be created inside each JavaScript package.

+

Documentation

Generate a documentation website for each package:

+
yarn docs
+
+

The output will be placed on the docs folder.

+

Releases

    +
  1. Bump a new version of the package with:
  2. +
+
yarn version:bump <package-name> <version>
# e.g. yarn version:bump utils 2.0.0 +
+

This step creates a commit and a git tag.

+
    +
  1. Push the changes to main:
  2. +
+
git push origin main
+
+
    +
  1. Push the new git tag:
  2. +
+
git push origin <package-name>-<version>
# e.g. git push origin utils-v2.0.0 +
+

After pushing the new git tag, a workflow will be triggered and will publish the package on npm and release a new version on Github with its changelogs automatically.

+

❓ FAQ

I have a library that could be reused in other projects. How can I integrate it on ZK-kit?

ZK-kit provides a set of pre-configured development tools. All you have to deal with is your own code, testing and documentation. To create a package follow these steps:

+
    +
  1. Fork this repository and clone it (or simply clone it directly if you are a collaborator),
  2. +
  3. Copy one of our current libraries and update the README.md and package.json files with your package name:
  4. +
+
cd zk-kit
cp -r packages/smt packages/my-package
cd packages/my-package && rm -fr node_modules dist
grep -r -l "smt" . | xargs sed -i 's/smt/my-package/'
# Update the remaining description/usage sections, and write your code in the src & tests folders! +
+
    +
  1. Create an issue for your package and open a PR.
  2. +
+

How can I create benchmarks for my library?

You can see some examples in the benchmarks folder. All you have to do is create a file that exports a function to run your benchmark in that folder and add that function to the index.ts file. The yarn benchmarks command can be run with no parameters (it will run all the benchmarks), or you can specify the name of your benchmark file to run just that. When you run the command it will create a benchmarks/results folder with your results.

+

I need to use a Merkle Tree to prove the inclusion or exclusion of data elements within a set. Which type of Merkle Tree should I use?

Incremental: Ideal for applications where you frequently add new elements and need to update the tree efficiently.

+

Lean Incremental: A more memory-efficient version of the incremental Merkle tree.

+

Sparse: Particularly useful when you need proof of non-membership.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeLibrary NameMain FeatureUsed by
Incremental@zk-kit/imtFastest for incremental updates.Semaphore V3, Worldcoin
Lean Incremental@zk-kit/lean-imtOptimized for lightweight environments.Semaphore V4, Zupass
Sparse@zk-kit/smtHandles very large sets efficiently.Iden3
+

Following benchmarks data of zk-kit Merkle Trees implementations:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
8 leafsinsertdeleteupdategenerate proofverify proof
fastestIMTIMT ~ SparseMTLeanIMTLeanIMTIMT
slowestLeanIMTIMT ~ SparseMTIMTSparseMTSparseMT
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
128 leafsinsertdeleteupdategenerate proofverify proof
fastestIMTSparseMTLeanIMTLeanIMTSparseMT
slowestLeanIMTIMTIMTIMTIMT
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
1024 leafsinsertdeleteupdategenerate proofverify proof
fastestSparseMTSparseMTLeanIMTLeanIMTSparseMT
slowestLeanIMTIMTIMTIMTIMT
+

From the benchmark data we can take another criteria to evaluate which Merkle tree should be used:

+
    +
  • IMT have the best performance for medium and small size insert related operations.
  • +
  • LeanIMT have the best performance for all the merkle tree sizes for update and generate proof related operations.
  • +
  • Sparse is good for larger data insert, delete and verify proof.
  • +
+
\ No newline at end of file diff --git a/interfaces/_zk_kit_smt.EntryResponse.html b/interfaces/_zk_kit_smt.EntryResponse.html new file mode 100644 index 000000000..541bd38fb --- /dev/null +++ b/interfaces/_zk_kit_smt.EntryResponse.html @@ -0,0 +1,4 @@ +EntryResponse | zk-kit

Interface EntryResponse

interface EntryResponse {
    entry: Entry | Node[];
    matchingEntry?: Entry | Node[];
    siblings: Siblings;
}

Hierarchy (view full)

Properties

entry: Entry | Node[]
matchingEntry?: Entry | Node[]
siblings: Siblings
\ No newline at end of file diff --git a/interfaces/_zk_kit_smt.MerkleProof.html b/interfaces/_zk_kit_smt.MerkleProof.html new file mode 100644 index 000000000..c51199ef7 --- /dev/null +++ b/interfaces/_zk_kit_smt.MerkleProof.html @@ -0,0 +1,6 @@ +MerkleProof | zk-kit

Interface MerkleProof

interface MerkleProof {
    entry: Entry | Node[];
    matchingEntry?: Entry | Node[];
    membership: boolean;
    root: Node;
    siblings: Siblings;
}

Hierarchy (view full)

Properties

entry: Entry | Node[]
matchingEntry?: Entry | Node[]
membership: boolean
root: Node
siblings: Siblings
\ No newline at end of file diff --git a/interfaces/_zk_kit_utils.Buffer.html b/interfaces/_zk_kit_utils.Buffer.html new file mode 100644 index 000000000..6fee1a4b7 --- /dev/null +++ b/interfaces/_zk_kit_utils.Buffer.html @@ -0,0 +1,749 @@ +Buffer | zk-kit
interface Buffer {
    BYTES_PER_ELEMENT: number;
    [toStringTag]: "Uint8Array";
    buffer: ArrayBufferLike;
    byteLength: number;
    byteOffset: number;
    length: number;
    [iterator](): ArrayIterator<number>;
    at(index): undefined | number;
    compare(target, targetStart?, targetEnd?, sourceStart?, sourceEnd?): -1 | 0 | 1;
    copy(target, targetStart?, sourceStart?, sourceEnd?): number;
    copyWithin(target, start, end?): this;
    entries(): ArrayIterator<[number, number]>;
    equals(otherBuffer): boolean;
    every(predicate, thisArg?): boolean;
    fill(value, offset?, end?, encoding?): this;
    filter(predicate, thisArg?): Uint8Array;
    find(predicate, thisArg?): undefined | number;
    findIndex(predicate, thisArg?): number;
    forEach(callbackfn, thisArg?): void;
    includes(value, byteOffset?, encoding?): boolean;
    indexOf(value, byteOffset?, encoding?): number;
    join(separator?): string;
    keys(): ArrayIterator<number>;
    lastIndexOf(value, byteOffset?, encoding?): number;
    map(callbackfn, thisArg?): Uint8Array;
    readBigInt64BE(offset?): bigint;
    readBigInt64LE(offset?): bigint;
    readBigUInt64BE(offset?): bigint;
    readBigUInt64LE(offset?): bigint;
    readBigUint64BE(offset?): bigint;
    readBigUint64LE(offset?): bigint;
    readDoubleBE(offset?): number;
    readDoubleLE(offset?): number;
    readFloatBE(offset?): number;
    readFloatLE(offset?): number;
    readInt16BE(offset?): number;
    readInt16LE(offset?): number;
    readInt32BE(offset?): number;
    readInt32LE(offset?): number;
    readInt8(offset?): number;
    readIntBE(offset, byteLength): number;
    readIntLE(offset, byteLength): number;
    readUInt16BE(offset?): number;
    readUInt16LE(offset?): number;
    readUInt32BE(offset?): number;
    readUInt32LE(offset?): number;
    readUInt8(offset?): number;
    readUIntBE(offset, byteLength): number;
    readUIntLE(offset, byteLength): number;
    readUint16BE(offset?): number;
    readUint16LE(offset?): number;
    readUint32BE(offset?): number;
    readUint32LE(offset?): number;
    readUint8(offset?): number;
    readUintBE(offset, byteLength): number;
    readUintLE(offset, byteLength): number;
    reduce(callbackfn): number;
    reduce(callbackfn, initialValue): number;
    reduce<U>(callbackfn, initialValue): U;
    reduceRight(callbackfn): number;
    reduceRight(callbackfn, initialValue): number;
    reduceRight<U>(callbackfn, initialValue): U;
    reverse(): this;
    set(array, offset?): void;
    slice(start?, end?): Buffer;
    some(predicate, thisArg?): boolean;
    sort(compareFn?): this;
    subarray(start?, end?): Buffer;
    swap16(): Buffer;
    swap32(): Buffer;
    swap64(): Buffer;
    toJSON(): {
        data: number[];
        type: "Buffer";
    };
    toLocaleString(): string;
    toLocaleString(locales, options?): string;
    toString(encoding?, start?, end?): string;
    valueOf(): Uint8Array;
    values(): ArrayIterator<number>;
    write(string, encoding?): number;
    write(string, offset, encoding?): number;
    write(string, offset, length, encoding?): number;
    writeBigInt64BE(value, offset?): number;
    writeBigInt64LE(value, offset?): number;
    writeBigUInt64BE(value, offset?): number;
    writeBigUInt64LE(value, offset?): number;
    writeBigUint64BE(value, offset?): number;
    writeBigUint64LE(value, offset?): number;
    writeDoubleBE(value, offset?): number;
    writeDoubleLE(value, offset?): number;
    writeFloatBE(value, offset?): number;
    writeFloatLE(value, offset?): number;
    writeInt16BE(value, offset?): number;
    writeInt16LE(value, offset?): number;
    writeInt32BE(value, offset?): number;
    writeInt32LE(value, offset?): number;
    writeInt8(value, offset?): number;
    writeIntBE(value, offset, byteLength): number;
    writeIntLE(value, offset, byteLength): number;
    writeUInt16BE(value, offset?): number;
    writeUInt16LE(value, offset?): number;
    writeUInt32BE(value, offset?): number;
    writeUInt32LE(value, offset?): number;
    writeUInt8(value, offset?): number;
    writeUIntBE(value, offset, byteLength): number;
    writeUIntLE(value, offset, byteLength): number;
    writeUint16BE(value, offset?): number;
    writeUint16LE(value, offset?): number;
    writeUint32BE(value, offset?): number;
    writeUint32LE(value, offset?): number;
    writeUint8(value, offset?): number;
    writeUintBE(value, offset, byteLength): number;
    writeUintLE(value, offset, byteLength): number;
}

Hierarchy

  • Uint8Array
    • Buffer

Properties

BYTES_PER_ELEMENT: number

The size in bytes of each element in the array.

+
[toStringTag]: "Uint8Array"
buffer: ArrayBufferLike

The ArrayBuffer instance referenced by the array.

+
byteLength: number

The length in bytes of the array.

+
byteOffset: number

The offset in bytes of the array.

+
length: number

The length of the array.

+

Methods

  • Returns ArrayIterator<number>

  • Takes an integer value and returns the item at that index, +allowing for positive and negative integers. +Negative integers count back from the last item in the array.

    +

    Parameters

    • index: number

    Returns undefined | number

  • Compares buf with target and returns a number indicating whether bufcomes before, after, or is the same as target in sort order. +Comparison is based on the actual sequence of bytes in each Buffer.

    +
      +
    • 0 is returned if target is the same as buf
    • +
    • 1 is returned if target should come beforebuf when sorted.
    • +
    • -1 is returned if target should come afterbuf when sorted.
    • +
    +
    import { Buffer } from 'node:buffer';

    const buf1 = Buffer.from('ABC');
    const buf2 = Buffer.from('BCD');
    const buf3 = Buffer.from('ABCD');

    console.log(buf1.compare(buf1));
    // Prints: 0
    console.log(buf1.compare(buf2));
    // Prints: -1
    console.log(buf1.compare(buf3));
    // Prints: -1
    console.log(buf2.compare(buf1));
    // Prints: 1
    console.log(buf2.compare(buf3));
    // Prints: 1
    console.log([buf1, buf2, buf3].sort(Buffer.compare));
    // Prints: [ <Buffer 41 42 43>, <Buffer 41 42 43 44>, <Buffer 42 43 44> ]
    // (This result is equal to: [buf1, buf3, buf2].) +
    +

    The optional targetStart, targetEnd, sourceStart, and sourceEnd arguments can be used to limit the comparison to specific ranges within target and buf respectively.

    +
    import { Buffer } from 'node:buffer';

    const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);
    const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);

    console.log(buf1.compare(buf2, 5, 9, 0, 4));
    // Prints: 0
    console.log(buf1.compare(buf2, 0, 6, 4));
    // Prints: -1
    console.log(buf1.compare(buf2, 5, 6, 5));
    // Prints: 1 +
    +

    ERR_OUT_OF_RANGE is thrown if targetStart < 0, sourceStart < 0, targetEnd > target.byteLength, or sourceEnd > source.byteLength.

    +

    Parameters

    • target: Uint8Array

      A Buffer or Uint8Array with which to compare buf.

      +
    • Optional targetStart: number

      The offset within target at which to begin comparison.

      +
    • Optional targetEnd: number

      The offset within target at which to end comparison (not inclusive).

      +
    • Optional sourceStart: number

      The offset within buf at which to begin comparison.

      +
    • Optional sourceEnd: number

      The offset within buf at which to end comparison (not inclusive).

      +

    Returns -1 | 0 | 1

    Since

    v0.11.13

    +
  • Copies data from a region of buf to a region in target, even if the targetmemory region overlaps with buf.

    +

    TypedArray.prototype.set() performs the same operation, and is available +for all TypedArrays, including Node.js Buffers, although it takes +different function arguments.

    +
    import { Buffer } from 'node:buffer';

    // Create two `Buffer` instances.
    const buf1 = Buffer.allocUnsafe(26);
    const buf2 = Buffer.allocUnsafe(26).fill('!');

    for (let i = 0; i < 26; i++) {
    // 97 is the decimal ASCII value for 'a'.
    buf1[i] = i + 97;
    }

    // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.
    buf1.copy(buf2, 8, 16, 20);
    // This is equivalent to:
    // buf2.set(buf1.subarray(16, 20), 8);

    console.log(buf2.toString('ascii', 0, 25));
    // Prints: !!!!!!!!qrst!!!!!!!!!!!!! +
    +
    import { Buffer } from 'node:buffer';

    // Create a `Buffer` and copy data from one region to an overlapping region
    // within the same `Buffer`.

    const buf = Buffer.allocUnsafe(26);

    for (let i = 0; i < 26; i++) {
    // 97 is the decimal ASCII value for 'a'.
    buf[i] = i + 97;
    }

    buf.copy(buf, 0, 4, 10);

    console.log(buf.toString());
    // Prints: efghijghijklmnopqrstuvwxyz +
    +

    Parameters

    • target: Uint8Array

      A Buffer or Uint8Array to copy into.

      +
    • Optional targetStart: number

      The offset within target at which to begin writing.

      +
    • Optional sourceStart: number

      The offset within buf from which to begin copying.

      +
    • Optional sourceEnd: number

      The offset within buf at which to stop copying (not inclusive).

      +

    Returns number

    The number of bytes copied.

    +

    Since

    v0.1.90

    +
  • Returns the this object after copying a section of the array identified by start and end +to the same array starting at position target

    +

    Parameters

    • target: number

      If target is negative, it is treated as length+target where length is the +length of the array.

      +
    • start: number

      If start is negative, it is treated as length+start. If end is negative, it +is treated as length+end.

      +
    • Optional end: number

      If not specified, length of the this object is used as its default value.

      +

    Returns this

  • Returns an array of key, value pairs for every entry in the array

    +

    Returns ArrayIterator<[number, number]>

  • Returns true if both buf and otherBuffer have exactly the same bytes,false otherwise. Equivalent to buf.compare(otherBuffer) === 0.

    +
    import { Buffer } from 'node:buffer';

    const buf1 = Buffer.from('ABC');
    const buf2 = Buffer.from('414243', 'hex');
    const buf3 = Buffer.from('ABCD');

    console.log(buf1.equals(buf2));
    // Prints: true
    console.log(buf1.equals(buf3));
    // Prints: false +
    +

    Parameters

    • otherBuffer: Uint8Array

      A Buffer or Uint8Array with which to compare buf.

      +

    Returns boolean

    Since

    v0.11.13

    +
  • Determines whether all the members of an array satisfy the specified test.

    +

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The every method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value false, or until the end of the array.

      +
        • (value, index, array): unknown
        • Parameters

          • value: number
          • index: number
          • array: Uint8Array

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value.

      +

    Returns boolean

  • Fills buf with the specified value. If the offset and end are not given, +the entire buf will be filled:

    +
    import { Buffer } from 'node:buffer';

    // Fill a `Buffer` with the ASCII character 'h'.

    const b = Buffer.allocUnsafe(50).fill('h');

    console.log(b.toString());
    // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

    // Fill a buffer with empty string
    const c = Buffer.allocUnsafe(5).fill('');

    console.log(c.fill(''));
    // Prints: <Buffer 00 00 00 00 00> +
    +

    value is coerced to a uint32 value if it is not a string, Buffer, or +integer. If the resulting integer is greater than 255 (decimal), buf will be +filled with value &#x26; 255.

    +

    If the final write of a fill() operation falls on a multi-byte character, +then only the bytes of that character that fit into buf are written:

    +
    import { Buffer } from 'node:buffer';

    // Fill a `Buffer` with character that takes up two bytes in UTF-8.

    console.log(Buffer.allocUnsafe(5).fill('\u0222'));
    // Prints: <Buffer c8 a2 c8 a2 c8> +
    +

    If value contains invalid characters, it is truncated; if no valid +fill data remains, an exception is thrown:

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(5);

    console.log(buf.fill('a'));
    // Prints: <Buffer 61 61 61 61 61>
    console.log(buf.fill('aazz', 'hex'));
    // Prints: <Buffer aa aa aa aa aa>
    console.log(buf.fill('zz', 'hex'));
    // Throws an exception. +
    +

    Parameters

    • value: string | number | Uint8Array

      The value with which to fill buf. Empty value (string, Uint8Array, Buffer) is coerced to 0.

      +
    • Optional offset: number

      Number of bytes to skip before starting to fill buf.

      +
    • Optional end: number

      Where to stop filling buf (not inclusive).

      +
    • Optional encoding: BufferEncoding

      The encoding for value if value is a string.

      +

    Returns this

    A reference to buf.

    +

    Since

    v0.5.0

    +
  • Returns the elements of an array that meet the condition specified in a callback function.

    +

    Parameters

    • predicate: ((value, index, array) => any)

      A function that accepts up to three arguments. The filter method calls +the predicate function one time for each element in the array.

      +
        • (value, index, array): any
        • Parameters

          • value: number
          • index: number
          • array: Uint8Array

          Returns any

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value.

      +

    Returns Uint8Array

  • Returns the value of the first element in the array where predicate is true, and undefined +otherwise.

    +

    Parameters

    • predicate: ((value, index, obj) => boolean)

      find calls predicate once for each element of the array, in ascending +order, until it finds one where predicate returns true. If such an element is found, find +immediately returns that element value. Otherwise, find returns undefined.

      +
        • (value, index, obj): boolean
        • Parameters

          • value: number
          • index: number
          • obj: Uint8Array

          Returns boolean

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead.

      +

    Returns undefined | number

  • Returns the index of the first element in the array where predicate is true, and -1 +otherwise.

    +

    Parameters

    • predicate: ((value, index, obj) => boolean)

      find calls predicate once for each element of the array, in ascending +order, until it finds one where predicate returns true. If such an element is found, +findIndex immediately returns that element index. Otherwise, findIndex returns -1.

      +
        • (value, index, obj): boolean
        • Parameters

          • value: number
          • index: number
          • obj: Uint8Array

          Returns boolean

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead.

      +

    Returns number

  • Performs the specified action for each element in an array.

    +

    Parameters

    • callbackfn: ((value, index, array) => void)

      A function that accepts up to three arguments. forEach calls the +callbackfn function one time for each element in the array.

      +
        • (value, index, array): void
        • Parameters

          • value: number
          • index: number
          • array: Uint8Array

          Returns void

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. +If thisArg is omitted, undefined is used as the this value.

      +

    Returns void

  • Equivalent to buf.indexOf() !== -1.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from('this is a buffer');

    console.log(buf.includes('this'));
    // Prints: true
    console.log(buf.includes('is'));
    // Prints: true
    console.log(buf.includes(Buffer.from('a buffer')));
    // Prints: true
    console.log(buf.includes(97));
    // Prints: true (97 is the decimal ASCII value for 'a')
    console.log(buf.includes(Buffer.from('a buffer example')));
    // Prints: false
    console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));
    // Prints: true
    console.log(buf.includes('this', 4));
    // Prints: false +
    +

    Parameters

    • value: string | number | Buffer

      What to search for.

      +
    • Optional byteOffset: number

      Where to begin searching in buf. If negative, then offset is calculated from the end of buf.

      +
    • Optional encoding: BufferEncoding

      If value is a string, this is its encoding.

      +

    Returns boolean

    true if value was found in buf, false otherwise.

    +

    Since

    v5.3.0

    +
  • If value is:

    +
      +
    • a string, value is interpreted according to the character encoding in encoding.
    • +
    • a Buffer or Uint8Array, value will be used in its entirety. +To compare a partial Buffer, use buf.subarray.
    • +
    • a number, value will be interpreted as an unsigned 8-bit integer +value between 0 and 255.
    • +
    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from('this is a buffer');

    console.log(buf.indexOf('this'));
    // Prints: 0
    console.log(buf.indexOf('is'));
    // Prints: 2
    console.log(buf.indexOf(Buffer.from('a buffer')));
    // Prints: 8
    console.log(buf.indexOf(97));
    // Prints: 8 (97 is the decimal ASCII value for 'a')
    console.log(buf.indexOf(Buffer.from('a buffer example')));
    // Prints: -1
    console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));
    // Prints: 8

    const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');

    console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le'));
    // Prints: 4
    console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le'));
    // Prints: 6 +
    +

    If value is not a string, number, or Buffer, this method will throw a TypeError. If value is a number, it will be coerced to a valid byte value, +an integer between 0 and 255.

    +

    If byteOffset is not a number, it will be coerced to a number. If the result +of coercion is NaN or 0, then the entire buffer will be searched. This +behavior matches String.prototype.indexOf().

    +
    import { Buffer } from 'node:buffer';

    const b = Buffer.from('abcdef');

    // Passing a value that's a number, but not a valid byte.
    // Prints: 2, equivalent to searching for 99 or 'c'.
    console.log(b.indexOf(99.9));
    console.log(b.indexOf(256 + 99));

    // Passing a byteOffset that coerces to NaN or 0.
    // Prints: 1, searching the whole buffer.
    console.log(b.indexOf('b', undefined));
    console.log(b.indexOf('b', {}));
    console.log(b.indexOf('b', null));
    console.log(b.indexOf('b', [])); +
    +

    If value is an empty string or empty Buffer and byteOffset is less +than buf.length, byteOffset will be returned. If value is empty andbyteOffset is at least buf.length, buf.length will be returned.

    +

    Parameters

    • value: string | number | Uint8Array

      What to search for.

      +
    • Optional byteOffset: number

      Where to begin searching in buf. If negative, then offset is calculated from the end of buf.

      +
    • Optional encoding: BufferEncoding

      If value is a string, this is the encoding used to determine the binary representation of the string that will be searched for in buf.

      +

    Returns number

    The index of the first occurrence of value in buf, or -1 if buf does not contain value.

    +

    Since

    v1.5.0

    +
  • Adds all the elements of an array separated by the specified separator string.

    +

    Parameters

    • Optional separator: string

      A string used to separate one element of an array from the next in the +resulting String. If omitted, the array elements are separated with a comma.

      +

    Returns string

  • Returns an list of keys in the array

    +

    Returns ArrayIterator<number>

  • Identical to buf.indexOf(), except the last occurrence of value is found +rather than the first occurrence.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from('this buffer is a buffer');

    console.log(buf.lastIndexOf('this'));
    // Prints: 0
    console.log(buf.lastIndexOf('buffer'));
    // Prints: 17
    console.log(buf.lastIndexOf(Buffer.from('buffer')));
    // Prints: 17
    console.log(buf.lastIndexOf(97));
    // Prints: 15 (97 is the decimal ASCII value for 'a')
    console.log(buf.lastIndexOf(Buffer.from('yolo')));
    // Prints: -1
    console.log(buf.lastIndexOf('buffer', 5));
    // Prints: 5
    console.log(buf.lastIndexOf('buffer', 4));
    // Prints: -1

    const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');

    console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le'));
    // Prints: 6
    console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le'));
    // Prints: 4 +
    +

    If value is not a string, number, or Buffer, this method will throw a TypeError. If value is a number, it will be coerced to a valid byte value, +an integer between 0 and 255.

    +

    If byteOffset is not a number, it will be coerced to a number. Any arguments +that coerce to NaN, like {} or undefined, will search the whole buffer. +This behavior matches String.prototype.lastIndexOf().

    +
    import { Buffer } from 'node:buffer';

    const b = Buffer.from('abcdef');

    // Passing a value that's a number, but not a valid byte.
    // Prints: 2, equivalent to searching for 99 or 'c'.
    console.log(b.lastIndexOf(99.9));
    console.log(b.lastIndexOf(256 + 99));

    // Passing a byteOffset that coerces to NaN.
    // Prints: 1, searching the whole buffer.
    console.log(b.lastIndexOf('b', undefined));
    console.log(b.lastIndexOf('b', {}));

    // Passing a byteOffset that coerces to 0.
    // Prints: -1, equivalent to passing 0.
    console.log(b.lastIndexOf('b', null));
    console.log(b.lastIndexOf('b', [])); +
    +

    If value is an empty string or empty Buffer, byteOffset will be returned.

    +

    Parameters

    • value: string | number | Uint8Array

      What to search for.

      +
    • Optional byteOffset: number

      Where to begin searching in buf. If negative, then offset is calculated from the end of buf.

      +
    • Optional encoding: BufferEncoding

      If value is a string, this is the encoding used to determine the binary representation of the string that will be searched for in buf.

      +

    Returns number

    The index of the last occurrence of value in buf, or -1 if buf does not contain value.

    +

    Since

    v6.0.0

    +
  • Calls a defined callback function on each element of an array, and returns an array that +contains the results.

    +

    Parameters

    • callbackfn: ((value, index, array) => number)

      A function that accepts up to three arguments. The map method calls the +callbackfn function one time for each element in the array.

      +
        • (value, index, array): number
        • Parameters

          • value: number
          • index: number
          • array: Uint8Array

          Returns number

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. +If thisArg is omitted, undefined is used as the this value.

      +

    Returns Uint8Array

  • Reads a signed, big-endian 64-bit integer from buf at the specified offset.

    +

    Integers read from a Buffer are interpreted as two's complement signed +values.

    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns bigint

    Since

    v12.0.0, v10.20.0

    +
  • Reads a signed, little-endian 64-bit integer from buf at the specifiedoffset.

    +

    Integers read from a Buffer are interpreted as two's complement signed +values.

    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns bigint

    Since

    v12.0.0, v10.20.0

    +
  • Reads an unsigned, big-endian 64-bit integer from buf at the specifiedoffset.

    +

    This function is also available under the readBigUint64BE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);

    console.log(buf.readBigUInt64BE(0));
    // Prints: 4294967295n +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns bigint

    Since

    v12.0.0, v10.20.0

    +
  • Reads an unsigned, little-endian 64-bit integer from buf at the specifiedoffset.

    +

    This function is also available under the readBigUint64LE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);

    console.log(buf.readBigUInt64LE(0));
    // Prints: 18446744069414584320n +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns bigint

    Since

    v12.0.0, v10.20.0

    +
  • Parameters

    • Optional offset: number

    Returns bigint

    Alias

    Buffer.readBigUInt64BE

    +

    Since

    v14.10.0, v12.19.0

    +
  • Parameters

    • Optional offset: number

    Returns bigint

    Alias

    Buffer.readBigUInt64LE

    +

    Since

    v14.10.0, v12.19.0

    +
  • Reads a 64-bit, big-endian double from buf at the specified offset.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);

    console.log(buf.readDoubleBE(0));
    // Prints: 8.20788039913184e-304 +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 8.

      +

    Returns number

    Since

    v0.11.15

    +
  • Reads a 64-bit, little-endian double from buf at the specified offset.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);

    console.log(buf.readDoubleLE(0));
    // Prints: 5.447603722011605e-270
    console.log(buf.readDoubleLE(1));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 8.

      +

    Returns number

    Since

    v0.11.15

    +
  • Reads a 32-bit, big-endian float from buf at the specified offset.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([1, 2, 3, 4]);

    console.log(buf.readFloatBE(0));
    // Prints: 2.387939260590663e-38 +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    Since

    v0.11.15

    +
  • Reads a 32-bit, little-endian float from buf at the specified offset.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([1, 2, 3, 4]);

    console.log(buf.readFloatLE(0));
    // Prints: 1.539989614439558e-36
    console.log(buf.readFloatLE(1));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    Since

    v0.11.15

    +
  • Reads a signed, big-endian 16-bit integer from buf at the specified offset.

    +

    Integers read from a Buffer are interpreted as two's complement signed values.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0, 5]);

    console.log(buf.readInt16BE(0));
    // Prints: 5 +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads a signed, little-endian 16-bit integer from buf at the specifiedoffset.

    +

    Integers read from a Buffer are interpreted as two's complement signed values.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0, 5]);

    console.log(buf.readInt16LE(0));
    // Prints: 1280
    console.log(buf.readInt16LE(1));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads a signed, big-endian 32-bit integer from buf at the specified offset.

    +

    Integers read from a Buffer are interpreted as two's complement signed values.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0, 0, 0, 5]);

    console.log(buf.readInt32BE(0));
    // Prints: 5 +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads a signed, little-endian 32-bit integer from buf at the specifiedoffset.

    +

    Integers read from a Buffer are interpreted as two's complement signed values.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0, 0, 0, 5]);

    console.log(buf.readInt32LE(0));
    // Prints: 83886080
    console.log(buf.readInt32LE(1));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads a signed 8-bit integer from buf at the specified offset.

    +

    Integers read from a Buffer are interpreted as two's complement signed values.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([-1, 5]);

    console.log(buf.readInt8(0));
    // Prints: -1
    console.log(buf.readInt8(1));
    // Prints: 5
    console.log(buf.readInt8(2));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1.

      +

    Returns number

    Since

    v0.5.0

    +
  • Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, two's complement signed value +supporting up to 48 bits of accuracy.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

    console.log(buf.readIntBE(0, 6).toString(16));
    // Prints: 1234567890ab
    console.log(buf.readIntBE(1, 6).toString(16));
    // Throws ERR_OUT_OF_RANGE.
    console.log(buf.readIntBE(1, 0).toString(16));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to read. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    Since

    v0.11.15

    +
  • Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, two's complement signed value +supporting up to 48 bits of accuracy.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

    console.log(buf.readIntLE(0, 6).toString(16));
    // Prints: -546f87a9cbee +
    +

    Parameters

    • offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to read. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    Since

    v0.11.15

    +
  • Reads an unsigned, big-endian 16-bit integer from buf at the specifiedoffset.

    +

    This function is also available under the readUint16BE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56]);

    console.log(buf.readUInt16BE(0).toString(16));
    // Prints: 1234
    console.log(buf.readUInt16BE(1).toString(16));
    // Prints: 3456 +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads an unsigned, little-endian 16-bit integer from buf at the specified offset.

    +

    This function is also available under the readUint16LE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56]);

    console.log(buf.readUInt16LE(0).toString(16));
    // Prints: 3412
    console.log(buf.readUInt16LE(1).toString(16));
    // Prints: 5634
    console.log(buf.readUInt16LE(2).toString(16));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads an unsigned, big-endian 32-bit integer from buf at the specifiedoffset.

    +

    This function is also available under the readUint32BE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);

    console.log(buf.readUInt32BE(0).toString(16));
    // Prints: 12345678 +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads an unsigned, little-endian 32-bit integer from buf at the specifiedoffset.

    +

    This function is also available under the readUint32LE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);

    console.log(buf.readUInt32LE(0).toString(16));
    // Prints: 78563412
    console.log(buf.readUInt32LE(1).toString(16));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    Since

    v0.5.5

    +
  • Reads an unsigned 8-bit integer from buf at the specified offset.

    +

    This function is also available under the readUint8 alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([1, -2]);

    console.log(buf.readUInt8(0));
    // Prints: 1
    console.log(buf.readUInt8(1));
    // Prints: 254
    console.log(buf.readUInt8(2));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • Optional offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1.

      +

    Returns number

    Since

    v0.5.0

    +
  • Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned big-endian integer supporting +up to 48 bits of accuracy.

    +

    This function is also available under the readUintBE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

    console.log(buf.readUIntBE(0, 6).toString(16));
    // Prints: 1234567890ab
    console.log(buf.readUIntBE(1, 6).toString(16));
    // Throws ERR_OUT_OF_RANGE. +
    +

    Parameters

    • offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to read. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    Since

    v0.11.15

    +
  • Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, little-endian integer supporting +up to 48 bits of accuracy.

    +

    This function is also available under the readUintLE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

    console.log(buf.readUIntLE(0, 6).toString(16));
    // Prints: ab9078563412 +
    +

    Parameters

    • offset: number

      Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to read. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    Since

    v0.11.15

    +
  • Parameters

    • Optional offset: number

    Returns number

    Alias

    Buffer.readUInt16BE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • Optional offset: number

    Returns number

    Alias

    Buffer.readUInt16LE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • Optional offset: number

    Returns number

    Alias

    Buffer.readUInt32BE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • Optional offset: number

    Returns number

    Alias

    Buffer.readUInt32LE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • Optional offset: number

    Returns number

    Alias

    Buffer.readUInt8

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • offset: number
    • byteLength: number

    Returns number

    Alias

    Buffer.readUIntBE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • offset: number
    • byteLength: number

    Returns number

    Alias

    Buffer.readUIntLE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Calls the specified callback function for all the elements in an array. The return value of +the callback function is the accumulated result, and is provided as an argument in the next +call to the callback function.

    +

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => number)

      A function that accepts up to four arguments. The reduce method calls the +callbackfn function one time for each element in the array.

      +
        • (previousValue, currentValue, currentIndex, array): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • array: Uint8Array

          Returns number

    Returns number

  • Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => number)
        • (previousValue, currentValue, currentIndex, array): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • array: Uint8Array

          Returns number

    • initialValue: number

    Returns number

  • Calls the specified callback function for all the elements in an array. The return value of +the callback function is the accumulated result, and is provided as an argument in the next +call to the callback function.

    +

    Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

      A function that accepts up to four arguments. The reduce method calls the +callbackfn function one time for each element in the array.

      +
        • (previousValue, currentValue, currentIndex, array): U
        • Parameters

          • previousValue: U
          • currentValue: number
          • currentIndex: number
          • array: Uint8Array

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start +the accumulation. The first call to the callbackfn function provides this value as an argument +instead of an array value.

      +

    Returns U

  • Calls the specified callback function for all the elements in an array, in descending order. +The return value of the callback function is the accumulated result, and is provided as an +argument in the next call to the callback function.

    +

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => number)

      A function that accepts up to four arguments. The reduceRight method calls +the callbackfn function one time for each element in the array.

      +
        • (previousValue, currentValue, currentIndex, array): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • array: Uint8Array

          Returns number

    Returns number

  • Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => number)
        • (previousValue, currentValue, currentIndex, array): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • array: Uint8Array

          Returns number

    • initialValue: number

    Returns number

  • Calls the specified callback function for all the elements in an array, in descending order. +The return value of the callback function is the accumulated result, and is provided as an +argument in the next call to the callback function.

    +

    Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

      A function that accepts up to four arguments. The reduceRight method calls +the callbackfn function one time for each element in the array.

      +
        • (previousValue, currentValue, currentIndex, array): U
        • Parameters

          • previousValue: U
          • currentValue: number
          • currentIndex: number
          • array: Uint8Array

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start +the accumulation. The first call to the callbackfn function provides this value as an argument +instead of an array value.

      +

    Returns U

  • Returns this

  • Sets a value or an array of values.

    +

    Parameters

    • array: ArrayLike<number>

      A typed or untyped array of values to set.

      +
    • Optional offset: number

      The index in the current array at which the values are to be written.

      +

    Returns void

  • Returns a new Buffer that references the same memory as the original, but +offset and cropped by the start and end indices.

    +

    This method is not compatible with the Uint8Array.prototype.slice(), +which is a superclass of Buffer. To copy the slice, useUint8Array.prototype.slice().

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from('buffer');

    const copiedBuf = Uint8Array.prototype.slice.call(buf);
    copiedBuf[0]++;
    console.log(copiedBuf.toString());
    // Prints: cuffer

    console.log(buf.toString());
    // Prints: buffer

    // With buf.slice(), the original buffer is modified.
    const notReallyCopiedBuf = buf.slice();
    notReallyCopiedBuf[0]++;
    console.log(notReallyCopiedBuf.toString());
    // Prints: cuffer
    console.log(buf.toString());
    // Also prints: cuffer (!) +
    +

    Parameters

    • Optional start: number

      Where the new Buffer will start.

      +
    • Optional end: number

      Where the new Buffer will end (not inclusive).

      +

    Returns Buffer

    Since

    v0.3.0

    +

    Deprecated

    Use subarray instead.

    +
  • Determines whether the specified callback function returns true for any element of an array.

    +

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The some method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value true, or until the end of the array.

      +
        • (value, index, array): unknown
        • Parameters

          • value: number
          • index: number
          • array: Uint8Array

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value.

      +

    Returns boolean

  • Sorts an array.

    +

    Parameters

    • Optional compareFn: ((a, b) => number)

      Function used to determine the order of the elements. It is expected to return +a negative value if first argument is less than second argument, zero if they're equal and a positive +value otherwise. If omitted, the elements are sorted in ascending order.

      +
      [11,2,22,1].sort((a, b) => a - b)
      +
      +
        • (a, b): number
        • Parameters

          • a: number
          • b: number

          Returns number

    Returns this

  • Returns a new Buffer that references the same memory as the original, but +offset and cropped by the start and end indices.

    +

    Specifying end greater than buf.length will return the same result as +that of end equal to buf.length.

    +

    This method is inherited from TypedArray.prototype.subarray().

    +

    Modifying the new Buffer slice will modify the memory in the original Bufferbecause the allocated memory of the two objects overlap.

    +
    import { Buffer } from 'node:buffer';

    // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
    // from the original `Buffer`.

    const buf1 = Buffer.allocUnsafe(26);

    for (let i = 0; i < 26; i++) {
    // 97 is the decimal ASCII value for 'a'.
    buf1[i] = i + 97;
    }

    const buf2 = buf1.subarray(0, 3);

    console.log(buf2.toString('ascii', 0, buf2.length));
    // Prints: abc

    buf1[0] = 33;

    console.log(buf2.toString('ascii', 0, buf2.length));
    // Prints: !bc +
    +

    Specifying negative indexes causes the slice to be generated relative to the +end of buf rather than the beginning.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from('buffer');

    console.log(buf.subarray(-6, -1).toString());
    // Prints: buffe
    // (Equivalent to buf.subarray(0, 5).)

    console.log(buf.subarray(-6, -2).toString());
    // Prints: buff
    // (Equivalent to buf.subarray(0, 4).)

    console.log(buf.subarray(-5, -2).toString());
    // Prints: uff
    // (Equivalent to buf.subarray(1, 4).) +
    +

    Parameters

    • Optional start: number

      Where the new Buffer will start.

      +
    • Optional end: number

      Where the new Buffer will end (not inclusive).

      +

    Returns Buffer

    Since

    v3.0.0

    +
  • Interprets buf as an array of unsigned 16-bit integers and swaps the +byte order in-place. Throws ERR_INVALID_BUFFER_SIZE if buf.length is not a multiple of 2.

    +
    import { Buffer } from 'node:buffer';

    const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);

    console.log(buf1);
    // Prints: <Buffer 01 02 03 04 05 06 07 08>

    buf1.swap16();

    console.log(buf1);
    // Prints: <Buffer 02 01 04 03 06 05 08 07>

    const buf2 = Buffer.from([0x1, 0x2, 0x3]);

    buf2.swap16();
    // Throws ERR_INVALID_BUFFER_SIZE. +
    +

    One convenient use of buf.swap16() is to perform a fast in-place conversion +between UTF-16 little-endian and UTF-16 big-endian:

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from('This is little-endian UTF-16', 'utf16le');
    buf.swap16(); // Convert to big-endian UTF-16 text. +
    +

    Returns Buffer

    A reference to buf.

    +

    Since

    v5.10.0

    +
  • Interprets buf as an array of unsigned 32-bit integers and swaps the +byte order in-place. Throws ERR_INVALID_BUFFER_SIZE if buf.length is not a multiple of 4.

    +
    import { Buffer } from 'node:buffer';

    const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);

    console.log(buf1);
    // Prints: <Buffer 01 02 03 04 05 06 07 08>

    buf1.swap32();

    console.log(buf1);
    // Prints: <Buffer 04 03 02 01 08 07 06 05>

    const buf2 = Buffer.from([0x1, 0x2, 0x3]);

    buf2.swap32();
    // Throws ERR_INVALID_BUFFER_SIZE. +
    +

    Returns Buffer

    A reference to buf.

    +

    Since

    v5.10.0

    +
  • Interprets buf as an array of 64-bit numbers and swaps byte order in-place. +Throws ERR_INVALID_BUFFER_SIZE if buf.length is not a multiple of 8.

    +
    import { Buffer } from 'node:buffer';

    const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);

    console.log(buf1);
    // Prints: <Buffer 01 02 03 04 05 06 07 08>

    buf1.swap64();

    console.log(buf1);
    // Prints: <Buffer 08 07 06 05 04 03 02 01>

    const buf2 = Buffer.from([0x1, 0x2, 0x3]);

    buf2.swap64();
    // Throws ERR_INVALID_BUFFER_SIZE. +
    +

    Returns Buffer

    A reference to buf.

    +

    Since

    v6.3.0

    +
  • Returns a JSON representation of buf. JSON.stringify() implicitly calls +this function when stringifying a Buffer instance.

    +

    Buffer.from() accepts objects in the format returned from this method. +In particular, Buffer.from(buf.toJSON()) works like Buffer.from(buf).

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);
    const json = JSON.stringify(buf);

    console.log(json);
    // Prints: {"type":"Buffer","data":[1,2,3,4,5]}

    const copy = JSON.parse(json, (key, value) => {
    return value &#x26;&#x26; value.type === 'Buffer' ?
    Buffer.from(value) :
    value;
    });

    console.log(copy);
    // Prints: <Buffer 01 02 03 04 05> +
    +

    Returns {
        data: number[];
        type: "Buffer";
    }

    • data: number[]
    • type: "Buffer"

    Since

    v0.9.2

    +
  • Converts a number to a string by using the current locale.

    +

    Returns string

  • Parameters

    • locales: string | string[]
    • Optional options: NumberFormatOptions

    Returns string

  • Decodes buf to a string according to the specified character encoding inencoding. start and end may be passed to decode only a subset of buf.

    +

    If encoding is 'utf8' and a byte sequence in the input is not valid UTF-8, +then each invalid byte is replaced with the replacement character U+FFFD.

    +

    The maximum length of a string instance (in UTF-16 code units) is available +as constants.MAX_STRING_LENGTH.

    +
    import { Buffer } from 'node:buffer';

    const buf1 = Buffer.allocUnsafe(26);

    for (let i = 0; i < 26; i++) {
    // 97 is the decimal ASCII value for 'a'.
    buf1[i] = i + 97;
    }

    console.log(buf1.toString('utf8'));
    // Prints: abcdefghijklmnopqrstuvwxyz
    console.log(buf1.toString('utf8', 0, 5));
    // Prints: abcde

    const buf2 = Buffer.from('tést');

    console.log(buf2.toString('hex'));
    // Prints: 74c3a97374
    console.log(buf2.toString('utf8', 0, 3));
    // Prints: té
    console.log(buf2.toString(undefined, 0, 3));
    // Prints: té +
    +

    Parameters

    • Optional encoding: BufferEncoding

      The character encoding to use.

      +
    • Optional start: number

      The byte offset to start decoding at.

      +
    • Optional end: number

      The byte offset to stop decoding at (not inclusive).

      +

    Returns string

    Since

    v0.1.90

    +
  • Returns the primitive value of the specified object.

    +

    Returns Uint8Array

  • Returns an list of values in the array

    +

    Returns ArrayIterator<number>

  • Writes string to buf at offset according to the character encoding inencoding. The length parameter is the number of bytes to write. If buf did +not contain enough space to fit the entire string, only part of string will be +written. However, partially encoded characters will not be written.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.alloc(256);

    const len = buf.write('\u00bd + \u00bc = \u00be', 0);

    console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
    // Prints: 12 bytes: ½ + ¼ = ¾

    const buffer = Buffer.alloc(10);

    const length = buffer.write('abcd', 8);

    console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);
    // Prints: 2 bytes : ab +
    +

    Parameters

    • string: string

      String to write to buf.

      +
    • Optional encoding: BufferEncoding

      The character encoding of string.

      +

    Returns number

    Number of bytes written.

    +

    Since

    v0.1.90

    +
  • Parameters

    • string: string
    • offset: number
    • Optional encoding: BufferEncoding

    Returns number

  • Parameters

    • string: string
    • offset: number
    • length: number
    • Optional encoding: BufferEncoding

    Returns number

  • Writes value to buf at the specified offset as big-endian.

    +

    value is interpreted and written as a two's complement signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(8);

    buf.writeBigInt64BE(0x0102030405060708n, 0);

    console.log(buf);
    // Prints: <Buffer 01 02 03 04 05 06 07 08> +
    +

    Parameters

    • value: bigint

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v12.0.0, v10.20.0

    +
  • Writes value to buf at the specified offset as little-endian.

    +

    value is interpreted and written as a two's complement signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(8);

    buf.writeBigInt64LE(0x0102030405060708n, 0);

    console.log(buf);
    // Prints: <Buffer 08 07 06 05 04 03 02 01> +
    +

    Parameters

    • value: bigint

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v12.0.0, v10.20.0

    +
  • Writes value to buf at the specified offset as big-endian.

    +

    This function is also available under the writeBigUint64BE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(8);

    buf.writeBigUInt64BE(0xdecafafecacefaden, 0);

    console.log(buf);
    // Prints: <Buffer de ca fa fe ca ce fa de> +
    +

    Parameters

    • value: bigint

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v12.0.0, v10.20.0

    +
  • Writes value to buf at the specified offset as little-endian

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(8);

    buf.writeBigUInt64LE(0xdecafafecacefaden, 0);

    console.log(buf);
    // Prints: <Buffer de fa ce ca fe fa ca de> +
    +

    This function is also available under the writeBigUint64LE alias.

    +

    Parameters

    • value: bigint

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v12.0.0, v10.20.0

    +
  • Parameters

    • value: bigint
    • Optional offset: number

    Returns number

    Alias

    Buffer.writeBigUInt64BE

    +

    Since

    v14.10.0, v12.19.0

    +
  • Parameters

    • value: bigint
    • Optional offset: number

    Returns number

    Alias

    Buffer.writeBigUInt64LE

    +

    Since

    v14.10.0, v12.19.0

    +
  • Writes value to buf at the specified offset as big-endian. The value must be a JavaScript number. Behavior is undefined when value is anything +other than a JavaScript number.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(8);

    buf.writeDoubleBE(123.456, 0);

    console.log(buf);
    // Prints: <Buffer 40 5e dd 2f 1a 9f be 77> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 8.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.11.15

    +
  • Writes value to buf at the specified offset as little-endian. The value must be a JavaScript number. Behavior is undefined when value is anything +other than a JavaScript number.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(8);

    buf.writeDoubleLE(123.456, 0);

    console.log(buf);
    // Prints: <Buffer 77 be 9f 1a 2f dd 5e 40> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 8.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.11.15

    +
  • Writes value to buf at the specified offset as big-endian. Behavior is +undefined when value is anything other than a JavaScript number.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeFloatBE(0xcafebabe, 0);

    console.log(buf);
    // Prints: <Buffer 4f 4a fe bb> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.11.15

    +
  • Writes value to buf at the specified offset as little-endian. Behavior is +undefined when value is anything other than a JavaScript number.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeFloatLE(0xcafebabe, 0);

    console.log(buf);
    // Prints: <Buffer bb fe 4a 4f> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.11.15

    +
  • Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer. Behavior is undefined when value is +anything other than a signed 16-bit integer.

    +

    The value is interpreted and written as a two's complement signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(2);

    buf.writeInt16BE(0x0102, 0);

    console.log(buf);
    // Prints: <Buffer 01 02> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer. Behavior is undefined when value is +anything other than a signed 16-bit integer.

    +

    The value is interpreted and written as a two's complement signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(2);

    buf.writeInt16LE(0x0304, 0);

    console.log(buf);
    // Prints: <Buffer 04 03> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. Behavior is undefined when value is +anything other than a signed 32-bit integer.

    +

    The value is interpreted and written as a two's complement signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeInt32BE(0x01020304, 0);

    console.log(buf);
    // Prints: <Buffer 01 02 03 04> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. Behavior is undefined when value is +anything other than a signed 32-bit integer.

    +

    The value is interpreted and written as a two's complement signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeInt32LE(0x05060708, 0);

    console.log(buf);
    // Prints: <Buffer 08 07 06 05> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset. value must be a valid +signed 8-bit integer. Behavior is undefined when value is anything other than +a signed 8-bit integer.

    +

    value is interpreted and written as a two's complement signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(2);

    buf.writeInt8(2, 0);
    buf.writeInt8(-2, 1);

    console.log(buf);
    // Prints: <Buffer 02 fe> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.0

    +
  • Writes byteLength bytes of value to buf at the specified offsetas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined whenvalue is anything other than a +signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(6);

    buf.writeIntBE(0x1234567890ab, 0, 6);

    console.log(buf);
    // Prints: <Buffer 12 34 56 78 90 ab> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to write. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.11.15

    +
  • Writes byteLength bytes of value to buf at the specified offsetas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined +when value is anything other than a signed integer.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(6);

    buf.writeIntLE(0x1234567890ab, 0, 6);

    console.log(buf);
    // Prints: <Buffer ab 90 78 56 34 12> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to write. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.11.15

    +
  • Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. Behavior is undefined when valueis anything other than an +unsigned 16-bit integer.

    +

    This function is also available under the writeUint16BE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeUInt16BE(0xdead, 0);
    buf.writeUInt16BE(0xbeef, 2);

    console.log(buf);
    // Prints: <Buffer de ad be ef> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. Behavior is undefined when value is +anything other than an unsigned 16-bit integer.

    +

    This function is also available under the writeUint16LE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeUInt16LE(0xdead, 0);
    buf.writeUInt16LE(0xbeef, 2);

    console.log(buf);
    // Prints: <Buffer ad de ef be> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. Behavior is undefined when valueis anything other than an +unsigned 32-bit integer.

    +

    This function is also available under the writeUint32BE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeUInt32BE(0xfeedface, 0);

    console.log(buf);
    // Prints: <Buffer fe ed fa ce> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. Behavior is undefined when value is +anything other than an unsigned 32-bit integer.

    +

    This function is also available under the writeUint32LE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeUInt32LE(0xfeedface, 0);

    console.log(buf);
    // Prints: <Buffer ce fa ed fe> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes value to buf at the specified offset. value must be a +valid unsigned 8-bit integer. Behavior is undefined when value is anything +other than an unsigned 8-bit integer.

    +

    This function is also available under the writeUint8 alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(4);

    buf.writeUInt8(0x3, 0);
    buf.writeUInt8(0x4, 1);
    buf.writeUInt8(0x23, 2);
    buf.writeUInt8(0x42, 3);

    console.log(buf);
    // Prints: <Buffer 03 04 23 42> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • Optional offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.0

    +
  • Writes byteLength bytes of value to buf at the specified offsetas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined +when value is anything other than an unsigned integer.

    +

    This function is also available under the writeUintBE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(6);

    buf.writeUIntBE(0x1234567890ab, 0, 6);

    console.log(buf);
    // Prints: <Buffer 12 34 56 78 90 ab> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to write. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Writes byteLength bytes of value to buf at the specified offsetas little-endian. Supports up to 48 bits of accuracy. Behavior is undefined +when value is anything other than an unsigned integer.

    +

    This function is also available under the writeUintLE alias.

    +
    import { Buffer } from 'node:buffer';

    const buf = Buffer.allocUnsafe(6);

    buf.writeUIntLE(0x1234567890ab, 0, 6);

    console.log(buf);
    // Prints: <Buffer ab 90 78 56 34 12> +
    +

    Parameters

    • value: number

      Number to be written to buf.

      +
    • offset: number

      Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength.

      +
    • byteLength: number

      Number of bytes to write. Must satisfy 0 < byteLength <= 6.

      +

    Returns number

    offset plus the number of bytes written.

    +

    Since

    v0.5.5

    +
  • Parameters

    • value: number
    • Optional offset: number

    Returns number

    Alias

    Buffer.writeUInt16BE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • value: number
    • Optional offset: number

    Returns number

    Alias

    Buffer.writeUInt16LE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • value: number
    • Optional offset: number

    Returns number

    Alias

    Buffer.writeUInt32BE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • value: number
    • Optional offset: number

    Returns number

    Alias

    Buffer.writeUInt32LE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • value: number
    • Optional offset: number

    Returns number

    Alias

    Buffer.writeUInt8

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • value: number
    • offset: number
    • byteLength: number

    Returns number

    Alias

    Buffer.writeUIntBE

    +

    Since

    v14.9.0, v12.19.0

    +
  • Parameters

    • value: number
    • offset: number
    • byteLength: number

    Returns number

    Alias

    Buffer.writeUIntLE

    +

    Since

    v14.9.0, v12.19.0

    +
\ No newline at end of file diff --git a/modules/_zk_kit_baby_jubjub.html b/modules/_zk_kit_baby_jubjub.html new file mode 100644 index 000000000..522cb255a --- /dev/null +++ b/modules/_zk_kit_baby_jubjub.html @@ -0,0 +1,78 @@ +@zk-kit/baby-jubjub | zk-kit

Module @zk-kit/baby-jubjub

+

+ Baby Jubjub +

+

A JavaScript library for adding points to the Baby Jubjub curve.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + +
+

[!NOTE]
This library has been audited as part of the Semaphore V4 PSE audit: https://semaphore.pse.dev/Semaphore_4.0.0_Audit.pdf.

+
+

BabyJubJub is an elliptic curve optimized for secure, efficient cryptographic operations in constrained environments like blockchain and zero-knowledge proofs. It's designed for fast, privacy-preserving transactions, balancing cryptographic strength with performance, making it ideal for modern cryptographic solutions.

+

References

    +
  1. Barry WhiteHat, Marta Bellés, Jordi Baylina. ERC-2494: Baby Jubjub Elliptic Curve. 2020-01-29. https://eips.ethereum.org/EIPS/eip-2494.
  2. +
  3. Barry WhiteHat, Marta Bellés, Jordi Baylina. Baby Jubjub Elliptic Curve. https://docs.iden3.io/publications/pdfs/Baby-Jubjub.pdf
  4. +
+
+

🛠 Install

npm or yarn

Install the @zk-kit/baby-jubjub package and its peer dependencies with npm:

+
npm i @zk-kit/baby-jubjub
+
+

or yarn:

+
yarn add @zk-kit/baby-jubjub
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/baby-jubjub"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/baby-jubjub"></script>
+
+

📜 Usage

import { packPoint, unpackPoint, Base8, mulPointEscalar, Point, addPoint } from "@zk-kit/baby-jubjub"

// Define two points on the BabyJubJub curve.
const p1: Point<bigint> = [BigInt(0), BigInt(1)] // Point at infinity (neutral element).
const p2: Point<bigint> = [BigInt(1), BigInt(0)] // Example point.

// Add the two points on the curve.
const p3 = addPoint(p1, p2)

// Add the result with Base8, another point on the curve, to get a new point.
const secretScalar = addPoint(Base8, p3)

// Multiply the base point by the x-coordinate of the secret scalar to get the public key.
const publicKey = mulPointEscalar(Base8, secretScalar[0])

// Pack the public key into a compressed format.
const packedPoint = packPoint(publicKey)

// Unpack the compressed public key back into its original form.
const unpackedPoint = unpackPoint(packedPoint)

if (unpackedPoint) {
console.log(publicKey[0] === unpackedPoint[0]) // true, checks if x-coordinates match
console.log(publicKey[1] === unpackedPoint[1]) // true, checks if y-coordinates match
} +
+

Index

Type Aliases

Variables

Functions

\ No newline at end of file diff --git a/modules/_zk_kit_eddsa_poseidon.html b/modules/_zk_kit_eddsa_poseidon.html new file mode 100644 index 000000000..1371cbb2b --- /dev/null +++ b/modules/_zk_kit_eddsa_poseidon.html @@ -0,0 +1,91 @@ +@zk-kit/eddsa-poseidon | zk-kit

Module @zk-kit/eddsa-poseidon

+

+ EdDSA Poseidon +

+

A JavaScript EdDSA library for secure signing and verification using Poseidon and the Baby Jubjub elliptic curve.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + + + + + + + +
This package offers a simplified JavaScript codebase essential for creating and validating digital signatures using EdDSA and Poseidon. It's built upon the Baby Jubjub elliptic curve, ensuring seamless integration with Circom and enhancing the developer experience.
+
+

[!NOTE]
This library has been audited as part of the Semaphore V4 PSE audit: https://semaphore.pse.dev/Semaphore_4.0.0_Audit.pdf.

+
+
    +
  • Super lightweight: ~33kB (minified)
  • +
  • Compatible with browsers and NodeJS
  • +
  • TS type support
  • +
  • Comprehensive code documentation
  • +
  • Full test coverage
  • +
+

👾 Would you like to try it now? Explore it now on Ceditor!

+

References

    +
  1. Barry WhiteHat, Marta Bellés, Jordi Baylina. ERC-2494: Baby Jubjub Elliptic Curve. 2020-01-29. https://eips.ethereum.org/EIPS/eip-2494.
  2. +
  3. Lorenzo Grassi, Dmitry Khovratovich, Christian Rechberger, Arnab Roy, and Markus Schofnegger. POSEIDON: A New Hash Function for Zero-Knowledge Proof Systems. 2019. https://eprint.iacr.org/2019/458.pdf.
  4. +
+

🛠 Install

npm or yarn

Install the @zk-kit/eddsa-poseidon package and its peer dependencies with npm:

+
npm i @zk-kit/eddsa-poseidon
+
+

or yarn:

+
yarn add @zk-kit/eddsa-poseidon
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/eddsa-poseidon"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/eddsa-poseidon"></script>
+
+

📜 Usage

The public key is generated using BLAKE by default and BLAKE2 if specified in the import as follows: import { ... } from "@zk-kit/eddsa-poseidon/blake-2b".

+
import {
derivePublicKey,
signMessage,
verifySignature,
deriveSecretScalar,
packPublicKey,
unpackPublicKey
} from "@zk-kit/eddsa-poseidon"

// Your private key (secret).
const privateKey = "secret"
// The message you want to sign.
const message = "message"

// Derive a public key from the private key.
const publicKey = derivePublicKey(privateKey)

/*
[
17191193026255111087474416516591393721975640005415762645730433950079177536248n,
13751717961795090314625781035919035073474308127816403910435238282697898234143n
]
*/
console.log(publicKey)

// Sign the message.
const signature = signMessage(privateKey, message)

/*
{
R8: [
12949573675545142400102669657964360005184873166024880859462384824349649539693n,
18253636630408169174294927826710424418689461166073329946402765380454102840608n
],
S: 701803947557694254685424075312408605924670918868054593580245088593184746870n
}
*/
console.log(signature)

const response = verifySignature(message, signature, publicKey)

// true.
console.log(response)

// Use this value as the input for your Circom circuit.
const secretScalar = deriveSecretScalar(privateKey)

/*
6544992227624943856419766050818315045047569225455760139072025985369615672473
14277921624107172450683599157880963081763136590946434672207840996093731170206
*/
console.log(secretScalar)

// Pack the public key into a compressed format.
const packedPublicKey = packPublicKey(publicKey)

// 52359937820999550851358128406546520360380553803646081112576207882956925379784n
console.log(packedPublicKey)

// Unpack the compressed public key back into its original form.
const unpackedPublicKey = unpackPublicKey(packedPublicKey)

/*
[
17191193026255111087474416516591393721975640005415762645730433950079177536248n,
13751717961795090314625781035919035073474308127816403910435238282697898234143n
]
*/
console.log(unpackedPublicKey)

if (unpackedPublicKey) {
console.log(publicKey[0] === unpackedPublicKey[0]) // true
console.log(publicKey[1] === unpackedPublicKey[1]) // true
} +
+

Index

Type Aliases

Variables

Functions

\ No newline at end of file diff --git a/modules/_zk_kit_imt.html b/modules/_zk_kit_imt.html new file mode 100644 index 000000000..8e3b0653e --- /dev/null +++ b/modules/_zk_kit_imt.html @@ -0,0 +1,67 @@ +@zk-kit/imt | zk-kit

Module @zk-kit/imt

+

+ Incremental Merkle Tree +

+

Incremental Merkle tree implementation in TypeScript.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + +
+

[!WARNING]
If you are looking for the first version of this package, please visit this link.

+
+

In this implementation, the tree is built with a predetermined depth, utilizing a list of zeros (one for each level) to hash nodes lacking fully defined children. The tree's branching factor, or the number of children per node, can be customized via the arity parameter. For detailed insights into the implementation specifics, please refer to the technical documentation.

+
+

🛠 Install

npm or yarn

Install the @zk-kit/imt package with npm:

+
npm i @zk-kit/imt --save
+
+

or yarn:

+
yarn add @zk-kit/imt
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/imt"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/imt"></script>
+
+

📜 Usage

import { IMT } from "@zk-kit/imt"
import { poseidon2 } from "poseidon-lite"

/**
* depth: number of nodes from the leaf to the tree's root node.
* zeroValue: default zero, can vary based on the specific use-case.
* arity: number of children per node (2 = Binary IMT, 5 = Quinary IMT).
*/

const depth = 16
const zeroValue = 0
const arity = 2

/**
* To create an instance of an IMT, you need to provide the hash function
* used to compute the tree nodes, as well as the depth, zeroValue, and arity of the tree.
*/
const tree = new IMT(poseidon2, depth, zeroValue, arity)

// You can also initialize a tree with a given list of leaves.
// const leaves = [1, 2, 3]
// new IMT(poseidon2, depth, zeroValue, arity, leaves)

// Insert (incrementally) a leaf with a value of 1.
tree.insert(1)

// Insert (incrementally) a leaf with a value of 3.
tree.insert(3)

// 6176938709541216276071057251289703345736952331798983957780950682673395007393n.
console.log(tree.root)
/*
[
0,
14744269619966411208579211824598458697587494354926760081771325075741142829156n,
7423237065226347324353380772367382631490014989348495481811164164159255474657n,
11286972368698509976183087595462810875513684078608517520839298933882497716792n,
3607627140608796879659380071776844901612302623152076817094415224584923813162n,
19712377064642672829441595136074946683621277828620209496774504837737984048981n,
20775607673010627194014556968476266066927294572720319469184847051418138353016n,
3396914609616007258851405644437304192397291162432396347162513310381425243293n,
21551820661461729022865262380882070649935529853313286572328683688269863701601n,
6573136701248752079028194407151022595060682063033565181951145966236778420039n,
12413880268183407374852357075976609371175688755676981206018884971008854919922n,
14271763308400718165336499097156975241954733520325982997864342600795471836726n,
20066985985293572387227381049700832219069292839614107140851619262827735677018n,
9394776414966240069580838672673694685292165040808226440647796406499139370960n,
11331146992410411304059858900317123658895005918277453009197229807340014528524n,
15819538789928229930262697811477882737253464456578333862691129291651619515538n
]
*/
console.log(tree.zeroes)
// 2
console.log(tree.arity)
// 16
console.log(tree.depth)
// [1, 3]
console.log(tree.leaves)

// Get the index of the leaf with value 3.
const idx = tree.indexOf(3)
// 1
console.log(idx)

// Update the value of the leaf at position 1 to 2.
tree.update(1, 2)
// [1, 2]
console.log(tree.leaves)

// Delete leaf at position 1.
tree.delete(1)
// [1, 0]
console.log(tree.leaves)

/**
* Compute a Merkle Inclusion Proof (proof of membership) for the leaf with index 1.
* The proof is only valid if the value 1 is found in a leaf of the tree.
*/
const proof = tree.createProof(1)
// true
console.log(tree.verifyProof(proof)) +
+

Index

Classes

IMT +

Type Aliases

\ No newline at end of file diff --git a/modules/_zk_kit_lazytower.html b/modules/_zk_kit_lazytower.html new file mode 100644 index 000000000..c4b5492d0 --- /dev/null +++ b/modules/_zk_kit_lazytower.html @@ -0,0 +1,67 @@ +@zk-kit/lazytower | zk-kit

Module @zk-kit/lazytower

+

+ LazyTower +

+

LazyTower implementation in TypeScript.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + +
+

❗ WARNING

This library has not been audited.

+

🛠 Install

npm or yarn

Install the @zk-kit/lazytower package with npm:

+
npm i @zk-kit/lazytower --save
+
+

or yarn:

+
yarn add @zk-kit/lazytower
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/lazytower/"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/lazytower/"></script>
+
+

📜 Usage

import { LazyTowerHashChainProofBuilder } from "@zk-kit/lazytower"
import { poseidon } from "circomlibjs" // v0.0.8

const H = 10
const W = 4
const pb = LazyTowerHashChainProofBuilder(H, W, poseidon)
for (let i = BigInt(0); i < 150; i += BigInt(1)) {
pb.add(i)
}
const index = pb.indexOf(BigInt(42))
const proof = pb.build(index)
console.log(proof) +
+

Contacts

Developers

+

Index

Type Aliases

Functions

\ No newline at end of file diff --git a/modules/_zk_kit_lean_imt.html b/modules/_zk_kit_lean_imt.html new file mode 100644 index 000000000..211fd8ccf --- /dev/null +++ b/modules/_zk_kit_lean_imt.html @@ -0,0 +1,66 @@ +@zk-kit/lean-imt | zk-kit

Module @zk-kit/lean-imt

+

+ Lean Incremental Merkle Tree +

+

Lean Incremental Merkle tree implementation in TypeScript.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + +
+

[!NOTE]
This library has been audited as part of the Semaphore V4 PSE audit: https://semaphore.pse.dev/Semaphore_4.0.0_Audit.pdf.

+
+

The LeanIMT is an optimized binary version of the IMT into binary-focused model, eliminating the need for zero values and allowing dynamic depth adjustment. Unlike the IMT, which uses a zero hash for incomplete nodes, the LeanIMT directly adopts the left child's value when a node lacks a right counterpart. The tree's depth dynamically adjusts to the count of leaves, enhancing efficiency by reducing the number of required hash calculations. To understand more about the LeanIMT, take a look at this visual explanation. For detailed insights into the implementation specifics, please refer to the technical documentation.

+
+

🛠 Install

npm or yarn

Install the @zk-kit/lean-imt package with npm:

+
npm i @zk-kit/lean-imt --save
+
+

or yarn:

+
yarn add @zk-kit/lean-imt
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/lean-imt"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/lean-imt"></script>
+
+

📜 Usage

import { LeanIMT } from "@zk-kit/lean-imt"
import { poseidon2 } from "poseidon-lite"

// Hash function used to compute the tree nodes.
const hash = (a, b) => poseidon2([a, b])

// To create an instance of a LeanIMT, you must provide the hash function.
const tree = new LeanIMT(hash)

// You can also initialize a tree with a given list of leaves.
// const leaves = [1n, 2n, 3n]
// new LeanIMT(hash, leaves)

// LeanIMT is strictly typed. Default type for nodes is 'bigint',
// but you can set your own type.
// new LeanIMT<number>((a, b) => a + b)

// Insert (incrementally) a leaf with a value of 1.
tree.insert(1n)
// [1n]
console.log(tree.leaves)

// Insert (incrementally) a leaf with a value of 3.
tree.insert(3n)

// 21106761926285267690763443010820487107972411248208546226053195422384279971821n
console.log(tree.root)
// 1
console.log(tree.depth)
// 2
console.log(tree.size)
// [1n, 3n]
console.log(tree.leaves)

// Get the index of the leaf with value 3n.
const idx = tree.indexOf(3n)
// 1
console.log(idx)

// Check if the tree contains a leaf with value 4n.
const has = tree.has(4n)
// false
console.log(tree.has(4n))

// Update the value of the leaf at position 1 to 2n.
tree.update(1, 2n)
// [1n, 2n]
console.log(tree.leaves)

// If you want to delete a leaf with LeanIMT you can use the update function with an
// arbitrary value to be used for the removed leaves.
// Update the value of the leaf at position 1 to 0n (deletion).
tree.update(1, 0n)
// [1n, 0n]
console.log(tree.leaves)

// Compute a Merkle Inclusion Proof (proof of membership) for the leaf with index 1.
// The proof is only valid if the value 1 is found in a leaf of the tree.
const proof = tree.generateProof(1)
// true
console.log(tree.verifyProof(proof))

// Export all the tree nodes.
const nodes = tree.export()

// Import the nodes.
const tree2 = LeanIMT.import(hash, nodes)

// Node types are converted from strings to bigints by default.
// The third parameter can be used to convert strings to other types.

// Import the nodes converting their types to numbers.
const tree3 = LeanIMT.import<number>(hash, nodes, Number) +
+

Index

Classes

Type Aliases

\ No newline at end of file diff --git a/modules/_zk_kit_logical_expressions.html b/modules/_zk_kit_logical_expressions.html new file mode 100644 index 000000000..cd2af7b8f --- /dev/null +++ b/modules/_zk_kit_logical_expressions.html @@ -0,0 +1,89 @@ +@zk-kit/logical-expressions | zk-kit

Module @zk-kit/logical-expressions

+

+ Logical Expressions +

+

A library to evaluate logical expressions.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + + + + + + + +
This library facilitates the work with logical (boolean) expressions. It allows you to tokenize and evaluate any logical expression. It supports the use of parentheses.
+

🛠 Install

npm or yarn

Install the @zk-kit/logical-expressions package with npm:

+
npm i @zk-kit/logical-expressions
+
+

or yarn:

+
yarn add @zk-kit/logical-expressions
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/logical-expressions"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/logical-expressions"></script>
+
+

📜 Usage

Supported logical operators: and, or, not, xor.

+

All other existing logical operators (nand, nor, xnor) can be generated using the supported logical operators.

+

Tokenize a logical expression

# tokenize(): string[]

+

Tokenizes a logical (boolean) expression. +Splits the expression into meaningful tokens.

+
import { tokenize } from "@zk-kit/logical-expressions"

const expression = "true and false or ( true and true )"

const tokens = tokenize(expression)

console.log(tokens)
// Output: ["true", "and", "false", "or", "(", "true", "and", "true", ")"] +
+

Precedence of a logical operator

# precedence(): number

+

Returns the precedence of a logical operator. If the operator is not supported, the precedence will be 0.

+
import { precedence } from "@zk-kit/logical-expressions"

const result = precedence("and")

console.log(result) // Output: 1 +
+

Apply Operator

# applyOperator(): boolean

+

Applies unary or binary operators to boolean values.

+
import { applyOperator } from "@zk-kit/logical-expressions"

// Unary operator
const result1 = applyOperator("not", true)
console.log(result1) // Output: false

// Binary operator
const result2 = applyOperator("and", true, false)
console.log(result2) // Output: false +
+

Evaluate a tokenized logical expression

# evaluate(): boolean

+

Evaluates a tokenized logical (boolean) expression.

+

There is no need to verify the correctness of the logical expression before calling the evaluate function, as this will be checked during the evaluation. If the expression is incorrect, an error will be thrown automatically.

+

Example of correct logical expression: "true and false".

+

Example of incorrect logical expression: "true true and false".

+
import { evaluate } from "@zk-kit/logical-expressions"

const expression = ["true", "and", "false"]

const result = evaluate(expression)

console.log(result) // Output: false +
+

Index

Functions

\ No newline at end of file diff --git a/modules/_zk_kit_poseidon_cipher.html b/modules/_zk_kit_poseidon_cipher.html new file mode 100644 index 000000000..3a3e45f65 --- /dev/null +++ b/modules/_zk_kit_poseidon_cipher.html @@ -0,0 +1,80 @@ +@zk-kit/poseidon-cipher | zk-kit

Module @zk-kit/poseidon-cipher

+

+ Poseidon Cipher +

+

Poseidon Hash function Encryption and Decryption implementation in TypeScript.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + +

This package implements encryption and decryption using the Poseidon hash function. This is a rewrite of the original implementation.

+

References

    +
  1. Dmitry Khovratovich. Encryption with Poseidon. 2019-12-26. https://drive.google.com/file/d/1EVrP3DzoGbmzkRmYnyEDcIQcXVU7GlOd/view.
  2. +
+
+

🛠 Install

npm or yarn

You can install @zk-kit/poseidon-cipher package with npm:

+
npm i @zk-kit/poseidon-cipher --save
+
+

or yarn:

+
yarn add @zk-kit/poseidon-cipher
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/poseidon-cipher"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/poseidon-cipher"></script>
+
+

📜 Usage

import { poseidonEncrypt, poseidonDecrypt, poseidonDecryptWithoutCheck } from "@zk-kit/poseidon-cipher"

// BabyJubJub random value used as private key.
const privateKey = BigInt("10108149867830299554549347844489388280570828384194562713227904027271736843407")

console.log(privateKey)

// The BabyJubJub public key derived from the private key.
const publicKey = [
BigInt("15100511232447817691325643662379962541629809665246870882117771367990737816375"),
BigInt("16289853525630400225782441139722681929418024277641315637394850958390724375621")
]
/**
[
15100511232447817691325643662379962541629809665246870882117771367990737816375n,
16289853525630400225782441139722681929418024277641315637394850958390724375621n
]
*/
console.log(publicKey)

/**
* The Elliptic-Curve Diffie–Hellman (ECDH) shared key from the private and public key.
* Learn more at https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman.
*/
const encryptionKey = [
BigInt("18215233274609902892566361706948385597370728108990013889912246034099844508236"),
BigInt("14884395706232754242497822954958766875005771827082919466711779658153477561231")
]
/**
[
18215233274609902892566361706948385597370728108990013889912246034099844508236n,
14884395706232754242497822954958766875005771827082919466711779658153477561231n
]
*/
console.log(encryptionKey)

// The plaintext to be encrypted.
const plainText = [BigInt(0), BigInt(1)]
// The unique random value.
const nonce = BigInt(5)

// Compute the encryption.
const encrypted = poseidonEncrypt(plainText, encryptionKey, nonce)
/*
[
13027563531333274777964504528445510545245985419061604793949748860800093661040n,
21542829407417339379457427303368865281142518080970543920113508599380643597111n,
334052772696549592017166610161467257195783602071397160212931200489386609812n,
9075054520224362422769554641603717496449971372103870041485347221024944155182n
]
*/
console.log(encrypted)

// Compute the decryption.
const decrypted = poseidonDecrypt(encrypted, encryptionKey, nonce, plainText.length)
/*
[
0n,
1n
]
*/
console.log(decrypted)

// Compute the decryption without check.
const decryptedWithoutCheck = poseidonDecryptWithoutCheck(encrypted, encryptionKey, nonce, plainText.length)
/*
[
0n,
1n
]
*/
console.log(decryptedWithoutCheck) +
+

Index

Type Aliases

Variables

C +M +

Functions

\ No newline at end of file diff --git a/modules/_zk_kit_poseidon_proof.html b/modules/_zk_kit_poseidon_proof.html new file mode 100644 index 000000000..362ff1b2e --- /dev/null +++ b/modules/_zk_kit_poseidon_proof.html @@ -0,0 +1,92 @@ +@zk-kit/poseidon-proof | zk-kit

Module @zk-kit/poseidon-proof

+

+ Poseidon proof +

+

A library to generate and verify Poseidon proofs.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + + + + + + + +
This zero-knowledge library facilitates the demonstration of having a Poseidon hash pre-image while keeping the pre-image value confidential. Additionally, it offers a mechanism to prevent the same proof from being reused. The circuit that forms the foundation of this library is accessible via this link.
+

Originally developed for integration with Semaphore V4, this library also functions effectively as a standalone tool. Notable use cases in connection with Semaphore can be:

+
    +
  • allowing a Semaphore user to prove that they possess the secret value associated with the identity commitment of their Semaphore identity,
  • +
  • unmasking the identity of zero-knowledge proofs earlier created using Semaphore.
  • +
+

The Snark artifacts (.wasm and .zkey files) can be specified or not in the generate function parameters and can possibly be downloaded using the following URLs:

+ +
+

[!WARNING]
The Snark artifacts currently used to generate zero-knowledge proofs are the result of an insecure trusted setup, and the library has not yet been audited. Therefore, it is advised not to use it in production.

+
+

🛠 Install

npm or yarn

Install the @zk-kit/poseidon-proof package:

+
npm i @zk-kit/poseidon-proof
+
+

or yarn:

+
yarn add @zk-kit/poseidon-proof
+
+

📜 Usage

import { generate, verify } from "@zk-kit/poseidon-proof"

// A public value used to contextualize the cryptographic proof and calculate the nullifier.
const scope = "scope"
// The message (preimage) to prove (secret).
const messages = [1, 2]

// Generate the proof.
const fullProof = await generate(messages, scope)

/*
nb. scope, digest and nullifier are always the same - proof is variable.
{
scope: '2',
digest: '13713635907739611880977640264956372443229506353728466835599871320028961887800',
nullifier: '4995263610384888704435371233168916617325583088652670186865584118891394144999',
proof: [
'4344680442683455359115899095464919042642166233886432616638435348359080260980',
'20569010229031596977566212621532395450352277701036306316464269899598925981651',
'19318221594436336163085169568471746851468100277321435282188061183430353155289',
'13863222659316400652438453097923451250965656325472339120118358727133180331649',
'2718553541880998786976126630362604850217726344847462841516918030540821216281',
'11960084231774590415377471656397863783771599717615252119734899677642065267169',
'10666072962579546268534775428261696356732715643486735369393626224913301307278',
'4251217137130113647513155953595492143724626859298741948572817563032672674599'
]
}
*/
console.log(fullProof)

// If not specified, the Snark artifacts are downloaded automatically.
// You can specify them as follows.

// const fullProof = await generate(message, scope, {
// wasm: "<your-path>/poseidon-proof.wasm",
// zkey: "<your-path>/poseidon-proof.zkey"
// })

// Verify the proof.
const response = await verify(fullProof)

// true.
console.log(response)

// Eventually you may want to check the nullifier. +
+

📈 Benchmarks

Benchmarks were run on an Intel Core i7-1165G7, 16 GB RAM machine (with two inputs).

+ + + + + + + + + + + + + +
Generate proofVerify proofConstraints
170ms12ms214
+
import { generate, verify } from "@zk-kit/poseidon-proof"

console.time("generate")

const proof = await generate([1, 2], "scope")

console.timeEnd("generate")

console.time("verify")

console.log(await verify(proof))

console.timeEnd("verify") +
+

Index

Type Aliases

Functions

\ No newline at end of file diff --git a/modules/_zk_kit_smt.html b/modules/_zk_kit_smt.html new file mode 100644 index 000000000..8570d501d --- /dev/null +++ b/modules/_zk_kit_smt.html @@ -0,0 +1,82 @@ +@zk-kit/smt | zk-kit

Module @zk-kit/smt

+

+ Sparse Merkle tree +

+

Sparse Merkle tree implementation in TypeScript.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + +

A sparse Merkle tree is a data structure useful for storing a key/value map where every leaf node of the tree contains the cryptographic hash of a key/value pair and every non leaf node contains the concatenated hashes of its child nodes. Sparse Merkle trees provides a secure and efficient verification of large data sets and they are often used in peer-to-peer technologies. This implementation is an optimized version of the traditional sparse Merkle tree and it is based on the concepts expressed in the papers and resources below.

+

References

    +
  1. Rasmus Dahlberg, Tobias Pulls and Roel Peeters. Efficient Sparse Merkle Trees: Caching Strategies and Secure (Non-)Membership Proofs. Cryptology ePrint Archive: Report 2016/683, 2016. https://eprint.iacr.org/2016/683.
  2. +
  3. Faraz Haider. Compact sparse merkle trees. Cryptology ePrint Archive: Report 2018/955, 2018. https://eprint.iacr.org/2018/955.
  4. +
  5. Jordi Baylina and Marta Bellés. Sparse Merkle Trees. https://docs.iden3.io/publications/pdfs/Merkle-Tree.pdf.
  6. +
  7. Vitalik Buterin Fichter. Optimizing sparse Merkle trees. https://ethresear.ch/t/optimizing-sparse-merkle-trees/3751.
  8. +
+
+

Install

npm or yarn

You can install @zk-kit/smt package with npm:

+
npm i @zk-kit/smt --save
+
+

or yarn:

+
yarn add @zk-kit/smt
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/smt"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/smt"></script>
+
+

📜 Usage

import { ChildNodes, SMT } from "@zk-kit/smt"
import sha256 from "crypto-js/sha256"
import { poseidon2, poseidon3 } from "poseidon-lite"

// Hexadecimal hashes.
const hash = (childNodes: ChildNodes) => sha256(childNodes.join("")).toString()

// Create the SMT with an Hexadecimal (SHA256) hash.
const tree = new SMT(hash)

// 0
console.log(tree.root)

// Big number hashes.
const hash2 = (childNodes) => (childNodes.length === 2 ? poseidon2(childNodes) : poseidon3(childNodes))

// Create the SMT with a BigNumber (Poseidon) hash.
const tree2 = new SMT(hash2, true)

// 0n
console.log(tree2.root)

// Add nodes to the SMT.
tree.add("2b", "44")
tree.add("16", "78")
tree.add("d", "e7")
tree.add("10", "141")
tree.add("20", "340")

// 31ee2a59741c9c32a32d8c7fafe461cca1ccaf5986c2d592586e3e6482a48645
console.log(tree.root)

// Get the value of the leaf.
const value = tree.get("16")

// 78
console.log(value)

// Update the value of the leaf.
tree.update("16", "79")

// 79
console.log(tree.get("16"))

// Delete the leaf.
tree.delete("16")

// undefined
console.log(tree.get("16"))

// Compute the proof of membership for the leaf.
const membershipProof = tree.createProof("2b")

// Compute the proof of membership for a previously deleted leaf.
const nonMembershipProof = tree.createProof("16") // This key has been deleted.

/*
{
entry: [ '2b', '44', '1' ],
matchingEntry: undefined,
siblings: [
'006a0ab15a212e0e0126b81e056b11576628b1ad80792403dbb3a90be2e71d64',
'f786ce5a843614d7da216d95c0087c1eb29244927feeeeeb658aa60cf124cd5e'
],
root: 'c3c023c84afc0a7bab1dbebcef5f7beaf3d6af4af98e8f481620dec052be7d0d',
membership: true
}
*/
console.log(membershipProof)

/*
{
entry: [ '16' ],
matchingEntry: undefined,
siblings: [
'960f23d9fbb44241be53efb7c4d69ac129bb1cb9482dcb6789d3cc7e6de2de2b',
'2a1aef839e68d1bdf43c1b3b1ed9ef16c27162e8a175898c9ac64a679b0fc825'
],
root: 'c3c023c84afc0a7bab1dbebcef5f7beaf3d6af4af98e8f481620dec052be7d0d',
membership: false
}
*/
console.log(nonMembershipProof)

// Verify the proofs.
console.log(tree.verifyProof(membershipProof)) // true
console.log(tree.verifyProof(nonMembershipProof)) // true +
+

Index

Classes

SMT +

Interfaces

Type Aliases

Functions

\ No newline at end of file diff --git a/modules/_zk_kit_utils.conversions.html b/modules/_zk_kit_utils.conversions.html new file mode 100644 index 000000000..9b1fe5720 --- /dev/null +++ b/modules/_zk_kit_utils.conversions.html @@ -0,0 +1,17 @@ +conversions | zk-kit
\ No newline at end of file diff --git a/modules/_zk_kit_utils.crypto.html b/modules/_zk_kit_utils.crypto.html new file mode 100644 index 000000000..2228a9b72 --- /dev/null +++ b/modules/_zk_kit_utils.crypto.html @@ -0,0 +1,2 @@ +crypto | zk-kit
\ No newline at end of file diff --git a/modules/_zk_kit_utils.errorHandlers.html b/modules/_zk_kit_utils.errorHandlers.html new file mode 100644 index 000000000..4fc448478 --- /dev/null +++ b/modules/_zk_kit_utils.errorHandlers.html @@ -0,0 +1,15 @@ +errorHandlers | zk-kit
\ No newline at end of file diff --git a/modules/_zk_kit_utils.html b/modules/_zk_kit_utils.html new file mode 100644 index 000000000..d2a308050 --- /dev/null +++ b/modules/_zk_kit_utils.html @@ -0,0 +1,123 @@ +@zk-kit/utils | zk-kit

Module @zk-kit/utils

+

+ Utils +

+

Essential zero-knowledge utility library for JavaScript developers.

+

+ +

+ + + + + NPM license + + + NPM version + + + Downloads + + + npm bundle size (scoped) + + + Linter eslint + + + Code style prettier + +

+ + + +
+

[!NOTE]
This library has been audited as part of the Semaphore V4 PSE audit: https://semaphore.pse.dev/Semaphore_4.0.0_Audit.pdf.

+
+

🛠 Install

npm or yarn

Install the @zk-kit/utils package and its peer dependencies with npm:

+
npm i @zk-kit/utils
+
+

or yarn:

+
yarn add @zk-kit/utils
+
+

CDN

You can also load it using a script tag using unpkg:

+
<script src="https://unpkg.com/@zk-kit/utils"></script>
+
+

or JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/@zk-kit/utils"></script>
+
+

📜 Usage

// You can import modules from the main bundle.
import { errorHandlers, typeChecks } from "@zk-kit/utils"

// Or by using conditional exports.
import { requireNumber } from "@zk-kit/utils/error-handlers"
import { isNumber } from "@zk-kit/utils/type-checks" +
+

For more information on the functions provided by @zk-kit/utils, please refer to the documentation.

+

References

Re-exports SupportedType
Re-exports base64ToBuffer
Re-exports base64ToText
Re-exports beBigIntToBuffer
Re-exports beBufferToBigInt
Re-exports bigIntToBuffer
Re-exports bigIntToHexadecimal
Re-exports bigNumberishToBigInt
Re-exports bigNumberishToBuffer
Re-exports bufferToBase64
Re-exports bufferToBigInt
Re-exports bufferToHexadecimal
Re-exports hexadecimalToBigInt
Re-exports hexadecimalToBuffer
Re-exports isArray
Re-exports isBigInt
Re-exports isBigNumber
Re-exports isBigNumberish
Re-exports isBuffer
Re-exports isDefined
Re-exports isFunction
Re-exports isHexadecimal
Re-exports isNumber
Re-exports isObject
Re-exports isString
Re-exports isStringifiedBigInt
Re-exports isSupportedType
Re-exports isType
Re-exports isUint8Array
Re-exports leBigIntToBuffer
Re-exports leBufferToBigInt
Re-exports packGroth16Proof
Re-exports requireArray
Re-exports requireBigInt
Re-exports requireBigNumber
Re-exports requireBigNumberish
Re-exports requireBuffer
Re-exports requireDefined
Re-exports requireFunction
Re-exports requireHexadecimal
Re-exports requireNumber
Re-exports requireObject
Re-exports requireString
Re-exports requireStringifiedBigInt
Re-exports requireTypes
Re-exports requireUint8Array
Re-exports supportedTypes
Re-exports textToBase64
Re-exports unpackGroth16Proof
\ No newline at end of file diff --git a/modules/_zk_kit_utils.packing.html b/modules/_zk_kit_utils.packing.html new file mode 100644 index 000000000..d5b0b6432 --- /dev/null +++ b/modules/_zk_kit_utils.packing.html @@ -0,0 +1,3 @@ +packing | zk-kit
\ No newline at end of file diff --git a/modules/_zk_kit_utils.scalar.html b/modules/_zk_kit_utils.scalar.html new file mode 100644 index 000000000..4a77e3243 --- /dev/null +++ b/modules/_zk_kit_utils.scalar.html @@ -0,0 +1,7 @@ +scalar | zk-kit
\ No newline at end of file diff --git a/modules/_zk_kit_utils.typeChecks.html b/modules/_zk_kit_utils.typeChecks.html new file mode 100644 index 000000000..96afd8262 --- /dev/null +++ b/modules/_zk_kit_utils.typeChecks.html @@ -0,0 +1,18 @@ +typeChecks | zk-kit
\ No newline at end of file diff --git a/types/_zk_kit_baby_jubjub.Point.html b/types/_zk_kit_baby_jubjub.Point.html new file mode 100644 index 000000000..334bbbdf4 --- /dev/null +++ b/types/_zk_kit_baby_jubjub.Point.html @@ -0,0 +1 @@ +Point | zk-kit
Point<N>: [N, N]

Type Parameters

\ No newline at end of file diff --git a/types/_zk_kit_eddsa_poseidon.Signature.html b/types/_zk_kit_eddsa_poseidon.Signature.html new file mode 100644 index 000000000..26b188e0a --- /dev/null +++ b/types/_zk_kit_eddsa_poseidon.Signature.html @@ -0,0 +1 @@ +Signature | zk-kit
Signature<N>: {
    R8: Point<N>;
    S: N;
}

Type Parameters

Type declaration

\ No newline at end of file diff --git a/types/_zk_kit_imt.IMTHashFunction.html b/types/_zk_kit_imt.IMTHashFunction.html new file mode 100644 index 000000000..9db2ec629 --- /dev/null +++ b/types/_zk_kit_imt.IMTHashFunction.html @@ -0,0 +1,3 @@ +IMTHashFunction | zk-kit

Type alias IMTHashFunction

IMTHashFunction: ((values) => IMTNode)

The hash function is used to compute the nodes of the tree. +In a binary Merkle tree, each node is the hash of its two children.

+

Type declaration

\ No newline at end of file diff --git a/types/_zk_kit_imt.IMTMerkleProof.html b/types/_zk_kit_imt.IMTMerkleProof.html new file mode 100644 index 000000000..f7c17f551 --- /dev/null +++ b/types/_zk_kit_imt.IMTMerkleProof.html @@ -0,0 +1,9 @@ +IMTMerkleProof | zk-kit

Type alias IMTMerkleProof

IMTMerkleProof: {
    leaf: any;
    leafIndex: number;
    pathIndices: number[];
    root: any;
    siblings: any[];
}

The Merkle Proof contains the necessary parameters to enable the +verifier to be certain that a leaf belongs to the tree. Given the value +of the leaf and its index, it is possible to traverse the tree by +recalculating the hashes up to the root and using the node siblings. +If the calculated root matches the root in the proof, then the leaf +belongs to the tree. It's important to note that the function used +to generate the proof and the one used to verify it must use the +same hash function.

+

Type declaration

  • leaf: any
  • leafIndex: number
  • pathIndices: number[]
  • root: any
  • siblings: any[]
\ No newline at end of file diff --git a/types/_zk_kit_imt.IMTNode.html b/types/_zk_kit_imt.IMTNode.html new file mode 100644 index 000000000..3b941033e --- /dev/null +++ b/types/_zk_kit_imt.IMTNode.html @@ -0,0 +1,2 @@ +IMTNode | zk-kit

Type alias IMTNode

IMTNode: any

It represents a node of the tree, which can be any value.

+
\ No newline at end of file diff --git a/types/_zk_kit_lazytower.LazyTowerHashChainProof.html b/types/_zk_kit_lazytower.LazyTowerHashChainProof.html new file mode 100644 index 000000000..be340727d --- /dev/null +++ b/types/_zk_kit_lazytower.LazyTowerHashChainProof.html @@ -0,0 +1 @@ +LazyTowerHashChainProof | zk-kit

Type alias LazyTowerHashChainProof

LazyTowerHashChainProof: {
    childrens: bigint[][];
    digestOfDigests: bigint;
    item: bigint;
    levelLengths: bigint;
    rootLevel: bigint[];
    rootLv: number;
    topDownDigests: bigint[];
}

Type declaration

  • childrens: bigint[][]
  • digestOfDigests: bigint
  • item: bigint
  • levelLengths: bigint
  • rootLevel: bigint[]
  • rootLv: number
  • topDownDigests: bigint[]
\ No newline at end of file diff --git a/types/_zk_kit_lean_imt.LeanIMTHashFunction.html b/types/_zk_kit_lean_imt.LeanIMTHashFunction.html new file mode 100644 index 000000000..6b265bc1a --- /dev/null +++ b/types/_zk_kit_lean_imt.LeanIMTHashFunction.html @@ -0,0 +1,3 @@ +LeanIMTHashFunction | zk-kit

Type alias LeanIMTHashFunction<N>

LeanIMTHashFunction<N>: ((a, b) => N)

The hash function is used to compute the nodes of the tree. +In a binary Merkle tree, each node is the hash of its two children.

+

Type Parameters

  • N = bigint

Type declaration

    • (a, b): N
    • Parameters

      Returns N

\ No newline at end of file diff --git a/types/_zk_kit_lean_imt.LeanIMTMerkleProof.html b/types/_zk_kit_lean_imt.LeanIMTMerkleProof.html new file mode 100644 index 000000000..34a02dafb --- /dev/null +++ b/types/_zk_kit_lean_imt.LeanIMTMerkleProof.html @@ -0,0 +1,9 @@ +LeanIMTMerkleProof | zk-kit

Type alias LeanIMTMerkleProof<N>

LeanIMTMerkleProof<N>: {
    index: number;
    leaf: N;
    root: N;
    siblings: N[];
}

The Merkle Proof contains the necessary parameters to enable the +verifier to be certain that a leaf belongs to the tree. Given the value +of the leaf and its index, it is possible to traverse the tree by +recalculating the hashes up to the root and using the node siblings. +If the calculated root matches the root in the proof, then the leaf +belongs to the tree. It's important to note that the function used +to generate the proof and the one used to verify it must use the +same hash function.

+

Type Parameters

  • N = bigint

Type declaration

  • index: number
  • leaf: N
  • root: N
  • siblings: N[]
\ No newline at end of file diff --git a/types/_zk_kit_poseidon_cipher.BigIntOutput.html b/types/_zk_kit_poseidon_cipher.BigIntOutput.html new file mode 100644 index 000000000..fa025f63a --- /dev/null +++ b/types/_zk_kit_poseidon_cipher.BigIntOutput.html @@ -0,0 +1 @@ +BigIntOutput | zk-kit
BigIntOutput: BigIntOutput[] | StringifiedInput | bigint | bigint[] | bigint[][] | bigint[][][] | {
    [key: string]: bigint;
} | null

Type declaration

  • [key: string]: bigint
\ No newline at end of file diff --git a/types/_zk_kit_poseidon_cipher.CipherText.html b/types/_zk_kit_poseidon_cipher.CipherText.html new file mode 100644 index 000000000..fe526209d --- /dev/null +++ b/types/_zk_kit_poseidon_cipher.CipherText.html @@ -0,0 +1 @@ +CipherText | zk-kit
CipherText<N>: N[]

Type Parameters

\ No newline at end of file diff --git a/types/_zk_kit_poseidon_cipher.EncryptionKey.html b/types/_zk_kit_poseidon_cipher.EncryptionKey.html new file mode 100644 index 000000000..c7ad1a9b6 --- /dev/null +++ b/types/_zk_kit_poseidon_cipher.EncryptionKey.html @@ -0,0 +1 @@ +EncryptionKey | zk-kit
EncryptionKey<N>: [N, N]

Type Parameters

\ No newline at end of file diff --git a/types/_zk_kit_poseidon_cipher.Nonce.html b/types/_zk_kit_poseidon_cipher.Nonce.html new file mode 100644 index 000000000..53b1e8a06 --- /dev/null +++ b/types/_zk_kit_poseidon_cipher.Nonce.html @@ -0,0 +1 @@ +Nonce | zk-kit
Nonce<N>: N

Type Parameters

\ No newline at end of file diff --git a/types/_zk_kit_poseidon_cipher.PlainText.html b/types/_zk_kit_poseidon_cipher.PlainText.html new file mode 100644 index 000000000..51497f247 --- /dev/null +++ b/types/_zk_kit_poseidon_cipher.PlainText.html @@ -0,0 +1 @@ +PlainText | zk-kit
PlainText<N>: N[]

Type Parameters

\ No newline at end of file diff --git a/types/_zk_kit_poseidon_cipher.StringifiedInput.html b/types/_zk_kit_poseidon_cipher.StringifiedInput.html new file mode 100644 index 000000000..49e3118d3 --- /dev/null +++ b/types/_zk_kit_poseidon_cipher.StringifiedInput.html @@ -0,0 +1 @@ +StringifiedInput | zk-kit
StringifiedInput: string | string[] | string[][] | string[][][] | {
    [key: string]: StringifiedInput;
} | null

Type declaration

\ No newline at end of file diff --git a/types/_zk_kit_poseidon_proof.PoseidonProof.html b/types/_zk_kit_poseidon_proof.PoseidonProof.html new file mode 100644 index 000000000..1dfbadf7f --- /dev/null +++ b/types/_zk_kit_poseidon_proof.PoseidonProof.html @@ -0,0 +1 @@ +PoseidonProof | zk-kit
PoseidonProof: {
    digest: NumericString;
    numberOfInputs: number;
    proof: PackedGroth16Proof;
    scope: NumericString;
}

Type declaration

\ No newline at end of file diff --git a/types/_zk_kit_smt.ChildNodes.html b/types/_zk_kit_smt.ChildNodes.html new file mode 100644 index 000000000..346646bfc --- /dev/null +++ b/types/_zk_kit_smt.ChildNodes.html @@ -0,0 +1 @@ +ChildNodes | zk-kit

Type alias ChildNodes

ChildNodes: Node[]
\ No newline at end of file diff --git a/types/_zk_kit_smt.Entry.html b/types/_zk_kit_smt.Entry.html new file mode 100644 index 000000000..b4c87aebe --- /dev/null +++ b/types/_zk_kit_smt.Entry.html @@ -0,0 +1 @@ +Entry | zk-kit

Type alias Entry

Entry: [Key, Value, EntryMark]
\ No newline at end of file diff --git a/types/_zk_kit_smt.EntryMark.html b/types/_zk_kit_smt.EntryMark.html new file mode 100644 index 000000000..e47cad937 --- /dev/null +++ b/types/_zk_kit_smt.EntryMark.html @@ -0,0 +1 @@ +EntryMark | zk-kit

Type alias EntryMark

EntryMark: Node
\ No newline at end of file diff --git a/types/_zk_kit_smt.HashFunction.html b/types/_zk_kit_smt.HashFunction.html new file mode 100644 index 000000000..8555f912f --- /dev/null +++ b/types/_zk_kit_smt.HashFunction.html @@ -0,0 +1 @@ +HashFunction | zk-kit

Type alias HashFunction

HashFunction: ((childNodes) => Node)

Type declaration

\ No newline at end of file diff --git a/types/_zk_kit_smt.Key.html b/types/_zk_kit_smt.Key.html new file mode 100644 index 000000000..efe4bd826 --- /dev/null +++ b/types/_zk_kit_smt.Key.html @@ -0,0 +1 @@ +Key | zk-kit

Type alias Key

Key: Node
\ No newline at end of file diff --git a/types/_zk_kit_smt.Node.html b/types/_zk_kit_smt.Node.html new file mode 100644 index 000000000..641f1db27 --- /dev/null +++ b/types/_zk_kit_smt.Node.html @@ -0,0 +1 @@ +Node | zk-kit

Type alias Node

Node: string | bigint
\ No newline at end of file diff --git a/types/_zk_kit_smt.Siblings.html b/types/_zk_kit_smt.Siblings.html new file mode 100644 index 000000000..d53c4e172 --- /dev/null +++ b/types/_zk_kit_smt.Siblings.html @@ -0,0 +1 @@ +Siblings | zk-kit

Type alias Siblings

Siblings: Node[]
\ No newline at end of file diff --git a/types/_zk_kit_smt.Value.html b/types/_zk_kit_smt.Value.html new file mode 100644 index 000000000..726cf09fe --- /dev/null +++ b/types/_zk_kit_smt.Value.html @@ -0,0 +1 @@ +Value | zk-kit

Type alias Value

Value: Node
\ No newline at end of file diff --git a/types/_zk_kit_utils.BigNumber.html b/types/_zk_kit_utils.BigNumber.html new file mode 100644 index 000000000..0ed7497ba --- /dev/null +++ b/types/_zk_kit_utils.BigNumber.html @@ -0,0 +1 @@ +BigNumber | zk-kit

Type alias BigNumber

BigNumber: bigint | string
\ No newline at end of file diff --git a/types/_zk_kit_utils.BigNumberish.html b/types/_zk_kit_utils.BigNumberish.html new file mode 100644 index 000000000..93c467300 --- /dev/null +++ b/types/_zk_kit_utils.BigNumberish.html @@ -0,0 +1 @@ +BigNumberish | zk-kit

Type alias BigNumberish

BigNumberish: BigNumber | number | Buffer | Uint8Array
\ No newline at end of file diff --git a/types/_zk_kit_utils.PackedGroth16Proof.html b/types/_zk_kit_utils.PackedGroth16Proof.html new file mode 100644 index 000000000..a1dac824b --- /dev/null +++ b/types/_zk_kit_utils.PackedGroth16Proof.html @@ -0,0 +1 @@ +PackedGroth16Proof | zk-kit

Type alias PackedGroth16Proof

PackedGroth16Proof: [NumericString, NumericString, NumericString, NumericString, NumericString, NumericString, NumericString, NumericString]
\ No newline at end of file diff --git a/types/_zk_kit_utils.typeChecks.SupportedType.html b/types/_zk_kit_utils.typeChecks.SupportedType.html new file mode 100644 index 000000000..9bc9f5e54 --- /dev/null +++ b/types/_zk_kit_utils.typeChecks.SupportedType.html @@ -0,0 +1 @@ +SupportedType | zk-kit
SupportedType: typeof supportedTypes[number]
\ No newline at end of file diff --git a/variables/_zk_kit_baby_jubjub.Base8.html b/variables/_zk_kit_baby_jubjub.Base8.html new file mode 100644 index 000000000..45c2adb73 --- /dev/null +++ b/variables/_zk_kit_baby_jubjub.Base8.html @@ -0,0 +1 @@ +Base8 | zk-kit

Variable Base8Const

Base8: Point<bigint> = ...
\ No newline at end of file diff --git a/variables/_zk_kit_baby_jubjub.Fr.html b/variables/_zk_kit_baby_jubjub.Fr.html new file mode 100644 index 000000000..18cb5ab92 --- /dev/null +++ b/variables/_zk_kit_baby_jubjub.Fr.html @@ -0,0 +1 @@ +Fr | zk-kit
Fr: F1Field = ...
\ No newline at end of file diff --git a/variables/_zk_kit_baby_jubjub.order.html b/variables/_zk_kit_baby_jubjub.order.html new file mode 100644 index 000000000..c7f98db56 --- /dev/null +++ b/variables/_zk_kit_baby_jubjub.order.html @@ -0,0 +1 @@ +order | zk-kit

Variable orderConst

order: bigint = ...
\ No newline at end of file diff --git a/variables/_zk_kit_baby_jubjub.r.html b/variables/_zk_kit_baby_jubjub.r.html new file mode 100644 index 000000000..6b7c62df2 --- /dev/null +++ b/variables/_zk_kit_baby_jubjub.r.html @@ -0,0 +1,3 @@ +r | zk-kit
r: bigint = ...

Constants and curve parameters for BabyJubJub elliptic curve operations. +See: https://eips.ethereum.org/EIPS/eip-2494

+
\ No newline at end of file diff --git a/variables/_zk_kit_baby_jubjub.subOrder.html b/variables/_zk_kit_baby_jubjub.subOrder.html new file mode 100644 index 000000000..e7f8cbc56 --- /dev/null +++ b/variables/_zk_kit_baby_jubjub.subOrder.html @@ -0,0 +1 @@ +subOrder | zk-kit

Variable subOrderConst

subOrder: bigint = ...
\ No newline at end of file diff --git a/variables/_zk_kit_eddsa_poseidon.EdDSAPoseidon.html b/variables/_zk_kit_eddsa_poseidon.EdDSAPoseidon.html new file mode 100644 index 000000000..a2dc6b759 --- /dev/null +++ b/variables/_zk_kit_eddsa_poseidon.EdDSAPoseidon.html @@ -0,0 +1 @@ +EdDSAPoseidon | zk-kit
EdDSAPoseidon: typeof EdDSAPoseidon
\ No newline at end of file diff --git a/variables/_zk_kit_poseidon_cipher.C.html b/variables/_zk_kit_poseidon_cipher.C.html new file mode 100644 index 000000000..61804aafa --- /dev/null +++ b/variables/_zk_kit_poseidon_cipher.C.html @@ -0,0 +1 @@ +C | zk-kit
C: bigint[][] = ...
\ No newline at end of file diff --git a/variables/_zk_kit_poseidon_cipher.M.html b/variables/_zk_kit_poseidon_cipher.M.html new file mode 100644 index 000000000..257f9f8b6 --- /dev/null +++ b/variables/_zk_kit_poseidon_cipher.M.html @@ -0,0 +1 @@ +M | zk-kit
M: bigint[][][] = ...
\ No newline at end of file diff --git a/variables/_zk_kit_utils.Buffer-1.html b/variables/_zk_kit_utils.Buffer-1.html new file mode 100644 index 000000000..ab6985b24 --- /dev/null +++ b/variables/_zk_kit_utils.Buffer-1.html @@ -0,0 +1 @@ +Buffer | zk-kit
Buffer: BufferConstructor
\ No newline at end of file diff --git a/variables/_zk_kit_utils.typeChecks.supportedTypes.html b/variables/_zk_kit_utils.typeChecks.supportedTypes.html new file mode 100644 index 000000000..5b0ad4e38 --- /dev/null +++ b/variables/_zk_kit_utils.typeChecks.supportedTypes.html @@ -0,0 +1 @@ +supportedTypes | zk-kit

Variable supportedTypesConst Internal

supportedTypes: readonly ["number", "string", "function", "Array", "Uint8Array", "Buffer", "object", "bigint", "stringified-bigint", "hexadecimal", "bignumber", "bignumberish"] = ...
\ No newline at end of file