BigBlocks

Bitcoin Signin

OAuth sign-in button via Sigma Identity with optional provider restore buttons for GitHub and Google

With OAuth Providers

Outline / Small

Ghost / Large

Installation

bunx shadcn@latest add https://registry.bigblocks.dev/r/bitcoin-signin.json

Usage

The block requires a signIn function that matches the shape of authClient.signIn.sigma() from a Better Auth client configured with the sigma plugin.

import { authClient } from "@/lib/auth-client"
import { BitcoinSignin } from "@/components/blocks/bitcoin-signin"
 
export default function LoginPage() {
  return (
    <BitcoinSignin
      clientId="my-app"
      signIn={(opts) => authClient.signIn.sigma(opts)}
      showProviders
      onError={(err) => console.error("Sign-in failed:", err)}
    />
  )
}

Variants

Default

A single "Sign in with Bitcoin" button using the sigma brand icon.

<BitcoinSignin clientId="my-app" signIn={signIn} />

With OAuth Providers

Shows OAuth provider buttons below the primary button for account restore/linking.

<BitcoinSignin
  clientId="my-app"
  signIn={signIn}
  showProviders
  providers={["github", "google"]}
/>

Size and Style Variants

<BitcoinSignin clientId="my-app" signIn={signIn} variant="outline" size="sm" />
<BitcoinSignin clientId="my-app" signIn={signIn} variant="ghost" size="lg" />

Props

BitcoinSignin

PropTypeDefaultDescription
clientIdstringOAuth client ID registered with Sigma Identity (required)
signInSigmaSignInFnThe signIn.sigma function from a Better Auth client (required)
callbackUrlstringwindow.location.origin + "/auth/sigma/callback"Callback URL after OAuth redirect
showProvidersbooleanfalseShow OAuth provider buttons for account restore
providersOAuthProvider[]["github", "google"]Which OAuth providers to show
variant"default" | "outline" | "ghost""default"Visual style variant
size"sm" | "md" | "lg""md"Size variant
classNamestringAdditional CSS classes
onError(error: Error) => voidCalled when a sign-in error occurs

Hook

useBitcoinSignin can be used independently for a custom sign-in UI.

import { useBitcoinSignin } from "@/components/blocks/bitcoin-signin"
 
function CustomLogin() {
  const { isLoading, error, loginWithSigma, loginWithProvider } =
    useBitcoinSignin({
      clientId: "my-app",
      signIn: (opts) => authClient.signIn.sigma(opts),
    })
 
  return (
    <button onClick={loginWithSigma} disabled={isLoading}>
      {isLoading ? "Signing in..." : "Sign in"}
    </button>
  )
}