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

@genation/sdk

v0.2.12

Published

OAuth 2.1 SDK for Genation authentication

Readme

Genation SDK

OAuth 2.1 SDK for Genation authentication. Built with TypeScript, supports browser and Node.js environments.

Installation

npm install @genation/sdk

Quick Start

import { createClient } from "@genation/sdk";

const client = createClient({
    // Your Genation client ID and secret
    clientId: "your-client-id",
    clientSecret: "your-client-secret",
    // Your app redirect URI
    redirectUri: "http://localhost:3000/callback",
});

// Listen to auth state changes
client.onAuthStateChange((event, session) => {
    if (event === "SIGNED_IN") {
        console.log("Welcome!", session?.user);
    } else if (event === "SIGNED_OUT") {
        console.log("Goodbye!");
    }
});

// Start login
window.location.href = await client.signIn();

// Handle callback (on /callback page)
const params = new URLSearchParams(window.location.search);
await client.handleCallback(params.get("code")!, params.get("state")!);

API Reference

createClient(config)

Create a new Genation client instance.

const client = createClient({
  clientId: string;       // Required
  clientSecret: string;   // Required
  redirectUri: string;    // Required
});

client.onAuthStateChange(callback)

Listen to authentication state changes.

Events:

| Event | Description | | ----------------- | ---------------------------------------- | | INITIAL_SESSION | First load, session may or may not exist | | SIGNED_IN | User successfully signed in | | SIGNED_OUT | User signed out or session expired | | TOKEN_REFRESHED | Access token was automatically refreshed |

const { subscription } = client.onAuthStateChange((event, session) => {
    console.log(event, session);
});

// Cleanup
subscription.unsubscribe();

client.signIn()

Start OAuth login flow. Returns authorization URL.

const url = await client.signIn();
window.location.href = url;

client.handleCallback(url)

Exchange authorization code for tokens.

const url = window.location.href;
await client.handleCallback(url);

client.getSession()

Get current session with auto-refresh.

const session = await client.getSession();
if (session) {
    console.log(session.accessToken);
    console.log(session.user);
}

client.signOut()

Sign out the current user and clear local session tokens.

await client.signOut();
// Triggers "SIGNED_OUT" event

client.verifyToken(token)

Verify a JWT token signature using the public JWKS endpoint.

try {
    const payload = await client.verifyToken(accessToken);
    console.log("Token is valid:", payload);
} catch (error) {
    console.error("Token verification failed:", error);
}

Standalone Token Verification

You can also verify tokens without a client instance:

import { verifyToken } from "@genation/sdk";

// Uses default Genation Auth URL
const payload = await verifyToken(token);

Session Object

interface Session {
    accessToken: string;
    refreshToken?: string;
    expiresIn: number;
    expiresAt: number;
    user: User | null;
}

interface User {
    sub: string; // user id
    name?: string;
    email?: string;
    ...
}

client.getLicenses()

const licenses = await client.getLicenses({ expiresAfter: new Date() });

License Object

interface License {
    id: string;
    expiresAt: string;
    appPlanId: string;
    durationDays: number;
    planTermId: string | null;
    purchaserId: string;
    redeemedBy: string;
    purchasedAt: string;
    redeemedAt: string;
    purchaserNote: string;
    status: string;
    plan: LicensePlan;
}

Security

  • ✅ OAuth 2.1 with PKCE (S256)
  • ✅ State parameter for CSRF protection
  • ✅ Automatic token refresh
  • ✅ Matches Supabase implementation

License

MIT