Catalog npm
PACKAGE EXPLORERView in registry

@0xobelisk/controller

npm

Modal SDK for partner user login/authentication.

authloginmodalsdk
Versions collected19
Direct dependencies42From release 0.2.10
Last observed21 Oct, 09:17 UTC

README

Current package documentation

Dubhe Auth Modal SDK (@0xobelisk/controller)

npm version License: MIT

Modal SDK that projects can embed for user login/auth. Published as @0xobelisk/controller, with ESM/CJS/UMD outputs and adapters for React, Vue, Svelte, Solid, Preact, Angular, and Cocos Creator.

📚 Documentation

Complete Integration Guide →

Platform-specific guides available for:

  • React / Next.js
  • Vue
  • Svelte
  • Solid
  • Preact
  • Angular
  • Cocos Creator
  • Vanilla JavaScript

What's here

  • Minimal TypeScript SDK (src/) that creates/destroys the modal with a simple API.
  • Themeable CSS (src/styles.css) with gradients, blur, and responsive layout.
  • Example scaffold (examples/basic) showing how to open the modal, plus a full-flow mock page (examples/full-flow) with CTA -> modal -> mock auth -> close,支持深色金色卡片风格。
  • Build setup via tsc (no runtime deps).

Quick Start

Installation

npm install @0xobelisk/controller

Basic Usage (Vanilla JS)

import { createAuthModal } from '@0xobelisk/controller';
import '@0xobelisk/controller/styles.css';

const modal = createAuthModal({
  onSelect: (providerId) => {
    console.log('Selected:', providerId);
    if (providerId === 'create-session') {
      // Handle session creation
      handleCreateSession();
    } else if (providerId === 'quit') {
      modal.close();
    }
  },
  onClose: () => {
    console.log('Modal closed');
  }
});

modal.open();

React / Next.js

import { useAuthModal } from '@0xobelisk/controller/react';
import '@0xobelisk/controller/styles.css';

export default function LoginPage() {
  const modal = useAuthModal({
    onSelect: (providerId) => {
      console.log('Selected:', providerId);
      if (providerId === 'create-session') {
        handleCreateSession();
      }
    }
  });

  return <button onClick={modal.open}>Login</button>;
}

See complete integration guides for all platforms →

Session Management

Session management with blockchain authentication:

import { runSessionFlow } from '@0xobelisk/controller';
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';

const userKeypair = Ed25519Keypair.generate();

try {
  const session = await runSessionFlow({
    keypair: userKeypair,
    endpoints: {
      start: 'https://api.example.com/session/start',
      create: 'https://api.example.com/session/create'
    }
  });

  console.log('Session created:', session.sessionKey);
} catch (error) {
  console.error('Session creation failed:', error);
}

See complete session management guide →

Development

Run examples locally:

npm install
npm run build
npm run serve           # http://localhost:4173

Examples available at:

  • Basic demo: http://localhost:4173/examples/basic/
  • Full flow: http://localhost:4173/examples/full-flow/

Custom Styling

Card Variant with Background Image

const modal = createAuthModal({
  variant: 'card',
  accentColor: '#7a63ff',
  backgroundImage: 'https://unpkg.com/@0xobelisk/controller/dist/dubhe.jpeg',
  onSelect: (providerId) => {
    console.log('Selected:', providerId);
  }
});

Custom Theme Colors

const modal = createAuthModal({
  accentColor: '#6366f1', // Indigo
  onSelect: handleAuth
});

See complete styling guide →

Supported Platforms

Adapters available for all major platforms:

  • React / Next.js: @0xobelisk/controller/react
  • Vue 3: @0xobelisk/controller/vue
  • Svelte: @0xobelisk/controller/svelte
  • Solid: @0xobelisk/controller/solid
  • Preact: @0xobelisk/controller/preact
  • Angular: @0xobelisk/controller/angular
  • Cocos Creator: @0xobelisk/controller/cocos
  • Vanilla JS: Direct import from @0xobelisk/controller

View platform-specific integration guides →

Features

  • 🎨 Themeable: Customize colors, layouts, and styling
  • 🌐 Universal: Works in browser, mobile WebView, and game engines
  • 📦 Lightweight: Minimal dependencies, tree-shakeable
  • 🔐 Session Management: Built-in blockchain authentication flows
  • ⚡ Fast: Optimized bundle size with code splitting
  • 🎯 TypeScript: Full type safety and IntelliSense

API Reference

createAuthModal(options)

Returns an AuthModalController instance.

Options:

  • onSelect: (providerId: string) => void - Required callback when button clicked
  • onClose?: () => void - Optional callback when modal closes
  • title?: string - Modal title (default: "Authenticate to continue")
  • subtitle?: string - Modal subtitle
  • variant?: 'card' | 'split' - Layout variant (default: "split")
  • accentColor?: string - Primary color (default: "#7a63ff")
  • backgroundImage?: string - Background image URL
  • buttons?: AuthButton[] - Custom buttons
  • container?: HTMLElement - Mount container (default: document.body)

Returns:

  • open() - Show the modal
  • close() - Hide the modal
  • destroy() - Remove and cleanup
  • isOpen() - Check if modal is open

See complete API reference →

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © Obelisk Labs

Support


Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 19

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.10Registry latest26 Nov 202542
0.2.924 Nov 202542
0.2.824 Nov 202542
0.2.624 Nov 202542
0.2.524 Nov 202542
0.2.424 Nov 202536
0.2.324 Nov 202536
0.2.123 Nov 202536
0.2.023 Nov 202536
0.1.023 Nov 202536
0.0.923 Nov 202536
0.0.823 Nov 202536
0.0.720 Nov 202512
0.0.620 Nov 202512
0.0.520 Nov 202512
0.0.420 Nov 202512
0.0.320 Nov 202512
0.0.220 Nov 202512
0.0.120 Nov 202512

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
0xobelisk/dubhe-controller

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:16 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:e876aa7c736b262481d28e128c5d3547cd9ca7e5f9a65b104f2da1d0ac661935