Former-commit-id: 7d25993591bf3add451711259082126cdbc30dbe [formerly 8ec993aa57a44b5d30b66195b459b3867b882168] [formerly 1a75ec01d0202542a0e31440e958573a560b77e2 [formerly 9fa0a7a7628496a79b3d36096cff839b4580963d]] [formerly 354711e81c9d00d9799ae7bee4ab4396832315e8 [formerly 6263a8c265c2ad6d0d3edee94e7d99ffa7c3f450] [formerly bfc1e7fcdce3d3b259b467fbbf2255ff5c6c6455 [formerly 427b072a49]]]
Former-commit-id: 27aef0425e0a403c45f65385a31b6b857319aed1 [formerly 83f3bac2d0d58d3a6000bf562de8f13edcafe58d] [formerly d31860a1bc67563a8996a54ba6d8724cb4ff1d66 [formerly cf6fc2ab47dcd8c4eaf7c1367a376deed5dabd58]]
Former-commit-id: 46e28cc44d21ad6fe7abfd68772fcb84173afc41 [formerly afefed8e87c69127f4da80a2cd940d803b0936e9]
Former-commit-id: e1e2a20b7b1e266b5c11767f93053bc89240719a
🧰 ZK-kit
A monorepo of reusable JS libraries for zero-knowledge technologies.
| ZK-kit is a set of NPM modules (algorithms or utility functions) that can be reused in different projects and zero-knowledge protocols, making it easier for developers to access ready-to-use and tested libraries for common tasks. |
|---|
♚ Simplified package management with Lerna (yarn, yarn build, yarn publish:fp)
♛ Conventional Commits for adding human and machine readable meaning to commit messages (yarn commit)
♜ Jest tests & common test coverage for all packages (yarn test)
♞ ESLint & Prettier to keep the code neat and well organized (yarn prettier & yarn lint)
♝ Automatic deployment of documentation generated with typedocs
♟ Simple benchmarking framework for JavaScript/TypeScript libraries with Benny (yarn benchmarks)
📦 Packages
🛠 Install
Clone this repository and install the dependencies:
$ git clone https://github.com/appliedzkp/zk-kit.git
$ cd zk-kit && yarn
📜 Usage
$ yarn lint # Syntax check with ESLint (yarn lint:fix to fix errors).
$ yarn prettier # Syntax check with Prettier (yarn prettier:fix to fix errors).
$ yarn commit # Interactive Commitizen commit.
$ yarn test # Test all packages (with common coverage).
$ yarn build # Create a JS build for each package.
$ yarn publish:fp # Publish packages on npm.
❓ 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:
- Fork this repository and clone it (or simply clone it directly if you are a collaborator),
- Copy one of our current libraries and update the
README.mdandpackage.jsonfiles with your package name:
cd zk-kit
cp -r packages/sparse-merkle-tree packages/my-package
cd packages/my-package && rm -fr node_modules dist
grep -r -l "sparse-merkle-tree" . | xargs sed -i 's/sparse-merkle-tree/my-package/'
# Update the remaining description/usage sections, and write your code in the src & tests folders!
How can I test and publish my library?
ZK-kit provides two commands: yarn test and yarn publish:fp. Both must be run from the root folder. yarn test will test all packages in the monorepo, including yours using the files inside your packages/my-package/tests folder. yarn publish:fp can only be run by those who own the NPM token of the ZK-kit organization. They will then have to publish your package. This task could be automated in the future.
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 creates a benchmarks/results folder with your results.
How can I publish the documentation of my library with typedocs?
You just need to insert the NPM docs command in your package.json file, as in the other packages. This command will be executed by Lerna and the output of typedocs will be placed in the docs folder of the root directory, which will be used to deploy the documentation websites by the Github docs workflow whenever the main branch is updated.