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

@identsphere/core

v0.2.1

Published

Framework-agnostic, zero-dependency TypeScript client for the IdentSphere authentication API. Runs anywhere fetch exists: browser, React Native, Node, Deno, Bun, Workers.

Readme

@identsphere/core

Framework-agnostic, zero-dependency TypeScript client for the IdentSphere authentication API. It has no React, no DOM, and no runtime dependencies — it runs anywhere fetch exists: the browser, React Native, Node 18+, Deno, Bun, and Cloudflare Workers.

Reach for this package when the DOM-bound @identsphere/react binding doesn't fit your runtime — a React Native / Tamagui app, a non-React framework, a backend-for-frontend, or an edge worker.

npm install @identsphere/core

Quick start

import { IdentSphereClient } from "@identsphere/core";

const auth = new IdentSphereClient({
  baseUrl: "https://auth.example.com",
  mode: "bearer", // "bearer" for native; "cookie" for first-party web
});

const result = await auth.login({ email, password });
if (result.status === "mfa_required") {
  await auth.completeMfaChallenge({ mfa_token: result.mfa_token, code: "123456" });
}
// authenticated — call any protected endpoint with auth + auto-refresh applied:
const me = await auth.request("GET", "/v1/users/me");

Transport modes

| Mode | Use for | Auth | CSRF | Refresh token | | --- | --- | --- | --- | --- | | cookie | First-party web | httpOnly identsphere_at cookie | double-submit identsphere_csrf header | httpOnly cookie (JS never sees it) | | bearer | React Native, native, edge | Authorization: Bearer <access> | n/a (bearer bypasses CSRF) | httpOnly cookie via the platform cookie jar |

credentials: "include" is sent in both modes so the refresh cookie rides along. On React Native the native networking layer (bare RN and Expo) persists and re-sends cookies automatically, so refresh() works out of the box.

Runtime note: refresh() relies on a cookie jar to carry the httpOnly identsphere_rt cookie. Browsers and React Native have one; bare Node / Workers do not, so there refresh() requires either a cookie-jar fetch wrapper or the server's opt-in body-token delivery. See Universal & React Native in the docs.

Token storage

The access token's home is injected, never assumed:

// React Native (Expo):
import * as SecureStore from "expo-secure-store";
import { createKeyValueTokenStore } from "@identsphere/core";

const tokenStore = createKeyValueTokenStore(SecureStore, "identsphere.at");
const auth = new IdentSphereClient({ baseUrl, mode: "bearer", tokenStore });

MemoryTokenStore (the default) and createKeyValueTokenStore(...) (wrap expo-secure-store, AsyncStorage, react-native-keychain, or localStorage) ship in the box. The refresh token is never exposed to JS — it stays an httpOnly cookie by design.

API

The client mirrors the REST surface with typed methods:

  • Credentialsregister, login, completeMfaChallenge
  • PasswordlessrequestEmailOtp, verifyEmailOtp
  • Sessionbootstrap, getSession, refresh, logout
  • Password resetforgotPassword, resetPassword
  • MFA managementgetMfaStatus, setupMfa, enableMfa, disableMfa, regenerateRecoveryCodes, stepUpMfa
  • Escape hatchrequest(method, path, opts) runs any endpoint through the same auth + single-flight refresh-and-retry engine
  • StategetState(), subscribe(listener), isAuthenticated()

login() and verifyEmailOtp() return a discriminated union — branch on result.status === "mfa_required" to drive the second-factor step.

Every rejection is an IdentSphereError with a stable machine code and predicates (isMfaRequired, isAuthRequired, isRateLimited, isCsrfFailed, isStepUpRequired), so you branch on codes, not error strings.

License

BUSL-1.1 © Pradumna Gautam. See LICENSE.