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

@kibaofficial/kio-auth-client

v0.1.0

Published

Official client SDK for KioAuth - Self-hosted authentication service

Readme

@kibaofficial/kio-auth-client

Official client SDK for KioAuth - Self-hosted authentication service.

Installation

npm install @kibaofficial/kio-auth-client
# or
pnpm add @kibaofficial/kio-auth-client
# or
yarn add @kibaofficial/kio-auth-client

Quick Start

Core Client (Framework-agnostic)

import { createClient } from '@kibaofficial/kio-auth-client';

const auth = createClient({
  baseUrl: 'https://auth.example.com'
});

// Sign in
try {
  const { user } = await auth.signIn({
    email: '[email protected]',
    password: 'password123'
  });
  console.log('Signed in as:', user.name);
} catch (error) {
  if (error.code === '2FA_REQUIRED') {
    // Show 2FA input
  }
}

// Get current user
const user = await auth.getUser();

// Sign out
await auth.signOut();

React Integration

import { KioAuthProvider, useUser, useAuth } from '@kibaofficial/kio-auth-client/react';

function App() {
  return (
    <KioAuthProvider 
      baseUrl="https://auth.example.com"
      redirectUrl="/dashboard"
    >
      <MyApp />
    </KioAuthProvider>
  );
}

function Profile() {
  const { user, isLoading } = useUser();
  const { signOut } = useAuth();
  
  if (isLoading) return <div>Loading...</div>;
  if (!user) return <div>Not signed in</div>;
  
  return (
    <div>
      <p>Hello {user.name}</p>
      <button onClick={() => signOut()}>Sign Out</button>
    </div>
  );
}

Next.js Integration

// middleware.ts
import { createAuthMiddleware } from '@kibaofficial/kio-auth-client/next';

export default createAuthMiddleware({
  publicRoutes: ['/', '/about', '/auth(.*)'],
  protectedRoutes: ['/dashboard(.*)'],
  authUrl: 'https://auth.example.com',
});

export const config = {
  matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
};

API Reference

createClient(config)

Creates a new KioAuth client instance.

const auth = createClient({
  baseUrl: string;          // Required: Your KioAuth server URL
  credentials?: 'include';  // Optional: Cookie handling (default: 'include')
  timeout?: number;         // Optional: Request timeout in ms (default: 30000)
});

Client Methods

Authentication

  • signIn({ email, password, totp? }) - Sign in with credentials
  • signUp({ email, password, username? }) - Create new account
  • signOut() - Sign out current user
  • requestPasswordReset(email) - Request password reset email
  • resetPassword(token, password) - Reset password with token

User

  • getUser() - Get current authenticated user
  • updateProfile({ name?, email? }) - Update user profile

Sessions

  • getSessions() - Get all active sessions
  • revokeSession(sessionId) - Revoke a specific session
  • validateSession() - Check if current session is valid

OAuth

  • getAccounts() - Get linked OAuth accounts
  • unlinkAccount(accountId) - Unlink an OAuth account
  • getOAuthLinkUrl(provider) - Get OAuth linking URL

Two-Factor Authentication

  • get2FAStatus() - Check if 2FA is enabled
  • setup2FA() - Generate 2FA secret and QR code
  • verify2FA(code) - Verify and enable 2FA
  • disable2FA(code) - Disable 2FA

Login History

  • getLoginHistory() - Get login history

Error Handling

import { KioAuthError } from '@kibaofficial/kio-auth-client';

try {
  await auth.signIn({ email, password });
} catch (error) {
  if (error instanceof KioAuthError) {
    switch (error.code) {
      case '2FA_REQUIRED':
        // Show 2FA input
        break;
      case 'INVALID_CREDENTIALS':
        // Show error message
        break;
      case 'RATE_LIMITED':
        // Too many attempts
        break;
      case 'ACCOUNT_BANNED':
        // Account is banned
        break;
    }
  }
}

Requirements

  • Node.js 18+
  • React 18+ (for React integration)
  • Next.js 13+ (for Next.js integration)

License

MIT © KibaOfficial