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

@zkyc/kyc-js

v0.1.0

Published

Browser SDK for integrating zKYC identity verification flows

Readme

@zkyc/kyc-js

Browser SDK for integrating zKYC identity verification flows into your web application.

Installation

npm install @zkyc/kyc-js
# or
yarn add @zkyc/kyc-js
# or
bun add @zkyc/kyc-js

Quick Start

import { ZKYCProcess } from '@zkyc/kyc-js'

await ZKYCProcess({
  apiKey: 'test_your_api_key',
  userId: 'user_123',
  successUrl: 'https://yourapp.com/kyc/success',
  failureUrl: 'https://yourapp.com/kyc/failure',
})

API Reference

ZKYCProcess(config)

Generates a secure KYC token and launches the identity verification flow.

Returns Promise<{ url: string }>.

Config Options

| Field | Type | Required | Description | |---|---|---|---| | apiKey | string | Yes | Your zKYC API key (test_ or prod_ prefix) | | userId | string | Yes | The user's ID on your platform | | callbackUrl | string | Conditional | Single URL for all outcomes. Mutually exclusive with failureUrl/successUrl. | | failureUrl | string | Conditional | URL to redirect on KYC failure. Must be used together with successUrl. | | successUrl | string | Conditional | URL to redirect on KYC success. Must be used together with failureUrl. | | platform | string | No | Platform identifier. Defaults to "sdk". | | mode | "redirect" \| "popup" | No | Launch mode. Defaults to "redirect". |

You must provide either callbackUrl alone, or both failureUrl and successUrl together. Providing all three throws an error.

Usage Examples

Redirect mode (default)

The browser navigates to the KYC flow, then redirects to your success/failure URL when complete.

import { ZKYCProcess } from '@zkyc/kyc-js'

document.getElementById('kyc-btn').addEventListener('click', async () => {
  try {
    await ZKYCProcess({
      apiKey: 'test_your_api_key',
      userId: 'user_abc123',
      successUrl: 'https://yourapp.com/kyc/success',
      failureUrl: 'https://yourapp.com/kyc/failure',
    })
    // Note: browser has navigated away at this point
  } catch (err) {
    console.error('KYC failed to start:', err.message)
  }
})

Popup mode

The KYC flow opens in a popup window, keeping your application in the background.

await ZKYCProcess({
  apiKey: 'test_your_api_key',
  userId: 'user_abc123',
  successUrl: 'https://yourapp.com/kyc/success',
  failureUrl: 'https://yourapp.com/kyc/failure',
  mode: 'popup',
})

Single callback URL

Use one URL to handle all outcomes.

await ZKYCProcess({
  apiKey: 'test_your_api_key',
  userId: 'user_abc123',
  callbackUrl: 'https://yourapp.com/kyc/callback',
})

React example

import { useState } from 'react'
import { ZKYCProcess } from '@zkyc/kyc-js'

function KYCButton({ apiKey, userId }: { apiKey: string; userId: string }) {
  const [loading, setLoading] = useState(false)
  const [error, setError] = useState<string | null>(null)

  const handleClick = async () => {
    setLoading(true)
    setError(null)
    try {
      await ZKYCProcess({
        apiKey,
        userId,
        successUrl: `${window.location.origin}/kyc/success`,
        failureUrl: `${window.location.origin}/kyc/failure`,
      })
    } catch (err) {
      setError(err instanceof Error ? err.message : 'Unknown error')
    } finally {
      setLoading(false)
    }
  }

  return (
    <>
      <button onClick={handleClick} disabled={loading}>
        {loading ? 'Starting...' : 'Verify Identity'}
      </button>
      {error && <p style={{ color: 'red' }}>{error}</p>}
    </>
  )
}

Notes

Browser only — This SDK requires the window object and throws if called in a server-side environment (SSR, Node.js, Bun, etc.).

If you use SSR (Next.js, Remix, etc.), call ZKYCProcess only from client-side event handlers or inside a useEffect.

License

MIT