JavaScript SDK

Complete SDK reference and configuration

/

SDK Overview

The Lemma JavaScript SDK provides client-side authentication with local credential verification.

Configuration

JavaScript
const wallet = new LemmaWallet({ // Required siteId: 'your-site-id', // From developer dashboard apiKey: 'your-api-key', // From developer dashboard // Optional debug: false, // Enable console logging autoInit: true, // Auto-initialize on construction apiBase: 'https://lemma.id', // API endpoint (rarely needed) // Storage options storagePrefix: 'lemma_', // IndexedDB key prefix enableCache: true, // Cache verified credentials // Sync options syncInterval: 3600000, // Revocation sync interval (ms) heartbeatInterval: 300000 // Session heartbeat interval (ms) });

Core Methods

init()

Initialize the wallet. Call once on page load.

JavaScript
await wallet.init(); // Returns: void

isUnlocked()

Check if wallet is currently unlocked.

JavaScript
const unlocked = await wallet.isUnlocked(); // Returns: boolean

derivePPID()

Get the user's pairwise identifier for your site.

JavaScript
const ppid = await wallet.derivePPID(); // Returns: string (hex-encoded HMAC)

More Methods

See SDK Methods Reference for the complete list.