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

@wizpro/auth-sdk

v2.0.0

Published

SDK for integrating WizAuth 2FA into WizPro applications. Includes server-side API client, Next.js route handlers, and React hooks.

Downloads

18

Readme

@wizpro/auth-sdk

SDK for integrating WizAuth authentication into WizPro applications.

Installation

npm install @wizpro/auth-sdk

Quick Start

import { WizAuthClient } from '@wizpro/auth-sdk';

const wizAuth = new WizAuthClient({
  appId: 'rooferwiz',
  appName: 'RooferWiz',
  appIcon: 'https://example.com/icon.png', // optional
});

Push Authentication

Push authentication sends a notification to the user's WizAuth mobile app. The user must select the correct 2-digit number displayed on your app to approve.

Basic Usage

async function authenticateUser(userId: string) {
  try {
    const result = await wizAuth.requestPushAuth({
      userId,
      onChallengeNumber: (challengeNumber) => {
        // Display this number to the user
        // They must match it in WizAuth to approve
        console.log(`Enter ${challengeNumber} in WizAuth to approve`);
      },
      onStatusUpdate: (status) => {
        console.log('Status:', status);
      },
    });

    switch (result.status) {
      case 'APPROVED':
        console.log('User approved! Biometric used:', result.biometricUsed);
        return true;

      case 'DENIED':
        console.log('User denied the request');
        return false;

      case 'EXPIRED':
        console.log('Request timed out');
        return false;

      case 'FRAUD_REPORTED':
        console.log('User reported this as fraudulent!');
        // Take security action
        return false;
    }
  } catch (error) {
    console.error('Push auth failed:', error);
    return false;
  }
}

React Example

import { useState } from 'react';
import { WizAuthClient } from '@wizpro/auth-sdk';

const wizAuth = new WizAuthClient({
  appId: 'rooferwiz',
  appName: 'RooferWiz',
});

function LoginWithPushAuth({ userId }: { userId: string }) {
  const [challengeNumber, setChallengeNumber] = useState<number | null>(null);
  const [status, setStatus] = useState<string>('idle');

  const handleLogin = async () => {
    setStatus('waiting');

    const result = await wizAuth.requestPushAuth({
      userId,
      onChallengeNumber: setChallengeNumber,
      onStatusUpdate: setStatus,
    });

    if (result.status === 'APPROVED') {
      // Redirect to dashboard
      window.location.href = '/dashboard';
    } else {
      setStatus('failed');
    }
  };

  return (
    <div>
      {status === 'idle' && (
        <button onClick={handleLogin}>Login with WizAuth</button>
      )}

      {status === 'waiting' && challengeNumber && (
        <div>
          <p>Open WizAuth and enter:</p>
          <h1>{challengeNumber}</h1>
          <p>Waiting for approval...</p>
        </div>
      )}

      {status === 'failed' && (
        <div>
          <p>Authentication failed</p>
          <button onClick={handleLogin}>Try Again</button>
        </div>
      )}
    </div>
  );
}

Request Types

You can specify different request types for different scenarios:

// Standard login
await wizAuth.requestPushAuth({
  userId,
  requestType: 'LOGIN',
});

// Sensitive action (e.g., deleting data)
await wizAuth.requestPushAuth({
  userId,
  requestType: 'SENSITIVE_ACTION',
  actionDescription: 'Delete all project data',
});

// Financial transaction
await wizAuth.requestPushAuth({
  userId,
  requestType: 'TRANSACTION',
  actionDescription: 'Transfer $500 to vendor',
});

// New device registration
await wizAuth.requestPushAuth({
  userId,
  requestType: 'NEW_DEVICE',
  actionDescription: 'Chrome on Windows 11',
});

Adding Context

Provide additional context for security:

await wizAuth.requestPushAuth({
  userId,
  requestType: 'LOGIN',
  ipAddress: req.ip,
  userAgent: req.headers['user-agent'],
  location: 'Austin, TX',
});

Manual Polling

If you prefer to handle polling yourself:

// Create request
const { requestToken, challengeNumber } = await wizAuth.createPushAuthRequest({
  userId,
  requestType: 'LOGIN',
});

// Display challenge number to user
showChallengeNumber(challengeNumber);

// Poll for status
const checkStatus = async () => {
  const { status } = await wizAuth.getPushAuthStatus(requestToken);

  if (status === 'PENDING') {
    // Still waiting, check again
    setTimeout(checkStatus, 2000);
  } else {
    // Terminal state reached
    handleResult(status);
  }
};

checkStatus();

Configuration

const wizAuth = new WizAuthClient({
  // Required
  appId: 'your-app-id',
  appName: 'Your App Name',

  // Optional
  appIcon: 'https://example.com/icon.png',
  apiUrl: 'https://wiz-auth-psi.vercel.app/api', // default
  timeout: 60000, // 60 seconds (default)
  pollInterval: 2000, // 2 seconds (default)
});

TypeScript

The SDK is written in TypeScript and includes full type definitions:

import type {
  WizAuthConfig,
  PushAuthResult,
  PushAuthStatus,
  PushAuthType,
} from '@wizpro/auth-sdk';

Security Best Practices

  1. Always display the challenge number - Users should verify the number matches what they see in WizAuth
  2. Use biometric verification - WizAuth supports biometric for added security
  3. Provide context - Include IP address, user agent, and location when available
  4. Handle fraud reports - If FRAUD_REPORTED, take immediate security action
  5. Implement fallback - Have TOTP or backup codes as fallback authentication

Support

For issues or questions, contact [email protected]