diff --git a/docs/sdk/auth-context-consumption/encrypt-and-decrypt.mdx b/docs/sdk/auth-context-consumption/encrypt-and-decrypt.mdx index 05b252c51..990322f5f 100644 --- a/docs/sdk/auth-context-consumption/encrypt-and-decrypt.mdx +++ b/docs/sdk/auth-context-consumption/encrypt-and-decrypt.mdx @@ -78,7 +78,7 @@ console.log("🧔🏻‍♂️ BobsAccount:", BobsAccount.address); Alice decides who can decrypt her encrypted data - See SDK Reference for more details on the Access Control Conditions Builder. [Access Control Conditions Builder Reference](/sdk/sdk-reference/access-control-conditions/functions/createAccBuilder) + See the [Access Control Conditions Builder Reference API](/sdk/sdk-reference/access-control-conditions/functions/createAccBuilder) for more details on how to build access control conditions. ### Build Access Control Conditions diff --git a/docs/sdk/auth-context-consumption/pkp-sign.mdx b/docs/sdk/auth-context-consumption/pkp-sign.mdx index f836755ff..859a158d2 100644 --- a/docs/sdk/auth-context-consumption/pkp-sign.mdx +++ b/docs/sdk/auth-context-consumption/pkp-sign.mdx @@ -4,8 +4,7 @@ description: "Use your PKP to sign a message with the selected chain and scheme. --- - See SDK Reference for more details on the PKP Sign. [PKP Sign - Reference](/sdk/sdk-reference/lit-client/functions/createLitClient#chain-raw-pkpsign) + See the [PKP Sign Reference API](/sdk/sdk-reference/lit-client/functions/createLitClient#chain-raw-pkpsign) for more details on how to sign a message with your PKP. # Prerequisites diff --git a/docs/sdk/auth/pkp-custom-auth/pkp-custom-auth.mdx b/docs/sdk/auth/pkp-custom-auth/pkp-custom-auth.mdx index 13b14fa09..c3c4ce808 100644 --- a/docs/sdk/auth/pkp-custom-auth/pkp-custom-auth.mdx +++ b/docs/sdk/auth/pkp-custom-auth/pkp-custom-auth.mdx @@ -15,13 +15,13 @@ description: "Implement custom PKP authentication methods with Lit Actions" Custom Authentication allows dApp owners to provide PKPs (Programmable Key Pairs) to their users without requiring them to understand blockchain technology or manage private keys. Instead of forcing users to learn new authentication methods, you can leverage your existing authentication systems (OAuth, APIs, databases) while providing them with powerful web3 capabilities. -This demonstrates the complete dApp-centric custom authentication flow from both perspectives: the Site Owner who sets up the system and the User who interacts with it. +This demonstrates the complete dApp-centric custom authentication flow from both perspectives: the Site Owner who sets up the system and the User who interacts with it. # Overview In this example: -- site owners control the PKP minting process and provide immutable validation logic via IPFS. +- Site owners control the PKP minting process and provide immutable validation logic via IPFS. - Users get pre-minted PKPs and authenticate through the site owner's validation Lit Action. # Site Owner Walkthrough diff --git a/docs/sdk/auth/pkp-native-auth/pkp-discord-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-discord-auth.mdx index fe9d8429b..be1c7fd62 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-discord-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-discord-auth.mdx @@ -49,7 +49,7 @@ description: "Discord Authentication uses your Discord account to authenticate v -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes - A secret key (private key) - kept securely on the client @@ -59,7 +59,7 @@ Use your newly minted PKP to create an AuthContext. This method will cache two t const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/auth/pkp-native-auth/pkp-eoa-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-eoa-auth.mdx index 8e2ab08aa..8fc3c1609 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-eoa-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-eoa-auth.mdx @@ -38,7 +38,7 @@ description: "Externally Owned Account (EOA) authentication uses your existing E -Use the WalletClientAuthenticator/ViemAccountAuthenticator to authenticate your connected wallet and generate auth data. +Use the `WalletClientAuthenticator` or `ViemAccountAuthenticator` to authenticate your connected wallet and generate auth data. ```ts wagmi @@ -97,17 +97,17 @@ You can select an existing PKP associated with your account or mint a new one. -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes - A secret key (private key) - kept securely on the client -2. Delegation AuthSig aka. the inner auth sig - a cryptographic attestation from the Lit Protocol nodes that authorises your session key to act on behalf of your PKP. +2. Delegation AuthSig (aka. the inner auth sig) - a cryptographic attestation from the Lit Protocol nodes that authorises your session key to act on behalf of your PKP. ```ts const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/auth/pkp-native-auth/pkp-google-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-google-auth.mdx index fd930c1d1..f4f0d306a 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-google-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-google-auth.mdx @@ -49,7 +49,7 @@ description: "Google Authentication uses your Google account to authenticate via -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes - A secret key (private key) - kept securely on the client @@ -59,7 +59,7 @@ Use your newly minted PKP to create an AuthContext. This method will cache two t const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/auth/pkp-native-auth/pkp-stytch-2fa-totp-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-stytch-2fa-totp-auth.mdx index 12ac1f441..4f5e6b9b5 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-stytch-2fa-totp-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-stytch-2fa-totp-auth.mdx @@ -6,7 +6,7 @@ description: "Stytch TOTP 2FA Authentication is a secondary authentication metho # Prerequisites - ⚠️ Backend Required: This authentication method requires a backend service + Backend Required: This authentication method requires a backend service that handles Stytch Email OTP operations. The auth service already has the implementation in place with the `/stytch/email/send-otp` and `/stytch/email/verify-otp` endpoints, but they are disabled by default. Simply @@ -121,7 +121,7 @@ const authData = await StytchWhatsAppOtpAuthenticator.authenticate({ -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes @@ -131,7 +131,7 @@ Use your newly minted PKP to create an AuthContext. This method will cache two t ```ts const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/auth/pkp-native-auth/pkp-stytch-email-otp-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-stytch-email-otp-auth.mdx index 865718a15..c964062c3 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-stytch-email-otp-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-stytch-email-otp-auth.mdx @@ -6,7 +6,7 @@ description: "Stytch Email OTP Authentication uses Stytch's Email OTP service to # Prerequisites -⚠️ Backend Required: This authentication method requires a backend service that handles Stytch Email OTP operations. The auth service already has the implementation in place with the `/stytch/email/send-otp` and `/stytch/email/verify-otp` endpoints, but they are disabled by default. Simply run your auth service at the configured URL to enable Stytch Email OTP functionality. +Backend Required: This authentication method requires a backend service that handles Stytch Email OTP operations. The auth service already has the implementation in place with the `/stytch/email/send-otp` and `/stytch/email/verify-otp` endpoints, but they are disabled by default. Simply run your auth service at the configured URL to enable Stytch Email OTP functionality. @@ -75,7 +75,7 @@ description: "Stytch Email OTP Authentication uses Stytch's Email OTP service to -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes - A secret key (private key) - kept securely on the client @@ -85,7 +85,7 @@ Use your newly minted PKP to create an AuthContext. This method will cache two t const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/auth/pkp-native-auth/pkp-stytch-sms-otp-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-stytch-sms-otp-auth.mdx index 6ceff065b..8bbc259ef 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-stytch-sms-otp-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-stytch-sms-otp-auth.mdx @@ -6,7 +6,7 @@ description: "Stytch SMS OTP Authentication uses Stytch's SMS OTP service to aut # Prerequisites - ⚠️ Backend Required: This authentication method requires a backend service + Backend Required: This authentication method requires a backend service that handles Stytch Email OTP operations. The auth service already has the implementation in place with the `/stytch/email/send-otp` and `/stytch/email/verify-otp` endpoints, but they are disabled by default. Simply @@ -82,7 +82,7 @@ const authData = await StytchSmsOtpAuthenticator.authenticate({ -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes @@ -92,7 +92,7 @@ Use your newly minted PKP to create an AuthContext. This method will cache two t ```ts const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/auth/pkp-native-auth/pkp-stytch-whatsapp-otp-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-stytch-whatsapp-otp-auth.mdx index c6a860598..589da0621 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-stytch-whatsapp-otp-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-stytch-whatsapp-otp-auth.mdx @@ -6,7 +6,7 @@ description: "Enter your phone number to receive a one-time password (OTP) via W # Prerequisites - ⚠️ Backend Required: This authentication method requires a backend service + Backend Required: This authentication method requires a backend service that handles Stytch Email OTP operations. The auth service already has the implementation in place with the `/stytch/email/send-otp` and `/stytch/email/verify-otp` endpoints, but they are disabled by default. Simply @@ -83,7 +83,7 @@ const authData = await StytchWhatsAppOtpAuthenticator.authenticate({ -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes @@ -93,7 +93,7 @@ Use your newly minted PKP to create an AuthContext. This method will cache two t ```ts const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/auth/pkp-native-auth/pkp-webauthn-auth.mdx b/docs/sdk/auth/pkp-native-auth/pkp-webauthn-auth.mdx index 2afc98bd4..3f15b2906 100644 --- a/docs/sdk/auth/pkp-native-auth/pkp-webauthn-auth.mdx +++ b/docs/sdk/auth/pkp-native-auth/pkp-webauthn-auth.mdx @@ -57,7 +57,7 @@ description: "WebAuthn Authentication uses your device's secure hardware (such a -Use your newly minted PKP to create an AuthContext. This method will cache two things: +Use your PKP's public key to create an AuthContext. This method will cache two things: 1. 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: - A public key - shared with the Lit nodes - A secret key (private key) - kept securely on the client @@ -67,7 +67,7 @@ Use your newly minted PKP to create an AuthContext. This method will cache two t const authContext = await authManager.createPkpAuthContext({ authData: authData, // <-- Retrieved earlier - pkpPublicKey: pkpInfo.pubkey, // <-- Minted earlier + pkpPublicKey: pkpInfo.pubkey, authConfig: { resources: [ ["pkp-signing", "*"], diff --git a/docs/sdk/getting-started/auth-manager.mdx b/docs/sdk/getting-started/auth-manager.mdx index c749356a1..dbbe74764 100644 --- a/docs/sdk/getting-started/auth-manager.mdx +++ b/docs/sdk/getting-started/auth-manager.mdx @@ -4,23 +4,23 @@ description: "Configure the authentication manager with storage options and auth --- -See SDK Reference for more details on the Auth Manager. [Auth Manager Reference](/sdk/sdk-reference/auth/functions/createAuthManager) +See the [Auth Manager Reference API](/sdk/sdk-reference/auth/functions/createAuthManager) for more details on how to create an Auth Manager. ## Overview & Key Concepts -The Auth Manager handles authentication flows and session persistence. +The Auth Manager is responsible for managing authentication state and session persistence in your Lit Protocol application. It handles the storage and retrieval of authentication credentials, enabling users to maintain active sessions across page refreshes and application restarts without re-authenticating. -### AuthContext Creation +### What the Auth Manager Stores -This method caches two components: +When you authenticate with Lit Protocol, the Auth Manager caches critical authentication data locally: -**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: +**Session Key Pair**: A temporary cryptographic key pair that represents your current session with Lit Protocol: -- **Public key** - shared with the Lit nodes -- **Secret key (private key)** - kept securely on the client +- **Public key** - Shared with Lit nodes to identify your session +- **Secret key (private key)** - Kept securely in local storage, never transmitted -**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 +**Delegation AuthSig (Inner Auth Sig)**: A cryptographic attestation from the Lit Protocol nodes that authorizes your session key to perform operations on behalf of your PKP @@ -48,15 +48,15 @@ bun add @lit-protocol/auth viem - viem must be installed in your application because the SDK no longer bundles it. + viem must be installed as a dependency because the Lit JS SDK does not bundle it. - Choose the appropriate network based on your development stage and requirements, then create your Lit Client instance. + Choose the appropriate storage plugin based on your environment and requirements, then create your Auth Manager instance. -```typescript browser +```typescript Browser Local Storage import { createAuthManager, storagePlugins } from "@lit-protocol/auth"; const authManager = createAuthManager({ @@ -67,7 +67,7 @@ const authManager = createAuthManager({ }); ``` -```typescript node.js +```typescript Node.js Local Storage import { createAuthManager, storagePlugins } from "@lit-protocol/auth"; const authManager = createAuthManager({ @@ -79,7 +79,7 @@ const authManager = createAuthManager({ }); ``` -```typescript custom +```typescript Custom Storage Plugin import { createAuthManager } from "@lit-protocol/auth"; // Custom storage plugin example @@ -116,10 +116,10 @@ const authManager = createAuthManager({ ## 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. +Choose your storage plugin based on where your application runs and how you want to manage session data. | Storage Type | Persistence | Use Case | Environment | | -------------------- | --------------------------------------- | -------------------------------------------------- | ------------ | -| **localStorage** | Survives page refresh & browser restart | Web applications, client-side storage | Browser | -| **localStorageNode** | File-based persistent storage | Node.js applications, server-side scripts | Node.js only | -| **custom** | Depends on implementation | Database storage, encrypted storage, cloud storage | Custom | +| **localStorage** | Survives page refresh & browser restart | Best for most web apps - sessions persist across browser restarts without additional setup | Browser | +| **localStorageNode** | File-based persistent storage | Ideal for CLI tools, backend services, or automated scripts that need to maintain sessions | Node.js only | +| **custom** | Depends on implementation | Use when you need centralized session management, enhanced security, multi-device sync, or database storage | Custom | diff --git a/docs/sdk/getting-started/auth-services.mdx b/docs/sdk/getting-started/auth-services.mdx index a37e7af5c..cbcd7597f 100644 --- a/docs/sdk/getting-started/auth-services.mdx +++ b/docs/sdk/getting-started/auth-services.mdx @@ -20,11 +20,35 @@ The Lit Protocol Auth Services package helps you run the infrastructure required Lit hosts default Auth Service instances so you can build without deploying infrastructure on day one. Point your application to the URL that matches the network you're targeting: -| Network | Auth Service URL | Login Server | Usage | -| ----------- | ------------------------------------------- | ------------------------------ | ----- | -| `naga-dev` | `https://naga-dev-auth-service.getlit.dev` | `https://login.litgateway.com` | Use Lit's hosted endpoints while you prototype. Configure your SDK or environment variables with the URLs in this table. | -| `naga-test` | `https://naga-test-auth-service.getlit.dev` | `https://login.litgateway.com` | Start with the hosted endpoints for staging, then switch to your own infrastructure as you scale. | -| `naga` | `Run your own (recommended)` | `Run your own (recommended)` | Lit does not (yet) operate public Auth Service or Login Server endpoints for `naga` | + + + - **Auth Service URL** + ``` + https://naga-dev-auth-service.getlit.dev + ``` + - **Login Server** + ``` + https://login.litgateway.com + ``` + - **Usage:** Use Lit's hosted endpoints while you prototype. Configure your SDK or environment variables with these URLs. + + + + - **Auth Service URL** + ``` + https://naga-test-auth-service.getlit.dev + ``` + - **Login Server** + ``` + https://login.litgateway.com + ``` + - **Usage:** Start with the hosted endpoints for staging, then switch to your own infrastructure as you scale. + + + + Lit does not operate public Auth Service or Login Server endpoints for `naga`. You must deploy your own infrastructure for production. + + The hosted services are best suited for prototyping. Self-host the Auth @@ -54,7 +78,7 @@ If you prefer not to run an Auth Service at all, you can still sponsor users man ### Install the SDK -Run the following command to install the SDK: (Only available using Bun to install at the moment.) +Run the following command to install the SDK: @@ -146,30 +170,28 @@ await startAuthServiceWorker(); Setup the environment variables. ```bash - -# Network configuration (supports naga-dev, naga-test, naga) -NETWORK=naga-dev -LOG_LEVEL=debug - -# Lit transaction sender settings -LIT_TXSENDER_RPC_URL=https://yellowstone-rpc.litprotocol.com -LIT_TXSENDER_PRIVATE_KEY=your_private_key -LIT_DELEGATION_ROOT_MNEMONIC= - -# Redis settings for job queue and caching -REDIS_URL=redis://user:pass@redis-host.com:12345 -PORT=6380 - -# Rate limiting configuration -ENABLE_API_KEY_GATE=true -MAX_REQUESTS_PER_WINDOW=10 -WINDOW_MS=10000 - -# Stytch configuration (for OTP services) -STYTCH_PUBLIC_TOKEN=your_stytch_public_token -STYTCH_SECRET=your_stytch_secret - -```` + # Network configuration (supports naga-dev, naga-test, naga) + NETWORK=naga-dev + LOG_LEVEL=debug + + # Lit transaction sender settings + LIT_TXSENDER_RPC_URL=https://yellowstone-rpc.litprotocol.com + LIT_TXSENDER_PRIVATE_KEY=your_private_key + LIT_DELEGATION_ROOT_MNEMONIC= + + # Redis settings for job queue and caching + REDIS_URL=redis://user:pass@redis-host.com:12345 + PORT=6380 + + # Rate limiting configuration + ENABLE_API_KEY_GATE=true + MAX_REQUESTS_PER_WINDOW=10 + WINDOW_MS=10000 + + # Stytch configuration (for OTP services) + STYTCH_PUBLIC_TOKEN=your_stytch_public_token + STYTCH_SECRET=your_stytch_secret + ``` @@ -183,8 +205,9 @@ STYTCH_SECRET=your_stytch_secret You should set the callback/redirect URLs to the same domain as the Login - Server. eg. > - https://your-domain.com/auth/discord/callback > - - https://your-domain.com/auth/google/callback + Server e.g. + - https://your-domain.com/auth/discord/callback + - https://your-domain.com/auth/google/callback #### One-click Deploy (Railway) @@ -257,4 +280,3 @@ DISCORD_CLIENT_SECRET=your_discord_client_secret When you run a custom Login Server, the `DISCORD_CLIENT_ID` is embedded into the `authMethodId` that Lit nodes use to locate the correct PKP. Make sure the value matches the client ID you used when minting the Discord auth method. -``` diff --git a/docs/sdk/getting-started/lit-client.mdx b/docs/sdk/getting-started/lit-client.mdx index 226b30040..1eb03c9f4 100644 --- a/docs/sdk/getting-started/lit-client.mdx +++ b/docs/sdk/getting-started/lit-client.mdx @@ -4,7 +4,7 @@ description: "Configure the Lit Protocol client for the Lit JS SDK" --- -See SDK Reference for more details on the Lit Client. [Lit Client Reference](/sdk/sdk-reference/lit-client/functions/createLitClient) +See the [Lit Client Reference API](/sdk/sdk-reference/lit-client/functions/createLitClient) for more details on how to create a Lit Client. ## Overview @@ -43,11 +43,9 @@ The Lit Client is the core interface for interacting with the Lit Protocol netwo Choose the appropriate network based on your development stage and requirements, then create your Lit Client instance. - Choose the appropriate network based on your development stage and requirements, then create your Lit Client instance. - -```typescript dev +```typescript Naga Dev import { nagaDev } from "@lit-protocol/networks"; import { createLitClient } from "@lit-protocol/lit-client"; @@ -56,8 +54,7 @@ const litClient = await createLitClient({ }); ``` -```typescript test -// ❗️ Currently in development. Coming soon... +```typescript Naga Test import { nagaTest } from "@lit-protocol/networks"; import { createLitClient } from "@lit-protocol/lit-client"; @@ -66,7 +63,7 @@ const litClient = await createLitClient({ }); ``` -```typescript production +```typescript Naga Mainnet // ❗️ Currently in development. Coming soon... import { nagaProduction } from "@lit-protocol/networks"; import { createLitClient } from "@lit-protocol/lit-client"; @@ -83,10 +80,8 @@ const litClient = await createLitClient({ ## Network Comparison -Select the appropriate network environment based on your development stage and requirements. Each network offers different characteristics for testing and production use cases. - | Network | Type | Key Persistence | Payment Required | Use Case | Status | | -------------- | ------------- | ---------------- | ---------------- | ---------------------- | -------------- | -| **Dev** | Centralised | ❌ Temporary | ❌ Free | Development & Testing | ✅ Available | -| **Test** | Decentralised | ⚠️ No guarantees | ✅ Required | Pre-production Testing | ❌ Coming Soon | -| **Production** | Decentralised | ✅ Persistent | ✅ Required | Live Applications | ❌ Coming Soon | +| **Naga Dev** | Centralised | ❌ Temporary | ❌ Free | Development & Testing | ✅ Available | +| **Naga Test** | Decentralised | ⚠️ No guarantees | ✅ Required | Pre-production Testing | ✅ Available | +| **Naga Mainnet** | Decentralised | ✅ Persistent | ✅ Required | Live Applications | ❌ Coming Soon | diff --git a/docs/sdk/getting-started/payment-manager-setup.mdx b/docs/sdk/getting-started/payment-manager-setup.mdx index c5f3a3688..45af5959e 100644 --- a/docs/sdk/getting-started/payment-manager-setup.mdx +++ b/docs/sdk/getting-started/payment-manager-setup.mdx @@ -19,29 +19,28 @@ description: 'Configure payment system for the Lit JS SDK' - See SDK Reference for more details on the Payment Manager. [Payment Manager - Reference](/sdk/sdk-reference/lit-client/functions/createLitClient#getpaymentmanager) + See the [Payment Manager Reference API](/sdk/sdk-reference/lit-client/functions/createLitClient#getpaymentmanager) for more details on how to manage payments. ## Overview -The Payment Manager demonstrates Lit Protocol's payment system - a billing system for decentralised cryptographic services. Users pay for compute resources on the Lit network to access core services like: +The Payment Manager handles Lit Protocol's payment system - a billing mechanism for decentralized cryptographic services. Users deposit funds to pay for compute resources when accessing core network operations: -- [Encryption/Decryption](/sdk/auth-context-consumption/encrypt-and-decrypt) - Secure data with programmable access control. -- [PKP Signing](/sdk/auth-context-consumption/pkp-sign) - Cryptographic keys that can sign transactions based on conditions. -- [Lit Actions](/sdk/auth-context-consumption/execute-js) - Serverless functions with cryptographic capabilities. +- [Encryption/Decryption](/sdk/auth-context-consumption/encrypt-and-decrypt) - Encrypt data that only authorized users or conditions can decrypt. +- [PKP Signing](/sdk/auth-context-consumption/pkp-sign) - Generate signatures and sign transactions using your PKP wallet. +- [Lit Actions](/sdk/auth-context-consumption/execute-js) - Execute serverless JavaScript functions for decentralized computation. -Similar to how you pay AWS for cloud computing, this system ensures the decentralised network can sustain itself and pay node operators. Each payer keeps a balance in the on-chain Lit Ledger contract funded with `$LITKEY` (or `$tstLPX` on testnet), which the network debits as requests execute. You can deposit funds, request withdrawals with security delays, and manage balances for yourself or other users (enabling applications to sponsor their users' costs for better UX). +Similar to how you pay AWS for cloud computing, this system ensures the decentralized network can sustain itself and compensate node operators. The Payment Manager allows you to deposit funds, request withdrawals (with security delays), and manage balances for yourself or delegate payment for other users - enabling applications to sponsor their users' costs for a seamless experience. -```typescript -import { createLitClient } from '@lit-protocol/lit-client'; -import { nagaTest } from '@lit-protocol/networks'; + ```typescript Naga Test + import { createLitClient } from '@lit-protocol/lit-client'; + import { nagaTest } from '@lit-protocol/networks'; -// 1. Create lit client -const litClient = await createLitClient({ network: nagaTest }); + // 1. Create lit client + const litClient = await createLitClient({ network: nagaTest }); // 2. Get PaymentManager instance (requires account for transactions) const paymentManager = await litClient.getPaymentManager({ @@ -223,7 +222,10 @@ const delegateResponse = await litClient.authService.delegateUsers({ authServiceBaseUrl, apiKey, payerSecretKey: registerResponse.payerSecretKey, - userAddresses: ['0x1234...abcd', '0xabcd...1234'], + userAddresses: [ + '0x1234...abcd', + '0xabcd...1234', + ], }); console.log('Delegation submitted with tx hash:', delegateResponse.txHash); diff --git a/docs/sdk/getting-started/prerequisites/chain-config.mdx b/docs/sdk/getting-started/prerequisites/chain-config.mdx index 33b7f4497..2eb4915e1 100644 --- a/docs/sdk/getting-started/prerequisites/chain-config.mdx +++ b/docs/sdk/getting-started/prerequisites/chain-config.mdx @@ -3,72 +3,79 @@ title: "Chain Config" --- import { AddLitChainButton } from "/snippets/AddLitChainButton.jsx"; -Depending on the Lit Protocol Network that you're using, you'll connect to one of the following Lit chains. For those using one of the Lit **testnets** (Naga Dev or Naga Test) will use the Chronicle Yellowstone Chain. Those building in production on the Naga Mainnet (COMING SOON) will use the Lit Chain. Configuation details for both can be found below: - -### Chronicle Yellowstone - Lit Protocol Testnet - -| Property | Value | -| -------- | ----- | -| ChainID | 175188 (0x2ac54) | -| Currency | tstLPX | -| RPC URL | `https://yellowstone-rpc.litprotocol.com/` | - -Also see [Chainlist](https://chainlist.org/chain/175188) for more details. - - -### Viem Chain Config for the Chronicle Yellowstone network - -```ts -import { Chain, http } from "viem"; - -export const viemChainConfig: Readonly = Object.freeze({ - id: 175188, - name: "Chronicle Yellowstone", - nativeCurrency: { - name: "Chronicle Yellowstone", - symbol: "tstLPX", - decimals: 18, - }, - rpcUrls: { - default: { - http: ["https://yellowstone-rpc.litprotocol.com/"], - }, - public: { - http: ["https://yellowstone-rpc.litprotocol.com/"], - }, - }, - blockExplorers: { - default: { - name: "Yellowstone Explorer", - url: "https://yellowstone-explorer.litprotocol.com/", - }, - }, -}); -``` - -Alternatively, we also provide a helper function to get the viem chain config. You can use - -```ts -litClient.getChainConfig().viemConfig -``` -to get the viem chain config. See [Lit Client Reference](/sdk/sdk-reference/lit-client/functions/createLitClient#getchainconfig) for more details. - - -### Lit Chain — Lit Protocol Mainnet - - - -To connect to Lit Chain, you can click the button above or manually add the network parameters below. For production use cases, you should get a free private RPC URL from Conduit by clicking "Get an API Key" on the [Lit Chain hub page](https://hub.conduit.xyz/lit-chain-1rw3jdu82h). - - -The below and additional chain parameters are available [here](https://hub.conduit.xyz/lit-chain-1rw3jdu82h). - - -| Parameter Name | Value | -|--------------------|----------------------------------------------------| -| Chain ID | 175200 | -| Name | Lit Chain | -| RPC URL | https://lit-chain-rpc.litprotocol.com | -| Block Explorer URL | https://lit-chain-explorer.litprotocol.com | -| Currency Symbol | LITKEY | -| Currency Decimals | 18 | +Lit Protocol uses dedicated blockchain networks for managing PKP ownership, permissions, and payment operations. + +If you're using one of the testnets: Naga Dev or Test, you'll connect to Chronicle Yellowstone, while production applications using Naga Mainnet (COMING SOON) will use the Lit Chain. Configuration details for both networks are below: + + + + ### Chronicle Yellowstone - Lit Protocol Testnet + + | Property | Value | + | -------- | ----- | + | ChainID | 175188 (0x2ac54) | + | Currency | tstLPX | + | RPC URL | `https://yellowstone-rpc.litprotocol.com/` | + + Also see [Chainlist](https://chainlist.org/chain/175188) for more details. + + + ### Viem Chain Config for the Chronicle Yellowstone network + + ```ts + import { Chain, http } from "viem"; + + export const viemChainConfig: Readonly = Object.freeze({ + id: 175188, + name: "Chronicle Yellowstone", + nativeCurrency: { + name: "Chronicle Yellowstone", + symbol: "tstLPX", + decimals: 18, + }, + rpcUrls: { + default: { + http: ["https://yellowstone-rpc.litprotocol.com/"], + }, + public: { + http: ["https://yellowstone-rpc.litprotocol.com/"], + }, + }, + blockExplorers: { + default: { + name: "Yellowstone Explorer", + url: "https://yellowstone-explorer.litprotocol.com/", + }, + }, + }); + ``` + + Alternatively, we also provide a helper function to get the viem chain config. You can use + + ```ts + litClient.getChainConfig().viemConfig + ``` + to get the viem chain config. See [Lit Client Reference](/sdk/sdk-reference/lit-client/functions/createLitClient#getchainconfig) for more details. + + + + ### Lit Chain - Lit Protocol Mainnet + + + + To connect to Lit Chain, you can click the button above or manually add the network parameters below. For production use cases, you should get a free private RPC URL from Conduit by clicking "Get an API Key" on the [Lit Chain hub page](https://hub.conduit.xyz/lit-chain-1rw3jdu82h). + + + The below and additional chain parameters are available [here](https://hub.conduit.xyz/lit-chain-1rw3jdu82h). + + + | Parameter Name | Value | + |--------------------|----------------------------------------------------| + | Chain ID | 175200 | + | Name | Lit Chain | + | RPC URL | https://lit-chain-rpc.litprotocol.com | + | Block Explorer URL | https://lit-chain-explorer.litprotocol.com | + | Currency Symbol | LITKEY | + | Currency Decimals | 18 | + + diff --git a/docs/sdk/getting-started/prerequisites/faucet.mdx b/docs/sdk/getting-started/prerequisites/faucet.mdx index 3e8edb723..1ba8b690f 100644 --- a/docs/sdk/getting-started/prerequisites/faucet.mdx +++ b/docs/sdk/getting-started/prerequisites/faucet.mdx @@ -4,8 +4,7 @@ title: "Faucet" ## Testnet Builders -💰 Visit the [Chronicle Yellowstone -Faucet](https://chronicle-yellowstone-faucet.getlit.dev/) to get some test tokens. +Visit the [Chronicle Yellowstone Faucet](https://chronicle-yellowstone-faucet.getlit.dev/) to get test tokens for the Naga Dev and Test networks. ## Mainnet Builders diff --git a/docs/sdk/introduction.mdx b/docs/sdk/introduction.mdx index 6a4d64c7c..4d013aca7 100644 --- a/docs/sdk/introduction.mdx +++ b/docs/sdk/introduction.mdx @@ -15,29 +15,29 @@ The Lit JS SDK provides a comprehensive toolkit for integrating Lit Protocol's d ### 1. Client Setup Layer -- **[Lit Client Setup](/sdk/getting-started/lit-client)**: Configure the Lit Protocol client -- **[Auth Manager Setup](/sdk/getting-started/auth-manager)**: Set up authentication management with configurable storage options -- **[Payment Manager Setup](/sdk/getting-started/payment-manager-setup)**: Configure payment processing capabilities -- **[Auth Services Setup](/sdk/getting-started/auth-services)**: Configure auth services +- **[Lit Client Setup](/sdk/getting-started/lit-client)**: Initialize and configure your connection to the Lit Protocol network +- **[Auth Manager Setup](/sdk/getting-started/auth-manager)**: Manage authentication state and session persistence across your application +- **[Payment Manager Setup](/sdk/getting-started/payment-manager-setup)**: Deposit funds and delegate payment for network compute resources +- **[Auth Services Setup](/sdk/getting-started/auth-services)**: Configure backend services for minting PKPs and managing OAuth-based sign-in flows ### 2. Authentication Options -- **[PKP Native Authentication](/sdk/auth/pkp-native-auth)**: Programmable Key Pair native authentication options -- **[PKP Custom Authentication](/sdk/auth/pkp-custom-auth)**: Custom PKP authentication implementations -- **[EOA Authentication](/sdk/auth/eoa/eoa-auth)**: Externally Owned Account authentication +- **[PKP Native Authentication](/sdk/auth/pkp-native-auth)**: Authenticate using built-in methods like social login, WebAuthn, or OTP to create and access PKPs +- **[PKP Custom Authentication](/sdk/auth/pkp-custom-auth)**: Implement custom authentication flows using your own identity providers or auth methods +- **[EOA Authentication](/sdk/auth/eoa/eoa-auth)**: Use traditional wallet-based authentication with externally owned accounts ### 3. Auth Context Consumption / Core API Methods -- **[pkpSign](/sdk/auth-context-consumption/pkp-sign)**: - Use your PKP to sign a message -- **[executeJs](/sdk/auth-context-consumption/execute-js)**: - Use your PKP to execute a JavaScript function -- **[encryptAndDecrypt](/sdk/auth-context-consumption/encrypt-and-decrypt)**: - Use your PKP to encrypt and decrypt data +- **[pkpSign](/sdk/auth-context-consumption/pkp-sign)**: Sign transactions and messages using your authenticated PKP wallet +- **[executeJs](/sdk/auth-context-consumption/execute-js)**: Run serverless JavaScript functions with decentralized access control and key management +- **[encryptAndDecrypt](/sdk/auth-context-consumption/encrypt-and-decrypt)**: Encrypt data that can only be decrypted by authorized users or under specific conditions ### 4. PKP Wallet Management -- **[PKP Permissions](/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-permissions)**: - Manage PKP permissions -- **[PKP Viem Account](/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-viem-account)**: - Manage PKP Viem account -- **[PKP View Helpers](/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-view-helpers)**: - View PKP permissions +- **[PKP Permissions](/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-permissions)**: Control which users and applications can use your PKP for signing and decryption +- **[PKP Viem Account](/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-viem-account)**: Integrate your PKP with Viem for seamless Ethereum transaction building and signing +- **[PKP View Helpers](/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-view-helpers)**: Query and inspect PKP permissions and metadata from the blockchain ### 5. Network Status & Monitoring -- **[Network Status](/sdk/resources/network-status)**: - Monitor real-time uptime and performance of Lit Protocol networks +- **[Network Status](/sdk/resources/network-status)**: Check real-time health metrics and availability across Lit Protocol's decentralized network diff --git a/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-permissions.mdx b/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-permissions.mdx index 68b3ebca0..7ed2a2291 100644 --- a/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-permissions.mdx +++ b/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-permissions.mdx @@ -3,8 +3,7 @@ title: PKP Permissions --- - See SDK Reference for more details on the PKP Permissions. [PKP Permissions - Reference](/sdk/sdk-reference/lit-client/functions/createLitClient#getpkppermissionsmanager) + See the [PKP Permissions Reference API](/sdk/sdk-reference/lit-client/functions/createLitClient#getpkppermissionsmanager) for more details on how to manage PKP permissions. ### What it is diff --git a/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-viem-account.mdx b/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-viem-account.mdx index bbadedf47..2dd970732 100644 --- a/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-viem-account.mdx +++ b/docs/sdk/sdk-reference/lit-client/functions/createLitClient/pkp-viem-account.mdx @@ -3,8 +3,7 @@ title: PKP Viem Account --- - See SDK Reference for more details on the PKP Viem Account. [PKP Viem Account - Reference](/sdk/sdk-reference/lit-client/functions/createLitClient#getpkpviemaccount) + See the [PKP Viem AccountReference Reference API](/sdk/sdk-reference/lit-client/functions/createLitClient#getpkpviemaccount) for more details on how to create a PKP Viem account. ### What it is