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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sigma-auth/client-plugin

v0.2.8

Published

Better Auth client plugin for Bitcoin-based OAuth authentication

Downloads

2,211

Readme

@sigma-auth/client-plugin

Better Auth client plugin for Bitcoin-based OAuth authentication with Sigma Identity.

What is Sigma Identity?

Sigma Identity (auth.sigmaidentity.com) is a centralized OAuth provider for Bitcoin-based authentication - like "Sign in with Google" or "Sign in with GitHub", but for Bitcoin identities.

Your users' private keys NEVER leave Sigma's domain. Your application receives OAuth tokens, just like any other OAuth provider.

Installation

npm install @sigma-auth/client-plugin
# or
bun add @sigma-auth/client-plugin

Setup

Add the Client Plugin

import { createAuthClient } from "better-auth/react";
import { sigmaClient } from "@sigma-auth/client-plugin";

export const authClient = createAuthClient({
  baseURL: "http://localhost:3000", // Your API base URL
  plugins: [sigmaClient()],
});

Usage

Sign In with Sigma (Basic)

import { authClient } from "./auth-client";

export function SignInButton() {
  return (
    <button onClick={() => authClient.signIn.sigma()}>
      Sign in with Sigma
    </button>
  );
}

This redirects the user to auth.sigmaidentity.com where they authenticate with their Bitcoin wallet, then redirects back to your app with an OAuth authorization code.

Sign In with Provider

Sigma Identity supports OAuth providers like GitHub, Google, etc.:

<button onClick={() => authClient.signIn.sigma({ provider: 'github' })}>
  Sign in with GitHub via Sigma
</button>

Custom Callback URL

<button
  onClick={() => authClient.signIn.sigma({
    callbackURL: 'https://myapp.com/auth/callback'
  })}
>
  Sign in with Sigma
</button>

OAuth Flow

  1. User clicks "Sign in with Sigma" button
  2. Client plugin redirects to auth.sigmaidentity.com/api/oauth/authorize
  3. User authenticates on Sigma's domain (private keys never leave Sigma)
  4. Sigma redirects back to your app with authorization code
  5. Your server exchanges code for access token
  6. User is authenticated

Note: Your users' Bitcoin private keys are managed by Sigma Identity and NEVER exposed to your application.

API Reference

sigmaClient()

Creates the Sigma Auth client plugin for Better Auth.

const plugin = sigmaClient();

authClient.signIn.sigma(options?)

Initiates the OAuth flow by redirecting to Sigma Identity's authorization endpoint.

Parameters:

  • options.callbackURL (string, optional) - Custom callback URL. Defaults to ${window.location.origin}/callback
  • options.provider (string, optional) - OAuth provider to use via Sigma ('github', 'google', etc.)
  • options.errorCallbackURL (string, optional) - URL to redirect to on error

Returns: Promise that never resolves (redirects away from page)

Server Setup

This plugin requires a corresponding Better Auth server plugin that handles the OAuth token exchange. See @sigma-auth/server-plugin for server-side setup.

Your server needs to:

  1. Provide a callback endpoint to receive the authorization code
  2. Exchange the code for an access token with Sigma Identity
  3. Create a user session

Environment Variables

# Optional: Custom Sigma Auth server URL (defaults to https://auth.sigmaidentity.com)
NEXT_PUBLIC_SIGMA_AUTH_URL=https://auth.sigmaidentity.com

# Or for Vite projects:
VITE_SIGMA_AUTH_URL=https://auth.sigmaidentity.com

TypeScript

Full TypeScript support included:

import type { BetterAuthClientPlugin } from "better-auth/client";

const plugin: BetterAuthClientPlugin = sigmaClient();

Requirements

Security

  • ✅ Private keys never leave Sigma Identity's domain
  • ✅ CSRF protection via state parameter
  • ✅ Standard OAuth 2.0 authorization code flow
  • ✅ No secrets or sensitive data in client code

Related Packages

License

MIT