@lit-protocol/vincent-app-sdk 0.0.4-mma

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/CONTRIBUTING.md +115 -0
  3. package/README.md +216 -0
  4. package/dist/CHANGELOG.md +74 -0
  5. package/dist/CONTRIBUTING.md +115 -0
  6. package/dist/README.md +216 -0
  7. package/dist/package.json +86 -0
  8. package/dist/src/expressMiddleware/express.d.ts +63 -0
  9. package/dist/src/expressMiddleware/express.d.ts.map +1 -0
  10. package/dist/src/expressMiddleware/express.js +125 -0
  11. package/dist/src/expressMiddleware/express.js.map +1 -0
  12. package/dist/src/expressMiddleware/index.d.ts +14 -0
  13. package/dist/src/expressMiddleware/index.d.ts.map +1 -0
  14. package/dist/src/expressMiddleware/index.js +17 -0
  15. package/dist/src/expressMiddleware/index.js.map +1 -0
  16. package/dist/src/expressMiddleware/types.d.ts +31 -0
  17. package/dist/src/expressMiddleware/types.d.ts.map +1 -0
  18. package/dist/src/expressMiddleware/types.js +3 -0
  19. package/dist/src/expressMiddleware/types.js.map +1 -0
  20. package/dist/src/index.d.ts +2 -0
  21. package/dist/src/index.d.ts.map +1 -0
  22. package/dist/src/index.js +3 -0
  23. package/dist/src/index.js.map +1 -0
  24. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.d.ts +14 -0
  25. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.d.ts.map +1 -0
  26. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.js +67 -0
  27. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.js.map +1 -0
  28. package/dist/src/internal/LitNodeClient/getLitNodeClient.d.ts +7 -0
  29. package/dist/src/internal/LitNodeClient/getLitNodeClient.d.ts.map +1 -0
  30. package/dist/src/internal/LitNodeClient/getLitNodeClient.js +25 -0
  31. package/dist/src/internal/LitNodeClient/getLitNodeClient.js.map +1 -0
  32. package/dist/src/jwt/accessors.d.ts +8 -0
  33. package/dist/src/jwt/accessors.d.ts.map +1 -0
  34. package/dist/src/jwt/accessors.js +15 -0
  35. package/dist/src/jwt/accessors.js.map +1 -0
  36. package/dist/src/jwt/core/create.d.ts +24 -0
  37. package/dist/src/jwt/core/create.d.ts.map +1 -0
  38. package/dist/src/jwt/core/create.js +95 -0
  39. package/dist/src/jwt/core/create.js.map +1 -0
  40. package/dist/src/jwt/core/isExpired.d.ts +9 -0
  41. package/dist/src/jwt/core/isExpired.d.ts.map +1 -0
  42. package/dist/src/jwt/core/isExpired.js +20 -0
  43. package/dist/src/jwt/core/isExpired.js.map +1 -0
  44. package/dist/src/jwt/core/utils/base64.d.ts +14 -0
  45. package/dist/src/jwt/core/utils/base64.d.ts.map +1 -0
  46. package/dist/src/jwt/core/utils/base64.js +54 -0
  47. package/dist/src/jwt/core/utils/base64.js.map +1 -0
  48. package/dist/src/jwt/core/utils/definedObject.d.ts +2 -0
  49. package/dist/src/jwt/core/utils/definedObject.d.ts.map +1 -0
  50. package/dist/src/jwt/core/utils/definedObject.js +7 -0
  51. package/dist/src/jwt/core/utils/definedObject.js.map +1 -0
  52. package/dist/src/jwt/core/utils/index.d.ts +5 -0
  53. package/dist/src/jwt/core/utils/index.d.ts.map +1 -0
  54. package/dist/src/jwt/core/utils/index.js +12 -0
  55. package/dist/src/jwt/core/utils/index.js.map +1 -0
  56. package/dist/src/jwt/core/utils/processJWTSignature.d.ts +8 -0
  57. package/dist/src/jwt/core/utils/processJWTSignature.d.ts.map +1 -0
  58. package/dist/src/jwt/core/utils/processJWTSignature.js +14 -0
  59. package/dist/src/jwt/core/utils/processJWTSignature.js.map +1 -0
  60. package/dist/src/jwt/core/utils/splitJWT.d.ts +11 -0
  61. package/dist/src/jwt/core/utils/splitJWT.d.ts.map +1 -0
  62. package/dist/src/jwt/core/utils/splitJWT.js +21 -0
  63. package/dist/src/jwt/core/utils/splitJWT.js.map +1 -0
  64. package/dist/src/jwt/core/utils/validateJWTTime.d.ts +12 -0
  65. package/dist/src/jwt/core/utils/validateJWTTime.d.ts.map +1 -0
  66. package/dist/src/jwt/core/utils/validateJWTTime.js +24 -0
  67. package/dist/src/jwt/core/utils/validateJWTTime.js.map +1 -0
  68. package/dist/src/jwt/core/validate.d.ts +29 -0
  69. package/dist/src/jwt/core/validate.d.ts.map +1 -0
  70. package/dist/src/jwt/core/validate.js +143 -0
  71. package/dist/src/jwt/core/validate.js.map +1 -0
  72. package/dist/src/jwt/index.d.ts +21 -0
  73. package/dist/src/jwt/index.d.ts.map +1 -0
  74. package/dist/src/jwt/index.js +32 -0
  75. package/dist/src/jwt/index.js.map +1 -0
  76. package/dist/src/jwt/typeGuards.d.ts +14 -0
  77. package/dist/src/jwt/typeGuards.d.ts.map +1 -0
  78. package/dist/src/jwt/typeGuards.js +32 -0
  79. package/dist/src/jwt/typeGuards.js.map +1 -0
  80. package/dist/src/jwt/types.d.ts +82 -0
  81. package/dist/src/jwt/types.d.ts.map +1 -0
  82. package/dist/src/jwt/types.js +3 -0
  83. package/dist/src/jwt/types.js.map +1 -0
  84. package/dist/src/toolClient/constants.d.ts +2 -0
  85. package/dist/src/toolClient/constants.d.ts.map +1 -0
  86. package/dist/src/toolClient/constants.js +5 -0
  87. package/dist/src/toolClient/constants.js.map +1 -0
  88. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.d.ts +8 -0
  89. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.d.ts.map +1 -0
  90. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.js +33 -0
  91. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.js.map +1 -0
  92. package/dist/src/toolClient/execute/resultCreators.d.ts +71 -0
  93. package/dist/src/toolClient/execute/resultCreators.d.ts.map +1 -0
  94. package/dist/src/toolClient/execute/resultCreators.js +57 -0
  95. package/dist/src/toolClient/execute/resultCreators.js.map +1 -0
  96. package/dist/src/toolClient/execute/types.d.ts +38 -0
  97. package/dist/src/toolClient/execute/types.d.ts.map +1 -0
  98. package/dist/src/toolClient/execute/types.js +4 -0
  99. package/dist/src/toolClient/execute/types.js.map +1 -0
  100. package/dist/src/toolClient/index.d.ts +19 -0
  101. package/dist/src/toolClient/index.d.ts.map +1 -0
  102. package/dist/src/toolClient/index.js +26 -0
  103. package/dist/src/toolClient/index.js.map +1 -0
  104. package/dist/src/toolClient/precheck/resultCreators.d.ts +71 -0
  105. package/dist/src/toolClient/precheck/resultCreators.d.ts.map +1 -0
  106. package/dist/src/toolClient/precheck/resultCreators.js +57 -0
  107. package/dist/src/toolClient/precheck/resultCreators.js.map +1 -0
  108. package/dist/src/toolClient/precheck/runPolicyPrechecks.d.ts +14 -0
  109. package/dist/src/toolClient/precheck/runPolicyPrechecks.d.ts.map +1 -0
  110. package/dist/src/toolClient/precheck/runPolicyPrechecks.js +98 -0
  111. package/dist/src/toolClient/precheck/runPolicyPrechecks.js.map +1 -0
  112. package/dist/src/toolClient/precheck/types.d.ts +82 -0
  113. package/dist/src/toolClient/precheck/types.d.ts.map +1 -0
  114. package/dist/src/toolClient/precheck/types.js +4 -0
  115. package/dist/src/toolClient/precheck/types.js.map +1 -0
  116. package/dist/src/toolClient/typeGuards.d.ts +28 -0
  117. package/dist/src/toolClient/typeGuards.d.ts.map +1 -0
  118. package/dist/src/toolClient/typeGuards.js +67 -0
  119. package/dist/src/toolClient/typeGuards.js.map +1 -0
  120. package/dist/src/toolClient/types.d.ts +50 -0
  121. package/dist/src/toolClient/types.d.ts.map +1 -0
  122. package/dist/src/toolClient/types.js +4 -0
  123. package/dist/src/toolClient/types.js.map +1 -0
  124. package/dist/src/toolClient/vincentToolClient.d.ts +76 -0
  125. package/dist/src/toolClient/vincentToolClient.d.ts.map +1 -0
  126. package/dist/src/toolClient/vincentToolClient.js +285 -0
  127. package/dist/src/toolClient/vincentToolClient.js.map +1 -0
  128. package/dist/src/type-inference-verification/tool-client-inference.d.ts +3 -0
  129. package/dist/src/type-inference-verification/tool-client-inference.d.ts.map +1 -0
  130. package/dist/src/type-inference-verification/tool-client-inference.js +220 -0
  131. package/dist/src/type-inference-verification/tool-client-inference.js.map +1 -0
  132. package/dist/src/utils/delegation.d.ts +7 -0
  133. package/dist/src/utils/delegation.d.ts.map +1 -0
  134. package/dist/src/utils/delegation.js +18 -0
  135. package/dist/src/utils/delegation.js.map +1 -0
  136. package/dist/src/utils/index.d.ts +3 -0
  137. package/dist/src/utils/index.d.ts.map +1 -0
  138. package/dist/src/utils/index.js +6 -0
  139. package/dist/src/utils/index.js.map +1 -0
  140. package/dist/src/utils/typedocRoot.d.ts +7 -0
  141. package/dist/src/utils/typedocRoot.d.ts.map +1 -0
  142. package/dist/src/utils/typedocRoot.js +13 -0
  143. package/dist/src/utils/typedocRoot.js.map +1 -0
  144. package/dist/src/utils/types.d.ts +15 -0
  145. package/dist/src/utils/types.d.ts.map +1 -0
  146. package/dist/src/utils/types.js +3 -0
  147. package/dist/src/utils/types.js.map +1 -0
  148. package/dist/src/webAuthClient/app.d.ts +7 -0
  149. package/dist/src/webAuthClient/app.d.ts.map +1 -0
  150. package/dist/src/webAuthClient/app.js +39 -0
  151. package/dist/src/webAuthClient/app.js.map +1 -0
  152. package/dist/src/webAuthClient/constants.d.ts +3 -0
  153. package/dist/src/webAuthClient/constants.d.ts.map +1 -0
  154. package/dist/src/webAuthClient/constants.js +6 -0
  155. package/dist/src/webAuthClient/constants.js.map +1 -0
  156. package/dist/src/webAuthClient/index.d.ts +13 -0
  157. package/dist/src/webAuthClient/index.d.ts.map +1 -0
  158. package/dist/src/webAuthClient/index.js +15 -0
  159. package/dist/src/webAuthClient/index.js.map +1 -0
  160. package/dist/src/webAuthClient/internal/index.d.ts +3 -0
  161. package/dist/src/webAuthClient/internal/index.d.ts.map +1 -0
  162. package/dist/src/webAuthClient/internal/index.js +7 -0
  163. package/dist/src/webAuthClient/internal/index.js.map +1 -0
  164. package/dist/src/webAuthClient/internal/uriHelpers.d.ts +15 -0
  165. package/dist/src/webAuthClient/internal/uriHelpers.d.ts.map +1 -0
  166. package/dist/src/webAuthClient/internal/uriHelpers.js +38 -0
  167. package/dist/src/webAuthClient/internal/uriHelpers.js.map +1 -0
  168. package/dist/src/webAuthClient/types.d.ts +109 -0
  169. package/dist/src/webAuthClient/types.d.ts.map +1 -0
  170. package/dist/src/webAuthClient/types.js +3 -0
  171. package/dist/src/webAuthClient/types.js.map +1 -0
  172. package/package.json +82 -0
package/dist/README.md ADDED
@@ -0,0 +1,216 @@
1
+ # Vincent SDK
2
+
3
+ ## Installation
4
+
5
+ ```
6
+ npm install @lit-protocol/vincent-app-sdk
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ # Client (Web)
12
+
13
+ ## WebAuthClient
14
+
15
+ The Vincent Web Auth Client provides methods for managing user authentication, JWT tokens, and consent flows in Vincent applications.
16
+
17
+ ### Methods
18
+
19
+ #### redirectToConsentPage()
20
+
21
+ Redirects the user to the Vincent consent page to obtain authorization. Once the user has completed the vincent consent flow
22
+ they will be redirected back to your app with a signed JWT that you can use to authenticate requests against your backend APIs
23
+
24
+ - When a JWT is expired, you need to use this method to get a new JWT
25
+
26
+ #### isLoginUri()
27
+
28
+ Checks if the current window location contains a Vincent login JWT. You can use this method to know that you should update login state with the newly provided JWT
29
+
30
+ - Returns: Boolean indicating if the URI contains a login JWT
31
+
32
+ #### decodeVincentLoginJWT(expectedAudience)
33
+
34
+ Decodes a Vincent login JWT. Performs basic sanity check but does not perform full verify() logic. You will want to run `verify()` from the jwt tools to verify the JWT is fully valid and not expired etc.
35
+
36
+ - The expected audience is typically your app's domain -- it should be one of your valid redirectUri values from your Vincent app configuration
37
+
38
+ - Returns: An object containing both the original JWT string and the decoded JWT object
39
+
40
+ #### removeLoginJWTFromURI()
41
+
42
+ Removes the login JWT parameter from the current URI. Call this after you have verified and stored the JWT for later usage.
43
+
44
+ ### Basic Usage
45
+
46
+ ```typescript
47
+ import { getWebAuthClient } from '@lit-protocol/vincent-app-sdk/webaAthClient';
48
+ import { isExpired } from '@lit-protocol/vincent-app-sdk/jwt';
49
+
50
+ const vincentAppClient = getWebAuthClient({ appId: MY_APP_ID });
51
+ // ... In your app logic:
52
+ if (vincentAppClient.isLogin()) {
53
+ // Handle app logic for the user has just logged in
54
+ const { decoded, jwt } = vincentAppClient.decodeVincentLoginJWT(window.location.origin);
55
+ // Store `jwt` for later usage; the user is now logged in.
56
+ } else {
57
+ // Handle app logic for the user is _already logged in_ (check for stored & unexpired JWT)
58
+
59
+ const jwt = localStorage.getItem('VINCENT_AUTH_JWT');
60
+ if (jwt && isExpired(jwt)) {
61
+ // User must re-log in
62
+ vincentAppClient.redirectToConsentPage({ redirectUri: window.location.href });
63
+ }
64
+
65
+ if (!jwt) {
66
+ // Handle app logic for the user is not yet logged in
67
+ vincentAppClient.redirectToConsentPage({ redirectUri: window.location.href });
68
+ }
69
+ }
70
+ ```
71
+
72
+ # Backend
73
+
74
+ In your backend, you will have to verify the JWT to make sure the user has granted you the required permissions to act on their behalf.
75
+
76
+ ## VincentToolClient
77
+
78
+ The Vincent Tool Client uses an ethers signer for your delegatee account to run Vincent Tools on behalf of your app users.
79
+
80
+ This client will typically be used by an AI agent or your app backend service, as it requires a signer that conforms to the ethers v5 signer API, and with access to your delegatee account's private key to authenticate with the LIT network when executing the Vincent Tool.
81
+
82
+ ### Configuration
83
+
84
+ ```typescript
85
+ interface VincentToolClientConfig {
86
+ ethersSigner: ethers.Signer; // An ethers v5 compatible signer
87
+ vincentToolCid: string; // The CID of the Vincent Tool to execute
88
+ }
89
+ ```
90
+
91
+ ### Methods
92
+
93
+ #### execute(params: VincentToolParams): Promise<ExecuteJsResponse>
94
+
95
+ Executes a Vincent Tool with the provided parameters.
96
+
97
+ - `params`: Record<string, unknown> - Parameters to pass to the Vincent Tool
98
+ - Returns: Promise resolving to an ExecuteJsResponse from the LIT network
99
+
100
+ ### Tool execution
101
+
102
+ ```typescript
103
+ import { getVincentToolClient } from '@lit-protocol/vincent-app-sdk/toolClient';
104
+ // Import the tool you want to execute
105
+ import { bundledVincentTool as erc20BundledTool } from '@lit-protocol/vincent-tool-erc20-approval';
106
+
107
+ // One of delegatee signers from your app's Vincent Dashboard
108
+ const delegateeSigner = new ethers.Wallet('YOUR_DELEGATEE_PRIVATE_KEY');
109
+
110
+ // Initialize the Vincent Tool Client
111
+ const toolClient = getVincentToolClient({
112
+ ethersSigner: delegateeSigner,
113
+ bundledVincentTool: erc20BundledTool,
114
+ });
115
+ const delegatorPkpEthAddress = '0x09182301238';
116
+
117
+ const toolParams = {
118
+ // Fill with the params your tool needs
119
+ };
120
+
121
+ // Run precheck to see if tool should be executed
122
+ const precheckResult = await client.precheck(toolParams, {
123
+ delegatorPkpEthAddress,
124
+ });
125
+
126
+ if (precheckResult.success === true) {
127
+ // Execute the Vincent Tool
128
+ const executeResult = await client.execute(toolParams, {
129
+ delegatorPkpEthAddress,
130
+ });
131
+
132
+ // ...tool has executed, you can check `executeResult` for details
133
+ }
134
+ ```
135
+
136
+ ### Usage
137
+
138
+ ### Authentication
139
+
140
+ A basic Express authentication middleware factory function is provided with the SDK.
141
+
142
+ - Create an express middleware using `getAuthenticateUserExpressHandler()`
143
+ - Once you have added the middleware to your route, use `authenticatedRequestHandler()` to provide
144
+ type-safe access to `req.user` in your downstream RequestHandler functions.
145
+ - When defining your authenticated routes, use the `ExpressAuthHelpers` type to type your functions and function arguments.
146
+
147
+ See getAuthenticateUserExpressHandler() documentation to see the source for the express authentication route handler
148
+
149
+ ```typescript
150
+ import {
151
+ authenticatedRequestHandler,
152
+ getAuthenticateUserExpressHandler,
153
+ } from '@lit-protocol/vincent-app-sdk/expressMiddleware';
154
+
155
+ import type { AuthenticatedRequest } from '@lit-protocol/vincent-app-sdk/expressMiddleware';
156
+
157
+ const { ALLOWED_AUDIENCE } = process.env;
158
+
159
+ const authenticateUserMiddleware = getAuthenticateUserExpressHandler(ALLOWED_AUDIENCE);
160
+
161
+ // Define an authenticated route handler
162
+ const getUserProfile = async (req: AuthenticatedRequest, res: Response) => {
163
+ // Access authenticated user information
164
+ const { pkpAddress } = req.user;
165
+
166
+ // Fetch and return user data
167
+ const userData = await userRepository.findByAddress(pkpAddress);
168
+ res.json(userData);
169
+ };
170
+
171
+ // Use in Express route with authentication
172
+ app.get('/profile', authenticateUser, authenticatedRequestHandler(getUserProfile));
173
+ ```
174
+
175
+ ## JWT Authentication
176
+
177
+ ### Overview
178
+
179
+ The JWT authentication system in Vincent SDK allows for secure communication between user applications and Vincent Tools. JWTs are used to verify user consent and authorize tool executions.
180
+
181
+ ### Authentication Flow
182
+
183
+ 1. User initiates an action requiring Vincent Tool access
184
+ 2. Application redirects to the Vincent consent page using `VincentWebAppClient.redirectToConsentPage()`
185
+ 3. User provides consent for the requested tools/policies
186
+ 4. User is redirected back to the application with a JWT in the URL
187
+ 5. Application validates and stores the JWT using `VincentWebAppClient` methods
188
+ 6. JWT is used to authenticate with the app backend
189
+
190
+ ### JWT Structure
191
+
192
+ Vincent JWTs contain:
193
+
194
+ - User account identity information (pkpAddress and pkpPublicKey)
195
+ - Expiration timestamp
196
+ - Signature from the Vincent authorization service
197
+
198
+ ### Error Handling
199
+
200
+ When JWT validation fails, descriptive error messages are thrown to help with troubleshooting.
201
+
202
+ ### Usage Notes
203
+
204
+ - JWTs have an expiration time after which they are no longer valid
205
+ - When a JWT expires, redirect the user to the consent page to obtain a new one using the `VincentWebAppClient`
206
+
207
+ ## Release
208
+
209
+ Pre-requisites:
210
+
211
+ - You will need a valid npm account with access to the `@lit-protocol` organization.
212
+ - Run `pnpm vercel login` at sdk root to get a authentication token for vercel
213
+ - Also you will need to fill the `.env` file with the vercel project and org ids for the [vincent-docs](https://vercel.com/lit-protocol/vincent-docs) project.
214
+
215
+ Then run `pnpm release` on the repository root. It will prompt you to update the Vincent SDK version and then ask you to confirm the release.
216
+ This process will also generate a `CHANGELOG.md` record with the changes for the release and update typedoc in vercel after publishing the SDK.
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@lit-protocol/vincent-app-sdk",
3
+ "version": "1.0.2",
4
+ "description": "Vincent SDK for browser and backend",
5
+ "author": "Lit Protocol",
6
+ "license": "ISC",
7
+ "access": "public",
8
+ "packageManager": "pnpm@10.7.0",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "engines": {
13
+ "node": "^20.11.1",
14
+ "pnpm": "10.7.0"
15
+ },
16
+ "exports": {
17
+ "./package.json": "./package.json",
18
+ "./jwt": {
19
+ "import": "./dist/src/jwt/index.js",
20
+ "require": "./dist/src/jwt/index.js",
21
+ "types": "./dist/src/jwt/index.d.ts"
22
+ },
23
+ "./toolClient": {
24
+ "import": "./dist/src/toolClient/index.js",
25
+ "require": "./dist/src/toolClient/index.js",
26
+ "types": "./dist/src/toolClient/index.d.ts"
27
+ },
28
+ "./webAuthClient": {
29
+ "import": "./dist/src/webAuthClient/index.js",
30
+ "require": "./dist/src/webAuthClient/index.js",
31
+ "types": "./dist/src/webAuthClient/index.d.ts"
32
+ },
33
+ "./expressMiddleware": {
34
+ "import": "./dist/src/expressMiddleware/index.js",
35
+ "require": "./dist/src/expressMiddleware/index.js",
36
+ "types": "./dist/src/expressMiddleware/index.d.ts"
37
+ },
38
+ "./utils": {
39
+ "import": "./dist/src/utils/index.js",
40
+ "require": "./dist/src/utils/index.js",
41
+ "types": "./dist/src/utils/index.d.ts"
42
+ }
43
+ },
44
+ "keywords": [
45
+ "jwt",
46
+ "authentication",
47
+ "sdk"
48
+ ],
49
+ "scripts": {
50
+ "type-tests": "./scripts/run-typecheck.sh",
51
+ "watch:type-tests": "chokidar 'src/**/*' --initial --await-write-finish --delay 100 --silent -c './scripts/run-typecheck.sh'",
52
+ "typecheck": "./scripts/precommit-check.sh"
53
+ },
54
+ "dependencies": {
55
+ "@lit-protocol/auth-helpers": "^7.0.9",
56
+ "@lit-protocol/constants": "^7.0.8",
57
+ "@lit-protocol/lit-node-client": "^7.0.8",
58
+ "@lit-protocol/vincent-contracts-sdk": "workspace:*",
59
+ "@lit-protocol/vincent-tool-sdk": "workspace:*",
60
+ "@noble/secp256k1": "^2.2.3",
61
+ "did-jwt": "^8.0.8",
62
+ "ethers": "5.8.0",
63
+ "tslib": "^2.8.1",
64
+ "zod": "3.25.64"
65
+ },
66
+ "sideEffects": false,
67
+ "files": [
68
+ "dist/**/*",
69
+ "*.md"
70
+ ],
71
+ "devDependencies": {
72
+ "@lit-protocol/pkp-ethers": "^7.2.0",
73
+ "@lit-protocol/types": "^7.0.8",
74
+ "@types/express": "^5.0.1",
75
+ "chokidar-cli": "^3.0.0",
76
+ "live-server": "^1.2.2",
77
+ "typedoc": "0.27.9",
78
+ "typedoc-material-theme": "1.3.0",
79
+ "typedoc-plugin-extras": "^4.0.0",
80
+ "typedoc-plugin-zod": "^1.4.1",
81
+ "vercel": "^41.6.2"
82
+ },
83
+ "types": "./src/index.d.ts",
84
+ "main": "./src/index.js",
85
+ "type": "commonjs"
86
+ }
@@ -0,0 +1,63 @@
1
+ import type { NextFunction, Request, Response } from 'express';
2
+ import type { AuthenticatedRequestHandler } from './types';
3
+ /** Returns an Express middleware function to authenticate a user using a JWT token, and a type-guard wrapper function
4
+ * for type-safe usage of route handlers guarded by the middleware.
5
+ *
6
+ * The `middleware()` function:
7
+ * - Checks the `Authorization` header for a Bearer token, verifies the token, and checks its audience.
8
+ * - If the token is valid, it attaches the user information (decoded JWT, and raw JWT string) to the request object
9
+ * - If the token is missing or invalid, it returns a 401 Unauthorized response with an error message.
10
+ *
11
+ * Designate what field on `req` should be set with the JWT with the `userKey` configuration option.
12
+ *
13
+ * The `handler()` function:
14
+ * - Provides a type-safe reference to `req` where the `userKey` you have provided is correctly inferred to the appropriate type
15
+ * - Note that it is still your responsibility to ensure you have attached the `middleware` somewhere in the chain before you use the `handler()`
16
+ * - If you forget, the `handler()` function will throw an error if the expected `req[userKey]` does not exist.
17
+ *
18
+ * See [express.js documentation](https://expressjs.com/en/guide/writing-middleware.html) for details on writing your route handler
19
+ * @category API
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { createVincentUserMiddleware } from '@lit-protocol/vincent-app-sdk/expressMiddleware';
24
+ *
25
+ * // In your environment configuration
26
+ * const ALLOWED_AUDIENCE = 'https://yourapp.example.com';
27
+ * const VINCENT_APP_ID = 555; // Provided by the vincent app registry
28
+ *
29
+ * const { middleware, handler } = createVincentUserMiddleware({
30
+ * allowedAudience: ALLOWED_AUDIENCE,
31
+ * requiredAppId: VINCENT_APP_ID,
32
+ * userKey: 'vincentUser',
33
+ * });
34
+ *
35
+ * // Apply to routes that require authentication; req is guaranteed authenticated because it is wrapped in `handler()`
36
+ * app.get('/protected-resource', middleware, handler((req, res) => {
37
+ * // handler() gives you the correct inferred type of `req[userKey]`
38
+ * const pkpAddress = req.vincentUser.decodedJWT.payload.pkp.ethAddress;
39
+ * const appInfo = req.vincentUser.decodedJWT.payload.app;
40
+ *
41
+ * if(appInfo) {
42
+ * res.json({ message: `Hello, user with PKP address ${pkpAddress}. You are authenticated for app ${appInfo.id} @ v${appInfo.version}` });
43
+ * return;
44
+ * }
45
+ *
46
+ * res.json({ message: `Hello, user with PKP address ${pkpAddress}.` });
47
+ * })
48
+ * );
49
+ * ```
50
+ *
51
+ * See the code below for the implementation used by the `middleware` returned by this function. You can adapt this logic
52
+ * to the HTTP framework of your choice.
53
+ *
54
+ */
55
+ export declare function createVincentUserMiddleware<const UserKey extends string>(config: {
56
+ allowedAudience: string;
57
+ userKey: UserKey;
58
+ requiredAppId: number | undefined;
59
+ }): {
60
+ middleware: (req: Request, res: Response, next: NextFunction) => Promise<void>;
61
+ handler: (handler: AuthenticatedRequestHandler<UserKey>) => (req: Request, res: Response, next: NextFunction) => void | Promise<void>;
62
+ };
63
+ //# sourceMappingURL=express.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../src/expressMiddleware/express.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAwB,2BAA2B,EAAkB,MAAM,SAAS,CAAC;AAwBjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,CAAC,OAAO,SAAS,MAAM,EAAE,MAAM,EAAE;IAChF,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;sBA8BoB,OAAO,OAAO,QAAQ,QAAQ,YAAY;iEArBnD,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY;EAJ1D"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createVincentUserMiddleware = createVincentUserMiddleware;
4
+ const jwt_1 = require("../jwt");
5
+ const utils_1 = require("../jwt/core/utils");
6
+ function assertAuthenticatedRequest(req, userKey) {
7
+ // @ts-expect-error It's an assertion
8
+ if (!(userKey in req) || typeof req[userKey] !== 'object' || !req[userKey]) {
9
+ throw new Error('Request is not an AuthenticatedRequest: Missing or invalid "user" property');
10
+ }
11
+ // Cast with a type assertion
12
+ const user = req[userKey];
13
+ const { decodedJWT, rawJWT } = user;
14
+ if (typeof rawJWT !== 'string' || !(0, utils_1.isDefinedObject)(decodedJWT)) {
15
+ throw new Error('Request is not an AuthenticatedRequest: Invalid "user" properties');
16
+ }
17
+ }
18
+ /** Returns an Express middleware function to authenticate a user using a JWT token, and a type-guard wrapper function
19
+ * for type-safe usage of route handlers guarded by the middleware.
20
+ *
21
+ * The `middleware()` function:
22
+ * - Checks the `Authorization` header for a Bearer token, verifies the token, and checks its audience.
23
+ * - If the token is valid, it attaches the user information (decoded JWT, and raw JWT string) to the request object
24
+ * - If the token is missing or invalid, it returns a 401 Unauthorized response with an error message.
25
+ *
26
+ * Designate what field on `req` should be set with the JWT with the `userKey` configuration option.
27
+ *
28
+ * The `handler()` function:
29
+ * - Provides a type-safe reference to `req` where the `userKey` you have provided is correctly inferred to the appropriate type
30
+ * - Note that it is still your responsibility to ensure you have attached the `middleware` somewhere in the chain before you use the `handler()`
31
+ * - If you forget, the `handler()` function will throw an error if the expected `req[userKey]` does not exist.
32
+ *
33
+ * See [express.js documentation](https://expressjs.com/en/guide/writing-middleware.html) for details on writing your route handler
34
+ * @category API
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { createVincentUserMiddleware } from '@lit-protocol/vincent-app-sdk/expressMiddleware';
39
+ *
40
+ * // In your environment configuration
41
+ * const ALLOWED_AUDIENCE = 'https://yourapp.example.com';
42
+ * const VINCENT_APP_ID = 555; // Provided by the vincent app registry
43
+ *
44
+ * const { middleware, handler } = createVincentUserMiddleware({
45
+ * allowedAudience: ALLOWED_AUDIENCE,
46
+ * requiredAppId: VINCENT_APP_ID,
47
+ * userKey: 'vincentUser',
48
+ * });
49
+ *
50
+ * // Apply to routes that require authentication; req is guaranteed authenticated because it is wrapped in `handler()`
51
+ * app.get('/protected-resource', middleware, handler((req, res) => {
52
+ * // handler() gives you the correct inferred type of `req[userKey]`
53
+ * const pkpAddress = req.vincentUser.decodedJWT.payload.pkp.ethAddress;
54
+ * const appInfo = req.vincentUser.decodedJWT.payload.app;
55
+ *
56
+ * if(appInfo) {
57
+ * res.json({ message: `Hello, user with PKP address ${pkpAddress}. You are authenticated for app ${appInfo.id} @ v${appInfo.version}` });
58
+ * return;
59
+ * }
60
+ *
61
+ * res.json({ message: `Hello, user with PKP address ${pkpAddress}.` });
62
+ * })
63
+ * );
64
+ * ```
65
+ *
66
+ * See the code below for the implementation used by the `middleware` returned by this function. You can adapt this logic
67
+ * to the HTTP framework of your choice.
68
+ *
69
+ */
70
+ function createVincentUserMiddleware(config) {
71
+ return {
72
+ middleware: getAuthenticateUserExpressHandler(config),
73
+ handler: authenticatedRequestHandler(config.userKey),
74
+ };
75
+ }
76
+ function authenticatedRequestHandler(userKey) {
77
+ return function (handler) {
78
+ return (req, res, next) => {
79
+ try {
80
+ assertAuthenticatedRequest(req, userKey);
81
+ return handler(req, res, next);
82
+ }
83
+ catch (_a) {
84
+ res.status(401).json({ error: 'Not authenticated' });
85
+ }
86
+ };
87
+ };
88
+ }
89
+ // #region expressHandlerTSDocExample
90
+ function getAuthenticateUserExpressHandler({ allowedAudience, requiredAppId, userKey, }) {
91
+ return async (req, res, next) => {
92
+ const authHeader = req.headers.authorization;
93
+ if (!authHeader) {
94
+ res.status(401).json({ error: 'No token provided' });
95
+ return;
96
+ }
97
+ const parts = authHeader.split(' ');
98
+ if (parts.length !== 2) {
99
+ res.status(401).json({ error: `Invalid authorization header - expected "Bearer <token>"` });
100
+ return;
101
+ }
102
+ const [scheme, rawJWT] = parts;
103
+ if (!/^Bearer$/i.test(scheme)) {
104
+ res.status(401).json({ error: `Expected "Bearer" scheme, got "${scheme}"` });
105
+ return;
106
+ }
107
+ try {
108
+ const decodedJWT = (0, jwt_1.verify)({ jwt: rawJWT, expectedAudience: allowedAudience, requiredAppId });
109
+ if (!decodedJWT) {
110
+ res.status(401).json({ error: 'Invalid token' });
111
+ return;
112
+ }
113
+ req[userKey] = {
114
+ decodedJWT,
115
+ rawJWT,
116
+ };
117
+ next();
118
+ }
119
+ catch (e) {
120
+ res.status(401).json({ error: `Invalid token: ${e.message}` });
121
+ }
122
+ };
123
+ }
124
+ // #endregion expressHandlerTSDocExample
125
+ //# sourceMappingURL=express.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express.js","sourceRoot":"","sources":["../../../src/expressMiddleware/express.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,14 @@
1
+ /** Express middleware is used to add a VincentJWT-specific authentication to your Express.js server routes
2
+ *
3
+ * All functionality is encapsulated into a single factory function -- see {@link createVincentUserMiddleware} for details
4
+ *
5
+ * You can see the source for the Express authentication handler below; use this as a reference to implement
6
+ * your own midddleware/authentication for other frameworks! Pull requests are welcome.
7
+ * {@includeCode ./express.ts#expressHandlerTSDocExample}
8
+ *
9
+ * @packageDocumentation
10
+ * @module expressMiddleware
11
+ * */
12
+ export { createVincentUserMiddleware } from './express';
13
+ export type { AuthenticatedRequest, AuthenticatedRequestHandler, ExtractRequestHandlerParams, VincentJWTData, } from './types';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expressMiddleware/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAExD,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,cAAc,GACf,MAAM,SAAS,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /** Express middleware is used to add a VincentJWT-specific authentication to your Express.js server routes
3
+ *
4
+ * All functionality is encapsulated into a single factory function -- see {@link createVincentUserMiddleware} for details
5
+ *
6
+ * You can see the source for the Express authentication handler below; use this as a reference to implement
7
+ * your own midddleware/authentication for other frameworks! Pull requests are welcome.
8
+ * {@includeCode ./express.ts#expressHandlerTSDocExample}
9
+ *
10
+ * @packageDocumentation
11
+ * @module expressMiddleware
12
+ * */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.createVincentUserMiddleware = void 0;
15
+ var express_1 = require("./express");
16
+ Object.defineProperty(exports, "createVincentUserMiddleware", { enumerable: true, get: function () { return express_1.createVincentUserMiddleware; } });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/expressMiddleware/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;KAUK;;;AAEL,qCAAwD;AAA/C,sHAAA,2BAA2B,OAAA"}
@@ -0,0 +1,31 @@
1
+ import type { NextFunction, Request, RequestHandler, Response } from 'express';
2
+ import type { VincentJWT } from '../jwt/types';
3
+ /** Extract the params type from the original Express.js RequestHandler
4
+ *
5
+ * You probably don't need this type; see { @link createVincentUserMiddleware } for details
6
+ *
7
+ * @category Interfaces
8
+ * */
9
+ export type ExtractRequestHandlerParams<T> = T extends RequestHandler<infer P, infer ResBody, infer ReqBody, infer ReqQuery, infer Locals> ? [P, ResBody, ReqBody, ReqQuery, Locals] : never;
10
+ /**
11
+ * An Express.js RequestHandler that guarantees the request is authenticated with a PKP address
12
+ *
13
+ * You probably don't need this type; see { @link createVincentUserMiddleware } for details
14
+ *
15
+ * @category Interfaces
16
+ * */
17
+ export type AuthenticatedRequestHandler<UserKey extends string, P = ExtractRequestHandlerParams<RequestHandler>[0], ResBody = ExtractRequestHandlerParams<RequestHandler>[1], ReqBody = ExtractRequestHandlerParams<RequestHandler>[2], ReqQuery = ExtractRequestHandlerParams<RequestHandler>[3], Locals extends Record<string, any> = ExtractRequestHandlerParams<RequestHandler>[4]> = (req: AuthenticatedRequest<UserKey, P, ResBody, ReqBody, ReqQuery>, res: Response<ResBody, Locals>, next: NextFunction) => void | Promise<void>;
18
+ export interface VincentJWTData {
19
+ decodedJWT: VincentJWT;
20
+ rawJWT: string;
21
+ }
22
+ /** An interface that extends the Express.js Request interface to include authenticated user data
23
+ *
24
+ * You probably don't need this type; see { @link createVincentUserMiddleware } for details
25
+ *
26
+ * @category Interfaces
27
+ * */
28
+ export type AuthenticatedRequest<UserKey extends string, P = any, ResBody = any, ReqBody = any, ReqQuery = any> = Request<P, ResBody, ReqBody, ReqQuery> & {
29
+ [K in UserKey]: VincentJWTData;
30
+ };
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/expressMiddleware/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;;KAKK;AACL,MAAM,MAAM,2BAA2B,CAAC,CAAC,IACvC,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,OAAO,EAAE,MAAM,OAAO,EAAE,MAAM,QAAQ,EAAE,MAAM,MAAM,CAAC,GACzF,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GACvC,KAAK,CAAC;AAEZ;;;;;;KAMK;AACL,MAAM,MAAM,2BAA2B,CACrC,OAAO,SAAS,MAAM,EACtB,CAAC,GAAG,2BAA2B,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAClD,OAAO,GAAG,2BAA2B,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACxD,OAAO,GAAG,2BAA2B,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACxD,QAAQ,GAAG,2BAA2B,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACzD,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,2BAA2B,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IACjF,CACF,GAAG,EAAE,oBAAoB,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EACjE,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,EAC9B,IAAI,EAAE,YAAY,KACf,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;KAKK;AACL,MAAM,MAAM,oBAAoB,CAC9B,OAAO,SAAS,MAAM,EACtB,CAAC,GAAG,GAAG,EACP,OAAO,GAAG,GAAG,EACb,OAAO,GAAG,GAAG,EACb,QAAQ,GAAG,GAAG,IACZ,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG;KAC1C,CAAC,IAAI,OAAO,GAAG,cAAc;CAC/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/expressMiddleware/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { LIT_NETWORKS_KEYS } from '@lit-protocol/types';
2
+ import { LitNodeClient } from '@lit-protocol/lit-node-client';
3
+ export declare class LitNodeClientInstance {
4
+ private readonly litNodeClientInstance;
5
+ private isConnected;
6
+ private connectHandle;
7
+ constructor({ network }: {
8
+ network: LIT_NETWORKS_KEYS;
9
+ });
10
+ connect(): Promise<boolean>;
11
+ disconnect(): Promise<void>;
12
+ get litNodeClient(): LitNodeClient;
13
+ }
14
+ //# sourceMappingURL=LitNodeClientInstance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LitNodeClientInstance.d.ts","sourceRoot":"","sources":["../../../../src/internal/LitNodeClient/LitNodeClientInstance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAgB;IAEtD,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,aAAa,CAAiC;gBAE1C,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,iBAAiB,CAAA;KAAE;IAOjD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IA4B3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBjC,IAAI,aAAa,IAAI,aAAa,CAEjC;CACF"}