npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@toruslabs/zkp-utils

v1.0.0

Published

A utility package for common math and formatting functions

Downloads

2

Readme

zkp-utils

This library contains many utility functions for use in zkp applications.

Install

In your NodeJS project:
npm i @eyblockchain/zkp-utils

Functions

  • number-conversions
    • hex
      strip0x,
      ensure0x,
      isHex,
      requireHex,
      leftPadHex,
      truncateHex,
      resizeHex,
      hexToUtf8,
      hexToAscii,
      hexToBinArray,
      hexToBin,
      hexToBytes,
      hexToDec,
      hexToField,
      hexToLimbs,
      hexToDecLimbs,
      hexToBinLimbs,
      randomHex,
    • decimal
      decToHex,
      decToBin,
      decToBinLimbs,
    • binary
      binToHex,
      binToDec,
      binToLimbs,
    • char
      utf8StringToHex,
      asciiToHex,
  • hashes
    • sha256
      shaHash;
    • mimc
      mimcHash;

Developer

Test

Clone the repo. npm i
npm test

Test with yalc

If you've made local changes to this repo, and would like to test whether those (unpublished) changes will work with some dependent zkp appliation (zApp)...

...then you’ll need to install your local, ‘branched’ version of zkp-utils in your zApp.

cd path/to/zkp-utils/
yalc publish

You should see something like "@eyblockchain/[email protected] published in store.". Notice the ‘signature’ 3df45b8c .

cd path/to/your/zApp/

Remove the package-lock.json and the node_modules from your zApp's root (if they exist on your machine).

Then:

yalc add @eyblockchain/zkp-utils

You’ll see that this has ‘swapped-in’ the ‘published’ (yalc version) of zkp-utils in the package.json. It’s also created .yalc.lock (which shows that you’ve replaced the ‘proper’ npm package of zkp-utils with your ‘yalc version’ (see the signature field in this file, which should match the signature from earlier)).

Now install node modules:

npm i

If your zApp runs in a container, then you might need to also edit its dockerfile:

Change a line in <your zApp>/Dockerfile from RUN npm ci to RUN npm install.

Add a line in <your zApp>/docker-compose.yml:

yourService:
  build:
    context: .
    dockerfile: Dockerfile
volumes:
  - ./.yalc:/app/.yalc # <<< ADD THIS LINE (or something similar)!!!

When you're happy that your local changes to zkp-utils work and you wish to create a PR, you MUST remove any references to yalc, or the PR shouldn't be accepted.