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

zukit

v0.2.4

Published

Like RainbowKit for the Zuzalu Passport

Downloads

10

Readme

npm install zukit

This React library makes it easy to use the Zuzalu Passport.

It gives you a login button similar to RainbowKit's Connect Wallet button.

Supports anonymous login, where your website never learns who the user is. Instead, Zupass creates a zero-knowledge proof that the user is part of a set-- for example, all Zuzalu participants, or just residents or organizers--without revealing who they are.

Live demo here.

Reference

<ZupassLoginButton />

<ZupassLoginButton anonymous namedGroup="residents" />
  • anonymous. Default false. If false, requests an identity-revealing login. If true, requests a Semaphore proof of anonymous membership in a group.
  • namedGroup. Default "participants". Also supports "organizers", "residents", and "visitors".
  • groupURL. Overrides namedGroup, specifying a semaphore group URL. For example, the named participants group is equivalent to passing https://api.pcd-passport.com/semaphore/1.
  • signal. Public input signal. You can use the generateMessageHash() function from semaphore-group-pcd to create a signal or external nullifier by hashing a string. See semaphore docs.
  • externalNullifier. External nullifier. This supports anonymous attribution. For example, you can make a poll that people can vote in anonymously, while ensuring that each user can only vote once.
  • className. CSS class for the button. Overrides default styling. Button will be :disabled while logging in.

Notice that there's no callback. Instead, you can get status and loading states from the useZupass() hook.

useZupass()

const [zupass] = useZupass();

if (zupass.status === "logged-in") {
  if (zupass.anonymous) return <h2>Welcome, anon</h2>;
  return <h2>Welcome, {zupass.participant.name}</h2>;
}

This is a React hook. The returned object contains the following.

  • status. See switch statement above. All keys below are undefined if the status is logged-out.
  • anonymous. True for anonymous login, false otherwise.
  • group. For an anonymous login, describes the anonymity set.
  • participant. For an identity-revealing login, contains user details.
  • pcd. A semaphore-group-pcd containing a nullifier hash for anonymous login, or a semaphore-signature-pcd containing a signature of the participant UUID for identity-revealing login. Either way, this PCD contains a zero-knowledge proof verifying the user.

<ZupassProvider>

export default function Page() {
  const url = "https://api.pcd-passport.com";
  return (
    <ZupassProvider passportServerUrl={url}>
      <MyApp />
    </ZupassProvider>
  );
}

Wrap your app in <ZupassProvider>. If you're using identity-revealing login, you must include a URL to the passport server, which serves participant info.

When running the Passport locally in development, use http://localhost:3002.

Popup page

import { usePassportPopupSetup } from "@pcd/passport-interface";

export default function PassportPopup() {
  return <div>{usePassportPopupSetup()}</div>;
}

Finally, your app needs a /popup page to communicate with the passport. If using Next, simply save the snippet above as pages/popup.tsx.

Development

npm ci
npm test

To develop Zukit, check out zukit-example.