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/contracts

v6.1.5

Published

## DKIMRegistry.sol

Downloads

1,190

Readme

@zk-email/contracts

DKIMRegistry.sol

DKIMRegistry.sol is a Solidity contract within the @zk-email/contracts package, functioning as a registry for storing hashes of DKIM public keys associated with particular domains.

  1. Registering DKIM Public Key Hashes: Developers can use the contract to register new hashes of DKIM public keys for a domain, so that any email sent from the domain can be verified against the blockchain-stored hash.

  2. Validating DKIM Public Key Hashes: The contract allows for the validation of a registered DKIM public key hash. This helps verify if the public key in an email matches the one registered in the blockchain for the domain, confirming the email's authenticity.

  3. Revoking Compromised Keys: In the event of a security breach or compromise of a private key, developers can revoke the associated DKIM public key hash to prevent misuse.

For a detailed overview of its functionalities, please refer to the source file: DKIMRegistry.sol

UserOverrideableDKIMRegistry.sol

UserOverrideableDKIMRegistry.sol is a Solidity contract within the @zk-email/contracts package.
This functions similarly to DKIMRegistry, but it allows users to set their own public keys. Even if the main authorizer, who is the contract owner, has already approved a public key, the user's signature is still required for setting it. Additionally, the public key can be revoked by the signature of either the user or the main authorizer alone.

UserOverrideableDKIMRegistry.sol

StringUtils.sol

StringUtils.sol is a Solidity library that offers a range of string manipulation functions, including conversion between bytes and strings, and numerical string operations, for use across the @zk-email/contracts package.

Converting Values to Strings

  • To Hex String: Convert a uint256 to its ASCII string hexadecimal representation.
string memory hexString = StringUtils.toHexString(12345, 4);
// hexString will be "0x3039" 
  • To Hex String Without Prefix: Similar to toHexString but without the "0x" prefix.
string memory hexStringNoPrefix = StringUtils.toHexStringNoPrefix(12345, 4);
// hexStringNoPrefix will be "3039"
  • To String from Various Types: Convert uint256, bytes32, or address to a string.
string memory uintToString = StringUtils.toString(uint256(12345));
string memory bytesToString = StringUtils.toString(bytes32("data"));
string memory addressToString = StringUtils.toString(address(0x123));

String Comparisons

  • String Equality: Check if two strings are equal.
bool isEqual = StringUtils.stringEq("hello", "hello");
// isEqual will be true

Advanced String Manipulations

  • Remove Trailing Zeros: Trims trailing zeros from a string representation of bytes.
string memory trimmedString = StringUtils.removeTrailingZeros("hello\x00\x00");
// trimmedString will be "hello"
  • Convert Packed Bytes to String: Unpacks uint256 values into a string, useful for handling compact data representations. 1 packed byte = 31 normal bytes.
  • Upper and Lower Case Conversion: Convert a string to all uppercase or lowercase.
string memory upperString = StringUtils.upper("hello"); // "HELLO"
string memory lowerString = StringUtils.lower("HELLO"); // "hello"