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

open-phiz-sdk

v0.1.0

Published

Server-side SDK for Open Phiz open login APIs

Readme

open-phiz-sdk

Server-side TypeScript SDK for Open Phiz open login. Use this package in the mini-app business backend. Do not bundle it into a mini-app, browser application, Flutter package, or native host app.

Install

bun add open-phiz-sdk

Node.js 22.12 or newer is required.

Exchange a login code

import { OpenPlatformClient } from 'open-phiz-sdk';

const openPlatform = new OpenPlatformClient({
  baseUrl: process.env.OPEN_PHIZ_BASE_URL!,
  appId: process.env.OPEN_PHIZ_APP_ID!,
  appSecret: process.env.OPEN_PHIZ_APP_SECRET!,
});

const session = await openPlatform.code2Session(loginCode);
// Persist your own business session. Do not return sessionKey to the mini-app.

Session and phone APIs

const checked = await openPlatform.checkSession({
  openId: session.openId,
  sessionKey: session.sessionKey,
});

const reset = await openPlatform.resetSession({
  openId: session.openId,
  sessionKey: session.sessionKey,
});

const phoneInfo = await openPlatform.getPhoneNumber({ code: phoneAuthorizationCode });

The SDK obtains and caches the app access_token in memory for session and phone operations. Concurrent refreshes share one request. An invalid internally managed token is refreshed once; an explicitly supplied token is never retried automatically.

Error handling

import { OpenPlatformSdkError } from 'open-phiz-sdk';

try {
  await openPlatform.code2Session(loginCode);
} catch (error) {
  if (error instanceof OpenPlatformSdkError) {
    console.error({
      code: error.code,
      status: error.status,
      requestId: error.requestId,
      retryable: error.retryable,
    });
  }
}

Do not log the login code, AppSecret, access token, session key, or phone authorization code. Use the returned Request ID with the Open Platform diagnostics page.

Transport policy

  • HTTPS is mandatory outside localhost unless allowInsecureHttp is explicitly enabled for an isolated development network.
  • AppSecret is sent only in JSON request bodies, never in query strings.
  • The SDK does not persist credentials or tokens to disk.
  • Requests time out after 10 seconds by default and accept an AbortSignal.