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

@godai_dev/auth

v0.2.0

Published

GDI 共通認証基盤(gdi-auth)JWT 検証 SDK。RS256 / JWKS ベースで auth_token を検証し、クロスドメイン SSO ハンドオフ(PKCE)を補助する

Readme

@godai_dev/auth

GDI 共通認証基盤(gdi-auth)が発行する RS256 JWT を検証するための SDK です。 検証専用(署名鍵・secret は一切保持しません)。Cloudflare Workers を主対象としますが、 jose の Web 標準 API のみを使うため Node / Edge ランタイム全般で動作します。

インストール

npm install @godai_dev/auth

設定

認証サービスの URL(AUTH_SERVICE_URL、例: https://auth.gdidatahub.net)を 環境変数等で用意してください。https スキームのみ許可されます。

セキュリティ上の注意(SSRF 防止): authServiceUrl はハードコード、 または信頼できる環境変数の値に限定してください。リクエストパラメータや DB に保存された値から動的に構築しないでください。

使い方

Next.js middleware での利用

import { authMiddleware } from '@godai_dev/auth';

const checkAuth = authMiddleware(process.env.AUTH_SERVICE_URL!, '/login');

export async function middleware(request: Request) {
  return (await checkAuth(request)) ?? NextResponse.next();
}

現在のユーザーを取得する

import { getCurrentUser } from '@godai_dev/auth';

const user = await getCurrentUser(request, process.env.AUTH_SERVICE_URL!);
if (!user) {
  // 未認証
}

トークンを直接検証する(エラー種別が必要な場合)

import { verifyAuthToken, AuthError } from '@godai_dev/auth';

try {
  const payload = await verifyAuthToken(token, process.env.AUTH_SERVICE_URL!);
} catch (err) {
  if (err instanceof AuthError) {
    // err.code: EXPIRED / INVALID_SIGNATURE / INVALID_ISSUER / NO_MATCHING_KID / JWKS_FETCH_FAILED 等
  }
}

セキュリティ上の注意(内部情報漏洩防止): AuthError.message は ログ出力用です。クライアントへのレスポンスには AuthError.code のみを 使用し、message を含めないでください。