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

zh-web-sdk

v3.5.1

Published

ZeroHash Web SDK

Readme

ZeroHash Web SDK

The ZeroHash Web SDK enables platforms to integrate ZeroHash financial services on web and mobile applications. Access various UI flows including Fund, Onboarding, Crypto Buy, Crypto Sell, Crypto Withdrawals, Fiat Deposits, and Fiat Withdrawals through a single SDK instance.

Installation

npm install zh-web-sdk

or

yarn add zh-web-sdk

Quick Start

React Example

import React, { useMemo } from 'react';
import ZeroHashSDK, { AppIdentifier } from 'zh-web-sdk';

const App = () => {
  // Create SDK instance once - not on every render
  const sdk = useMemo(() => new ZeroHashSDK({
    zeroHashAppsURL: "https://web-sdk.zerohash.com",
    env: "prod",
    theme: "light"
  }), []);

  const handleOpenFund = () => {
    sdk.openModal({
      appIdentifier: AppIdentifier.FUND,
      jwt: "<JWT_TOKEN_HERE>"
    });
  };

  return (
    <button onClick={handleOpenFund}>
      Fund Account
    </button>
  );
};

export default App;

Vanilla JavaScript Example

import ZeroHashSDK, { AppIdentifier } from 'zh-web-sdk';

// Initialize SDK once
const sdk = new ZeroHashSDK({
  zeroHashAppsURL: "https://web-sdk.zerohash.com",
  env: "prod",
  theme: "light"
});

// Open a modal
sdk.openModal({
  appIdentifier: AppIdentifier.FUND,
  jwt: "<JWT_TOKEN_HERE>"
});

// Close when done
sdk.closeModal(AppIdentifier.FUND);

Environments

Pass env to select the deployment the SDK should target. Accepted values are 'cert' and 'prod'. When set, env is the source of truth for environment resolution and overrides hostname-based inference from zeroHashAppsURL.

const sdk = new ZeroHashSDK({
  zeroHashAppsURL: "https://web-sdk.cert.zerohash.com",
  env: "cert"
});

Default URLs per environment:

  • Production: https://web-sdk.zerohash.com
  • Certification/Sandbox: https://web-sdk.cert.zerohash.com

If env is omitted, the SDK falls back to inferring the environment from the hostname of zeroHashAppsURL. Hosts outside the recognized Zero Hash list resolve to 'prod' — pass env explicitly when integrating from a partner-hosted domain.

env is init-only: it is read once when you construct ZeroHashSDK and cannot be changed afterwards. Region (EU) routing is derived from the JWT, not from env.

Available App Identifiers

The SDK supports the following application flows:

| AppIdentifier | Description | |--------------|-------------| | FUND | Fund account operations | | ONBOARDING | User onboarding and KYC | | CRYPTO_BUY | Purchase cryptocurrency | | CRYPTO_SELL | Sell cryptocurrency | | CRYPTO_WITHDRAWALS | Withdraw crypto to external wallets | | FIAT_DEPOSITS | Deposit fiat currency | | FIAT_WITHDRAWALS | Withdraw fiat currency | | PROFILE | User profile management | | CRYPTO_ACCOUNT_LINK | Link cryptocurrency accounts | | CRYPTO_ACCOUNT_LINK_PAYOUTS | Link crypto accounts for payouts | | FIAT_ACCOUNT_LINK | Link bank accounts | | PAYOUTS | Payout operations | | PAY | Payment operations |

API Reference

Constructor

new ZeroHashSDK(config: IInitializeParameters)

Configuration Options:

{
  zeroHashAppsURL: string;           // Required: Base URL for ZeroHash apps
  env?: 'cert' | 'prod';             // Optional: Explicit environment selection
  theme?: 'light' | 'dark' | 'auto'; // Optional: Appearance for next-gen flows (defaults to 'light')
  rootQuerySelector?: string;        // Optional: Custom DOM element selector

  // Optional: Set JWTs during initialization
  cryptoBuyJWT?: string;
  cryptoSellJWT?: string;
  cryptoWithdrawalsJWT?: string;
  fiatDepositsJWT?: string;
  fiatWithdrawalsJWT?: string;
  userOnboardingJWT?: string;
  fundJWT?: string;
  profileJWT?: string;
  cryptoAccountLinkJWT?: string;
  cryptoAccountLinkPayoutsJWT?: string;
  fiatAccountLinkJWT?: string;
  payoutsJWT?: string;
  payJWT?: string;
}

Methods

openModal(params)

Opens a modal for the specified app.

sdk.openModal({
  appIdentifier: AppIdentifier.FUND,
  jwt?: string,           // Optional: Set or update JWT
  filters?: Filters,      // Optional: Filter options
  navigate?: Page         // Optional: Navigation parameters
});

closeModal(appIdentifier)

Closes the modal for the specified app.

sdk.closeModal(AppIdentifier.FUND);

setJWT(params)

Set or update the JWT for a specific app.

sdk.setJWT({
  jwt: "<JWT_TOKEN>",
  appIdentifier: AppIdentifier.FUND
});

isModalOpen(appIdentifier)

Check if a modal is currently open.

const isOpen = sdk.isModalOpen(AppIdentifier.FUND);

setFilters(params)

Set filters for a specific app.

sdk.setFilters({
  appIdentifier: AppIdentifier.FUND,
  filters: {
    getAssets: {
      stablecoin: true
    }
  }
});

setTheme(params)

Update the theme forwarded to the next-generation @zerohash-sdk/*-react flows and Connect Auth (Fund). Has no effect on the legacy iframe.

sdk.setTheme({ theme: "dark" }); // 'light' | 'dark' | 'auto'

JWT Authentication

⚠️ Security Note: JWTs should be obtained from your backend server using the ZeroHash API with your API key. Never expose your API key or perform JWT exchanges on the client side.

Ways to provide JWTs

You only need to provide the JWT once. If it was set during initialization or via setJWT, calling openModal without a jwt uses the token already set for that app. Passing jwt to openModal sets or updates it. Either way the SDK reads the same token to decide whether to render the next-generation UI, so no change to how you call openModal is needed.

1. During initialization:

const sdk = new ZeroHashSDK({
  zeroHashAppsURL: "https://web-sdk.zerohash.com",
  env: "prod",
  fundJWT: jwt
});

2. When opening a modal:

sdk.openModal({
  appIdentifier: AppIdentifier.FUND,
  jwt: jwt
});

3. Update JWT later:

sdk.setJWT({
  jwt: newJwt,
  appIdentifier: AppIdentifier.FUND
});

TypeScript Support

The SDK is written in TypeScript and includes type definitions. Import types as needed:

import ZeroHashSDK, {
  AppIdentifier,
  IInitializeParameters,
  IOpenModalParameters,
  Filters
} from 'zh-web-sdk';

Documentation & Support

License

MIT