Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

@0xobelisk/controller

Modal SDK for partner user login/authentication.

authloginmodalsdk
Published23 Nov 2025
Direct dependencies36
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 42

Native requirements
36 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
vue
Environment
{
  "local_name": "vue",
  "alias": false,
  "peer_metadata": null
}
^3.3.8development
husky
Environment
{
  "local_name": "husky",
  "alias": false,
  "peer_metadata": null
}
^9.1.7development
jsdom
Environment
{
  "local_name": "jsdom",
  "alias": false,
  "peer_metadata": null
}
^24.1.3development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.2.0development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^8.57.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
vitest
Environment
{
  "local_name": "vitest",
  "alias": false,
  "peer_metadata": null
}
^4.0.13development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^3.6.2development
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
@mysten/sui
Environment
{
  "local_name": "@mysten/sui",
  "alias": false,
  "peer_metadata": null
}
^1.45.0development
lint-staged
Environment
{
  "local_name": "lint-staged",
  "alias": false,
  "peer_metadata": null
}
^16.2.7development
@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
@0xobelisk/ecs
Environment
{
  "local_name": "@0xobelisk/ecs",
  "alias": false,
  "peer_metadata": null
}
1.2.0-pre.88development
fake-indexeddb
Environment
{
  "local_name": "fake-indexeddb",
  "alias": false,
  "peer_metadata": null
}
^6.2.5development
@commitlint/cli
Environment
{
  "local_name": "@commitlint/cli",
  "alias": false,
  "peer_metadata": null
}
^20.1.0development
@0xobelisk/react
Environment
{
  "local_name": "@0xobelisk/react",
  "alias": false,
  "peer_metadata": null
}
1.2.0-pre.88development
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.2.19development
standard-version
Environment
{
  "local_name": "standard-version",
  "alias": false,
  "peer_metadata": null
}
^9.5.0development
@0xobelisk/sui-cli
Environment
{
  "local_name": "@0xobelisk/sui-cli",
  "alias": false,
  "peer_metadata": null
}
1.2.0-pre.88development
@vitest/coverage-v8
Environment
{
  "local_name": "@vitest/coverage-v8",
  "alias": false,
  "peer_metadata": null
}
^4.0.13development
eslint-plugin-react
Environment
{
  "local_name": "eslint-plugin-react",
  "alias": false,
  "peer_metadata": null
}
^7.35.0development
@0xobelisk/controller
Environment
{
  "local_name": "@0xobelisk/controller",
  "alias": false,
  "peer_metadata": null
}
0.0.7development
@0xobelisk/sui-client
Environment
{
  "local_name": "@0xobelisk/sui-client",
  "alias": false,
  "peer_metadata": null
}
1.2.0-pre.88development
@0xobelisk/sui-common
Environment
{
  "local_name": "@0xobelisk/sui-common",
  "alias": false,
  "peer_metadata": null
}
1.2.0-pre.88development
@0xobelisk/graphql-client
Environment
{
  "local_name": "@0xobelisk/graphql-client",
  "alias": false,
  "peer_metadata": null
}
1.2.0-pre.88development
@rollup/plugin-typescript
Environment
{
  "local_name": "@rollup/plugin-typescript",
  "alias": false,
  "peer_metadata": null
}
^11.1.6development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
^7.0.0development
eslint-plugin-react-hooks
Environment
{
  "local_name": "eslint-plugin-react-hooks",
  "alias": false,
  "peer_metadata": null
}
^4.6.0development
@rollup/plugin-node-resolve
Environment
{
  "local_name": "@rollup/plugin-node-resolve",
  "alias": false,
  "peer_metadata": null
}
^15.2.3development
@size-limit/preset-small-lib
Environment
{
  "local_name": "@size-limit/preset-small-lib",
  "alias": false,
  "peer_metadata": null
}
^11.2.0development
@commitlint/config-conventional
Environment
{
  "local_name": "@commitlint/config-conventional",
  "alias": false,
  "peer_metadata": null
}
^20.0.0development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
^7.0.0development
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": "592faf6d3fc2b4de09196480c5aff3aaa895a9bc",
  "tarball": "https://registry.npmjs.org/@0xobelisk/controller/-/controller-0.1.0.tgz",
  "fileCount": 71,
  "integrity": "sha512-lNL5E6tjukaZo2jWjaQFMOsRMluTTfjT2KSNmrspoJG8Yb0f4cyX24mJGH+DJ+MvCVHzaqbi3BmxXja2gCvNoA==",
  "signatures": [
    {
      "sig": "MEYCIQC2blQQsP/gwXaNZBkTL9YBBjr+fftzg/0PH8YR29dgRAIhAJVgazMyDgQ6Y88bDZ3fRey3MFyP5V3+HiAHs+oxZO7b",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 4975687
}

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:2c554ee0ce411dfdfbaefc79df65fe9329a5f3b09f52d6969de36e2e34e4950e

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 →