Skip to content

Commit 359ee4a

Browse files
committed
Merge branch 'naga' into chore/doc-updates
2 parents 6d35200 + f2f4182 commit 359ee4a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3908
-1901
lines changed

docs/governance/overview.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
title: "Overview"
33
---
44

5+
<Tip>
6+
$LITKEY and the Staking Contest to Select the Genesis Node Operator Set for the Naga Mainnet are now LIVE.
7+
8+
[Learn More](https://spark.litprotocol.com/litkey-is-live/).
9+
</Tip>
10+
511
Lit Protocol has established an initial governance system to guide and organize its development and operations. This system exists to manage decision-making related to the core protocol, the infrastructure that supports it, and the broader ecosystem of applications built on top of it.
612

713
## Purpose

docs/index.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ description: 'Decentralized key management and private compute'
44
---
55

66
<Tip>
7-
We're excited to announce that Vincent is now live! Vincent is a powerful toolkit that enables secure web3 capabilities for AI agents through:
7+
$LITKEY and the Staking Contest to Select the Genesis Node Operator Set for the Naga Mainnet are now LIVE.
88

9-
- Secure Delegation: Safely delegate wallet operations to AI agents while maintaining full control
10-
- Customizable Tools: Define and manage specific web3 actions your agents can perform
11-
- Policy Controls: Set granular rules and restrictions for how agents interact with web3
12-
13-
Check out the [Vincent documentation](https://docs.heyvincent.ai/) to get started!
9+
[Learn More](https://spark.litprotocol.com/litkey-is-live/).
1410
</Tip>
1511

1612
# Overview

docs/node-ops/overview.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
title: "Overview"
33
---
44

5+
<Tip>
6+
$LITKEY and the Staking Contest to Select the Genesis Node Operator Set for the Naga Mainnet are now LIVE.
7+
8+
[Learn More](https://spark.litprotocol.com/litkey-is-live/).
9+
</Tip>
10+
511
Lit Protocol is secured and operated by a decentralized network of validator nodes. These nodes are responsible for executing the threshold cryptographic operations that underpin the core functionality of the network, including signing, encryption, decryption, and private compute via Lit Actions.
612

713
Each node participates in threshold signature multi-party computation (TSS MPC) protocols and operates inside a confidential compute environment (TEE), ensuring that no single operator can access plaintext key material or violate policy constraints.
@@ -14,4 +20,4 @@ A staking and delegation contest will be run to select the genesis validator set
1420

1521
To whitelist your node, visit https://staking.litprotocol.com/
1622

17-
Refer to the next page for details on hardware specs, minimum requirements, and operational guidelines for node operators.
23+
Refer to the next page for details on hardware specs, minimum requirements, and operational guidelines for node operators.

docs/sdk/getting-started/auth-services.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@ Lit hosts default Auth Service instances so you can build without deploying infr
5656
configuration.
5757
</Note>
5858

59+
## Payment Delegation APIs
60+
61+
The Auth Service also exposes lightweight endpoints that sponsor user requests on the network. These are the same APIs the Lit SDK calls when you use `litClient.authService.registerPayer` / `delegateUsers` from the Payment Manager guide.
62+
63+
- `POST /register-payer`
64+
- Headers: `x-api-key`.
65+
- Behaviour: generates a random `payerSecretKey`, hashes it with the API key, and derives a child wallet from `LIT_DELEGATION_ROOT_MNEMONIC`.
66+
- Response: `{ success, payerWalletAddress, payerSecretKey }`. The service **does not** persist the secret—you must store it securely (KMS, vault, etc.).
67+
- Rotation: call the endpoint again with the same API key to rotate the secret and derive a new child wallet.
68+
- `POST /add-users`
69+
- Headers: `x-api-key`, `payer-secret-key`; body is a JSON array of user addresses.
70+
- Behaviour: recomputes the same child wallet on the fly and calls `PaymentManager.delegatePaymentsBatch` so the payer sponsors those users.
71+
72+
<Tip>
73+
Running the Auth Service yourself keeps the derivation mnemonic and payer secrets inside your infrastructure. The Lit-hosted instance is great for quick starts, but you remain responsible for storing the returned `payerSecretKey`.
74+
</Tip>
75+
76+
If you prefer not to run an Auth Service at all, you can still sponsor users manually: create a payer wallet, fund it, and call `paymentManager.delegatePayments*` directly from your backend. See [Payment Manager Setup](/sdk/getting-started/payment-manager-setup#sponsoring-your-users-capacity-delegation-replacement) for sample code.
77+
5978

6079
### Install the SDK
6180

docs/sdk/getting-started/payment-manager-setup.mdx

Lines changed: 116 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
---
2-
title: "Payment Manager Setup"
3-
description: "Configure payment system for the Lit JS SDK"
2+
title: 'Payment Manager Setup'
3+
description: 'Configure payment system for the Lit JS SDK'
44
---
55

66
<Warning>
7-
❗️ Currently free on the dev network, so no need to deposit funds. More
8-
details coming soon for test and production networks.
7+
❗️ Payment status by network:
8+
- **naga-dev** – usage is currently free; no deposits required.
9+
- **naga-test** – payments are enabled using test tokens (see faucet link
10+
below).
11+
- **Mainnet** – coming soon; mainnet payment details will be announced
12+
shortly.
913
</Warning>
1014

1115
<Note>
@@ -22,9 +26,9 @@ description: "Configure payment system for the Lit JS SDK"
2226

2327
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:
2428

25-
- **Encryption/Decryption** - Encrypt data that only authorized users or conditions can decrypt
26-
- **PKP Signing** - Generate signatures and sign transactions using your PKP wallet
27-
- **Lit Actions** - Execute serverless JavaScript functions for decentralized computation
29+
- [Encryption/Decryption](/sdk/auth-context-consumption/encrypt-and-decrypt) - Encrypt data that only authorized users or conditions can decrypt.
30+
- [PKP Signing](/sdk/auth-context-consumption/pkp-sign) - Generate signatures and sign transactions using your PKP wallet.
31+
- [Lit Actions](/sdk/auth-context-consumption/execute-js) - Execute serverless JavaScript functions for decentralized computation.
2832

2933
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.
3034

@@ -38,11 +42,12 @@ Similar to how you pay AWS for cloud computing, this system ensures the decentra
3842
// 1. Create lit client
3943
const litClient = await createLitClient({ network: nagaTest });
4044

41-
// 2. Get PaymentManager instance (requires account for transactions)
42-
const paymentManager = await litClient.getPaymentManager({
45+
// 2. Get PaymentManager instance (requires account for transactions)
46+
const paymentManager = await litClient.getPaymentManager({
4347
account: yourAccount // viem account instance
44-
});
45-
```
48+
});
49+
50+
````
4651

4752
</Step>
4853

@@ -59,7 +64,7 @@ const { data: myAccount } = useWalletClient();
5964
6065
```typescript viem/accounts
6166
// 1. import the privateKeyToAccount function from viem/accounts
62-
import { privateKeyToAccount } from "viem/accounts";
67+
import { privateKeyToAccount } from 'viem/accounts';
6368

6469
// 2. Convert your private key to a viem account object that can be used for payment operations.
6570
const myAccount = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
@@ -74,7 +79,7 @@ const myAccount = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
7479
```typescript Deposit funds to your own account
7580
// 1. Deposit funds to your own account
7681
const result = await paymentManager.deposit({
77-
amountInEth: "0.1",
82+
amountInEth: '0.1',
7883
});
7984

8085
console.log(`Deposit successful: ${result.hash}`);
@@ -84,8 +89,8 @@ console.log(`Deposit successful: ${result.hash}`);
8489
```typescript Deposit for another user
8590
// 1. Deposit funds for another user
8691
const result = await paymentManager.depositForUser({
87-
userAddress: "0x742d35Cc6638Cb49f4E7c9ce71E02ef18C53E1d5",
88-
amountInEth: "0.05",
92+
userAddress: '0x742d35Cc6638Cb49f4E7c9ce71E02ef18C53E1d5',
93+
amountInEth: '0.05',
8994
});
9095

9196
console.log(`Deposit successful: ${result.hash}`);
@@ -97,12 +102,101 @@ console.log(`Deposit successful: ${result.hash}`);
97102

98103
</Steps>
99104

105+
## Sponsoring Your Users
106+
107+
<Steps>
108+
<Step title="Define spending limit">
109+
110+
Define spending limits for the users you want to sponsor (values are in wei).
111+
112+
<CodeGroup>
113+
114+
```typescript
115+
await paymentManager.setRestriction({
116+
totalMaxPrice: '1000000000000000000', // 1 ETH equivalent limit
117+
requestsPerPeriod: '100', // max number of sponsored requests in a period
118+
periodSeconds: '3600', // rolling window (1 hour in this example)
119+
});
120+
```
121+
122+
</CodeGroup>
123+
124+
</Step>
125+
126+
<Step title="Delegate users">
127+
128+
With restrictions set, delegate one or more users to spend from your payer wallet.
129+
130+
<CodeGroup>
131+
132+
```typescript
133+
await paymentManager.delegatePaymentsBatch({
134+
userAddresses: ['0xAlice...', '0xBob...'],
135+
});
136+
```
137+
138+
</CodeGroup>
139+
140+
</Step>
141+
142+
<Step title="Remove users (optional)">
143+
144+
Undelegate users when you no longer want to sponsor them.
145+
146+
<CodeGroup>
147+
148+
```typescript
149+
await paymentManager.undelegatePaymentsBatch({
150+
userAddresses: ['0xAlice...'],
151+
});
152+
```
153+
154+
</CodeGroup>
155+
156+
</Step>
157+
</Steps>
158+
159+
## **Alternatively**
160+
161+
Manage delegation via the hosted or self-hosted Auth Service (see [Auth Services setup](/sdk/getting-started/auth-services) for the full flow).
162+
163+
## After Payment Delegation
164+
165+
**Users decrypt as normal** – we still call `litClient.decrypt` with an auth context; the network draws fees from the delegated payer instead of the user’s wallet.
166+
167+
<Note>
168+
ℹ️ `userMaxPrice` is recommended for sponsored sessions, typically the same value or less than the the restriction the sponsor set; optional guardrail when self-funded.
169+
</Note>
170+
171+
```typescript highlight={18}
172+
// Client-side decrypt with sponsored payments
173+
const authContext = await authManager.createEoaAuthContext({
174+
litClient,
175+
config: { account: walletClient },
176+
authConfig: {
177+
resources: [
178+
['access-control-condition-decryption', '*'],
179+
['lit-action-execution', '*'],
180+
],
181+
},
182+
});
183+
184+
const response = await litClient.decrypt({
185+
data: encryptedData,
186+
unifiedAccessControlConditions: accs,
187+
authContext,
188+
chain: 'ethereum',
189+
userMaxPrice: 1000000000000000000n,
190+
});
191+
```
192+
100193
## Auth Service API Endpoints
101194

102-
Leverage the hosted Auth Service to manage delegation without exposing private keys in your application:
195+
Leverage the hosted Auth Service to manage delegation without exposing private keys in your application. Full request/response details live in the [Auth Services setup guide](/sdk/getting-started/auth-services#payment-delegation-apis). In practice you will:
103196

104-
- `POST /register-payer` - Send your `x-api-key` header to receive a delegated payer address and `payerSecretKey`. Persist this secret securely; it is required for all future delegation calls.
105-
- `POST /add-users` - Provide headers `x-api-key` and `payer-secret-key` plus a JSON body containing an array of user addresses. The Auth Service uses the Payment Manager internally to delegate payments to each address in a single transaction.
197+
- Call `authService.registerPayer` (hosted or self-hosted) to derive a payer wallet + `payerSecretKey`.
198+
- Call `authService.delegateUsers` (`/add-users`) to sponsor a list of user addresses.
199+
- Or skip the service entirely and use the Payment Manager methods directly (example below).
106200

107201
```typescript
108202
import { createLitClient } from '@lit-protocol/lit-client';
@@ -111,8 +205,8 @@ import { nagaTest } from '@lit-protocol/networks';
111205
// 1. Create the Lit client for the naga-test environment
112206
const litClient = await createLitClient({ network: nagaTest });
113207

114-
const authServiceBaseUrl = 'https://naga-test-auth-service.example.com';
115-
const apiKey = process.env.LIT_API_KEY!;
208+
const authServiceBaseUrl = 'https://naga-test-auth-service.getlit.dev/';
209+
const apiKey = process.env.YOUR_AUTH_SERVICE_API_KEY!;
116210

117211
// 3. Register a payer wallet (store the secret securely server-side)
118212
const registerResponse = await litClient.authService.registerPayer({
@@ -137,14 +231,8 @@ const delegateResponse = await litClient.authService.delegateUsers({
137231
console.log('Delegation submitted with tx hash:', delegateResponse.txHash);
138232

139233
// 5. Continue to use the same payer secret for future delegation calls
140-
````
234+
```
141235

142236
### How the Auth Service derives payer wallets
143237

144-
- The service holds a single root mnemonic (`LIT_DELEGATION_ROOT_MNEMONIC`).
145-
- `/register-payer` combines the `x-api-key` header with a freshly generated `payerSecretKey`. That pair is hashed into a deterministic derivation index, which is then used with the root mnemonic to derive a unique child wallet.
146-
- The response includes the derived wallet address and the random `payerSecretKey`. The server does not store this secret; you must persist it securely on the client side.
147-
- Later, `/add-users` expects both headers (`x-api-key` and `payer-secret-key`). The service recomputes the same derivation index and wallet on the fly, so the same header pair always maps to the same child wallet.
148-
- Calling `/register-payer` again with the same API key issues a new random `payerSecretKey`, which leads to a different child wallet. Choose whether to rotate secrets or keep the original one depending on your application needs.
149-
150-
![](https://www.plantuml.com/plantuml/png/XPAn3jCm48PtFyMfKw8IiKSAQcab1a1K58c1CXpEaLWaJcHVIlFs6DkKcBHYYy-Vl_Floyuo6fxwJh3YZc0_SGjdCbSb2KuuzwGPZjHHWwm6BSJeS2NLYAw-ENJAxMy0BOJFT7ifyz3lGbodv3l5qG3lKMD3nlFn-ndh6RTyr3lSFTN5MYo96Xc_eINOh8F2OT1iKFeUzuKGLGKVgL6MoS28CnceAX5lNhnQ1YpXzE7y2LwQY1SUl-ZiLk2eYXyqvsA1hqw_8Kq6cKARCqb3VD57CkfAy1ExZXY-cw67NbC_Q2LX2quCJfnwdJXSi0ogp_xilguDMNlH2_rRcdt2-0m4aoLZ_viGwxhmv3BSYz2iiDuSAXxwydMLEmwaX8RYBBDSnABR_plY4fmCcToZEbUgMM1Ub0uxGoc7INCk0XNJf509Ibj6pGfvPVyNhUCZnRfzZIpRp4VCHGgxu_TVo1zSlAxuim75WoPy0qEIrCWhPJeBZxPeswUpjvEKP2rix-IET3trtIy0)
238+
- For hosted or self-hosted deployments, see the derivation and rotation notes in the [Auth Services guide](/sdk/getting-started/auth-services#payment-delegation-apis). Manual deployments can always provision and delegate entirely via the `PaymentManager` helper without touching these endpoints.

packages/artillery/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# @lit-protocol/artillery
22

3+
## 0.0.7
4+
5+
### Patch Changes
6+
7+
- @lit-protocol/e2e@3.0.2
8+
9+
## 0.0.6
10+
11+
### Patch Changes
12+
13+
- Updated dependencies [6bd3394]
14+
- @lit-protocol/e2e@3.0.1
15+
316
## 0.0.5
417

518
### Patch Changes

packages/artillery/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lit-protocol/artillery",
3-
"version": "0.0.5",
3+
"version": "0.0.7",
44
"private": true,
55
"type": "commonjs",
66
"dependencies": {

packages/auth-helpers/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @lit-protocol/auth-helpers
22

3+
## 8.1.1
4+
5+
### Patch Changes
6+
7+
- 6bd3394: Update the naga-dev staking address. users are expected to reinstall the SDK to apply this patch to continue using the naga-dev network.
8+
39
## 8.1.0
410

511
### Minor Changes

packages/auth-helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"crypto": false,
2626
"stream": false
2727
},
28-
"version": "8.1.0",
28+
"version": "8.1.1",
2929
"main": "./src/index.js",
3030
"typings": "./src/index.d.ts",
3131
"dependencies": {

packages/auth-services/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @lit-protocol/auth-services
22

3+
## 2.0.5
4+
5+
### Patch Changes
6+
7+
- 6bd3394: Update the naga-dev staking address. users are expected to reinstall the SDK to apply this patch to continue using the naga-dev network.
8+
- Updated dependencies [6bd3394]
9+
- @lit-protocol/contracts@0.7.1
10+
311
## 2.0.4
412

513
### Patch Changes

0 commit comments

Comments
 (0)