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

@workos/radar-signals

v0.0.1

Published

Browser signals collector for WorkOS Radar

Readme

@workos/radar-signals

Collect browser signals for WorkOS Radar fraud and bot detection.

@workos/radar-signals runs in the browser, loads a signal collection script from the WorkOS CDN, and returns a correlation token you pass with your authentication calls. WorkOS Radar uses these signals server-side to evaluate risk.

Installation

npm install @workos/radar-signals

Quick start

Wrap your app (or auth subtree) in RadarSignalsProvider. Signal collection starts automatically on mount. You can find your client ID in the WorkOS Dashboard under Applications.

import { RadarSignalsProvider } from '@workos/radar-signals/react';

function App() {
  return (
    <RadarSignalsProvider clientId="client_01ABC...">
      <LoginForm />
    </RadarSignalsProvider>
  );
}

Then call getToken() from any child component when you need the correlation token:

import { useRadarToken } from '@workos/radar-signals/react';

function LoginForm() {
  const { getToken, tokenReady } = useRadarToken();

  const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
    e.preventDefault();
    const token = await getToken();
    await fetch('/api/auth/login', {
      method: 'POST',
      body: JSON.stringify({ radar_token: token }),
    });
  };

  return (
    <form onSubmit={handleSubmit}>
      {/* ... */}
      <button type="submit" disabled={!tokenReady}>Log in</button>
    </form>
  );
}

How it works

  1. The library loads a signal collection script from the WorkOS CDN
  2. The CDN script collects device and environment signals and submits them to the WorkOS API
  3. getToken() returns the correlation token — if collection is still in-flight, it waits for completion
  4. Pass the token server-side to WorkOS Radar for risk evaluation

The library is fail-open: getToken() always returns a value, even if the CDN script fails to load. Server-side Radar handles missing signals gracefully.

React API

Requires React 18 or later. Import from @workos/radar-signals/react.

<RadarSignalsProvider>

Initializes Radar and provides the token to descendant components via context.

| Prop | Type | Required | Description | |------|------|----------|-------------| | clientId | string | Yes | Your WorkOS client ID (publishable, safe for browser use). Find this in the WorkOS Dashboard under Applications. | | apiUrl | string | No | Override the API base URL (defaults to https://api.workos.com) |

useRadarToken()

Returns { getToken, tokenReady } from the nearest RadarSignalsProvider.

  • getToken() — returns the token after collection completes (async)
  • tokenReadytrue once a real token is available; useful for disabling submit buttons until signals are collected

useRadarSignals(options)

Standalone hook that creates its own Radar instance — no provider needed. Accepts the same options as RadarSignalsProvider. Returns { getToken, tokenReady }.

import { useRadarSignals } from '@workos/radar-signals/react';

function LoginForm() {
  const { getToken, tokenReady } = useRadarSignals({
    clientId: 'client_01ABC...',
  });
  // ...
}

Vanilla JS

If you're not using React, the WorkOSRadar class provides the same functionality.

import { WorkOSRadar } from '@workos/radar-signals';

const radar = WorkOSRadar.init({ clientId: 'client_01ABC...' });

const token = await radar.getToken();

WorkOSRadar.init(options)

Creates a new Radar instance and loads the CDN collectors script.

| Option | Type | Required | Description | |--------|------|----------|-------------| | clientId | string | Yes | Your WorkOS client ID (publishable, safe for browser use). Find this in the WorkOS Dashboard under Applications. | | apiUrl | string | No | Override the API base URL (defaults to https://api.workos.com) |

radar.getToken()

Returns the correlation token after signals have been collected and submitted. If the CDN script is still loading, the promise resolves once complete.

radar.tokenReady

Boolean flag that becomes true once a real token is available. Useful for checking whether collection has completed without awaiting.

Script tag usage

For environments without a bundler, load the IIFE build via a <script> tag.

<script src="https://unpkg.com/@workos/radar-signals/dist/workos-radar-signals.global.js"></script>
<script>
  var radar = WorkOSRadar.init({ clientId: 'client_01ABC...' });
  radar.getToken().then(function (token) {
    // pass token with your auth request
  });
</script>

License

MIT