@zk-email/jwt-tx-builder-helpers
v0.1.0
Published
The @zk-email/jwt-tx-builder-helpers package provides utility functions for JWT verification and cryptographic operations. It includes functions for handling RSA signatures, public keys, JWT messages, and hashes.
Downloads
142
Maintainers
Keywords
Readme
@zk-email/jwt-tx-builder-helpers
The @zk-email/jwt-tx-builder-helpers package provides utility functions for JWT verification and cryptographic operations. It includes functions for handling RSA signatures, public keys, JWT messages, and hashes.
Installation
yarn add @zk-email/jwt-tx-builder-helpers
input-generators.ts
The input-generators.ts file provides functions for generating inputs to the JWT Auth circuit. It includes utilities for JWT verification, input generation, and handling anonymous domains.
Key Interfaces:
export interface RSAPublicKey {
n: string; // Base64-encoded modulus
e: number; // Public exponent
}
export interface JWTInputGenerationArgs {
maxMessageLength?: number;
verifyAnonymousDomains?: boolean;
anonymousDomainsTreeHeight?: number;
anonymousDomainsTreeRoot?: bigint;
emailDomainPath?: bigint[];
emailDomainPathHelper?: number[];
}
Main Function:
async function generateJWTVerifierInputs(
rawJWT: string,
publicKey: RSAPublicKey,
accountCode: bigint,
params: JWTInputGenerationArgs = {},
);
Testing
To test the input generator, you can run the following command:
yarn test