See SDK Reference for more details on the Auth Manager. Auth Manager Reference

Overview & Key Concepts

The Auth Manager handles authentication flows and session persistence.

AuthContext Creation

This method caches two components: Session Key Pair: A temporary cryptographic key pair generated on the client side that acts as a temporary identity for the client application. It consists of:
  • Public key - shared with the Lit nodes
  • Secret key (private key) - kept securely on the client
Delegation AuthSig (Inner Auth Sig): A cryptographic attestation from the Lit Protocol nodes that authorises your session key to act on behalf of your PKP
1

Install the SDK

Run the following command to install the SDK:
npm i @lit-protocol/auth@beta
2

Choose Storage Plugin

Choose the appropriate network based on your development stage and requirements, then create your Lit Client instance.
import { createAuthManager, storagePlugins } from "@lit-protocol/auth";

const authManager = createAuthManager({
  storage: storagePlugins.localStorage({
    appName: "my-app",
    networkName: "naga-dev",
  }),
});

Storage Options Comparison

Select the appropriate network environment based on your development stage and requirements. Each network offers different characteristics for testing and production use cases.
Storage TypePersistenceUse CaseEnvironment
localStorageSurvives page refresh & browser restartWeb applications, client-side storageBrowser
localStorageNodeFile-based persistent storageNode.js applications, server-side scriptsNode.js only
customDepends on implementationDatabase storage, encrypted storage, cloud storageCustom