Catalog npm
Back to packageRELEASE DETAILS

0.0.3

npm

@0xobelisk/controller

Modal SDK for partner user login/authentication.

authloginmodalsdk
Published20 Nov 2025
Direct dependencies12
Transitive dependenciesNot calculated

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.

Declared dependencies 18

Native requirements
12 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
vue
Environment
{
  "local_name": "vue",
  "alias": false,
  "peer_metadata": null
}
^3.3.8development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.2.0development
preact
Environment
{
  "local_name": "preact",
  "alias": false,
  "peer_metadata": null
}
^10.27.2development
rollup
Environment
{
  "local_name": "rollup",
  "alias": false,
  "peer_metadata": null
}
^4.6.1development
svelte
Environment
{
  "local_name": "svelte",
  "alias": false,
  "peer_metadata": null
}
^4.2.20development
solid-js
Environment
{
  "local_name": "solid-js",
  "alias": false,
  "peer_metadata": null
}
^1.9.10development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.3.3development
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^18.2.58development
@angular/core
Environment
{
  "local_name": "@angular/core",
  "alias": false,
  "peer_metadata": null
}
^17.0.0development
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.2.19development
@rollup/plugin-typescript
Environment
{
  "local_name": "@rollup/plugin-typescript",
  "alias": false,
  "peer_metadata": null
}
^11.1.6development
@rollup/plugin-node-resolve
Environment
{
  "local_name": "@rollup/plugin-node-resolve",
  "alias": false,
  "peer_metadata": null
}
^15.2.3development
vue
Environment
{
  "local_name": "vue",
  "alias": false,
  "peer_metadata": null
}
^3.3.0peer
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0peer
preact
Environment
{
  "local_name": "preact",
  "alias": false,
  "peer_metadata": null
}
^10.19.3peer
svelte
Environment
{
  "local_name": "svelte",
  "alias": false,
  "peer_metadata": null
}
^4.2.0peer
solid-js
Environment
{
  "local_name": "solid-js",
  "alias": false,
  "peer_metadata": null
}
^1.8.11peer
@angular/core
Environment
{
  "local_name": "@angular/core",
  "alias": false,
  "peer_metadata": null
}
^17.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "754e3dcd9f02e2611b760abe8c126506486c1ff8",
  "tarball": "https://registry.npmjs.org/@0xobelisk/controller/-/controller-0.0.3.tgz",
  "fileCount": 44,
  "integrity": "sha512-BsKEn0Omv2Xhn8IPFCF9Ygp4FWBUaAg1UnHZ1ZzAO/GBkz6CrXcvBs9014JTtI3PeehRgsczUN54MR/zctnGXQ==",
  "signatures": [
    {
      "sig": "MEUCIQD456T9+QNr8IM5xufsxAbR3JNwireP/cEbY0ycomerJgIgbeQI9UUA97K992wlAIo/mifbfL+19URomC4GCG+mfuo=",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 575642
}

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_version:ef8d606faaccec8ddf5e73801532899a813b77fdbdd150516ee78fc15136d24e

Other collected versions

0.2.1026 Nov0.2.924 Nov0.2.824 Nov0.2.624 Nov0.2.524 Nov0.2.424 NovView all collected versions →