@agnostack/next-shopify 1.14.1 → 1.15.0-alpha.1

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 (346) hide show
  1. package/CHANGELOG.md +252 -0
  2. package/README.md +9 -8
  3. package/dist/lib/handlers/api/billing.d.ts.map +1 -1
  4. package/dist/lib/handlers/api/billing.js +2 -1
  5. package/dist/lib/handlers/api/billing.js.map +1 -1
  6. package/dist/lib/handlers/api/uninstall.d.ts.map +1 -1
  7. package/dist/lib/handlers/api/uninstall.js +2 -1
  8. package/dist/lib/handlers/api/uninstall.js.map +1 -1
  9. package/dist/lib/handlers/api/verifiable/graph.d.ts.map +1 -1
  10. package/dist/lib/handlers/api/verifiable/graph.js +3 -2
  11. package/dist/lib/handlers/api/verifiable/graph.js.map +1 -1
  12. package/dist/lib/handlers/api/verifiable/proxy.d.ts.map +1 -1
  13. package/dist/lib/handlers/api/verifiable/proxy.js +3 -2
  14. package/dist/lib/handlers/api/verifiable/proxy.js.map +1 -1
  15. package/dist/lib/handlers/api/verifiable/rest.d.ts.map +1 -1
  16. package/dist/lib/handlers/api/verifiable/rest.js +3 -2
  17. package/dist/lib/handlers/api/verifiable/rest.js.map +1 -1
  18. package/dist/lib/handlers/api/verifiable/token.js +3 -2
  19. package/dist/lib/handlers/api/verifiable/token.js.map +1 -1
  20. package/dist/lib/handlers/api/webhook.d.ts.map +1 -1
  21. package/dist/lib/handlers/api/webhook.js +2 -1
  22. package/dist/lib/handlers/api/webhook.js.map +1 -1
  23. package/dist/lib/index.d.ts +2 -2
  24. package/dist/lib/index.d.ts.map +1 -1
  25. package/dist/lib/index.js +2 -4
  26. package/dist/lib/index.js.map +1 -1
  27. package/dist/lib/utils/crypto.d.ts +1 -1
  28. package/dist/lib/utils/crypto.d.ts.map +1 -1
  29. package/dist/lib/utils/index.d.ts +0 -2
  30. package/dist/lib/utils/index.js +0 -2
  31. package/dist/lib/utils/index.js.map +1 -1
  32. package/dist/lib/utils/token.d.ts +1 -1
  33. package/dist/plugins/index.d.ts +3 -0
  34. package/dist/plugins/index.d.ts.map +1 -0
  35. package/dist/plugins/index.js +19 -0
  36. package/dist/plugins/index.js.map +1 -0
  37. package/dist/plugins/types.d.ts +1 -0
  38. package/dist/plugins/types.d.ts.map +1 -0
  39. package/dist/plugins/types.js +1 -0
  40. package/dist/plugins/types.js.map +1 -0
  41. package/dist/plugins/withShopify.d.ts.map +1 -0
  42. package/dist/{lib → plugins}/withShopify.js +71 -69
  43. package/dist/plugins/withShopify.js.map +1 -0
  44. package/dist/react/hooks/useVerification.d.ts +1 -1
  45. package/dist/react/hooks/useVerification.js +17 -5
  46. package/dist/react/hooks/useVerification.js.map +1 -1
  47. package/dist/react/index.d.ts +1 -0
  48. package/dist/react/index.d.ts.map +1 -1
  49. package/dist/react/index.js +1 -0
  50. package/dist/react/index.js.map +1 -1
  51. package/dist/shared/WebCrypto.d.ts +55 -0
  52. package/dist/shared/WebCrypto.d.ts.map +1 -0
  53. package/dist/shared/WebCrypto.js +342 -0
  54. package/dist/shared/WebCrypto.js.map +1 -0
  55. package/dist/shared/display.d.ts +0 -2
  56. package/dist/shared/display.d.ts.map +1 -1
  57. package/dist/shared/display.js +2 -8
  58. package/dist/shared/display.js.map +1 -1
  59. package/dist/shared/errors.d.ts +0 -5
  60. package/dist/shared/errors.d.ts.map +1 -1
  61. package/dist/shared/errors.js +1 -23
  62. package/dist/shared/errors.js.map +1 -1
  63. package/dist/shared/index.d.ts +2 -1
  64. package/dist/shared/index.d.ts.map +1 -1
  65. package/dist/shared/index.js +7 -1
  66. package/dist/shared/index.js.map +1 -1
  67. package/dist/shared/request.d.ts +5 -0
  68. package/dist/shared/request.d.ts.map +1 -1
  69. package/dist/shared/request.js +24 -1
  70. package/dist/shared/request.js.map +1 -1
  71. package/dist/shared/shopify.d.ts +1 -6
  72. package/dist/shared/shopify.d.ts.map +1 -1
  73. package/dist/shared/shopify.js +1 -24
  74. package/dist/shared/shopify.js.map +1 -1
  75. package/dist/shared/uuid.d.ts +3 -0
  76. package/dist/shared/uuid.d.ts.map +1 -0
  77. package/dist/shared/uuid.js +10 -0
  78. package/dist/shared/uuid.js.map +1 -0
  79. package/dist/shared/verification.d.ts +12 -5
  80. package/dist/shared/verification.d.ts.map +1 -1
  81. package/dist/shared/verification.js +17 -12
  82. package/dist/shared/verification.js.map +1 -1
  83. package/dist/umd/verification/index.js +1234 -0
  84. package/dist/umd/verification/index.js.map +1 -0
  85. package/dist/umd/verification/lib/handlers/api/auth.d.ts +2 -0
  86. package/dist/umd/verification/lib/handlers/api/auth.d.ts.map +1 -0
  87. package/dist/umd/verification/lib/handlers/api/billing.d.ts +2 -0
  88. package/dist/umd/verification/lib/handlers/api/billing.d.ts.map +1 -0
  89. package/dist/umd/verification/lib/handlers/api/callback.d.ts +2 -0
  90. package/dist/umd/verification/lib/handlers/api/callback.d.ts.map +1 -0
  91. package/dist/umd/verification/lib/handlers/api/index.d.ts +10 -0
  92. package/dist/umd/verification/lib/handlers/api/index.d.ts.map +1 -0
  93. package/dist/umd/verification/lib/handlers/api/types.d.ts +1 -0
  94. package/dist/umd/verification/lib/handlers/api/types.d.ts.map +1 -0
  95. package/dist/umd/verification/lib/handlers/api/uninstall.d.ts +2 -0
  96. package/dist/umd/verification/lib/handlers/api/uninstall.d.ts.map +1 -0
  97. package/dist/umd/verification/lib/handlers/api/verifiable/appInstallation.d.ts +2 -0
  98. package/dist/umd/verification/lib/handlers/api/verifiable/appInstallation.d.ts.map +1 -0
  99. package/dist/umd/verification/lib/handlers/api/verifiable/graph.d.ts +2 -0
  100. package/dist/umd/verification/lib/handlers/api/verifiable/graph.d.ts.map +1 -0
  101. package/dist/umd/verification/lib/handlers/api/verifiable/index.d.ts +6 -0
  102. package/dist/umd/verification/lib/handlers/api/verifiable/index.d.ts.map +1 -0
  103. package/dist/umd/verification/lib/handlers/api/verifiable/proxy.d.ts +2 -0
  104. package/dist/umd/verification/lib/handlers/api/verifiable/proxy.d.ts.map +1 -0
  105. package/dist/umd/verification/lib/handlers/api/verifiable/rest.d.ts +2 -0
  106. package/dist/umd/verification/lib/handlers/api/verifiable/rest.d.ts.map +1 -0
  107. package/dist/umd/verification/lib/handlers/api/verifiable/token.d.ts +4 -0
  108. package/dist/umd/verification/lib/handlers/api/verifiable/token.d.ts.map +1 -0
  109. package/dist/umd/verification/lib/handlers/api/webhook.d.ts +2 -0
  110. package/dist/umd/verification/lib/handlers/api/webhook.d.ts.map +1 -0
  111. package/dist/umd/verification/lib/handlers/index.d.ts +3 -0
  112. package/dist/umd/verification/lib/handlers/index.d.ts.map +1 -0
  113. package/dist/umd/verification/lib/handlers/ssr/index.d.ts +3 -0
  114. package/dist/umd/verification/lib/handlers/ssr/index.d.ts.map +1 -0
  115. package/dist/umd/verification/lib/handlers/ssr/protect.d.ts +16 -0
  116. package/dist/umd/verification/lib/handlers/ssr/protect.d.ts.map +1 -0
  117. package/dist/umd/verification/lib/handlers/ssr/types.d.ts +1 -0
  118. package/dist/umd/verification/lib/handlers/ssr/types.d.ts.map +1 -0
  119. package/dist/umd/verification/lib/handlers/ssr/wrap.d.ts +9 -0
  120. package/dist/umd/verification/lib/handlers/ssr/wrap.d.ts.map +1 -0
  121. package/dist/umd/verification/lib/handlers/types.d.ts +1 -0
  122. package/dist/umd/verification/lib/handlers/types.d.ts.map +1 -0
  123. package/dist/umd/verification/lib/index.d.ts +5 -0
  124. package/dist/umd/verification/lib/index.d.ts.map +1 -0
  125. package/dist/umd/verification/lib/types.d.ts +1 -0
  126. package/dist/umd/verification/lib/types.d.ts.map +1 -0
  127. package/dist/umd/verification/lib/utils/billing.d.ts +24 -0
  128. package/dist/umd/verification/lib/utils/billing.d.ts.map +1 -0
  129. package/dist/umd/verification/lib/utils/crypto.d.ts +22 -0
  130. package/dist/umd/verification/lib/utils/crypto.d.ts.map +1 -0
  131. package/dist/umd/verification/lib/utils/firebase.d.ts +25 -0
  132. package/dist/umd/verification/lib/utils/firebase.d.ts.map +1 -0
  133. package/dist/umd/verification/lib/utils/headers.d.ts +5 -0
  134. package/dist/umd/verification/lib/utils/headers.d.ts.map +1 -0
  135. package/dist/umd/verification/lib/utils/index.d.ts +9 -0
  136. package/dist/umd/verification/lib/utils/index.d.ts.map +1 -0
  137. package/dist/umd/verification/lib/utils/session.d.ts +41 -0
  138. package/dist/umd/verification/lib/utils/session.d.ts.map +1 -0
  139. package/dist/umd/verification/lib/utils/shopify-api-js/oauth.d.ts +9 -0
  140. package/dist/umd/verification/lib/utils/shopify-api-js/oauth.d.ts.map +1 -0
  141. package/dist/umd/verification/lib/utils/shopify.d.ts +26 -0
  142. package/dist/umd/verification/lib/utils/shopify.d.ts.map +1 -0
  143. package/dist/umd/verification/lib/utils/token.d.ts +19 -0
  144. package/dist/umd/verification/lib/utils/token.d.ts.map +1 -0
  145. package/dist/umd/verification/lib/utils/types.d.ts +1 -0
  146. package/dist/umd/verification/lib/utils/types.d.ts.map +1 -0
  147. package/dist/umd/verification/plugins/index.d.ts +3 -0
  148. package/dist/umd/verification/plugins/index.d.ts.map +1 -0
  149. package/dist/umd/verification/plugins/types.d.ts +1 -0
  150. package/dist/umd/verification/plugins/types.d.ts.map +1 -0
  151. package/dist/umd/verification/plugins/withShopify.d.ts +6 -0
  152. package/dist/umd/verification/plugins/withShopify.d.ts.map +1 -0
  153. package/dist/umd/verification/react/hooks/index.d.ts +2 -0
  154. package/dist/umd/verification/react/hooks/index.d.ts.map +1 -0
  155. package/dist/umd/verification/react/hooks/useVerification.d.ts +8 -0
  156. package/dist/umd/verification/react/hooks/useVerification.d.ts.map +1 -0
  157. package/dist/umd/verification/react/index.d.ts +3 -0
  158. package/dist/umd/verification/react/index.d.ts.map +1 -0
  159. package/dist/umd/verification/react/types.d.ts +1 -0
  160. package/dist/umd/verification/react/types.d.ts.map +1 -0
  161. package/dist/umd/verification/runtime/index.d.ts +2 -0
  162. package/dist/umd/verification/runtime/index.d.ts.map +1 -0
  163. package/dist/umd/verification/runtime/types.d.ts +1 -0
  164. package/dist/umd/verification/runtime/types.d.ts.map +1 -0
  165. package/dist/umd/verification/shared/WebCrypto.d.ts +55 -0
  166. package/dist/umd/verification/shared/WebCrypto.d.ts.map +1 -0
  167. package/dist/umd/verification/shared/constants.d.ts +211 -0
  168. package/dist/umd/verification/shared/constants.d.ts.map +1 -0
  169. package/dist/umd/verification/shared/datetime.d.ts +96 -0
  170. package/dist/umd/verification/shared/datetime.d.ts.map +1 -0
  171. package/dist/umd/verification/shared/display.d.ts +100 -0
  172. package/dist/umd/verification/shared/display.d.ts.map +1 -0
  173. package/dist/umd/verification/shared/errors.d.ts +19 -0
  174. package/dist/umd/verification/shared/errors.d.ts.map +1 -0
  175. package/dist/umd/verification/shared/graph.d.ts +24 -0
  176. package/dist/umd/verification/shared/graph.d.ts.map +1 -0
  177. package/dist/umd/verification/shared/index.d.ts +12 -0
  178. package/dist/umd/verification/shared/index.d.ts.map +1 -0
  179. package/dist/umd/verification/shared/match.d.ts +6 -0
  180. package/dist/umd/verification/shared/match.d.ts.map +1 -0
  181. package/dist/umd/verification/shared/request.d.ts +16 -0
  182. package/dist/umd/verification/shared/request.d.ts.map +1 -0
  183. package/dist/umd/verification/shared/shopify.d.ts +31 -0
  184. package/dist/umd/verification/shared/shopify.d.ts.map +1 -0
  185. package/dist/umd/verification/shared/types.d.ts +1 -0
  186. package/dist/umd/verification/shared/types.d.ts.map +1 -0
  187. package/dist/umd/verification/shared/uuid.d.ts +3 -0
  188. package/dist/umd/verification/shared/uuid.d.ts.map +1 -0
  189. package/dist/umd/verification/shared/verification.d.ts +31 -0
  190. package/dist/umd/verification/shared/verification.d.ts.map +1 -0
  191. package/dist/umd/verification/verification/index.d.ts +4 -0
  192. package/dist/umd/verification/verification/index.d.ts.map +1 -0
  193. package/dist/umd/verification/verification/types.d.ts +1 -0
  194. package/dist/umd/verification/verification/types.d.ts.map +1 -0
  195. package/dist/umd/verification/verification/utils/errors.d.ts +6 -0
  196. package/dist/umd/verification/verification/utils/errors.d.ts.map +1 -0
  197. package/dist/umd/verification/verification/utils/index.d.ts +3 -0
  198. package/dist/umd/verification/verification/utils/index.d.ts.map +1 -0
  199. package/dist/umd/verification/verification/utils/rawbody.d.ts.map +1 -0
  200. package/dist/umd/verification/verification/verification.d.ts +10 -0
  201. package/dist/umd/verification/verification/verification.d.ts.map +1 -0
  202. package/dist/verification/index.d.ts +4 -0
  203. package/dist/verification/index.d.ts.map +1 -0
  204. package/dist/verification/index.js +20 -0
  205. package/dist/verification/index.js.map +1 -0
  206. package/dist/verification/types.d.ts +1 -0
  207. package/dist/verification/types.d.ts.map +1 -0
  208. package/dist/verification/types.js +1 -0
  209. package/dist/verification/types.js.map +1 -0
  210. package/dist/verification/utils/errors.d.ts +6 -0
  211. package/dist/verification/utils/errors.d.ts.map +1 -0
  212. package/dist/verification/utils/errors.js +26 -0
  213. package/dist/verification/utils/errors.js.map +1 -0
  214. package/dist/verification/utils/index.d.ts +3 -0
  215. package/dist/verification/utils/index.d.ts.map +1 -0
  216. package/dist/verification/utils/index.js +19 -0
  217. package/dist/verification/utils/index.js.map +1 -0
  218. package/dist/verification/utils/rawbody.d.ts +2 -0
  219. package/dist/verification/utils/rawbody.d.ts.map +1 -0
  220. package/dist/verification/utils/rawbody.js +60 -0
  221. package/dist/verification/utils/rawbody.js.map +1 -0
  222. package/dist/verification/verification.d.ts +10 -0
  223. package/dist/verification/verification.d.ts.map +1 -0
  224. package/dist/verification/verification.js +84 -0
  225. package/dist/verification/verification.js.map +1 -0
  226. package/node_modules/browser-monads-ts/LICENSE +21 -0
  227. package/node_modules/browser-monads-ts/README.md +46 -0
  228. package/node_modules/browser-monads-ts/dist/browser-monads-ts.cjs.js +2 -0
  229. package/node_modules/browser-monads-ts/dist/browser-monads-ts.cjs.js.map +1 -0
  230. package/node_modules/browser-monads-ts/dist/browser-monads-ts.es.js +12 -0
  231. package/node_modules/browser-monads-ts/dist/browser-monads-ts.es.js.map +1 -0
  232. package/node_modules/browser-monads-ts/dist/index.d.ts +5 -0
  233. package/node_modules/browser-monads-ts/dist/index.d.ts.map +1 -0
  234. package/node_modules/browser-monads-ts/package.json +79 -0
  235. package/node_modules/bytes/History.md +97 -0
  236. package/node_modules/bytes/LICENSE +23 -0
  237. package/node_modules/bytes/Readme.md +152 -0
  238. package/node_modules/bytes/index.js +170 -0
  239. package/node_modules/bytes/package.json +42 -0
  240. package/node_modules/depd/History.md +103 -0
  241. package/node_modules/depd/LICENSE +22 -0
  242. package/node_modules/depd/Readme.md +280 -0
  243. package/node_modules/depd/index.js +538 -0
  244. package/node_modules/depd/lib/browser/index.js +77 -0
  245. package/node_modules/depd/package.json +45 -0
  246. package/node_modules/http-errors/HISTORY.md +180 -0
  247. package/node_modules/http-errors/LICENSE +23 -0
  248. package/node_modules/http-errors/README.md +169 -0
  249. package/node_modules/http-errors/index.js +289 -0
  250. package/node_modules/http-errors/package.json +50 -0
  251. package/node_modules/iconv-lite/Changelog.md +162 -0
  252. package/node_modules/iconv-lite/LICENSE +21 -0
  253. package/node_modules/iconv-lite/README.md +156 -0
  254. package/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
  255. package/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
  256. package/node_modules/iconv-lite/encodings/index.js +22 -0
  257. package/node_modules/iconv-lite/encodings/internal.js +188 -0
  258. package/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  259. package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  260. package/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
  261. package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  262. package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  263. package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  264. package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  265. package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  266. package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  267. package/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
  268. package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  269. package/node_modules/iconv-lite/encodings/utf16.js +177 -0
  270. package/node_modules/iconv-lite/encodings/utf7.js +290 -0
  271. package/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  272. package/node_modules/iconv-lite/lib/extend-node.js +217 -0
  273. package/node_modules/iconv-lite/lib/index.d.ts +24 -0
  274. package/node_modules/iconv-lite/lib/index.js +153 -0
  275. package/node_modules/iconv-lite/lib/streams.js +121 -0
  276. package/node_modules/iconv-lite/package.json +46 -0
  277. package/node_modules/inherits/LICENSE +16 -0
  278. package/node_modules/inherits/README.md +42 -0
  279. package/node_modules/inherits/inherits.js +9 -0
  280. package/node_modules/inherits/inherits_browser.js +27 -0
  281. package/node_modules/inherits/package.json +29 -0
  282. package/node_modules/nothing-mock/LICENSE +21 -0
  283. package/node_modules/nothing-mock/README.md +266 -0
  284. package/node_modules/nothing-mock/dist/nothing-mock.es.js +2 -0
  285. package/node_modules/nothing-mock/dist/nothing-mock.es.js.map +1 -0
  286. package/node_modules/nothing-mock/dist/nothing-mock.js +2 -0
  287. package/node_modules/nothing-mock/dist/nothing-mock.js.map +1 -0
  288. package/node_modules/nothing-mock/dist/nothing-mock.modern.js +2 -0
  289. package/node_modules/nothing-mock/dist/nothing-mock.modern.js.map +1 -0
  290. package/node_modules/nothing-mock/dist/nothing-mock.umd.js +2 -0
  291. package/node_modules/nothing-mock/dist/nothing-mock.umd.js.map +1 -0
  292. package/node_modules/nothing-mock/index.d.ts +6 -0
  293. package/node_modules/nothing-mock/package.json +29 -0
  294. package/node_modules/nothing-mock/src/index.js +15 -0
  295. package/node_modules/raw-body/HISTORY.md +308 -0
  296. package/node_modules/raw-body/LICENSE +22 -0
  297. package/node_modules/raw-body/README.md +223 -0
  298. package/node_modules/raw-body/SECURITY.md +24 -0
  299. package/node_modules/raw-body/index.d.ts +87 -0
  300. package/node_modules/raw-body/index.js +336 -0
  301. package/node_modules/raw-body/package.json +49 -0
  302. package/node_modules/safer-buffer/LICENSE +21 -0
  303. package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  304. package/node_modules/safer-buffer/Readme.md +156 -0
  305. package/node_modules/safer-buffer/dangerous.js +58 -0
  306. package/node_modules/safer-buffer/package.json +34 -0
  307. package/node_modules/safer-buffer/safer.js +77 -0
  308. package/node_modules/safer-buffer/tests.js +406 -0
  309. package/node_modules/setprototypeof/LICENSE +13 -0
  310. package/node_modules/setprototypeof/README.md +31 -0
  311. package/node_modules/setprototypeof/index.d.ts +2 -0
  312. package/node_modules/setprototypeof/index.js +17 -0
  313. package/node_modules/setprototypeof/package.json +38 -0
  314. package/node_modules/setprototypeof/test/index.js +24 -0
  315. package/node_modules/statuses/HISTORY.md +82 -0
  316. package/node_modules/statuses/LICENSE +23 -0
  317. package/node_modules/statuses/README.md +136 -0
  318. package/node_modules/statuses/codes.json +65 -0
  319. package/node_modules/statuses/index.js +146 -0
  320. package/node_modules/statuses/package.json +49 -0
  321. package/node_modules/toidentifier/HISTORY.md +9 -0
  322. package/node_modules/toidentifier/LICENSE +21 -0
  323. package/node_modules/toidentifier/README.md +61 -0
  324. package/node_modules/toidentifier/index.js +32 -0
  325. package/node_modules/toidentifier/package.json +38 -0
  326. package/node_modules/unpipe/HISTORY.md +4 -0
  327. package/node_modules/unpipe/LICENSE +22 -0
  328. package/node_modules/unpipe/README.md +43 -0
  329. package/node_modules/unpipe/index.js +69 -0
  330. package/node_modules/unpipe/package.json +27 -0
  331. package/package.json +28 -9
  332. package/dist/lib/utils/rawbody.d.ts.map +0 -1
  333. package/dist/lib/utils/rawbody.js +0 -37
  334. package/dist/lib/utils/rawbody.js.map +0 -1
  335. package/dist/lib/utils/verification.d.ts +0 -8
  336. package/dist/lib/utils/verification.d.ts.map +0 -1
  337. package/dist/lib/utils/verification.js +0 -76
  338. package/dist/lib/utils/verification.js.map +0 -1
  339. package/dist/lib/withShopify.d.ts.map +0 -1
  340. package/dist/lib/withShopify.js.map +0 -1
  341. package/dist/shared/subtlecrypto.d.ts +0 -41
  342. package/dist/shared/subtlecrypto.d.ts.map +0 -1
  343. package/dist/shared/subtlecrypto.js +0 -282
  344. package/dist/shared/subtlecrypto.js.map +0 -1
  345. /package/dist/{lib → plugins}/withShopify.d.ts +0 -0
  346. /package/dist/{lib → umd/verification/verification}/utils/rawbody.d.ts +0 -0
@@ -0,0 +1,24 @@
1
+ export namespace FRAGMENTS {
2
+ const APP_INSTALLATION: string;
3
+ const APP_SUBSCRIPTION: string;
4
+ const APP_PURCHASE: string;
5
+ const APP_METAFIELD: string;
6
+ }
7
+ export namespace TRANSFORM {
8
+ export { APP_QUERY_TRANSFORM as APP_QUERY };
9
+ export { APP_METAFIELDS_TRANSFORM as APP_METAFIELDS };
10
+ }
11
+ export namespace APP_QUERY {
12
+ export { INSTALLATION_BASIC };
13
+ export { INSTALLATION };
14
+ }
15
+ declare function APP_QUERY_TRANSFORM(data: any): {
16
+ appMetafields: any;
17
+ appInfo: any;
18
+ appInstallation: any;
19
+ };
20
+ declare function APP_METAFIELDS_TRANSFORM(metafields: any): any;
21
+ declare const INSTALLATION_BASIC: string;
22
+ declare const INSTALLATION: string;
23
+ export {};
24
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/shared/graph.js"],"names":[],"mappings":";;;;;;;;;;;;;;AAgGA;;;;EAkDC;AAlFD,gEA8BC;AA5DD,yCAMC;AAED,mCAmBC"}
@@ -0,0 +1,12 @@
1
+ export * from './constants';
2
+ export * from './datetime';
3
+ export * from './display';
4
+ export * from './errors';
5
+ export * from './graph';
6
+ export * from './match';
7
+ export * from './request';
8
+ export * from './shopify';
9
+ export * from './uuid';
10
+ export * from './verification';
11
+ export { default as WebCrypto } from './WebCrypto';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,6 @@
1
+ export function safeHostname(nameable: any): any;
2
+ export function isMatch(value: any, pattern: any): boolean;
3
+ export function matchArray(value: any, patterns: any): boolean;
4
+ export function matchObject(value: any, patterns: any): any;
5
+ export function matchHostname(nameable: any, patterns: any): any;
6
+ //# sourceMappingURL=match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/shared/match.js"],"names":[],"mappings":"AAIO,iDAQN;AAEM,2DAIN;AAEM,+DAYN;AAEM,4DAYN;AAEM,iEAKN"}
@@ -0,0 +1,16 @@
1
+ export const HEADER_CONTENT_TYPE: "Content-Type";
2
+ export namespace CONTENT_TYPES {
3
+ const APPLICATION_JSON: string;
4
+ }
5
+ export function getRequestMethod(body: any, _method: any): string;
6
+ export function prepareRequestOptions({ method: _method, body: _body, headers: _header, ...requestOptions }?: {
7
+ method: any;
8
+ body: any;
9
+ headers: any;
10
+ }): any;
11
+ export function normalizeURIParts(uri: any): {
12
+ pathname: string;
13
+ search: string;
14
+ origin?: string | undefined;
15
+ } | undefined;
16
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/shared/request.js"],"names":[],"mappings":"AAUA,iDAAiD;;;;AAK1C,kEAIN;AAEM;;;;QAmBN;AAgBM;;;;cAeN"}
@@ -0,0 +1,31 @@
1
+ export const decodeJWT: typeof jwt_decode;
2
+ export function getSanitizedShopData(shop: any, customDomains: any): {
3
+ shop: string;
4
+ store_name: string;
5
+ };
6
+ export function sanitizeShop(shop: any, { throwOnInvalid, customDomains }?: {
7
+ throwOnInvalid: any;
8
+ customDomains: any;
9
+ }): string;
10
+ export function ensureShop(store: any, { throwOnInvalid, ...params }?: {
11
+ throwOnInvalid: any;
12
+ }): string | undefined;
13
+ export function decodeShopData(token: any): {
14
+ decoded?: undefined;
15
+ token?: undefined;
16
+ dest?: undefined;
17
+ sid?: undefined;
18
+ shop?: undefined;
19
+ host?: undefined;
20
+ store_name?: undefined;
21
+ } | {
22
+ decoded: unknown;
23
+ token: any;
24
+ dest: any;
25
+ sid: any;
26
+ shop: string;
27
+ host: string | undefined;
28
+ store_name: string;
29
+ };
30
+ import jwt_decode from "jwt-decode";
31
+ //# sourceMappingURL=shopify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify.d.ts","sourceRoot":"","sources":["../../src/shared/shopify.js"],"names":[],"mappings":"AAWA,0CAAmC;AAI5B;;;EAcN;AAGM;;;WAQN;AAGM;;uBAYN;AAEM;;;;;;;;;;;;;;;;EAiCN"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export function getGUID(): any;
2
+ export function getInteger(): any;
3
+ //# sourceMappingURL=uuid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/shared/uuid.js"],"names":[],"mappings":"AAIO,+BAEN;AAEM,kCAEN"}
@@ -0,0 +1,31 @@
1
+ export function getKeysData(publicKey: any, { crypto: _crypto, util: _util }?: {
2
+ crypto: any;
3
+ util: any;
4
+ }): Promise<{
5
+ publicKey: any;
6
+ ephemeral: {};
7
+ verification: {
8
+ derivedSecretKey?: undefined;
9
+ derivedHMACKey?: undefined;
10
+ } | {
11
+ derivedSecretKey: any;
12
+ derivedHMACKey: any;
13
+ };
14
+ }>;
15
+ export function prepareVerificationRequest({ keysData: _keysData, disableRecryption: _disableRecryption, crypto: _crypto, util: _util }?: {
16
+ keysData: any;
17
+ disableRecryption: any;
18
+ crypto: any;
19
+ util: any;
20
+ }): (requestPath: any, { method: rawMethod, body: rawBody, headers: rawHeaders, ...requestOptions }?: {
21
+ method: any;
22
+ body: any;
23
+ headers: any;
24
+ }) => Promise<any[] | undefined>;
25
+ export function processVerificationResponse({ keysData, disableRecryption: _disableRecryption, crypto: _crypto, util: _util }?: {
26
+ keysData: any;
27
+ disableRecryption: any;
28
+ crypto: any;
29
+ util: any;
30
+ }): (encryptedResponse: any, _derivedSecretKey: any) => Promise<any>;
31
+ //# sourceMappingURL=verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/shared/verification.js"],"names":[],"mappings":"AAKO;;;;;;;;;;;;;GAiBN;AAGM;;;;;;;;;iCAkEN;AAEM;;;;;qEAaN"}
@@ -0,0 +1,4 @@
1
+ export * from '../shared/constants';
2
+ export * from './utils';
3
+ export * from './verification';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export class VerificationError extends Error {
2
+ constructor(message: any, _data: any);
3
+ code: any;
4
+ data: any;
5
+ }
6
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/verification/utils/errors.js"],"names":[],"mappings":"AAAA;IACE,sCAOC;IAJC,UAAgB;IAChB,UAAgB;CAInB"}
@@ -0,0 +1,3 @@
1
+ export * from "./errors";
2
+ export * from "./rawbody";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/verification/utils/index.js"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawbody.d.ts","sourceRoot":"","sources":["../../../src/verification/utils/rawbody.js"],"names":[],"mappings":"AAgBO,sDAON"}
@@ -0,0 +1,10 @@
1
+ export function getVerificationHelpers({ keyPairs, crypto: _crypto, util: _util }?: {
2
+ keyPairs: any;
3
+ crypto: any;
4
+ util: any;
5
+ }): (req: any, params: any) => Promise<{
6
+ rawBody: any;
7
+ requestBody: any;
8
+ processResponse: (response: any) => Promise<any>;
9
+ }>;
10
+ //# sourceMappingURL=verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/verification/verification.js"],"names":[],"mappings":"AAgBO;;;;;;;;GA6FN"}
@@ -0,0 +1,4 @@
1
+ export * from '../shared/constants';
2
+ export * from './utils';
3
+ export * from './verification';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../shared/constants"), exports);
18
+ __exportStar(require("./utils"), exports);
19
+ __exportStar(require("./verification"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,0CAAuB;AACvB,iDAA8B"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export class VerificationError extends Error {
2
+ constructor(message: any, _data: any);
3
+ code: any;
4
+ data: any;
5
+ }
6
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/verification/utils/errors.js"],"names":[],"mappings":"AAAA;IACE,sCAOC;IAJC,UAAgB;IAChB,UAAgB;CAInB"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.VerificationError = void 0;
15
+ class VerificationError extends Error {
16
+ constructor(message, _data) {
17
+ super(message);
18
+ const _a = _data !== null && _data !== void 0 ? _data : {}, { code = 500 } = _a, data = __rest(_a, ["code"]);
19
+ this.code = code;
20
+ this.data = data;
21
+ this.name = 'VerificationError';
22
+ Object.setPrototypeOf(this, VerificationError.prototype);
23
+ }
24
+ }
25
+ exports.VerificationError = VerificationError;
26
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/verification/utils/errors.js"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAO,EAAE,KAAK;QACxB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,MAAM,KAA0B,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,EAArC,EAAE,IAAI,GAAG,GAAG,OAAyB,EAApB,IAAI,cAArB,QAAuB,CAAc,CAAA;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;QAC/B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;IAC1D,CAAC;CACF;AATD,8CASC"}
@@ -0,0 +1,3 @@
1
+ export * from "./errors";
2
+ export * from "./rawbody";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/verification/utils/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./errors"), exports);
18
+ __exportStar(require("./rawbody"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/verification/utils/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,4CAAyB"}
@@ -0,0 +1,2 @@
1
+ export function ensureRawBody(req: any): Promise<any>;
2
+ //# sourceMappingURL=rawbody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawbody.d.ts","sourceRoot":"","sources":["../../../src/verification/utils/rawbody.js"],"names":[],"mappings":"AAgBO,sDAON"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.ensureRawBody = void 0;
36
+ const getChunkedRawBody = (readable) => __awaiter(void 0, void 0, void 0, function* () {
37
+ if (readable === null || readable === void 0 ? void 0 : readable.rawBody) {
38
+ return readable.rawBody;
39
+ }
40
+ // TODO: move to req.text() after next 13.5: https://github.com/vercel/next.js/discussions/13405
41
+ try {
42
+ const getRawBody = (yield Promise.resolve().then(() => __importStar(require('raw-body')))).default;
43
+ return getRawBody(readable);
44
+ }
45
+ catch (error) {
46
+ console.error(`Failed to import 'raw-body', please ensure the dependency is installed`);
47
+ throw error;
48
+ }
49
+ });
50
+ // TODO: explore returning mutated request object adding on req.rawBody??
51
+ const ensureRawBody = (req) => __awaiter(void 0, void 0, void 0, function* () {
52
+ return (getChunkedRawBody(req)
53
+ .then((_rawBody) => _rawBody.toString())
54
+ .catch((error) => {
55
+ console.error(`Error getting raw body for '${req === null || req === void 0 ? void 0 : req.url}'`, error);
56
+ throw error;
57
+ }));
58
+ });
59
+ exports.ensureRawBody = ensureRawBody;
60
+ //# sourceMappingURL=rawbody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawbody.js","sourceRoot":"","sources":["../../../src/verification/utils/rawbody.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,iBAAiB,GAAG,CAAO,QAAQ,EAAE,EAAE;IAC3C,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,EAAE;QACrB,OAAO,QAAQ,CAAC,OAAO,CAAA;KACxB;IAED,gGAAgG;IAChG,IAAI;QACF,MAAM,UAAU,GAAG,CAAC,wDAAa,UAAU,GAAC,CAAC,CAAC,OAAO,CAAA;QACrD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAA;KAC5B;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAA;QACvF,MAAM,KAAK,CAAA;KACZ;AACH,CAAC,CAAA,CAAA;AAED,yEAAyE;AAClE,MAAM,aAAa,GAAG,CAAO,GAAG,EAAE,EAAE;IAAC,OAAA,CAC1C,iBAAiB,CAAC,GAAG,CAAC;SACnB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;SACvC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,GAAG,GAAG,EAAE,KAAK,CAAC,CAAA;QAChE,MAAM,KAAK,CAAA;IACf,CAAC,CAAC,CACH,CAAA;EAAA,CAAA;AAPY,QAAA,aAAa,iBAOzB"}
@@ -0,0 +1,10 @@
1
+ export function getVerificationHelpers({ keyPairs, crypto: _crypto, util: _util }?: {
2
+ keyPairs: any;
3
+ crypto: any;
4
+ util: any;
5
+ }): (req: any, params: any) => Promise<{
6
+ rawBody: any;
7
+ requestBody: any;
8
+ processResponse: (response: any) => Promise<any>;
9
+ }>;
10
+ //# sourceMappingURL=verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/verification/verification.js"],"names":[],"mappings":"AAgBO;;;;;;;;GA6FN"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getVerificationHelpers = void 0;
16
+ const display_1 = require("../shared/display");
17
+ const request_1 = require("../shared/request");
18
+ const WebCrypto_1 = __importDefault(require("../shared/WebCrypto"));
19
+ const utils_1 = require("./utils");
20
+ const getVerificationHelpers = ({ keyPairs, crypto: _crypto, util: _util } = {}) => {
21
+ const webCrypto = new WebCrypto_1.default({ crypto: _crypto, util: _util });
22
+ return (req, params) => __awaiter(void 0, void 0, void 0, function* () {
23
+ var _a;
24
+ const { 'x-public-key': apiKey, 'x-ephemeral-key': ephemeralPublicKey, 'x-authorization-timestamp': customAuthTimestamp, 'x-authorization': customAuth, } = (_a = req.headers) !== null && _a !== void 0 ? _a : {};
25
+ const { uri: _uri, disableRecryption: _disableRecryption } = params !== null && params !== void 0 ? params : {};
26
+ const uri = _uri !== null && _uri !== void 0 ? _uri : req.url;
27
+ const disableRecryption = (0, display_1.isTrue)(_disableRecryption);
28
+ let isVerifiable;
29
+ try {
30
+ const [authProtocol, authSignature] = (0, display_1.ensureString)(customAuth).split(' ');
31
+ isVerifiable = (0, display_1.isTrue)(apiKey &&
32
+ ephemeralPublicKey &&
33
+ (keyPairs === null || keyPairs === void 0 ? void 0 : keyPairs.shared) &&
34
+ customAuthTimestamp &&
35
+ authSignature &&
36
+ (authProtocol === 'HMAC-SHA256'));
37
+ let verificationKeys;
38
+ const rawBody = yield (0, utils_1.ensureRawBody)(req);
39
+ // NOTE: requestBody should be wind up decrypted when isVerifiable (unless disableRecryption, then will pass through)
40
+ let requestBody = (0, display_1.safeParse)(rawBody);
41
+ // TEMP!!! remove isVerifiable check once webwidget moved to react
42
+ if (isVerifiable) {
43
+ if (!apiKey ||
44
+ !ephemeralPublicKey ||
45
+ !customAuthTimestamp ||
46
+ !authSignature ||
47
+ !(keyPairs === null || keyPairs === void 0 ? void 0 : keyPairs.shared) ||
48
+ (apiKey !== keyPairs.shared.publicKey) ||
49
+ (authProtocol !== 'HMAC-SHA256')) {
50
+ throw new utils_1.VerificationError('Invalid or missing authorization', { code: 401 });
51
+ }
52
+ verificationKeys = yield webCrypto.getVerificationKeys({
53
+ publicKey: ephemeralPublicKey,
54
+ privateKey: keyPairs.shared.privateKey,
55
+ });
56
+ if (!verificationKeys) {
57
+ throw new utils_1.VerificationError('Invalid or missing verification', { code: 412 });
58
+ }
59
+ const verificationPayload = (0, display_1.objectToSortedString)(Object.assign({ method: (0, request_1.getRequestMethod)(rawBody, req.method), timestamp: customAuthTimestamp, body: requestBody }, (0, request_1.normalizeURIParts)(uri)));
60
+ const isValid = yield webCrypto.verifyHMAC(verificationPayload, verificationKeys.derivedHMACKey, authSignature);
61
+ if (!isValid) {
62
+ throw new utils_1.VerificationError('Invalid or missing verification', { code: 412 });
63
+ }
64
+ if (!disableRecryption && requestBody) {
65
+ const decryptedMessage = yield webCrypto.decryptMessage(requestBody, verificationKeys.derivedSecretKey);
66
+ requestBody = (0, display_1.safeParse)(decryptedMessage);
67
+ }
68
+ }
69
+ const processResponse = (response) => __awaiter(void 0, void 0, void 0, function* () {
70
+ if (!response || disableRecryption || !isVerifiable || !(verificationKeys === null || verificationKeys === void 0 ? void 0 : verificationKeys.derivedSecretKey)) {
71
+ return response;
72
+ }
73
+ return webCrypto.encryptMessage(JSON.stringify(response), verificationKeys.derivedSecretKey);
74
+ });
75
+ return { rawBody, requestBody, processResponse };
76
+ }
77
+ catch (error) {
78
+ console.error(`Error handling request verification for '${uri}'`, { error, isVerifiable, disableRecryption });
79
+ throw error;
80
+ }
81
+ });
82
+ };
83
+ exports.getVerificationHelpers = getVerificationHelpers;
84
+ //# sourceMappingURL=verification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification.js","sourceRoot":"","sources":["../../src/verification/verification.js"],"names":[],"mappings":"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"}
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Daniel Esteves
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # Browser Monads TS
2
+
3
+ <p align="center">
4
+ <a href="https://www.npmjs.org/package/browser-monads-ts">
5
+ <img src="https://img.shields.io/npm/v/browser-monads-ts/latest.svg" alt="NPM Version" />
6
+ </a>
7
+ <a href="https://www.npmjs.org/package/browser-monads-ts">
8
+ <img src="https://img.shields.io/npm/dm/browser-monads-ts.svg" alt="Monthly download on NPM" />
9
+ </a>
10
+ <a href="https://github.com/danestves/browser-monads-ts/actions">
11
+ <img src="https://github.com/danestves/browser-monads-ts/workflows/CI/badge.svg" alt="Workflow of main.yml action" />
12
+ </a>
13
+ </p>
14
+
15
+ > This package is inspired by [browser-monads](https://github.com/Jense5/browser-monads) currently without support from the author.
16
+
17
+ Provide interfaces for the `window`, `document` and `navigator` variables of a webpage.
18
+
19
+ ## What is a monad?
20
+
21
+ > In functional programming, a monad is an abstraction that allows structuring programs generically. Supporting languages may use monads to abstract away boilerplate code needed by the program logic.
22
+ >
23
+ > -Wikipedia - [Monad (functional programming)](<https://en.wikipedia.org/wiki/Monad_(functional_programming)>)
24
+
25
+ You don't really have to know what a monad is since the variables provided by this library aren't _really_ monads. Let's take a look at the `window` variable to get a basic understanding. The main purpose of this variable is that it _may be a window_ or it _may be nothing_. You don't know what it is and you shouldn't really care. In case it is a window, you can use it as you're used to. In case it is not a window, you can still use the same functions on the instance. The caring about the existence of the variable is already taken care of.
26
+
27
+ This same concept is applicable to the `document` variable too. You can use the `exists` function in order to check if the variable exists or you are operating on an instance that contains _nothing_.
28
+
29
+ ## Why use monads?
30
+
31
+ This library makes it possible to use these variables without checks with [Gatsby](https://www.gatsbyjs.org) and [NextJS](https://nextjs.org/). This way of programming splits the defensive part from your own code, since you don't have to care anymore about the environment in which you are running. This makes it especially useful with server-side rendering. More info about the `nothing`-type can be found [here](https://github.com/slmgc/Nothing).
32
+
33
+ ## Example
34
+
35
+ ```js
36
+ import { window, document, exists } from 'browser-monads';
37
+
38
+ // inside browser ? window.location.href : ''
39
+ window.location.href;
40
+
41
+ // inside browser ? document.getElementById("myId") : ''
42
+ document.getElementById('myId');
43
+
44
+ // inside browser ? true : false
45
+ exists(window);
46
+ ```
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var n,t=((n=function(){return t}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return""},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(e,o){return e.hasOwnProperty(o)?e[o]:t}})),l=function(e){return e===t};let r=global.window,i=global.document,u=global.navigator,a=typeof i<"u"?i:t,d=e=>!l(e),f=typeof u<"u"?u:t,c=typeof r<"u"?r:t;exports.document=a;exports.exists=d;exports.navigator=f;exports.window=c;
2
+ //# sourceMappingURL=browser-monads-ts.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-monads-ts.cjs.js","sources":["../node_modules/nothing-mock/dist/nothing-mock.es.js","../src/index.ts"],"sourcesContent":["var n,r=((n=function(){return r}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return\"\"},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:r}})),t=function(n){return!(!n||!n.valueOf())},u=function(n){return n===r},e=function(n){return!(n===r||null==n)},o=function(n){return JSON.stringify(n,function(n,t){return t===r?null:t})},i=function(n){return JSON.parse(n,function(n,t){return null===t?r:t})};export{r as Nothing,i as deserialize,u as isNothing,e as isSomething,o as serialize,t as toBool};\n//# sourceMappingURL=nothing-mock.es.js.map\n","// Dependencies\nimport { Nothing, isNothing } from 'nothing-mock';\n\nlet win = global.window;\nlet doc = global.document;\nlet nav = global.navigator;\n\nexport let document: Document = typeof doc !== 'undefined' ? doc : Nothing;\nexport let exists = (variable: any) => !isNothing(variable);\nexport let navigator: Navigator = typeof nav !== 'undefined' ? nav : Nothing;\nexport let window: Window = typeof win !== 'undefined' ? win : Nothing;\n"],"names":["Nothing","isNothing"],"mappings":"4GAAG,GAAC,GAAE,EAAI,IAAE,UAAU,CAAC,MAAO,EAAC,GAAG,SAAS,EAAE,eAAe,EAAE,OAAO,aAAa,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,UAAU,CAAC,MAAM,EAAE,EAAE,GAAI,OAAM,OAAO,OAAO,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,EAAE,CAAC,MAAO,GAAE,eAAe,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,GAA4C,EAAE,SAAS,EAAE,CAAC,MAAO,KAAI,CAAC,ECG7R,GAAI,GAAM,OAAO,OACb,EAAM,OAAO,SACb,EAAM,OAAO,UAEN,EAAqB,MAAO,GAAQ,IAAc,EAAMA,EACxD,EAAS,AAAC,GAAkB,CAACC,EAAU,CAAQ,EAC/C,EAAuB,MAAO,GAAQ,IAAc,EAAMD,EAC1D,EAAiB,MAAO,GAAQ,IAAc,EAAMA"}