Skip to content

Commit 1fc4b6b

Browse files
authored
Merge branch 'naga' into feature/jss-35-naga-js-sdk-wrapped-keys-implementation
2 parents 7675fa3 + 9a5a8a5 commit 1fc4b6b

Some content is hidden

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

55 files changed

+951
-60
lines changed

docs/changelog.mdx

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ rss: true
66

77
| Package | Latest version | Summary |
88
| ------- | -------------- | ------- |
9-
| [@lit-protocol/lit-client](#lit-client) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Flit-client) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
9+
| [@lit-protocol/lit-client](#lit-client) | [8.2.0](https://www.npmjs.com/package/%40lit-protocol%2Flit-client) | LitClient now offers `getIpfsId` via `@lit-protocol/lit-client/ipfs`, letting apps compute CIDv0 hashes (e.g., `await getIpfsId('hello')`) while keeping bundles lean. |
1010
| [@lit-protocol/auth](#auth) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Fauth) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
11-
| [@lit-protocol/networks](#networks) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Fnetworks) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
12-
| [@lit-protocol/auth-services](#auth-services) | [2.0.3](https://www.npmjs.com/package/%40lit-protocol%2Fauth-services) | Updated dependencies |
11+
| [@lit-protocol/networks](#networks) | [8.2.0](https://www.npmjs.com/package/%40lit-protocol%2Fnetworks) | introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime |
12+
| [@lit-protocol/auth-services](#auth-services) | [2.0.4](https://www.npmjs.com/package/%40lit-protocol%2Fauth-services) | Updated dependencies |
1313
| [@lit-protocol/access-control-conditions](#access-control-conditions) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Faccess-control-conditions) | - |
1414
| [@lit-protocol/access-control-conditions-schemas](#access-control-conditions-schemas) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Faccess-control-conditions-schemas) | - |
15-
| [@lit-protocol/artillery](#artillery) | [0.0.4](https://www.npmjs.com/package/%40lit-protocol%2Fartillery) | @lit-protocol/e2e@2.0.0 |
15+
| [@lit-protocol/artillery](#artillery) | [0.0.5](https://www.npmjs.com/package/%40lit-protocol%2Fartillery) | Updated dependencies |
1616
| [@lit-protocol/auth-helpers](#auth-helpers) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Fauth-helpers) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
17-
| [@lit-protocol/constants](#constants) | [8.0.3](https://www.npmjs.com/package/%40lit-protocol%2Fconstants) | Updated dependencies |
18-
| [@lit-protocol/contracts](#contracts) | [0.6.0](https://www.npmjs.com/package/%40lit-protocol%2Fcontracts) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
17+
| [@lit-protocol/constants](#constants) | [8.0.4](https://www.npmjs.com/package/%40lit-protocol%2Fconstants) | Updated dependencies |
18+
| [@lit-protocol/contracts](#contracts) | [0.7.0](https://www.npmjs.com/package/%40lit-protocol%2Fcontracts) | introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime |
1919
| [@lit-protocol/crypto](#crypto) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Fcrypto) | - |
20-
| [@lit-protocol/e2e](#e2e) | [2.0.0](https://www.npmjs.com/package/%40lit-protocol%2Fe2e) | Updated dependencies |
20+
| [@lit-protocol/e2e](#e2e) | [3.0.0](https://www.npmjs.com/package/%40lit-protocol%2Fe2e) | introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime |
2121
| [@lit-protocol/logger](#logger) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Flogger) | - |
2222
| [@lit-protocol/schemas](#schemas) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Fschemas) | - |
2323
| [@lit-protocol/types](#types) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Ftypes) | - |
@@ -27,15 +27,20 @@ rss: true
2727

2828
<Update
2929
label="lit-client"
30-
description="v8.1.0"
30+
description="v8.2.0"
3131
tags={["Minor Changes"]}
32-
rss={{ title: "lit-client", description: "Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually." }}
32+
rss={{ title: "lit-client", description: "LitClient now offers `getIpfsId` via `@lit-protocol/lit-client/ipfs`, letting apps compute CIDv0 hashes (e.g., `await getIpfsId('hello')`) while keeping bundles lean." }}
3333
id="lit-client"
3434
>
3535

3636
## Minor Changes
3737

38-
- Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually.
38+
- LitClient now offers `getIpfsId` via `@lit-protocol/lit-client/ipfs`, letting apps compute CIDv0 hashes (e.g., `await getIpfsId('hello')`) while keeping bundles lean.
39+
- ```ts
40+
- import { getIpfsId } from '@lit-protocol/lit-client/ipfs';
41+
- const cid = await getIpfsId('hello');
42+
- ```
43+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
3944
</Update>
4045
4146
<Update
@@ -57,25 +62,25 @@ rss: true
5762
5863
<Update
5964
label="networks"
60-
description="v8.1.0"
65+
description="v8.2.0"
6166
tags={["Minor Changes", "Patch Changes"]}
62-
rss={{ title: "networks", description: "Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually." }}
67+
rss={{ title: "networks", description: "introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime" }}
6368
id="networks"
6469
>
6570
6671
## Minor Changes
6772
68-
- Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually.
73+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
6974
7075
## Patch Changes
7176
7277
- Updated dependencies
73-
- @lit-protocol/contracts@0.6.0
78+
- @lit-protocol/contracts@0.7.0
7479
</Update>
7580
7681
<Update
7782
label="auth-services"
78-
description="v2.0.3"
83+
description="v2.0.4"
7984
tags={["Patch Changes"]}
8085
rss={{ title: "auth-services", description: "Updated dependencies" }}
8186
id="auth-services"
@@ -84,7 +89,7 @@ rss: true
8489
## Patch Changes
8590
8691
- Updated dependencies
87-
- @lit-protocol/contracts@0.6.0
92+
- @lit-protocol/contracts@0.7.0
8893
</Update>
8994
9095
<Update
@@ -111,15 +116,16 @@ rss: true
111116
112117
<Update
113118
label="artillery"
114-
description="v0.0.4"
119+
description="v0.0.5"
115120
tags={["Patch Changes"]}
116-
rss={{ title: "artillery", description: "@lit-protocol/[email protected]" }}
121+
rss={{ title: "artillery", description: "Updated dependencies" }}
117122
id="artillery"
118123
>
119124
120125
## Patch Changes
121126
122-
- @lit-protocol/e2e@2.0.0
127+
- Updated dependencies
128+
- @lit-protocol/[email protected]
123129
</Update>
124130
125131
<Update
@@ -137,7 +143,7 @@ rss: true
137143
138144
<Update
139145
label="constants"
140-
description="v8.0.3"
146+
description="v8.0.4"
141147
tags={["Patch Changes"]}
142148
rss={{ title: "constants", description: "Updated dependencies" }}
143149
id="constants"
@@ -146,20 +152,20 @@ rss: true
146152
## Patch Changes
147153
148154
- Updated dependencies
149-
- @lit-protocol/contracts@0.6.0
155+
- @lit-protocol/contracts@0.7.0
150156
</Update>
151157
152158
<Update
153159
label="contracts"
154-
description="v0.6.0"
160+
description="v0.7.0"
155161
tags={["Minor Changes"]}
156-
rss={{ title: "contracts", description: "Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually." }}
162+
rss={{ title: "contracts", description: "introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime" }}
157163
id="contracts"
158164
>
159165
160166
## Minor Changes
161167
162-
- Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually.
168+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
163169
</Update>
164170
165171
<Update
@@ -175,19 +181,22 @@ rss: true
175181
176182
<Update
177183
label="e2e"
178-
description="v2.0.0"
179-
tags={["Patch Changes"]}
180-
rss={{ title: "e2e", description: "Updated dependencies" }}
184+
description="v3.0.0"
185+
tags={["Minor Changes", "Patch Changes"]}
186+
rss={{ title: "e2e", description: "introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime" }}
181187
id="e2e"
182188
>
183189
190+
## Minor Changes
191+
192+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
193+
184194
## Patch Changes
185195
186196
- Updated dependencies
187197
- Updated dependencies
188-
- @lit-protocol/auth@8.1.0
189-
- @lit-protocol/lit-client@8.1.0
190-
- @lit-protocol/networks@8.1.0
198+
- @lit-protocol/[email protected]
199+
- @lit-protocol/[email protected]
191200
</Update>
192201
193202
<Update

docs/docs.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@
9292
]
9393
},
9494
{
95-
"group": "Access Control Conditions",
95+
"group": "Utilities",
9696
"pages": [
97-
"sdk/sdk-reference/access-control-conditions/functions/createAccBuilder"
97+
"sdk/sdk-reference/access-control-conditions/functions/createAccBuilder",
98+
"sdk/sdk-reference/lit-client/functions/getIpfsId"
9899
]
99100
},
100101
{

docs/guides/lit-action-sign-as-action.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,21 @@ const { keccak256, arrayify } = ethers.utils;
6969
```
7070

7171
This approach keeps the derivation entirely within the Lit Action context. Because the public key depends only on the Action CID and signing scheme, you can rely on `Lit.Actions.getActionPublicKey` for a deterministic identity without needing to execute the Action externally first.
72+
73+
## Derive the Same Public Key from Client Code
74+
75+
If you prefer to resolve the Lit Action public key outside of the Action runtime - e.g., inside tests or other tooling—the SDK now exposes a helper that calls the on-chain PubkeyRouter contract.
76+
77+
```ts
78+
import { createLitClient } from "@lit-protocol/lit-client";
79+
import { nagaDev } from "@lit-protocol/networks";
80+
import { keccak256, stringToBytes } from "viem";
81+
82+
const litClient = await createLitClient({ network: nagaDev });
83+
const derivedKeyId = keccak256(stringToBytes(`lit_action_${actionIpfsCid}`));
84+
const actionPublicKey = await litClient.utils.getDerivedKeyId(derivedKeyId);
85+
86+
console.log("Derived Lit Action pubkey:", actionPublicKey);
87+
```
88+
89+
Under the hood, `getDerivedKeyId` routes through `PubkeyRouter.getDerivedPubkey`, passing the staking contract address and the default Naga key set (`naga-keyset1`) (will be dynamic in the future). This mirrors the same key derivation the nodes perform, letting you confirm identities or signatures without re-running the Lit Action.

docs/sdk/sdk-reference/lit-client/functions/createLitClient.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,33 @@ Create a Viem-compatible account backed by a PKP.
10461046
</Expandable>
10471047
</ResponseField>
10481048

1049+
### utils.getDerivedKeyId
1050+
1051+
Resolve the uncompressed PKP public key for a given derived key identifier.
1052+
1053+
#### Parameters
1054+
1055+
<ResponseField name="derivedKeyId" type="string" required>
1056+
0x-prefixed bytes32 identifier (for example, <code>keccak256(stringToBytes(`lit_action_${ipfsCid}`))</code>).
1057+
</ResponseField>
1058+
1059+
#### Returns
1060+
1061+
<ResponseField name="result" type="Promise<string>">
1062+
0x-prefixed uncompressed public key as returned by the PubkeyRouter contract.
1063+
</ResponseField>
1064+
1065+
#### Example
1066+
1067+
```ts
1068+
import { keccak256, stringToBytes } from "viem";
1069+
1070+
const derivedKeyId = keccak256(stringToBytes(`lit_action_${ipfsCid}`));
1071+
const derivedPubkey = await litClient.utils.getDerivedKeyId(derivedKeyId);
1072+
```
1073+
1074+
> Note: this helper currently calls `PubkeyRouter.getDerivedPubkey` with the default Naga key set (`naga-keyset1`). See the [Derive Lit Action Public Keys guide](../../../../guides/lit-action-sign-as-action) for an end-to-end workflow.
1075+
10491076
### getChainConfig
10501077

10511078
Returns the chain configuration for the current network.
@@ -1074,4 +1101,4 @@ Stop background state updates and release resources.
10741101
none
10751102

10761103
#### Returns
1077-
void
1104+
void
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: getIpfsId
3+
description: Generate CIDv0 hashes with the Lit Client IPFS helper
4+
---
5+
6+
## Overview
7+
8+
`getIpfsId` is an optional helper exported via `@lit-protocol/lit-client/ipfs`. It produces CIDv0 IPFS identifiers identical to the Lit SDK v7 utility while remaining fully tree-shakeable from the main client bundle.
9+
10+
## Usage
11+
12+
```ts
13+
import { getIpfsId } from '@lit-protocol/lit-client/ipfs';
14+
15+
const cid = await getIpfsId('console.log("hello lit")');
16+
// cid === 'Qm...'
17+
18+
const bytes = new TextEncoder().encode('console.log("hello lit")');
19+
const sameCid = await getIpfsId(bytes);
20+
// sameCid === cid
21+
```
22+
23+
## Parameters
24+
25+
| Name | Type | Description |
26+
| ---- | ---- | ----------- |
27+
| input | `string \| Uint8Array \| ArrayBuffer \| ArrayBufferView` | Source content to hash. Strings are UTF-8 encoded automatically; buffers and typed views are accepted directly. |
28+
29+
## Returns
30+
31+
```
32+
// A CIDv0 string beginning with Qm
33+
Promise<Qm${string}>
34+
```
35+
36+
## Notes
37+
38+
- The helper delegates to the same hashing routine used in v7 (`typestub-ipfs-only-hash`) and can be imported without pulling the entire Lit Client into your bundle.
39+
- Binary payloads do not need to be stringified first—pass any `Uint8Array`, `ArrayBuffer`, or typed view directly and the helper will normalize it before hashing.

packages/artillery/CHANGELOG.md

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

3+
## 0.0.5
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [4d339d1]
8+
- @lit-protocol/e2e@3.0.0
9+
310
## 0.0.4
411

512
### 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.4",
3+
"version": "0.0.5",
44
"private": true,
55
"type": "commonjs",
66
"dependencies": {

packages/auth-services/CHANGELOG.md

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

3+
## 2.0.4
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [4d339d1]
8+
- @lit-protocol/contracts@0.7.0
9+
310
## 2.0.3
411

512
### Patch Changes

packages/auth-services/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/auth-services",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"license": "MIT",
55
"type": "commonjs",
66
"main": "./src/index.js",

packages/constants/CHANGELOG.md

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

3+
## 8.0.4
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [4d339d1]
8+
- @lit-protocol/contracts@0.7.0
9+
310
## 8.0.3
411

512
### Patch Changes

0 commit comments

Comments
 (0)