Skip to content

Commit 3021791

Browse files
authored
V7 Docs
V7 Docs
2 parents 3188f7c + 8e2263a commit 3021791

Some content is hidden

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

54 files changed

+1302
-746
lines changed

docs/api-reference/latest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import FeedbackComponent from "@site/src/pages/feedback.md";
22

33
# Latest SDK Version
44

5-
The most recent version of the SDK i.e. v6.x.x (beta) API docs can be viewed [here](https://v6-api-doc-lit-js-sdk.vercel.app/).
5+
The most recent version of the SDK (v7.x.x) API docs can be viewed [here](https://v7-api-doc-lit-js-sdk.vercel.app/).
66

77
<FeedbackComponent/>

docs/api-reference/v6-sdk.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
# SDK 6.x.x
3+
4+
The SDK v6.x.x API docs can be viewed [here](https://v6-api-doc-lit-js-sdk.vercel.app/).
5+
6+
:::warning
7+
Please note that the latest API docs are [here](https://developer.litprotocol.com/api-reference/latest/).
8+
:::
9+
<FeedbackComponent/>

docs/concepts/capacity-credits-concept.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ You can read more about Session Signatures [here](../sdk/authentication/session-
4747

4848

4949
```javascript
50-
import { LitNetwork } from "@lit-protocol/constants";
50+
import { LIT_NETWORK, LIT_ABILITY } from "@lit-protocol/constants";
5151

5252
const litNodeClient = new LitNodeClient({
53-
litNetwork: LitNetwork.DatilTest,
53+
litNetwork: LIT_NETWORK.DatilTest,
5454
checkNodeAttestation: true,
5555
});
5656

@@ -66,12 +66,12 @@ import { LitNetwork } from "@lit-protocol/constants";
6666

6767
recapObject.addCapabilityForResource(
6868
litResource,
69-
LitAbility.LitActionExecution
69+
LIT_ABILITY.LitActionExecution
7070
);
7171

7272
const verified = recapObject.verifyCapabilitiesForResource(
7373
litResource,
74-
LitAbility.LitActionExecution
74+
LIT_ABILITY.LitActionExecution
7575
);
7676

7777
if (!verified) {
@@ -110,7 +110,7 @@ import { LitNetwork } from "@lit-protocol/constants";
110110
resourceAbilityRequests: [
111111
{
112112
resource: new LitActionResource('*'),
113-
ability: LitAbility.LitActionExecution,
113+
ability: LIT_ABILITY.LitActionExecution,
114114
},
115115
],
116116
authNeededCallback,

docs/connecting-to-a-lit-network/connecting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Connecting to a Lit Network
22

3-
After installing the Lit SDK, you can connect an instance of [LitNodeClient](https://v6-api-doc-lit-js-sdk.vercel.app/classes/lit_node_client_src.LitNodeClient.html) to a Lit network. This is done by setting the `litNetwork` property when instantiating an instance of `LitNodeClient`:
3+
After installing the Lit SDK, you can connect an instance of [LitNodeClient](https://v7-api-doc-lit-js-sdk.vercel.app/classes/lit_node_client_src.LitNodeClient.html) to a Lit network. This is done by setting the `litNetwork` property when instantiating an instance of `LitNodeClient`:
44

55
```ts
66
import { LitNodeClient } from "@lit-protocol/lit-node-client";
7-
import { LitNetwork } from "@lit-protocol/constants";
7+
import { LIT_NETWORK } from "@lit-protocol/constants";
88

99
const litNodeClient = new LitNodeClient({
1010
// Change this to the Lit SDK Network Identifier you want to connect to
11-
litNetwork: LitNetwork.DatilDev,
11+
litNetwork: LIT_NETWORK.DatilDev,
1212
});
1313
await litNodeClient.connect();
1414
```

docs/integrations/aa/candide.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,31 @@ JSON_RPC_NODE_PROVIDER= // Get an RPC from a Node provider
4949
#### Initialize the Lit Network Connection and GoogleProvider
5050

5151
- Connect to the Lit Network using LitNodeClient.
52-
- Set up the LitAuthClient for authentication.
52+
- Set up the LitRelay for authentication.
5353
- Initialize a GoogleProvider for Google sign-in.
5454

5555
```jsx
5656
import { LitNodeClient } from "@lit-protocol/lit-node-client";
57-
import { LitAuthClient, GoogleProvider } from "@lit-protocol/lit-auth-client";
58-
import { ProviderType, LitNetwork } from "@lit-protocol/constants";
57+
import { LitRelay } from "@lit-protocol/lit-auth-client";
58+
import { GoogleProvider } from "@lit-protocol/providers";
59+
import { PROVIDER_TYPE, LIT_NETWORK } from "@lit-protocol/constants";
5960

6061
const initalizeClientsAndProvider = async () => {
6162
const litNodeClient = new LitNodeClient({
62-
litNetwork: LitNetwork.DatilDev,
63+
litNetwork: LIT_NETWORK.DatilDev,
6364
debug: true,
6465
});
6566
await litNodeClient.connect();
6667

67-
const litAuthClient = new LitAuthClient({
68-
litRelayConfig: {
69-
relayApiKey: process.env.LIT_API_KEY,
70-
},
71-
litNodeClient,
68+
const litRelay = new LitRelay({
69+
relayUrl: LitRelay.getRelayUrl(LIT_NETWORK.DatilDev),
70+
relayApiKey: 'test-api-key',
7271
});
72+
console.log("Connected to Lit Nodes and Lit Relay ✔️");
7373

74-
console.log("Connected to Lit Node and Lit Auth Clients ✔️");
74+
const provider = new GoogleProvider({ relay: litRelay, litNodeClient });
7575

76-
const provider = litAuthClient.initProvider<GoogleProvider>(
77-
ProviderType.Google,
78-
{
79-
// redirectUri: The redirect URI Lit's login server should redirect to after a successful login
80-
}
81-
);
82-
return { litNodeClient, litAuthClient, provider };
76+
return { litNodeClient, litRelay, provider };
8377
};
8478
```
8579

@@ -108,11 +102,20 @@ const authMethod = await generateAuthMethod();
108102
if (!authMethod) {
109103
return;
110104
}
111-
Mint PKP (Programmable Key Pair)
112-
import { LitAuthClient } from "@lit-protocol/lit-auth-client";
105+
```
106+
107+
#### Mint PKP (Programmable Key Pair)
108+
109+
```jsx
110+
import { LitRelay } from "@lit-protocol/lit-auth-client";
113111

114112
const mintWithGoogle = async (authMethod) => {
115-
const pkp = await litAuthClient.mintPKPWithAuthMethods([authMethod], {
113+
const litRelay = new LitRelay({
114+
relayUrl: LitRelay.getRelayUrl(LIT_NETWORK.DatilDev),
115+
relayApiKey: 'test-api-key',
116+
});
117+
118+
const pkp = await litRelay.mintPKPWithAuthMethods([authMethod], {
116119
addPkpEthAddressAsPermittedAddress: true
117120
});
118121
console.log("Fetched PKP", pkp);
@@ -127,7 +130,7 @@ console.log("Minted PKP ✔️");
127130

128131
```jsx
129132
import { PKPEthersWallet } from "@lit-protocol/pkp-ethers";
130-
import { LitAbility, LitPKPResource } from "@lit-protocol/auth-helpers";
133+
import { LIT_ABILITY, LitPKPResource } from "@lit-protocol/auth-helpers";
131134
import { AuthCallbackParams } from "@lit-protocol/types";
132135
import { LIT_RPC } from "@lit-protocol/constants";
133136

@@ -139,7 +142,7 @@ const response = await litNodeClient.signSessionKey({
139142
resourceAbilityRequests: [
140143
{
141144
resource: new LitPKPResource("*"),
142-
ability: LitAbility.PKPSigning,
145+
ability: LIT_ABILITY.PKPSigning,
143146
},
144147
],
145148
expiration: params.expiration,
@@ -159,7 +162,7 @@ const guardianSigner = new PKPEthersWallet({
159162
resourceAbilityRequests: [
160163
{
161164
resource: new LitPKPResource("*"),
162-
ability: LitAbility.PKPSigning,
165+
ability: LIT_ABILITY.PKPSigning,
163166
},
164167
],
165168
authNeededCallback: authNeededCallback,

docs/integrations/aa/pimlico.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,39 +152,45 @@ You can also ping the Lit developement team on [Discord](https://litgateway.com/
152152
### 6. Mint a PKPs through Lit Protocol
153153

154154
```js
155-
const litClient = new LitAuthClient({
156-
litRelayConfig: {
157-
relayApiKey: '<Your Lit Relay Server API Key>',
158-
}
155+
import { LIT_NETWORK } from "@lit-protocol/constants";
156+
import { StytchOtpProvider } from "@lit-protocol/providers";
157+
import { LitRelay } from "@lit-protocol/lit-auth-client";
158+
159+
const litRelay = new LitRelay({
160+
relayUrl: LitRelay.getRelayUrl(LIT_NETWORK.DatilDev),
161+
relayApiKey: 'test-api-key',
159162
});
160-
161-
const session = litClient.initProvider(ProviderType.StytchOtp, {
163+
164+
const session = new StytchOtpProvider({ relay: litRelay, litNodeClient,
162165
userId: sessionStatus.session.user_id,
163166
appId: "project-test-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
164-
})
167+
});
165168

166169
const authMethod = await session.authenticate({
167170
accessToken: sessionStatus.session_jwt
168-
})
171+
});
169172

170-
await session.mintPKPThroughRelayer(authMethod)
171-
const pkps = await session.fetchPKPsThroughRelayer(authMethod)
173+
await litRelay.mintPKPWithAuthMethods([authMethod], {});
174+
const pkps = await session.fetchPKPs(authMethod);
172175
```
173176

174177

175178
### 7. Generate the Controller Session Signatures or its context to generate them on demand
176179

177180
```js
181+
import { LitNodeClientNodeJs } from "@lit-protocol/lit-node-client-nodejs";
182+
import { LIT_ABILITY, LIT_NETWORK } from "@lit-protocol/constants";
183+
178184
const litNodeClient = new LitNodeClientNodeJs({
179-
litNetwork: "datil-dev",
185+
litNetwork: LIT_NETWORK.DatilDev,
180186
debug: false,
181187
})
182188
await litNodeClient.connect();
183189

184190
const resourceAbilities = [
185191
{
186192
resource: new LitActionResource("*"),
187-
ability: LitAbility.PKPSigning,
193+
ability: LIT_ABILITY.PKPSigning,
188194
},
189195
];
190196

@@ -228,8 +234,22 @@ We will now generate a wallet that can act a regular Ethers.js wallet, but will
228234
const pkpWallet = new PKPEthersWallet({
229235
pkpPubKey: pkp[pkp.length - 1].publicKey,
230236
rpc: "<standard RPC URL for the chain you are using>", // e.g. https://rpc.ankr.com/eth_goerli
237+
litNodeClient,
238+
authContext: {
239+
getSessionSigsProps: {
240+
chain: 'ethereum',
241+
expiration: new Date(Date.now() + 60_000 * 60).toISOString(),
242+
resourceAbilityRequests: resourceAbilities,
243+
authNeededCallback,
244+
},
245+
},
246+
// controllerSessionSigs: sesionSigs, // (deprecated) If you will be passing sessionSigs directly, do not pass authContext
247+
});
248+
249+
const pkpWallet = new PKPEthersWallet({
250+
pkpPubKey: pkp[pkp.length - 1].publicKey,
251+
litNodeClient,
231252
authContext: {
232-
client: litNodeClient,
233253
getSessionSigsProps: {
234254
chain: 'ethereum',
235255
expiration: new Date(Date.now() + 60_000 * 60).toISOString(),

docs/integrations/storage/irys.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Connect to a Lit node on one of our [active networks](https://developer.litproto
9191

9292
```ts
9393
import * as LitJsSdk from "@lit-protocol/lit-node-client-nodejs";
94-
import { LitNetwork } from "@lit-protocol/constants";
94+
import { LIT_NETWORK } from "@lit-protocol/constants";
9595

9696
let litNodeClientInstance: LitJsSdk.LitNodeClientNodeJs | null = null;
9797

@@ -100,7 +100,7 @@ async function getLitNodeClient(): Promise<LitJsSdk.LitNodeClientNodeJs> {
100100

101101
litNodeClientInstance = new LitJsSdk.LitNodeClientNodeJs({
102102
alertWhenUnauthorized: false,
103-
litNetwork: LitNetwork.DatilDev, // DatilDev network for free usage
103+
litNetwork: LIT_NETWORK.DatilDev, // DatilDev network for free usage
104104
debug: false,
105105
});
106106

@@ -181,8 +181,6 @@ We provide multiple methods to encrypt data, including strings, files, zip files
181181

182182
- `encryptString():` Encrypts a string.
183183
- `encryptToJson()`: Encrypts a string or file and serializes the result to JSON.
184-
- `zipAndEncryptString()`: Encrypts and compresses a string into a zip file. Useful for bundling multiple pieces of data.
185-
- `encryptFile()` and `zipAndEncryptFiles()`: Encrypt a single file or multiple files.
186184

187185
We will use `encryptString()` to encrypt a simple string:
188186

@@ -291,7 +289,7 @@ async function decryptData(
291289
resourceAbilityRequests: [
292290
{
293291
resource: new LitAccessControlConditionResource("*"),
294-
ability: LitAbility.AccessControlConditionDecryption,
292+
ability: LIT_ABILITY.AccessControlConditionDecryption,
295293
},
296294
],
297295
authNeededCallback: async (params: any) => {
@@ -351,10 +349,13 @@ Connect to a Lit node on one of our [active networks](https://developer.litproto
351349
```ts
352350
import * as LitJsSdk from "@lit-protocol/lit-node-client";
353351
import { LitNodeClient } from "@lit-protocol/lit-node-client";
352+
import { LIT_NETWORK } from "@lit-protocol/constants";
354353

355-
const litClient = new LitNodeClient({
356-
litNetwork: "datil-dev",
354+
const litNodeClient = new LitNodeClient({
355+
litNetwork: LIT_NETWORK.DatilDev,
357356
});
357+
358+
await litNodeClient.connect();
358359
```
359360

360361
### Setting Access Control Rules
@@ -427,8 +428,6 @@ We provide multiple methods to encrypt data, including strings, files, zip files
427428

428429
- `encryptString()`: Encrypts a string.
429430
- `encryptToJson()`: Encrypts a string or file and serializes the result to JSON.
430-
- `zipAndEncryptString()`: Encrypts and compresses a string into a zip file. Useful for bundling multiple pieces of data.
431-
- `encryptFile()` and `zipAndEncryptFiles()`: Encrypt a single file or multiple files.
432431

433432
We will use `encryptString()` to encrypt a string:
434433

@@ -569,7 +568,7 @@ export const decryptData = async (encryptedText: string, dataToEncryptHash: stri
569568
resourceAbilityRequests: [
570569
{
571570
resource: litResource,
572-
ability: LitAbility.AccessControlConditionDecryption,
571+
ability: LIT_ABILITY.AccessControlConditionDecryption,
573572
},
574573
],
575574
authNeededCallback,

docs/intro/first-request/connecting-to-lit.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ When initializing a `LitNodeClient` instance, you must provide a `litNetwork`.
66

77
```tsx
88
import { LitNodeClient } from '@lit-protocol/lit-node-client';
9-
import { LitNetwork } from '@lit-protocol/constants';
9+
import { LIT_NETWORK } from '@lit-protocol/constants';
1010

1111
const litNodeClient = new LitNodeClient({
12-
litNetwork: LitNetwork.DatilDev,
12+
litNetwork: LIT_NETWORK.DatilDev,
1313
debug: false,
1414
});
1515

1616
await litNodeClient.connect();
1717
```
1818

19-
### `LitNetwork` Constant
19+
### `LIT_NETWORK` Constant
2020

21-
The `LitNetwork` constant contains the past and present Lit networks. The constant is imported from the `@lit-protocol/constants` package. The current networks in the constant can be found [here](https://v6-api-doc-lit-js-sdk.vercel.app/enums/constants_src.LitNetwork.html).
21+
The `LIT_NETWORK` constant contains the past and present Lit networks. The constant is imported from the `@lit-protocol/constants` package. The current networks in the constant can be found [here](https://v7-api-doc-lit-js-sdk.vercel.app/variables/constants_src.LIT_NETWORK.html).
2222

2323
### `LitNodeClient` Flags
2424

25-
You have the option to pass flags to the `LitNodeClient` instance. These flags are used to configure the Lit network connection. You can find a complete list of flags in the [LitNodeClient Config](https://v6-api-doc-lit-js-sdk.vercel.app/interfaces/types_src.LitNodeClientConfig.html). In this guide we will cover the most common flags: `debug` and `storageProvider`.
25+
You have the option to pass flags to the `LitNodeClient` instance. These flags are used to configure the Lit network connection. You can find a complete list of flags in the [LitNodeClient Config](https://v7-api-doc-lit-js-sdk.vercel.app/interfaces/types_src.LitNodeClientConfig.html). In this guide we will cover the most common flags: `debug` and `storageProvider`.
2626

2727
#### `debug`
2828

@@ -38,13 +38,13 @@ In a browser environment, the `storageProvider` flag will be ignored, and the Se
3838

3939
```ts
4040
import { LitNodeClient } from '@lit-protocol/lit-node-client';
41-
import { LitNetwork } from '@lit-protocol/constants';
41+
import { LIT_NETWORK } from '@lit-protocol/constants';
4242
import { disconnectWeb3 } from "@lit-protocol/auth-browser";
4343

4444
let litNodeClient;
4545
try {
4646
litNodeClient = new LitNodeClient({
47-
litNetwork: LitNetwork.DatilDev,
47+
litNetwork: LIT_NETWORK.DatilDev,
4848
debug: false,
4949
});
5050

@@ -90,7 +90,7 @@ The following is an example of a response to a request made using `LitNodeClient
9090

9191
### API Reference
9292

93-
To learn more about `LitNodeClient` properties and methods, visit the [API Reference Docs](https://v6-api-doc-lit-js-sdk.vercel.app/classes/core_src.LitCore.html).
93+
To learn more about `LitNodeClient` properties and methods, visit the [API Reference Docs](https://v7-api-doc-lit-js-sdk.vercel.app/classes/core_src.LitCore.html).
9494

9595
### Code Example
9696

0 commit comments

Comments
 (0)