@lit-protocol/vincent-app-sdk 1.0.1 → 1.0.3-beta.0

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 (188) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/CONTRIBUTING.md +2 -2
  3. package/README.md +12 -11
  4. package/dist/CHANGELOG.md +21 -0
  5. package/dist/CONTRIBUTING.md +2 -2
  6. package/dist/README.md +12 -11
  7. package/dist/package.json +32 -3
  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.map +1 -0
  19. package/dist/src/index.d.ts +1 -17
  20. package/dist/src/index.d.ts.map +1 -1
  21. package/dist/src/index.js +0 -16
  22. package/dist/src/index.js.map +1 -1
  23. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.d.ts +1 -1
  24. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.d.ts.map +1 -1
  25. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.js +3 -2
  26. package/dist/src/internal/LitNodeClient/LitNodeClientInstance.js.map +1 -1
  27. package/dist/src/internal/LitNodeClient/getLitNodeClient.d.ts +2 -2
  28. package/dist/src/internal/LitNodeClient/getLitNodeClient.d.ts.map +1 -1
  29. package/dist/src/jwt/accessors.d.ts +8 -0
  30. package/dist/src/jwt/accessors.d.ts.map +1 -0
  31. package/dist/src/jwt/accessors.js +15 -0
  32. package/dist/src/jwt/accessors.js.map +1 -0
  33. package/dist/src/jwt/core/create.d.ts +2 -19
  34. package/dist/src/jwt/core/create.d.ts.map +1 -1
  35. package/dist/src/jwt/core/create.js +9 -28
  36. package/dist/src/jwt/core/create.js.map +1 -1
  37. package/dist/src/jwt/core/isExpired.d.ts +9 -0
  38. package/dist/src/jwt/core/isExpired.d.ts.map +1 -0
  39. package/dist/src/jwt/core/{utils/isJWTExpired.js → isExpired.js} +4 -3
  40. package/dist/src/jwt/core/isExpired.js.map +1 -0
  41. package/dist/src/jwt/core/utils/base64.d.ts +14 -0
  42. package/dist/src/jwt/core/utils/base64.d.ts.map +1 -0
  43. package/dist/src/jwt/core/utils/base64.js +54 -0
  44. package/dist/src/jwt/core/utils/base64.js.map +1 -0
  45. package/dist/src/jwt/core/utils/index.d.ts +0 -1
  46. package/dist/src/jwt/core/utils/index.d.ts.map +1 -1
  47. package/dist/src/jwt/core/utils/index.js +1 -3
  48. package/dist/src/jwt/core/utils/index.js.map +1 -1
  49. package/dist/src/jwt/core/utils/processJWTSignature.d.ts.map +1 -1
  50. package/dist/src/jwt/core/utils/processJWTSignature.js +2 -9
  51. package/dist/src/jwt/core/utils/processJWTSignature.js.map +1 -1
  52. package/dist/src/jwt/core/validate.d.ts +28 -22
  53. package/dist/src/jwt/core/validate.d.ts.map +1 -1
  54. package/dist/src/jwt/core/validate.js +82 -35
  55. package/dist/src/jwt/core/validate.js.map +1 -1
  56. package/dist/src/jwt/index.d.ts +15 -63
  57. package/dist/src/jwt/index.d.ts.map +1 -1
  58. package/dist/src/jwt/index.js +24 -64
  59. package/dist/src/jwt/index.js.map +1 -1
  60. package/dist/src/jwt/typeGuards.d.ts +14 -0
  61. package/dist/src/jwt/typeGuards.d.ts.map +1 -0
  62. package/dist/src/jwt/typeGuards.js +32 -0
  63. package/dist/src/jwt/typeGuards.js.map +1 -0
  64. package/dist/src/jwt/types.d.ts +32 -22
  65. package/dist/src/jwt/types.d.ts.map +1 -1
  66. package/dist/src/toolClient/constants.d.ts +2 -0
  67. package/dist/src/toolClient/constants.d.ts.map +1 -0
  68. package/dist/src/toolClient/constants.js +5 -0
  69. package/dist/src/toolClient/constants.js.map +1 -0
  70. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.d.ts +8 -0
  71. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.d.ts.map +1 -0
  72. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.js +33 -0
  73. package/dist/src/toolClient/execute/generateVincentToolSessionSigs.js.map +1 -0
  74. package/dist/src/toolClient/{resultCreators.d.ts → execute/resultCreators.d.ts} +22 -20
  75. package/dist/src/toolClient/execute/resultCreators.d.ts.map +1 -0
  76. package/dist/src/toolClient/{resultCreators.js → execute/resultCreators.js} +14 -12
  77. package/dist/src/toolClient/execute/resultCreators.js.map +1 -0
  78. package/dist/src/toolClient/execute/types.d.ts +38 -0
  79. package/dist/src/toolClient/execute/types.d.ts.map +1 -0
  80. package/dist/src/toolClient/execute/types.js +4 -0
  81. package/dist/src/toolClient/execute/types.js.map +1 -0
  82. package/dist/src/toolClient/index.d.ts +17 -1
  83. package/dist/src/toolClient/index.d.ts.map +1 -1
  84. package/dist/src/toolClient/index.js +21 -1
  85. package/dist/src/toolClient/index.js.map +1 -1
  86. package/dist/src/toolClient/precheck/resultCreators.d.ts +71 -0
  87. package/dist/src/toolClient/precheck/resultCreators.d.ts.map +1 -0
  88. package/dist/src/toolClient/precheck/resultCreators.js +57 -0
  89. package/dist/src/toolClient/precheck/resultCreators.js.map +1 -0
  90. package/dist/src/toolClient/precheck/runPolicyPrechecks.d.ts +14 -0
  91. package/dist/src/toolClient/precheck/runPolicyPrechecks.d.ts.map +1 -0
  92. package/dist/src/toolClient/precheck/runPolicyPrechecks.js +97 -0
  93. package/dist/src/toolClient/precheck/runPolicyPrechecks.js.map +1 -0
  94. package/dist/src/toolClient/precheck/types.d.ts +82 -0
  95. package/dist/src/toolClient/precheck/types.d.ts.map +1 -0
  96. package/dist/src/toolClient/precheck/types.js +4 -0
  97. package/dist/src/toolClient/precheck/types.js.map +1 -0
  98. package/dist/src/toolClient/typeGuards.d.ts +26 -17
  99. package/dist/src/toolClient/typeGuards.d.ts.map +1 -1
  100. package/dist/src/toolClient/typeGuards.js +32 -13
  101. package/dist/src/toolClient/typeGuards.js.map +1 -1
  102. package/dist/src/toolClient/types.d.ts +5 -35
  103. package/dist/src/toolClient/types.d.ts.map +1 -1
  104. package/dist/src/toolClient/types.js +1 -0
  105. package/dist/src/toolClient/types.js.map +1 -1
  106. package/dist/src/toolClient/vincentToolClient.d.ts +54 -6
  107. package/dist/src/toolClient/vincentToolClient.d.ts.map +1 -1
  108. package/dist/src/toolClient/vincentToolClient.js +132 -138
  109. package/dist/src/toolClient/vincentToolClient.js.map +1 -1
  110. package/dist/src/type-inference-verification/tool-client-inference.d.ts.map +1 -1
  111. package/dist/src/type-inference-verification/tool-client-inference.js +11 -6
  112. package/dist/src/type-inference-verification/tool-client-inference.js.map +1 -1
  113. package/dist/src/utils/delegation.d.ts +7 -0
  114. package/dist/src/utils/delegation.d.ts.map +1 -0
  115. package/dist/src/utils/delegation.js +18 -0
  116. package/dist/src/utils/delegation.js.map +1 -0
  117. package/dist/src/utils/index.d.ts +3 -0
  118. package/dist/src/utils/index.d.ts.map +1 -0
  119. package/dist/src/utils/index.js +6 -0
  120. package/dist/src/utils/index.js.map +1 -0
  121. package/dist/src/utils/typedocRoot.d.ts +7 -0
  122. package/dist/src/utils/typedocRoot.d.ts.map +1 -0
  123. package/dist/src/utils/typedocRoot.js +13 -0
  124. package/dist/src/utils/typedocRoot.js.map +1 -0
  125. package/dist/src/utils/types.d.ts +15 -0
  126. package/dist/src/utils/types.d.ts.map +1 -0
  127. package/dist/src/{app → utils}/types.js.map +1 -1
  128. package/dist/src/webAuthClient/app.d.ts +7 -0
  129. package/dist/src/webAuthClient/app.d.ts.map +1 -0
  130. package/dist/src/webAuthClient/app.js +39 -0
  131. package/dist/src/webAuthClient/app.js.map +1 -0
  132. package/dist/src/webAuthClient/constants.d.ts.map +1 -0
  133. package/dist/src/webAuthClient/constants.js.map +1 -0
  134. package/dist/src/webAuthClient/index.d.ts +13 -0
  135. package/dist/src/webAuthClient/index.d.ts.map +1 -0
  136. package/dist/src/webAuthClient/index.js +15 -0
  137. package/dist/src/webAuthClient/index.js.map +1 -0
  138. package/dist/src/webAuthClient/internal/index.d.ts.map +1 -0
  139. package/dist/src/webAuthClient/internal/index.js.map +1 -0
  140. package/dist/src/webAuthClient/internal/uriHelpers.d.ts +15 -0
  141. package/dist/src/webAuthClient/internal/uriHelpers.d.ts.map +1 -0
  142. package/dist/src/{app → webAuthClient}/internal/uriHelpers.js +12 -6
  143. package/dist/src/webAuthClient/internal/uriHelpers.js.map +1 -0
  144. package/dist/src/{app → webAuthClient}/types.d.ts +33 -41
  145. package/dist/src/webAuthClient/types.d.ts.map +1 -0
  146. package/dist/src/{types.js.map → webAuthClient/types.js.map} +1 -1
  147. package/package.json +31 -4
  148. package/dist/src/app/app.d.ts +0 -9
  149. package/dist/src/app/app.d.ts.map +0 -1
  150. package/dist/src/app/app.js +0 -33
  151. package/dist/src/app/app.js.map +0 -1
  152. package/dist/src/app/constants.d.ts.map +0 -1
  153. package/dist/src/app/constants.js.map +0 -1
  154. package/dist/src/app/index.d.ts +0 -3
  155. package/dist/src/app/index.d.ts.map +0 -1
  156. package/dist/src/app/index.js +0 -6
  157. package/dist/src/app/index.js.map +0 -1
  158. package/dist/src/app/internal/index.d.ts.map +0 -1
  159. package/dist/src/app/internal/index.js.map +0 -1
  160. package/dist/src/app/internal/uriHelpers.d.ts +0 -11
  161. package/dist/src/app/internal/uriHelpers.d.ts.map +0 -1
  162. package/dist/src/app/internal/uriHelpers.js.map +0 -1
  163. package/dist/src/app/types.d.ts.map +0 -1
  164. package/dist/src/express-authentication-middleware/express.d.ts +0 -79
  165. package/dist/src/express-authentication-middleware/express.d.ts.map +0 -1
  166. package/dist/src/express-authentication-middleware/express.js +0 -137
  167. package/dist/src/express-authentication-middleware/express.js.map +0 -1
  168. package/dist/src/express-authentication-middleware/index.d.ts +0 -43
  169. package/dist/src/express-authentication-middleware/index.d.ts.map +0 -1
  170. package/dist/src/express-authentication-middleware/index.js +0 -47
  171. package/dist/src/express-authentication-middleware/index.js.map +0 -1
  172. package/dist/src/express-authentication-middleware/types.d.ts +0 -25
  173. package/dist/src/express-authentication-middleware/types.d.ts.map +0 -1
  174. package/dist/src/express-authentication-middleware/types.js.map +0 -1
  175. package/dist/src/jwt/core/utils/isJWTExpired.d.ts +0 -8
  176. package/dist/src/jwt/core/utils/isJWTExpired.d.ts.map +0 -1
  177. package/dist/src/jwt/core/utils/isJWTExpired.js.map +0 -1
  178. package/dist/src/toolClient/resultCreators.d.ts.map +0 -1
  179. package/dist/src/toolClient/resultCreators.js.map +0 -1
  180. package/dist/src/types.d.ts +0 -5
  181. package/dist/src/types.d.ts.map +0 -1
  182. /package/dist/src/{app → expressMiddleware}/types.js +0 -0
  183. /package/dist/src/{express-authentication-middleware → utils}/types.js +0 -0
  184. /package/dist/src/{app → webAuthClient}/constants.d.ts +0 -0
  185. /package/dist/src/{app → webAuthClient}/constants.js +0 -0
  186. /package/dist/src/{app → webAuthClient}/internal/index.d.ts +0 -0
  187. /package/dist/src/{app → webAuthClient}/internal/index.js +0 -0
  188. /package/dist/src/{types.js → webAuthClient/types.js} +0 -0
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVincentWebAppClient = void 0;
4
- const internal_1 = require("./internal");
5
- const constants_1 = require("./constants");
6
- const { isLoginUri, composeConsentUrl, removeSearchParam, decodeVincentJWTFromUri } = internal_1.uriHelpers;
7
- const redirectToConsentPage = ({ appId, redirectUri, consentPageUrl, }) => window.open(composeConsentUrl(appId, redirectUri, consentPageUrl).toString(), '_self');
8
- /** Create a new {@link VincentWebAppClient} instance.
9
- *
10
- * - `appId` is the numeric app ID displayed for your app on the Vincent Dashboard
11
- *
12
- * @category API Methods
13
- * */
14
- const getVincentWebAppClient = (appClientConfig) => {
15
- const { appId } = appClientConfig;
16
- return {
17
- redirectToConsentPage: (redirectConsentPageConfig) => {
18
- const { consentPageUrl, redirectUri } = redirectConsentPageConfig;
19
- redirectToConsentPage({ appId, consentPageUrl, redirectUri });
20
- },
21
- isLogin: () => isLoginUri(window.location.href),
22
- decodeVincentLoginJWT: (expectedAudience) => decodeVincentJWTFromUri(window.location.href, expectedAudience),
23
- removeLoginJWTFromURI: () => {
24
- const urlWithoutJWTSearchParam = removeSearchParam({
25
- paramName: constants_1.JWT_URL_KEY,
26
- uri: window.location.href,
27
- });
28
- window.history.replaceState({}, document.title, urlWithoutJWTSearchParam);
29
- },
30
- };
31
- };
32
- exports.getVincentWebAppClient = getVincentWebAppClient;
33
- //# sourceMappingURL=app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/app/app.ts"],"names":[],"mappings":";;;AAKA,yCAAwC;AACxC,2CAA0C;AAE1C,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,GAAG,qBAAU,CAAC;AAEjG,MAAM,qBAAqB,GAAG,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,cAAc,GAKf,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;AAE7F;;;;;KAKK;AACE,MAAM,sBAAsB,GAAG,CACpC,eAAuC,EAClB,EAAE;IACvB,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC;IAElC,OAAO;QACL,qBAAqB,EAAE,CAAC,yBAA6D,EAAE,EAAE;YACvF,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,yBAAyB,CAAC;YAClE,qBAAqB,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC/C,qBAAqB,EAAE,CAAC,gBAAwB,EAAE,EAAE,CAClD,uBAAuB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;QACjE,qBAAqB,EAAE,GAAG,EAAE;YAC1B,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;gBACjD,SAAS,EAAE,uBAAW;gBACtB,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;aAC1B,CAAC,CAAC;YACH,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC;QAC5E,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,sBAAsB,0BAqBjC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/app/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,qCAAqC,CAAC;AACnF,eAAO,MAAM,WAAW,QAAQ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/app/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gCAAgC,GAAG,kCAAkC,CAAC;AACtE,QAAA,WAAW,GAAG,KAAK,CAAC"}
@@ -1,3 +0,0 @@
1
- import { getVincentWebAppClient } from './app';
2
- export { getVincentWebAppClient };
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVincentWebAppClient = void 0;
4
- const app_1 = require("./app");
5
- Object.defineProperty(exports, "getVincentWebAppClient", { enumerable: true, get: function () { return app_1.getVincentWebAppClient; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":";;;AAAA,+BAA+C;AAEtC,uGAFA,4BAAsB,OAEA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app/internal/index.ts"],"names":[],"mappings":";;;;AAAA,iEAA2C;AAElC,gCAAU"}
@@ -1,11 +0,0 @@
1
- export declare const decodeVincentJWTFromUri: (uri: string, expectedAudience: string) => {
2
- decodedJWT: import("../..").VincentJWT;
3
- jwtStr: string;
4
- } | null;
5
- export declare const isLoginUri: (uri: string) => boolean;
6
- export declare function composeConsentUrl(appId: string, redirectUri: string, consentPageUrl?: string): URL;
7
- export declare const removeSearchParam: ({ paramName, uri, }: {
8
- paramName: string;
9
- uri: string;
10
- }) => string;
11
- //# sourceMappingURL=uriHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uriHelpers.d.ts","sourceRoot":"","sources":["../../../../src/app/internal/uriHelpers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,GAAI,KAAK,MAAM,EAAE,kBAAkB,MAAM;;;QAS5E,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,YAKrC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,OAK5F;AAED,eAAO,MAAM,iBAAiB,GAAI,qBAG/B;IACD,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AAC;IACzB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnC,0DAA0D;IAC1D,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/app/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB;;SAEK;IACL,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,qBAAqB,EAAE,CAAC,cAAc,EAAE,kCAAkC,KAAK,IAAI,CAAC;IAEpF;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,qBAAqB,EAAE,CACrB,gBAAgB,EAAE,MAAM,KACrB;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC"}
@@ -1,79 +0,0 @@
1
- import type { NextFunction, Request, Response } from 'express';
2
- import { AuthenticatedRequestHandler } from './types';
3
- /**
4
- * Higher-order helper function to enforce authentication on a request handler and assert the type of `Request` that is
5
- * passed into your authenticated Express routes.
6
- *
7
- * This function takes an `AuthenticatedRequestHandler` and returns a new request handler
8
- * that verifies that the request has a 'user' property with the correct shape on it before calling the original handler.
9
- * If the `req.user` property isn't the correct shape, it sends a `401 Unauthorized` response to the client.
10
- *
11
- * NOTE: This does not verify signatures or any other content -- use `getAuthenticateUserExpressHandler` to create a
12
- * middleware that does those things and ensure that your routes use it.
13
- *
14
- * See [express.js documentation](https://expressjs.com/en/guide/writing-middleware.html) for details on writing your route handler
15
- * @example
16
- * ```typescript
17
- * import { expressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
18
- * const { authenticatedRequestHandler, getAuthenticateUserExpressHandler } = expressAuthHelpers;
19
- *
20
- * import type { ExpressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
21
- *
22
- * // Define an authenticated route handler
23
- * const getUserProfile = async (req: ExpressAuthHelpers['AuthenticatedRequest'], res: Response) => {
24
- * // Access authenticated user information
25
- * const { pkpAddress } = req.user;
26
- *
27
- * // Fetch and return user data
28
- * const userData = await userRepository.findByAddress(pkpAddress);
29
- * res.json(userData);
30
- * };
31
- *
32
- * // Use in Express route with authentication
33
- * app.get('/profile', authenticateUser, authenticatedRequestHandler(getUserProfile));
34
- * ```
35
- */
36
- export declare const authenticatedRequestHandler: (handler: AuthenticatedRequestHandler) => (req: Request, res: Response, next: NextFunction) => void | Promise<void>;
37
- /**
38
- * Creates an Express middleware function to authenticate a user using a JWT token.
39
- *
40
- * This middleware checks the `Authorization` header for a Bearer token, verifies the token, and checks its audience.
41
- * If the token is valid, it attaches the user information (decoded JWT, raw token, and PKP address) to the request object as `req.user`.
42
- * If the token is missing or invalid, it returns a 401 Unauthorized response with an error message.
43
- *
44
- * NOTE: Wrap your route handler functions with `authenticatedRequestHandler()` to assert the type of `Request` and to
45
- * ensure that `req.user` was correctly set before your route handler is run.
46
- *
47
- * See [express.js documentation](https://expressjs.com/en/guide/writing-middleware.html) for details on writing your route handler
48
- *
49
- * @example
50
- * ```typescript
51
- * import { expressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
52
- * const { authenticatedRequestHandler, getAuthenticateUserExpressHandler } = expressAuthHelpers;
53
- *
54
- * import type { ExpressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
55
- *
56
- * // In your environment configuration
57
- * const ALLOWED_AUDIENCE = 'https://yourapp.example.com';
58
- *
59
- * // Create the authentication middleware
60
- * const authenticateUser = getAuthenticateUserExpressHandler(ALLOWED_AUDIENCE);
61
- *
62
- * // Define a handler that requires authentication
63
- * const getProtectedResource = (req: ExpressAuthHelpers['AuthenticatedRequest'], res: Response) => {
64
- * // The request is now authenticated
65
- * // No need for type casting as the handler is properly typed
66
- * const { pkpAddress } = req.user;
67
- * res.json({ message: `Hello, user with PKP address ${pkpAddress}` });
68
- * };
69
- *
70
- * // Apply to routes that require authentication by using authenticatedRequestHandler
71
- * app.get('/protected-resource', authenticateUser, authenticatedRequestHandler(getProtectedResource));
72
- * ```
73
- *
74
- * You can see the source for `getAuthenticateUserExpressHandler()` below; use this as a reference to implement
75
- * your own midddleware/authentication for other frameworks! Pull requests are welcome.
76
- * {@includeCode ./express.ts#expressHandlerTSDocExample}
77
- */
78
- export declare const getAuthenticateUserExpressHandler: (allowedAudience: string) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
79
- //# sourceMappingURL=express.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../src/express-authentication-middleware/express.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK/D,OAAO,EAAwB,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAsB5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,2BAA2B,GACrC,SAAS,2BAA2B,MAAM,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,yBAOzF,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,eAAO,MAAM,iCAAiC,GAC3C,iBAAiB,MAAM,MAAY,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,kBAmClF,CAAC"}
@@ -1,137 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAuthenticateUserExpressHandler = exports.authenticatedRequestHandler = void 0;
4
- const __1 = require("..");
5
- const utils_1 = require("../jwt/core/utils");
6
- const { verify } = __1.jwt;
7
- function assertAuthenticatedRequest(req) {
8
- if (!('user' in req) || typeof req.user !== 'object' || !req.user) {
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.user;
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
- /**
19
- * Higher-order helper function to enforce authentication on a request handler and assert the type of `Request` that is
20
- * passed into your authenticated Express routes.
21
- *
22
- * This function takes an `AuthenticatedRequestHandler` and returns a new request handler
23
- * that verifies that the request has a 'user' property with the correct shape on it before calling the original handler.
24
- * If the `req.user` property isn't the correct shape, it sends a `401 Unauthorized` response to the client.
25
- *
26
- * NOTE: This does not verify signatures or any other content -- use `getAuthenticateUserExpressHandler` to create a
27
- * middleware that does those things and ensure that your routes use it.
28
- *
29
- * See [express.js documentation](https://expressjs.com/en/guide/writing-middleware.html) for details on writing your route handler
30
- * @example
31
- * ```typescript
32
- * import { expressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
33
- * const { authenticatedRequestHandler, getAuthenticateUserExpressHandler } = expressAuthHelpers;
34
- *
35
- * import type { ExpressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
36
- *
37
- * // Define an authenticated route handler
38
- * const getUserProfile = async (req: ExpressAuthHelpers['AuthenticatedRequest'], res: Response) => {
39
- * // Access authenticated user information
40
- * const { pkpAddress } = req.user;
41
- *
42
- * // Fetch and return user data
43
- * const userData = await userRepository.findByAddress(pkpAddress);
44
- * res.json(userData);
45
- * };
46
- *
47
- * // Use in Express route with authentication
48
- * app.get('/profile', authenticateUser, authenticatedRequestHandler(getUserProfile));
49
- * ```
50
- */
51
- const authenticatedRequestHandler = (handler) => (req, res, next) => {
52
- try {
53
- assertAuthenticatedRequest(req);
54
- return handler(req, res, next);
55
- }
56
- catch (_a) {
57
- res.status(401).json({ error: 'Not authenticated' });
58
- }
59
- };
60
- exports.authenticatedRequestHandler = authenticatedRequestHandler;
61
- /**
62
- * Creates an Express middleware function to authenticate a user using a JWT token.
63
- *
64
- * This middleware checks the `Authorization` header for a Bearer token, verifies the token, and checks its audience.
65
- * If the token is valid, it attaches the user information (decoded JWT, raw token, and PKP address) to the request object as `req.user`.
66
- * If the token is missing or invalid, it returns a 401 Unauthorized response with an error message.
67
- *
68
- * NOTE: Wrap your route handler functions with `authenticatedRequestHandler()` to assert the type of `Request` and to
69
- * ensure that `req.user` was correctly set before your route handler is run.
70
- *
71
- * See [express.js documentation](https://expressjs.com/en/guide/writing-middleware.html) for details on writing your route handler
72
- *
73
- * @example
74
- * ```typescript
75
- * import { expressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
76
- * const { authenticatedRequestHandler, getAuthenticateUserExpressHandler } = expressAuthHelpers;
77
- *
78
- * import type { ExpressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
79
- *
80
- * // In your environment configuration
81
- * const ALLOWED_AUDIENCE = 'https://yourapp.example.com';
82
- *
83
- * // Create the authentication middleware
84
- * const authenticateUser = getAuthenticateUserExpressHandler(ALLOWED_AUDIENCE);
85
- *
86
- * // Define a handler that requires authentication
87
- * const getProtectedResource = (req: ExpressAuthHelpers['AuthenticatedRequest'], res: Response) => {
88
- * // The request is now authenticated
89
- * // No need for type casting as the handler is properly typed
90
- * const { pkpAddress } = req.user;
91
- * res.json({ message: `Hello, user with PKP address ${pkpAddress}` });
92
- * };
93
- *
94
- * // Apply to routes that require authentication by using authenticatedRequestHandler
95
- * app.get('/protected-resource', authenticateUser, authenticatedRequestHandler(getProtectedResource));
96
- * ```
97
- *
98
- * You can see the source for `getAuthenticateUserExpressHandler()` below; use this as a reference to implement
99
- * your own midddleware/authentication for other frameworks! Pull requests are welcome.
100
- * {@includeCode ./express.ts#expressHandlerTSDocExample}
101
- */
102
- // #region expressHandlerTSDocExample
103
- const getAuthenticateUserExpressHandler = (allowedAudience) => async (req, res, next) => {
104
- const authHeader = req.headers.authorization;
105
- if (!authHeader) {
106
- res.status(401).json({ error: 'No token provided' });
107
- return;
108
- }
109
- const parts = authHeader.split(' ');
110
- if (parts.length !== 2) {
111
- res.status(401).json({ error: `Invalid authorization header - expected "Bearer <token>"` });
112
- return;
113
- }
114
- const [scheme, rawJWT] = parts;
115
- if (!/^Bearer$/i.test(scheme)) {
116
- res.status(401).json({ error: `Expected "Bearer" scheme, got "${scheme}"` });
117
- return;
118
- }
119
- try {
120
- const decodedJWT = verify(rawJWT, allowedAudience);
121
- if (!decodedJWT) {
122
- res.status(401).json({ error: 'Invalid token' });
123
- return;
124
- }
125
- req.user = {
126
- decodedJWT,
127
- rawJWT,
128
- };
129
- next();
130
- }
131
- catch (e) {
132
- res.status(401).json({ error: `Invalid token: ${e.message}` });
133
- }
134
- };
135
- exports.getAuthenticateUserExpressHandler = getAuthenticateUserExpressHandler;
136
- // #endregion expressHandlerTSDocExample
137
- //# sourceMappingURL=express.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"express.js","sourceRoot":"","sources":["../../../src/express-authentication-middleware/express.ts"],"names":[],"mappings":";;;AAEA,0BAAyB;AACzB,6CAAoD;AAIpD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAG,CAAC;AAEvB,SAAS,0BAA0B,CAAC,GAAY;IAC9C,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAA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AC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,0DAA0D,EAAE,CAAC,CAAC;QAC5F,OAAO;IACT,CAAC;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;IAC/B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,kCAAkC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC7E,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;YACjD,OAAO;QACT,CAAC;QAEA,GAA4B,CAAC,IAAI,GAAG;YACnC,UAAU;YACV,MAAM;SACP,CAAC;QAEF,IAAI,EAAE,CAAC;IACT,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,kBAAmB,CAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC;AApCS,QAAA,iCAAiC,qCAoC1C;AACJ,wCAAwC"}
@@ -1,43 +0,0 @@
1
- /** expressAuthHelpers are used to add a VincentJWT-specific authentication to your Express.js server routes
2
- *
3
- * - Create an express middleware using {@link getAuthenticateUserExpressHandler}
4
- * - Once you have added the middleware to your route, use {@link authenticatedRequestHandler} to provide
5
- * type-safe access to `req.user` in your downstream RequestHandler functions.
6
- * @example
7
- * ```typescript
8
- * import { expressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
9
- * const { authenticatedRequestHandler, getAuthenticateUserExpressHandler } = expressAuthHelpers;
10
- *
11
- * import type { ExpressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
12
- *
13
- * const { ALLOWED_AUDIENCE } = process.env;
14
- *
15
- *
16
- * const authenticateUserMiddleware = getAuthenticateUserExpressHandler(ALLOWED_AUDIENCE);
17
- *
18
- *
19
- * // Define an authenticated route handler
20
- * const getUserProfile = async (req: ExpressAuthHelpers['AuthenticatedRequest'], res: Response) => {
21
- * // Access authenticated user information
22
- * const { pkpAddress } = req.user;
23
- *
24
- * // Fetch and return user data
25
- * const userData = await userRepository.findByAddress(pkpAddress);
26
- * res.json(userData);
27
- * };
28
- *
29
- * // Use in Express route with authentication
30
- * app.get('/profile', authenticateUser, authenticatedRequestHandler(getUserProfile));
31
- * ```
32
- *
33
- * You can see the source for `getAuthenticateUserExpressHandler()` below; use this as a reference to implement
34
- * your own midddleware/authentication for other frameworks! Pull requests are welcome.
35
- *
36
- * {@includeCode ./express.ts#expressHandlerTSDocExample}
37
- *
38
- * @module expressAuthHelpers
39
- * @category API Methods
40
- * */
41
- import { authenticatedRequestHandler, getAuthenticateUserExpressHandler } from './express';
42
- export { authenticatedRequestHandler, getAuthenticateUserExpressHandler };
43
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/express-authentication-middleware/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCK;AAEL,OAAO,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,MAAM,WAAW,CAAC;AAE3F,OAAO,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,CAAC"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /** expressAuthHelpers are used to add a VincentJWT-specific authentication to your Express.js server routes
3
- *
4
- * - Create an express middleware using {@link getAuthenticateUserExpressHandler}
5
- * - Once you have added the middleware to your route, use {@link authenticatedRequestHandler} to provide
6
- * type-safe access to `req.user` in your downstream RequestHandler functions.
7
- * @example
8
- * ```typescript
9
- * import { expressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
10
- * const { authenticatedRequestHandler, getAuthenticateUserExpressHandler } = expressAuthHelpers;
11
- *
12
- * import type { ExpressAuthHelpers } from '@lit-protocol/vincent-app-sdk';
13
- *
14
- * const { ALLOWED_AUDIENCE } = process.env;
15
- *
16
- *
17
- * const authenticateUserMiddleware = getAuthenticateUserExpressHandler(ALLOWED_AUDIENCE);
18
- *
19
- *
20
- * // Define an authenticated route handler
21
- * const getUserProfile = async (req: ExpressAuthHelpers['AuthenticatedRequest'], res: Response) => {
22
- * // Access authenticated user information
23
- * const { pkpAddress } = req.user;
24
- *
25
- * // Fetch and return user data
26
- * const userData = await userRepository.findByAddress(pkpAddress);
27
- * res.json(userData);
28
- * };
29
- *
30
- * // Use in Express route with authentication
31
- * app.get('/profile', authenticateUser, authenticatedRequestHandler(getUserProfile));
32
- * ```
33
- *
34
- * You can see the source for `getAuthenticateUserExpressHandler()` below; use this as a reference to implement
35
- * your own midddleware/authentication for other frameworks! Pull requests are welcome.
36
- *
37
- * {@includeCode ./express.ts#expressHandlerTSDocExample}
38
- *
39
- * @module expressAuthHelpers
40
- * @category API Methods
41
- * */
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.getAuthenticateUserExpressHandler = exports.authenticatedRequestHandler = void 0;
44
- const express_1 = require("./express");
45
- Object.defineProperty(exports, "authenticatedRequestHandler", { enumerable: true, get: function () { return express_1.authenticatedRequestHandler; } });
46
- Object.defineProperty(exports, "getAuthenticateUserExpressHandler", { enumerable: true, get: function () { return express_1.getAuthenticateUserExpressHandler; } });
47
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/express-authentication-middleware/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCK;;;AAEL,uCAA2F;AAElF,4GAFA,qCAA2B,OAEA;AAAE,kHAFA,2CAAiC,OAEA"}
@@ -1,25 +0,0 @@
1
- import { NextFunction, Request, RequestHandler, Response } from 'express';
2
- import { VincentJWT } from '../jwt/types';
3
- /** Extract the parameters type from the original RequestHandler */
4
- type ExtractRequestHandlerParams<T> = T extends RequestHandler<infer P, infer ResBody, infer ReqBody, infer ReqQuery, infer Locals> ? [P, ResBody, ReqBody, ReqQuery, Locals] : never;
5
- /**
6
- * A RequestHandler that guarantees the request is authenticated with a PKP address
7
- * */
8
- export type AuthenticatedRequestHandler<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<P, ResBody, ReqBody, ReqQuery>, res: Response<ResBody, Locals>, next: NextFunction) => void | Promise<void>;
9
- /** Interface that extends Express Request to include authenticated user data
10
- * */
11
- export interface AuthenticatedRequest<P = any, ResBody = any, ReqBody = any, ReqQuery = any> extends Request<P, ResBody, ReqBody, ReqQuery> {
12
- user: {
13
- decodedJWT: VincentJWT;
14
- rawJWT: string;
15
- };
16
- }
17
- /**
18
- * @category Interfaces
19
- */
20
- export interface ExpressAuthHelpers {
21
- AuthenticatedRequestHandler: AuthenticatedRequestHandler;
22
- AuthenticatedRequest: AuthenticatedRequest;
23
- }
24
- export {};
25
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/express-authentication-middleware/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,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AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2BAA2B,EAAE,2BAA2B,CAAC;IACzD,oBAAoB,EAAE,oBAAoB,CAAC;CAC5C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/express-authentication-middleware/types.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import { VincentJWT } from '../../types';
2
- /** Checks if a JWT is expired based on its 'exp' claim
3
- *
4
- * @returns true if expired, false otherwise
5
- * @param decodedJWT
6
- */
7
- export declare function isJWTExpired(decodedJWT: VincentJWT): boolean;
8
- //# sourceMappingURL=isJWTExpired.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isJWTExpired.d.ts","sourceRoot":"","sources":["../../../../../src/jwt/core/utils/isJWTExpired.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAW5D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isJWTExpired.js","sourceRoot":"","sources":["../../../../../src/jwt/core/utils/isJWTExpired.ts"],"names":[],"mappings":";;AAOA,oCAWC;AAhBD;;;;GAIG;AACH,SAAgB,YAAY,CAAC,UAAsB;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAE/B,gEAAgE;IAChE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uDAAuD;IACvD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAClD,OAAO,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;AACpC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"resultCreators.d.ts","sourceRoot":"","sources":["../../../src/toolClient/resultCreators.ts"],"names":[],"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ultCreators.js","sourceRoot":"","sources":["../../../src/toolClient/resultCreators.ts"],"names":[],"mappings":";AAAA,uCAAuC;;AAgBvC,kEAiCC;AAED,gEA0DC;AAED,8DASC;AAED,8EAQC;AAED,8DAWC;AAED,8EAUC;AA3ID,SAAgB,2BAA2B,CACzC,iBAAqD,EACrD,eAUC;IAgBD,OAAO;QACL,KAAK,EAAE,IAAI;QACX,iBAAiB;QACjB,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CACxC,iBAAqD,EACrD,eAUC,EACD,YAWC;IA4BD,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,iBAAiB;QACjB,eAAe;QACf,YAAY;KACb,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CAA6C,MAGrF;IACC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC;AAED,SAAgB,iCAAiC,CAAoC,MAEpF;IACC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO;KACzB,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CAA0C,MAIlF;IACC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,OAAO;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC;AAED,SAAgB,iCAAiC,CAAoC,MAGpF;IACC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,MAAM,CAAC,OAAO;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC"}
@@ -1,5 +0,0 @@
1
- export type { JWTConfig, VincentJWT, VincentJWTPayload } from './jwt/types';
2
- export type { VincentWebAppClient, VincentAppClientConfig, RedirectToVincentConsentPageParams, } from './app/types';
3
- export type { BaseToolContext } from './toolClient';
4
- export type { ExpressAuthHelpers } from './express-authentication-middleware/types';
5
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC"}
File without changes
File without changes
File without changes
File without changes