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

emblem-auth-sdk

v1.0.0-alpha.7

Published

Official TypeScript SDK for Emblem Vault authentication

Readme

emblem-auth-sdk

Official TypeScript SDK for Emblem Vault authentication.

Installation

npm install emblem-auth-sdk
# or
yarn add emblem-auth-sdk

Quick Start

import { EmblemAuthSDK } from 'emblem-auth-sdk';

// Minimal setup - only appId is required
const auth = new EmblemAuthSDK({
  appId: 'your-app-id',
  onSuccess: (session) => {
    console.log('Authenticated!', session);
  },
  onError: (error) => {
    console.error('Auth failed:', error);
  }
});

// Open authentication modal
auth.openAuthModal();

// Get current session
const session = auth.getSession();

// Use JWT for API calls
fetch('https://api.emblemvault.ai/protected-endpoint', {
  headers: {
    'Authorization': `Bearer ${session.authToken}`
  }
});

Features

  • 🔐 Multiple Auth Methods - Wallet (EVM, Solana, Hedera) and OAuth (Twitter, Google)
  • 🔑 JWT-based Sessions - Secure token management with auto-refresh
  • 💾 Session Persistence - Stay logged in across page reloads (enabled by default)
  • 🎨 Flexible UI - Iframe or popup modal modes
  • 📦 TypeScript - Full type definitions included
  • 🌐 Browser & Node - Works in browsers and Node.js environments
  • Lightweight - < 15KB minified and gzipped

API Reference

Constructor

new EmblemAuthSDK(config: EmblemAuthConfig)

Config Options

| Option | Type | Required | Default | Description | |--------|------|----------|---------|-------------| | appId | string | ✅ | - | Your application ID | | apiUrl | string | ❌ | https://api.emblemvault.ai | Emblem Vault API URL | | modalUrl | string | ❌ | https://auth.emblemvault.ai/connect | Auth modal URL | | modalMode | 'iframe' | 'popup' | 'auto' | ❌ | 'auto' | Modal display mode | | persistSession | boolean | ❌ | true | Persist session to localStorage (stay logged in) | | onSuccess | (session) => void | ❌ | - | Success callback | | onError | (error) => void | ❌ | - | Error callback |

Methods

openAuthModal(): Promise<void>

Opens the authentication modal for users to sign in.

getSession(): AuthSession | null

Returns the current authentication session.

refreshSession(): Promise<AuthSession | null>

Manually refreshes the authentication token.

authenticateWallet(params): Promise<AuthSession | null>

Programmatically authenticate with wallet signature.

getVaultInfo(): Promise<VaultInfo>

Retrieves information about the user's vault. Caches the result for the session duration.

const vaultInfo = await auth.getVaultInfo();
console.log(vaultInfo.vaultId);
console.log(vaultInfo.evmAddress);

getVaultApiKey(): Promise<string>

Retrieves or generates the vault API key.

logout(): void

Clears the current session.

on(event, handler): void

Subscribe to authentication events.

off(event, handler): void

Unsubscribe from authentication events.

Events

  • session - Fired when session is established or updated
  • sessionExpired - Session has expired
  • sessionRefreshed - Session was refreshed
  • sessionWillRefresh - Session will refresh soon
  • authError - Authentication error occurred

Session Persistence

By default, sessions are persisted to localStorage, allowing users to stay logged in across page reloads and browser sessions. This follows the industry-standard "stay logged in" behavior.

// Default behavior - sessions are persisted
const auth = new EmblemAuthSDK({
  appId: 'your-app-id'
});

// Sessions will automatically restore on page load
const session = auth.getSession(); // Returns persisted session if valid

// To disable persistence (session only lasts until page closes)
const auth = new EmblemAuthSDK({
  appId: 'your-app-id',
  persistSession: false
});

Notes:

  • Sessions are stored with the key emblem_session_{appId}
  • Expired sessions are automatically cleared on load
  • Calling logout() clears the persisted session
  • Works gracefully in private browsing mode (falls back to memory-only)

Types

VaultInfo

interface VaultInfo {
  vaultId: string;
  evmAddress?: string;
  solanaAddress?: string;
  hederaAccountId?: string;
  createdAt?: string;
  metadata?: Record<string, any>;
}

CDN Usage

<script src="https://unpkg.com/emblem-auth-sdk@latest/dist/emblem-auth.min.js"></script>
<script>
  // Only appId is required - apiUrl and modalUrl have production defaults
  const auth = new EmblemAuth.EmblemAuthSDK({
    appId: 'your-app-id'
  });

  auth.openAuthModal();
</script>

Alternative CDNs:

  • jsDelivr: https://cdn.jsdelivr.net/npm/emblem-auth-sdk@latest/dist/emblem-auth.min.js
  • unpkg (specific version): https://unpkg.com/[email protected]/dist/emblem-auth.min.js

License

MIT