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

@hypernetlabs/hypernet-id-contracts-integration

v0.0.2

Published

A minimalist smart contract library for on-chain identity verification.

Downloads

4

Readme

Smart Contract Integration

How It Works

Hypernet.ID mints Non-Fungible Token assets directly to a user's account on the blockchain. This package allows protocol developers to gate access to their protocol by requiring that an account own a Hypernet.ID NFT and that it indicates the user has met certain identity check criteria.

The tokenURI field of each Hypernet.ID NFT contains a bit field that indicates what Personally Identifying Information (PII) the user presented during their identity verification screening, what country code they were verified under, and the timestamp of when they passed the screening. This bitmap only indicates the PII was presented and passed verification checks; no PII is actually written to the blockchain. See the full NFT specification for details.

NOTE: In order to adhere to the specification of the EIP721 standard, the Hypernet.ID bit field is encoded as a UTF-8 string. The smart contract integration package handles conversion from UTF-8 to bits for you.

Hypernet.ID Registry Chain Addresses

Currently, the Hypernet.ID smart contract registries are only deployed to testnet environments. Therefore, only smart contracts on these networks can directly query a user's verification status. As Hypernet.ID deploys to other EVM-compatible blockchains, this section will list the offical contract addresses that Hypernet.ID administers.

Rinkeby (chainid: 4)

0x8E92D1D990E36e00Af533db811Fc5C342823C817

Polygon Mainnet (chainid: 137)

0x267F7bE23760743f0e415A28f56dA5129EA11AA9

Mumbai (chainid: 80001)

0x398c52D8599B78bB1CeAe56532DDBf683433EC3f

Avalanche Mainnet (chainid: 43114)

0x70f622E02b96c498c6266eA6C96327160A21263b

Fuji (chainid: 43113)

0x70f622E02b96c498c6266eA6C96327160A21263b

Installation

Hypernet.ID publishes a helper contract, ID.sol, as an NPM package that you can inherit in your own smart contract to protect public and external functions from being accessed by users who have not undergone sufficient identity verification. This allows for id verification to be enforced at the protocol level so that it cannot be circumvented. To install Hypernet.ID's helper contracts in your project run:

npm install --sav-dev @hypernetlabs/hypernet-id-contracts-integration

Usage

Protecting your smart contract's external and public functions from unverified accounts simply requries that they be decorated with one of the following modifiers defined in ID.sol.

  • onlyVerified: Simply checks that the msg.sender owns a Hypernet.ID NFT but does not check that any specific id checks were performed. This is the most gas effient modifier.
  • onlyVerifiedWithCriteria: Checks that the msg.sender owns a Hypernet.ID NFT and that its owner has met the id checks specified in CRITERIA. This is the most gas expensive modifer.
  • onlyVerifiedTokenWithCriteria: Checks that the msg.sender owns a Hypernet.ID NFT and that its owner has met the id checks specified in CRITERIA. This is about 12% cheaper to call than onlyVerifiedWithCriteria but requires that a tokenid be given as an argument.

You can see a simple yet complete example of how to use ID.sol here. In order to gate on specific id verification criteria, you must set the CRITERIA variable appropriately. An example of how to do this can be seen in the constructor of Test.sol. Additionally, since Hypernet.ID maintains id registries on multiple chains, you must be sure to set the registryAddress variable to the requisite address for your target network (i.e. Rinkeby, Mainnet, Avalanche, Polygon, etc.).