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

@zk-email/jwt-tx-builder-circuits

v0.1.0

Published

The `circuits` package exports the circom circuits needed for building on jwt-tx-builder.

Downloads

12

Readme

@zk-email/jwt-tx-builder-circuits

The circuits package exports the circom circuits needed for building on jwt-tx-builder.

All circuits in this package are libraries that can be imported to your circom project (i.e this package does not contain a main circuit).

Installation

yarn add @zk-email/jwt-tx-builder-circuits

JWT Auth Circuit

The JWT Auth circuit is the core circuit for verifying JWT signatures and actions using the JWT Auth protocol.

Usage

Import to your circuit file like below.

include "@zk-email/jwt-tx-builder-circuits/jwt-auth.circom";
  • Parameters:
    • n: Number of bits per chunk the RSA key is split into. Recommended to be 121.
    • k: Number of chunks the RSA key is split into. Recommended to be 17.
    • maxMessageLength: Maximum length of the JWT message (header + payload).
    • maxB64HeaderLength: Maximum length of the base64 encoded header.
    • maxB64PayloadLength: Maximum length of the base64 encoded payload.
    • maxAzpLength: Maximum length of the "azp" (authorized party) claim.
    • maxCommandLength: Maximum length of the "command" claim.

Note: We use these values for n and k because their product (n * k) needs to be more than 2048 (RSA constraint) and n has to be less than half of 255 to fit in a circom signal.

  • Inputs:

    • message: The JWT message (header + payload).
    • messageLength: Actual length of the message signed in the JWT.
    • pubkey: The RSA public key split into k chunks of n bits each.
    • signature: The RSA signature split into k chunks of n bits each.
    • accountCode: The account code. (Used in the context of a jwt-wallet to identify the smart wallet)
    • codeIndex: The index of the "account code" in the "command".
    • periodIndex: The index of the period in the JWT message.
    • jwtKidStartIndex: The index of the "kid" in the JWT header.
    • issKeyStartIndex: The index of the "iss" key in the JWT payload.
    • issLength: The length of the "iss" claim in the JWT payload.
    • iatKeyStartIndex: The index of the "iat" key in the JWT payload.
    • azpKeyStartIndex: The index of the "azp" (authorized party) key in the JWT payload.
    • azpLength: The length of the "azp" (authorized party) claim in the JWT payload.
    • emailKeyStartIndex: The index of the "email" key in the JWT payload.
    • emailLength: The length of the "email" claim in the JWT payload.
    • nonceKeyStartIndex: The index of the "nonce" key in the JWT payload.
    • commandLength: The length of the "command" claim in the "nonce" key in the JWT payload.
    • emailDomainIndex: The index of the domain in the email.
    • emailDomainLength: The length of the domain in the email.
  • Outputs:

    • kid: The "kid" (key ID) claim in the JWT header.
    • iss: The "iss" (issuer) claim in the JWT payload.
    • publicKeyHash: The SHA256 hash of the RSA public key.
    • jwtNullifier: The unique nullifier for the JWT.
    • timestamp: The "iat" (issued at) claim in the JWT payload.
    • maskedCommand: The "command" claim in the JWT payload with the "accountCode" masked and receiving email address masked.
    • accountSalt: The "accountSalt" claim in the JWT payload.
    • azp: The "azp" (authorized party) claim in the JWT payload.
    • domainName: The domain name extracted from the email.
    • isCodeExist: Whether the "accountCode" exists in the "command" claim.