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

@farcasterorg/quick-auth

v0.2.0

Published

Quick Auth without an auth server: wallet-signed tokens verified against Farcaster protocol state.

Readme

@farcasterorg/quick-auth

Quick Auth without an auth server. A Quick Auth token is a short-lived EIP-4361 message naming a Farcaster FID, signed by a wallet linked to that FID. This library verifies one against Farcaster protocol state read from a hub.

Tokens come from the Mini App SDK's sdk.protocolAuth.getToken(); this package also exports the token format (createMessage, encodeToken, decodeToken, from @farcasterorg/quick-auth/token) for producing them elsewhere.

It also verifies classic Quick Auth JWTs (sdk.quickAuth.getToken()), and is a drop-in replacement for @farcaster/quick-auth.

import { createClient, HubError, InvalidTokenError } from '@farcasterorg/quick-auth'

const client = createClient() // hubUrl defaults to https://haatz.quilibrium.com

try {
  const { sub: fid, address, method } = await client.verifyToken({
    token, // from `Authorization: Bearer <token>`
    domain: 'example.com',
  })
} catch (e) {
  if (e instanceof InvalidTokenError) // 401
  if (e instanceof HubError) // 503: couldn't check, let the client retry
}

method says how the FID was proven: custody, authAddress or verified for a protocol token, quickAuthServer for a JWT. address is always set for a protocol token; JWTs from auth.farcaster.xyz don't carry one.

Replacing @farcaster/quick-auth

Everything @farcaster/quick-auth exports is exported here under the same name, from the same entry points (., /light, /decodeJwt), as ESM and CommonJS:

  • createClient({ origin }). origin is the Quick Auth server, as there (quickAuthServerOrigin is a synonym).
  • verifyJwt verifies Quick Auth JWTs exactly as there, and protocol tokens too. verifyToken is the same function.
  • generateNonce, verifySiwf, createLightClient, decodeJwt, Actions and Endpoints are @farcaster/quick-auth's own.
  • Errors holds the same classes. Our InvalidTokenError subclasses theirs, so instanceof agrees across the two packages; HubError (503, couldn't check) is new, and extends their BaseError.

verifyJwt differs in two ways. It throws InvalidTokenError for every rejected JWT, including a bad signature or unknown key, which @farcaster/quick-auth throws as jose errors. And sub is always a number, which the JWT itself carries as a string.

What a token must be

  • Starts with hqa1., followed by the base64url message and signature.
  • The message is canonical EIP-4361 (it must re-serialize to the exact bytes that were signed), for the given domain, with an http(s) URI on that domain, the statement Authenticate as Farcaster FID <fid>., and exactly one resource, farcaster://fid/<fid>.
  • Issued At and Expiration Time are required; the lifetime is at most maxTokenLifetime (default 3600s), with clockSkew (default 300s) tolerance.
  • The signature is a 65-byte EOA signature over the message (EIP-191), or passes your verifySignature hook (smart-contract wallets).
  • The signing address is linked to the FID:
    • its custody address;
    • an auth address — KeyRegistry key type 2, read from the signer event history, since hubs store the key left-padded to 32 bytes;
    • a verified address whose verification was added by a signer with a trusted requestFid (trustedAppFids, default [9152], the Farcaster app) or the user's own FID. The signer must still be active.

Links are cached for linkCacheTtl seconds (default 60) and hub failures are never cached.

Hub API

Uses /v1/fidAddressType, /v1/verificationsByFid, /v1/signer and /v1/onChainEventsByFid. linkedAccounts(address), for building an account picker, also needs /v2/farcaster/user/bulk-by-address (haatz, Neynar).