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 🙏

© 2026 – Pkg Stats / Ryan Hefner

stupidwebauthn-client

v1.8.2

Published

## Installation

Readme

Stupid Webauthn Client

Installation

yarn add stupidwebauthn-client

Code instructions

Add this as a global constant, available for use in any of your frontend's components.

const client = new StupidWebauthnClient();

Register email address

<form>
  <input name="email" type="email" required />
</form>
const email = e.target.email.value;
await client.Register1EmailChallenge(email);
// send email

Run on opening at the validation link:

import queryString from "query-string";

const params = queryString.parse(location.search) as { c?: string };
// check if token is add to the url
if (!params.c) throw "Invalid email verification url provided";
// validating email
await client.Register2EmailVerify(params.c);
// email registered successfully
// creates an `swa_auth` cookie

Register passkey

const res1 = await client.Register3PasskeyChallenge();
const res2 = await client.Register4PasskeyRegister(res1);
await client.Register5PasskeyVerify(res2);
// passkey authenticated

Login

<form>
  <input name="email" type="email" required />
</form>

On form submission:

const email = e.target.email.value;
const res1 = await client.Login1Challenge(email);
const res2 = await client.Login2Authenticate(res1);
await client.Login3Verify(res2);
// authenticated
// creates an `swa_auth` cookie

Authentication

Check if the swa_auth cookie is valid

client
  .AuthValidate()
  .then(() => {
    // is authenticated
  })
  .catch((err) => {
    // navigate back to the login page
  });

Authentication with csrf blocking

await client.AuthCsrfChallenge();

// Or any api call that uses the csrf validate middleware
await client.AuthCsrfValidate();

Double Validation

// assuming that the client is authenticated
const res1 = await client.AuthDoubleCheck1Challenge();
const res2 = await client.AuthDoubleCheck2Authenticate(res1);
await client.AuthDoubleCheckVerify(res2);
// creates an `swa_doublecheck_auth` cookie that is valid for a minute
// Now make a request to your server which requires an extra check to validate

Logout

await client.Logout();
// Navigate back to the login page

Passkey invalidation

// Removes all passkeys, invalidates all session cookies and logs out
await AuthDoubleCheck123();
await AuthPanic();

// Removes current passkey and logs out
const res1 = await AuthDoubleCheck1Challenge();
const res2 = await AuthDoubleCheck2Authenticate(res1);
await AuthDeletePasskey3(res3);

GDPR Request

// Data Request
await AuthDoubleCheck123();
await GdprData();

// Data Deletion Request (will delete the account after 30 days)
await AuthDoubleCheck123();
await GdprDeleteSet();

// Retract Deletion Request
await AuthDoubleCheck123();
await GdprDeleteUnset();