Skip to content

Commit 5b686da

Browse files
committed
feat(docs): add wrapped-keys support and new APIs for key management and signing
1 parent 59c2bef commit 5b686da

File tree

5 files changed

+89
-39
lines changed

5 files changed

+89
-39
lines changed

.changeset/cold-dancers-push.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
'@lit-protocol/e2e': minor
1414
---
1515

16-
Introduce wrapped-keys feature to v8 which allows you to manage encrypted key generation/import/export across EVM and Solana, and sign message or transactions without exposing private key material.
16+
Introduce wrapped-keys support to v8 so applications can generate, import, export, and sign with encrypted keys across EVM and Solana without exposing private key material. New `auth` package APIs include `validateDelegationAuthSig`, `generatePkpDelegationAuthSig`, `generateEoaDelegationAuthSig`, `createPkpAuthContextFromPreGenerated`, and `createPkpSessionSigs`. New `wrapped-keys` APIs include `generatePrivateKey`, `importPrivateKey`, `exportPrivateKey`, `listEncryptedKeyMetadata`, `getEncryptedKey`, `storeEncryptedKey`, `storeEncryptedKeyBatch`, `batchGeneratePrivateKeys`, `signMessageWithEncryptedKey`, and `signTransactionWithEncryptedKey`. See the updated docs (guides/server-sessions, sdk-reference/wrapped-keys, and the new auth references) for end-to-end examples. [PR](https://github.com/LIT-Protocol/js-sdk/pull/972)

docs/docs.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@
113113
"sdk/sdk-reference/auth/functions/generatePkpDelegationAuthSig",
114114
"sdk/sdk-reference/auth/functions/generateEoaDelegationAuthSig",
115115
"sdk/sdk-reference/auth/functions/validateDelegationAuthSig",
116-
"sdk/sdk-reference/auth/functions/getPkpAuthContextFromPreGeneratedAdapter"
116+
"sdk/sdk-reference/auth/functions/createPkpAuthContextFromPreGenerated",
117+
"sdk/sdk-reference/auth/functions/createPkpSessionSigs"
117118
]
118119
},
119120
{
@@ -240,4 +241,4 @@
240241
"discord": "https://litgateway.com/discord"
241242
}
242243
}
243-
}
244+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: createPkpAuthContextFromPreGenerated
3+
---
4+
5+
# Function
6+
7+
> **createPkpAuthContextFromPreGenerated**(`params`)
8+
9+
Rehydrates a PKP auth context from pre-generated session materials. Ideal for server or lambda environments that receive `{ sessionKeyPair, delegationAuthSig }` and want to issue fresh session signatures on demand.
10+
11+
## Parameters
12+
13+
<ParamField path="params.pkpPublicKey" type="string" required />
14+
<ParamField path="params.sessionKeyPair" type="SessionKeyPair" required />
15+
<ParamField path="params.delegationAuthSig" type="AuthSig" required />
16+
<ParamField path="params.authData" type="AuthData">
17+
Optional override when you need to supply explicit auth data instead of relying on the delegation contents.
18+
</ParamField>
19+
20+
## Returns
21+
22+
<ResponseField name="authContext" type="AuthContext">
23+
Auth context compatible with `litClient.executeJs`, `pkpSign`, or further session signature issuance.
24+
</ResponseField>
25+
26+
## Example
27+
28+
```ts
29+
import { createPkpAuthContextFromPreGenerated } from '@lit-protocol/auth';
30+
31+
const authContext = await createPkpAuthContextFromPreGenerated({
32+
pkpPublicKey,
33+
sessionKeyPair,
34+
delegationAuthSig,
35+
});
36+
```
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: createPkpSessionSigs
3+
---
4+
5+
# Function
6+
7+
> **createPkpSessionSigs**(`params`)
8+
9+
Issues fresh session signatures for a PKP based on pre-generated delegation materials. Pair this with `createPkpAuthContextFromPreGenerated` when a backend needs to sign or execute Lit Actions on demand.
10+
11+
## Parameters
12+
13+
<ParamField path="params.authContext" type="AuthContext" required>
14+
Auth context obtained from `createPkpAuthContextFromPreGenerated` or `createPkpAuthContext`.
15+
</ParamField>
16+
17+
<ParamField path="params.litClient" type="LitClient" required>
18+
Lit client that will request session signatures from the network.
19+
</ParamField>
20+
21+
<ParamField path="params.product" type="'DECRYPTION' | 'SIGN' | 'LIT_ACTION' | 'SIGN_SESSION_KEY'">
22+
Optional override for the product type when you need signatures for a specific capability. Defaults to `LIT_ACTION`.
23+
</ParamField>
24+
25+
## Returns
26+
27+
<ResponseField name="sessionSigs" type="SessionSigsMap">
28+
Session signatures scoped to the delegated resources.
29+
</ResponseField>
30+
31+
## Example
32+
33+
```ts
34+
import {
35+
createPkpAuthContextFromPreGenerated,
36+
createPkpSessionSigs,
37+
} from '@lit-protocol/auth';
38+
39+
const authContext = await createPkpAuthContextFromPreGenerated({
40+
pkpPublicKey,
41+
sessionKeyPair,
42+
delegationAuthSig,
43+
});
44+
45+
const pkpSessionSigs = await createPkpSessionSigs({
46+
authContext,
47+
litClient,
48+
});
49+
```

docs/sdk/sdk-reference/auth/functions/getPkpAuthContextFromPreGeneratedAdapter.mdx

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)