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

@atpassport/client

v0.1.34

Published

@passport client library for integrating secure handle input assist into applications.

Readme

@atpassport/client

@passport is a service designed to eliminate the need for handle entry across applications in the atproto ecosystem. Using this client library, you can integrate a @passport-powered "handle input assist feature" into your web applications.

For the Japanese documentation, please see README_ja.md.

Features

  • Zero dependencies
  • OAuth-like secure integration flow (Built-in CSRF protection via atpstate)
  • Custom parameter passthrough (Query parameters attached to the callback URL are automatically returned)

Installation

npm install @atpassport/client
# or
pnpm add @atpassport/client

Usage

import { AtPassport } from '@atpassport/client/core';

// 1. Initialize the client
const passport = new AtPassport({
  callbackUrl: 'https://myapp.com/api/atpassport/callback', // Required: The URL to redirect back to
  lang: 'en', // Optional: 'en', 'ja', 'pt', 'de', 'fr', 'es'
  requiredParams: { returnTo: 'string' } // Optional: Define required parameters
});

// 2. Generate the authentication URL and atpstate (for CSRF protection)
// In TypeScript, 'returnTo' (defined in requiredParams) is required
const { url, atpstate } = passport.generateAuthUrl({
  returnTo: window.location.href
});

// 3. Save atpstate to cookies or session to prevent CSRF
document.cookie = `atpstate=${atpstate}; path=/; max-age=600; SameSite=Lax`;

// 4. Redirect the user to @passport
window.location.href = url;
// Receive the parameters on your callback page (Next.js API Route example at https://myapp.com/api/atpassport/callback)

export async function GET(req: Request) {
  const url = new URL(req.url);
  const expectedState = getCookie(req, 'atpstate'); // Get saved state from cookie
  
  try {
    const result = passport.parseCallback(req.url, expectedState);
    
    console.log('Handle:', result.handle);
    console.log('Custom Parameters:', result.customParams.returnTo);
    
    // Continue the OAuth flow... (e.g., call authorize() with the received handle using your OAuth library)
    const authUrl = await client.authorize(result.handle);

  } catch (err) {
    console.error('Finalize login failed:', err);
  }
}

Standard UI Texts and Icons for Integration

To make it easy for developers to build consistent "Login with @passport" buttons, the client library exports multi-language standard texts and an SVG icon constant AtPassportUI.

import { AtPassportUI } from '@atpassport/client/ui';

// English translations
console.log(AtPassportUI.en.title); // "Login with @passport"
console.log(AtPassportUI.en.description); // "@passport is a handle manager that eliminates the need for handle entry across atproto apps."

// Japanese translations
console.log(AtPassportUI.ja.title); // "@passportでログイン"
console.log(AtPassportUI.ja.description); // "@passportは、各atprotoアプリでハンドルを都度入力する手間が省ける共通ハンドルマネージャーです。"

// Standard Icon (SVG String)
const svgString = AtPassportUI.iconSvg;

// React Component
import { AtPassportIcon } from '@atpassport/client/ui';

// Use it in your React component
// <AtPassportIcon size={24} />

Explained: Parameters and Placeholders

When @passport redirects back to your callbackUrl, the following information will be attached as URL parameters.

Basic Parameters (Automatically extracted by parseCallback)

  • handle: The authenticated user's Bluesky / atproto handle (e.g., alice.bsky.social).
  • did: The user's Decentralized Identifier (DID). (e.g., did:plc:xxxxxxxx. Used to resolve the handle or communicate with the user's PDS.)
  • pdsurl: The endpoint URL of the user's Personal Data Server (PDS).
  • atpstate: The state string automatically generated for CSRF protection via generateAuthUrl().

Note: In the standard generateAuthUrlparseCallback flow using @atpassport/client, @passport securely appends information as standard query parameters (e.g., &handle=...). By using parseCallback(), you can easily receive all these parameters.