@windrun-huaiin/backend-core 14.6.0 → 15.1.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 (281) hide show
  1. package/dist/app/api/stripe/checkout/route.js +2 -2
  2. package/dist/app/api/stripe/checkout/route.mjs +1 -1
  3. package/dist/app/api/stripe/customer-portal/route.js +2 -2
  4. package/dist/app/api/stripe/customer-portal/route.mjs +1 -1
  5. package/dist/app/api/user/anonymous/init/route.js +6 -6
  6. package/dist/app/api/user/anonymous/init/route.mjs +1 -1
  7. package/dist/app/api/webhook/clerk/user/route.js +4 -4
  8. package/dist/app/api/webhook/clerk/user/route.mjs +1 -1
  9. package/dist/app/api/webhook/stripe/route.js +2 -2
  10. package/dist/app/api/webhook/stripe/route.mjs +1 -1
  11. package/dist/auth/auth-middleware.js +3 -3
  12. package/dist/auth/auth-middleware.mjs +1 -1
  13. package/dist/auth/auth-utils.js +10 -10
  14. package/dist/auth/auth-utils.mjs +1 -1
  15. package/dist/lib/money-price-helper.js +3 -3
  16. package/dist/lib/money-price-helper.mjs +1 -1
  17. package/dist/lib/stripe-config.js +8 -8
  18. package/dist/lib/stripe-config.mjs +1 -1
  19. package/dist/lib/upstash/qstash.js +12 -12
  20. package/dist/lib/upstash/qstash.mjs +2 -2
  21. package/dist/lib/upstash/redis-counter.js +7 -7
  22. package/dist/lib/upstash/redis-counter.mjs +1 -1
  23. package/dist/lib/upstash/redis-favorite.js +9 -9
  24. package/dist/lib/upstash/redis-favorite.mjs +1 -1
  25. package/dist/lib/upstash/redis-like.js +9 -9
  26. package/dist/lib/upstash/redis-like.mjs +1 -1
  27. package/dist/lib/upstash/redis-lock.js +6 -6
  28. package/dist/lib/upstash/redis-lock.mjs +1 -1
  29. package/dist/lib/upstash/redis-structures.js +25 -25
  30. package/dist/lib/upstash/redis-structures.mjs +1 -1
  31. package/dist/lib/upstash-config.js +14 -14
  32. package/dist/lib/upstash-config.mjs +4 -4
  33. package/dist/prisma/prisma-transaction-util.js +2 -2
  34. package/dist/prisma/prisma-transaction-util.mjs +1 -1
  35. package/dist/services/aggregate/anonymous.aggregate.service.js +6 -6
  36. package/dist/services/aggregate/anonymous.aggregate.service.mjs +1 -1
  37. package/dist/services/aggregate/billing.aggregate.service.js +21 -21
  38. package/dist/services/aggregate/billing.aggregate.service.mjs +1 -1
  39. package/dist/services/aggregate/user.aggregate.service.js +10 -10
  40. package/dist/services/aggregate/user.aggregate.service.mjs +1 -1
  41. package/dist/services/context/user-context-service.js +3 -3
  42. package/dist/services/context/user-context-service.mjs +1 -1
  43. package/dist/services/database/apilog.service.js +14 -14
  44. package/dist/services/database/apilog.service.mjs +1 -1
  45. package/dist/services/database/credit.service.js +20 -20
  46. package/dist/services/database/credit.service.mjs +1 -1
  47. package/dist/services/database/creditAuditLog.service.js +13 -13
  48. package/dist/services/database/creditAuditLog.service.mjs +1 -1
  49. package/dist/services/database/subscription.service.js +16 -16
  50. package/dist/services/database/subscription.service.mjs +1 -1
  51. package/dist/services/database/transaction.service.js +18 -18
  52. package/dist/services/database/transaction.service.mjs +1 -1
  53. package/dist/services/database/user.service.js +14 -14
  54. package/dist/services/database/user.service.mjs +1 -1
  55. package/dist/services/database/userBackup.service.js +15 -15
  56. package/dist/services/database/userBackup.service.mjs +1 -1
  57. package/dist/services/stripe/webhook-handler.js +13 -13
  58. package/dist/services/stripe/webhook-handler.mjs +3 -3
  59. package/package.json +6 -3
  60. package/dist/_virtual/_commonjs-dynamic-modules.js +0 -7
  61. package/dist/_virtual/_commonjs-dynamic-modules.mjs +0 -5
  62. package/dist/_virtual/_commonjsHelpers.js +0 -10
  63. package/dist/_virtual/_commonjsHelpers.mjs +0 -7
  64. package/dist/_virtual/aes.js +0 -5
  65. package/dist/_virtual/aes.mjs +0 -3
  66. package/dist/_virtual/blowfish.js +0 -5
  67. package/dist/_virtual/blowfish.mjs +0 -3
  68. package/dist/_virtual/cipher-core.js +0 -5
  69. package/dist/_virtual/cipher-core.mjs +0 -3
  70. package/dist/_virtual/core.js +0 -5
  71. package/dist/_virtual/core.mjs +0 -3
  72. package/dist/_virtual/enc-base64.js +0 -5
  73. package/dist/_virtual/enc-base64.mjs +0 -3
  74. package/dist/_virtual/enc-base64url.js +0 -5
  75. package/dist/_virtual/enc-base64url.mjs +0 -3
  76. package/dist/_virtual/enc-utf16.js +0 -5
  77. package/dist/_virtual/enc-utf16.mjs +0 -3
  78. package/dist/_virtual/evpkdf.js +0 -5
  79. package/dist/_virtual/evpkdf.mjs +0 -3
  80. package/dist/_virtual/format-hex.js +0 -5
  81. package/dist/_virtual/format-hex.mjs +0 -3
  82. package/dist/_virtual/hmac.js +0 -5
  83. package/dist/_virtual/hmac.mjs +0 -3
  84. package/dist/_virtual/index.js +0 -11
  85. package/dist/_virtual/index.mjs +0 -7
  86. package/dist/_virtual/index2.js +0 -5
  87. package/dist/_virtual/index2.mjs +0 -3
  88. package/dist/_virtual/lib-typedarrays.js +0 -5
  89. package/dist/_virtual/lib-typedarrays.mjs +0 -3
  90. package/dist/_virtual/md5.js +0 -5
  91. package/dist/_virtual/md5.mjs +0 -3
  92. package/dist/_virtual/mode-cfb.js +0 -5
  93. package/dist/_virtual/mode-cfb.mjs +0 -3
  94. package/dist/_virtual/mode-ctr-gladman.js +0 -5
  95. package/dist/_virtual/mode-ctr-gladman.mjs +0 -3
  96. package/dist/_virtual/mode-ctr.js +0 -5
  97. package/dist/_virtual/mode-ctr.mjs +0 -3
  98. package/dist/_virtual/mode-ecb.js +0 -5
  99. package/dist/_virtual/mode-ecb.mjs +0 -3
  100. package/dist/_virtual/mode-ofb.js +0 -5
  101. package/dist/_virtual/mode-ofb.mjs +0 -3
  102. package/dist/_virtual/pad-ansix923.js +0 -5
  103. package/dist/_virtual/pad-ansix923.mjs +0 -3
  104. package/dist/_virtual/pad-iso10126.js +0 -5
  105. package/dist/_virtual/pad-iso10126.mjs +0 -3
  106. package/dist/_virtual/pad-iso97971.js +0 -5
  107. package/dist/_virtual/pad-iso97971.mjs +0 -3
  108. package/dist/_virtual/pad-nopadding.js +0 -5
  109. package/dist/_virtual/pad-nopadding.mjs +0 -3
  110. package/dist/_virtual/pad-zeropadding.js +0 -5
  111. package/dist/_virtual/pad-zeropadding.mjs +0 -3
  112. package/dist/_virtual/pbkdf2.js +0 -5
  113. package/dist/_virtual/pbkdf2.mjs +0 -3
  114. package/dist/_virtual/rabbit-legacy.js +0 -5
  115. package/dist/_virtual/rabbit-legacy.mjs +0 -3
  116. package/dist/_virtual/rabbit.js +0 -5
  117. package/dist/_virtual/rabbit.mjs +0 -3
  118. package/dist/_virtual/rc4.js +0 -5
  119. package/dist/_virtual/rc4.mjs +0 -3
  120. package/dist/_virtual/ripemd160.js +0 -5
  121. package/dist/_virtual/ripemd160.mjs +0 -3
  122. package/dist/_virtual/sha1.js +0 -5
  123. package/dist/_virtual/sha1.mjs +0 -3
  124. package/dist/_virtual/sha224.js +0 -5
  125. package/dist/_virtual/sha224.mjs +0 -3
  126. package/dist/_virtual/sha256.js +0 -5
  127. package/dist/_virtual/sha256.mjs +0 -3
  128. package/dist/_virtual/sha3.js +0 -5
  129. package/dist/_virtual/sha3.mjs +0 -3
  130. package/dist/_virtual/sha384.js +0 -5
  131. package/dist/_virtual/sha384.mjs +0 -3
  132. package/dist/_virtual/sha512.js +0 -5
  133. package/dist/_virtual/sha512.mjs +0 -3
  134. package/dist/_virtual/tripledes.js +0 -5
  135. package/dist/_virtual/tripledes.mjs +0 -3
  136. package/dist/_virtual/x64-core.js +0 -5
  137. package/dist/_virtual/x64-core.mjs +0 -3
  138. package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +0 -48
  139. package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs +0 -45
  140. package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.js +0 -1848
  141. package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.mjs +0 -1830
  142. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.js +0 -5308
  143. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.mjs +0 -5302
  144. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.js +0 -116
  145. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.mjs +0 -113
  146. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js +0 -248
  147. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.mjs +0 -246
  148. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.js +0 -485
  149. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.mjs +0 -483
  150. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.js +0 -906
  151. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.mjs +0 -904
  152. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.js +0 -818
  153. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.mjs +0 -816
  154. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.js +0 -146
  155. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.mjs +0 -144
  156. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.js +0 -158
  157. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.mjs +0 -156
  158. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.js +0 -159
  159. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.mjs +0 -157
  160. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.js +0 -146
  161. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.mjs +0 -144
  162. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.js +0 -77
  163. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.mjs +0 -75
  164. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.js +0 -153
  165. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.mjs +0 -151
  166. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.js +0 -62
  167. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +0 -60
  168. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.js +0 -86
  169. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.mjs +0 -84
  170. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.js +0 -278
  171. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.mjs +0 -276
  172. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.js +0 -91
  173. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.mjs +0 -89
  174. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.js +0 -127
  175. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.mjs +0 -125
  176. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.js +0 -69
  177. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.mjs +0 -67
  178. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js +0 -51
  179. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.mjs +0 -49
  180. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.js +0 -65
  181. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.mjs +0 -63
  182. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.js +0 -60
  183. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.mjs +0 -58
  184. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.js +0 -55
  185. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.mjs +0 -53
  186. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.js +0 -51
  187. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.mjs +0 -49
  188. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.js +0 -41
  189. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.mjs +0 -39
  190. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.js +0 -58
  191. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.mjs +0 -56
  192. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.js +0 -157
  193. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.mjs +0 -155
  194. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.js +0 -204
  195. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.mjs +0 -202
  196. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.js +0 -206
  197. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.mjs +0 -204
  198. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.js +0 -153
  199. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.mjs +0 -151
  200. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.js +0 -277
  201. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.mjs +0 -275
  202. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.js +0 -160
  203. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.mjs +0 -158
  204. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.js +0 -91
  205. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.mjs +0 -89
  206. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.js +0 -209
  207. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.mjs +0 -207
  208. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.js +0 -337
  209. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.mjs +0 -335
  210. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.js +0 -95
  211. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.mjs +0 -93
  212. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.js +0 -337
  213. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.mjs +0 -335
  214. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.js +0 -793
  215. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.mjs +0 -791
  216. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.js +0 -314
  217. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.mjs +0 -312
  218. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.js +0 -26
  219. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.mjs +0 -24
  220. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js +0 -127
  221. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.mjs +0 -125
  222. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js +0 -20
  223. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.mjs +0 -18
  224. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js +0 -31
  225. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.mjs +0 -29
  226. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.js +0 -18
  227. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.mjs +0 -14
  228. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.js +0 -82
  229. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.mjs +0 -80
  230. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.js +0 -103
  231. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.mjs +0 -101
  232. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js +0 -7
  233. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.mjs +0 -3
  234. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.js +0 -38
  235. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.mjs +0 -33
  236. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js +0 -27
  237. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.mjs +0 -23
  238. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js +0 -21
  239. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.mjs +0 -16
  240. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js +0 -22
  241. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.mjs +0 -18
  242. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js +0 -111
  243. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.mjs +0 -107
  244. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js +0 -61
  245. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.mjs +0 -57
  246. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js +0 -16
  247. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.mjs +0 -12
  248. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js +0 -40
  249. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.mjs +0 -36
  250. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js +0 -15
  251. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.mjs +0 -13
  252. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js +0 -23
  253. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.mjs +0 -19
  254. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js +0 -30
  255. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.mjs +0 -26
  256. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js +0 -60
  257. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.mjs +0 -56
  258. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js +0 -35
  259. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.mjs +0 -31
  260. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js +0 -20
  261. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.mjs +0 -16
  262. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js +0 -15
  263. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.mjs +0 -10
  264. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js +0 -28
  265. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.mjs +0 -5
  266. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js +0 -14
  267. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.mjs +0 -10
  268. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js +0 -115
  269. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.mjs +0 -111
  270. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js +0 -42
  271. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.mjs +0 -19
  272. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js +0 -54
  273. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.mjs +0 -31
  274. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.js +0 -32
  275. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.mjs +0 -7
  276. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.js +0 -69
  277. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.mjs +0 -60
  278. package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.js +0 -422
  279. package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.mjs +0 -415
  280. package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.js +0 -6
  281. package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.mjs +0 -4
@@ -1,101 +0,0 @@
1
- function unusable(name, prop = 'algorithm.name') {
2
- return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
3
- }
4
- function isAlgorithm(algorithm, name) {
5
- return algorithm.name === name;
6
- }
7
- function getHashLength(hash) {
8
- return parseInt(hash.name.slice(4), 10);
9
- }
10
- function getNamedCurve(alg) {
11
- switch (alg) {
12
- case 'ES256':
13
- return 'P-256';
14
- case 'ES384':
15
- return 'P-384';
16
- case 'ES512':
17
- return 'P-521';
18
- default:
19
- throw new Error('unreachable');
20
- }
21
- }
22
- function checkUsage(key, usages) {
23
- if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {
24
- let msg = 'CryptoKey does not support this operation, its usages must include ';
25
- if (usages.length > 2) {
26
- const last = usages.pop();
27
- msg += `one of ${usages.join(', ')}, or ${last}.`;
28
- }
29
- else if (usages.length === 2) {
30
- msg += `one of ${usages[0]} or ${usages[1]}.`;
31
- }
32
- else {
33
- msg += `${usages[0]}.`;
34
- }
35
- throw new TypeError(msg);
36
- }
37
- }
38
- function checkSigCryptoKey(key, alg, ...usages) {
39
- switch (alg) {
40
- case 'HS256':
41
- case 'HS384':
42
- case 'HS512': {
43
- if (!isAlgorithm(key.algorithm, 'HMAC'))
44
- throw unusable('HMAC');
45
- const expected = parseInt(alg.slice(2), 10);
46
- const actual = getHashLength(key.algorithm.hash);
47
- if (actual !== expected)
48
- throw unusable(`SHA-${expected}`, 'algorithm.hash');
49
- break;
50
- }
51
- case 'RS256':
52
- case 'RS384':
53
- case 'RS512': {
54
- if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5'))
55
- throw unusable('RSASSA-PKCS1-v1_5');
56
- const expected = parseInt(alg.slice(2), 10);
57
- const actual = getHashLength(key.algorithm.hash);
58
- if (actual !== expected)
59
- throw unusable(`SHA-${expected}`, 'algorithm.hash');
60
- break;
61
- }
62
- case 'PS256':
63
- case 'PS384':
64
- case 'PS512': {
65
- if (!isAlgorithm(key.algorithm, 'RSA-PSS'))
66
- throw unusable('RSA-PSS');
67
- const expected = parseInt(alg.slice(2), 10);
68
- const actual = getHashLength(key.algorithm.hash);
69
- if (actual !== expected)
70
- throw unusable(`SHA-${expected}`, 'algorithm.hash');
71
- break;
72
- }
73
- case 'EdDSA': {
74
- if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {
75
- throw unusable('Ed25519 or Ed448');
76
- }
77
- break;
78
- }
79
- case 'Ed25519': {
80
- if (!isAlgorithm(key.algorithm, 'Ed25519'))
81
- throw unusable('Ed25519');
82
- break;
83
- }
84
- case 'ES256':
85
- case 'ES384':
86
- case 'ES512': {
87
- if (!isAlgorithm(key.algorithm, 'ECDSA'))
88
- throw unusable('ECDSA');
89
- const expected = getNamedCurve(alg);
90
- const actual = key.algorithm.namedCurve;
91
- if (actual !== expected)
92
- throw unusable(expected, 'algorithm.namedCurve');
93
- break;
94
- }
95
- default:
96
- throw new TypeError('CryptoKey does not support this operation');
97
- }
98
- checkUsage(key, usages);
99
- }
100
-
101
- export { checkSigCryptoKey };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var epoch = (date) => Math.floor(date.getTime() / 1000);
6
-
7
- exports.default = epoch;
@@ -1,3 +0,0 @@
1
- var epoch = (date) => Math.floor(date.getTime() / 1000);
2
-
3
- export { epoch as default };
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function message(msg, actual, ...types) {
6
- types = types.filter(Boolean);
7
- if (types.length > 2) {
8
- const last = types.pop();
9
- msg += `one of type ${types.join(', ')}, or ${last}.`;
10
- }
11
- else if (types.length === 2) {
12
- msg += `one of type ${types[0]} or ${types[1]}.`;
13
- }
14
- else {
15
- msg += `of type ${types[0]}.`;
16
- }
17
- if (actual == null) {
18
- msg += ` Received ${actual}`;
19
- }
20
- else if (typeof actual === 'function' && actual.name) {
21
- msg += ` Received function ${actual.name}`;
22
- }
23
- else if (typeof actual === 'object' && actual != null) {
24
- if (actual.constructor?.name) {
25
- msg += ` Received an instance of ${actual.constructor.name}`;
26
- }
27
- }
28
- return msg;
29
- }
30
- var invalidKeyInput = (actual, ...types) => {
31
- return message('Key must be ', actual, ...types);
32
- };
33
- function withAlg(alg, actual, ...types) {
34
- return message(`Key for the ${alg} algorithm must be `, actual, ...types);
35
- }
36
-
37
- exports.default = invalidKeyInput;
38
- exports.withAlg = withAlg;
@@ -1,33 +0,0 @@
1
- function message(msg, actual, ...types) {
2
- types = types.filter(Boolean);
3
- if (types.length > 2) {
4
- const last = types.pop();
5
- msg += `one of type ${types.join(', ')}, or ${last}.`;
6
- }
7
- else if (types.length === 2) {
8
- msg += `one of type ${types[0]} or ${types[1]}.`;
9
- }
10
- else {
11
- msg += `of type ${types[0]}.`;
12
- }
13
- if (actual == null) {
14
- msg += ` Received ${actual}`;
15
- }
16
- else if (typeof actual === 'function' && actual.name) {
17
- msg += ` Received function ${actual.name}`;
18
- }
19
- else if (typeof actual === 'object' && actual != null) {
20
- if (actual.constructor?.name) {
21
- msg += ` Received an instance of ${actual.constructor.name}`;
22
- }
23
- }
24
- return msg;
25
- }
26
- var invalidKeyInput = (actual, ...types) => {
27
- return message('Key must be ', actual, ...types);
28
- };
29
- function withAlg(alg, actual, ...types) {
30
- return message(`Key for the ${alg} algorithm must be `, actual, ...types);
31
- }
32
-
33
- export { invalidKeyInput as default, withAlg };
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const isDisjoint = (...headers) => {
6
- const sources = headers.filter(Boolean);
7
- if (sources.length === 0 || sources.length === 1) {
8
- return true;
9
- }
10
- let acc;
11
- for (const header of sources) {
12
- const parameters = Object.keys(header);
13
- if (!acc || acc.size === 0) {
14
- acc = new Set(parameters);
15
- continue;
16
- }
17
- for (const parameter of parameters) {
18
- if (acc.has(parameter)) {
19
- return false;
20
- }
21
- acc.add(parameter);
22
- }
23
- }
24
- return true;
25
- };
26
-
27
- exports.default = isDisjoint;
@@ -1,23 +0,0 @@
1
- const isDisjoint = (...headers) => {
2
- const sources = headers.filter(Boolean);
3
- if (sources.length === 0 || sources.length === 1) {
4
- return true;
5
- }
6
- let acc;
7
- for (const header of sources) {
8
- const parameters = Object.keys(header);
9
- if (!acc || acc.size === 0) {
10
- acc = new Set(parameters);
11
- continue;
12
- }
13
- for (const parameter of parameters) {
14
- if (acc.has(parameter)) {
15
- return false;
16
- }
17
- acc.add(parameter);
18
- }
19
- }
20
- return true;
21
- };
22
-
23
- export { isDisjoint as default };
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- var is_object = require('./is_object.js');
4
-
5
- function isJWK(key) {
6
- return is_object.default(key) && typeof key.kty === 'string';
7
- }
8
- function isPrivateJWK(key) {
9
- return key.kty !== 'oct' && typeof key.d === 'string';
10
- }
11
- function isPublicJWK(key) {
12
- return key.kty !== 'oct' && typeof key.d === 'undefined';
13
- }
14
- function isSecretJWK(key) {
15
- return isJWK(key) && key.kty === 'oct' && typeof key.k === 'string';
16
- }
17
-
18
- exports.isJWK = isJWK;
19
- exports.isPrivateJWK = isPrivateJWK;
20
- exports.isPublicJWK = isPublicJWK;
21
- exports.isSecretJWK = isSecretJWK;
@@ -1,16 +0,0 @@
1
- import isObject from './is_object.mjs';
2
-
3
- function isJWK(key) {
4
- return isObject(key) && typeof key.kty === 'string';
5
- }
6
- function isPrivateJWK(key) {
7
- return key.kty !== 'oct' && typeof key.d === 'string';
8
- }
9
- function isPublicJWK(key) {
10
- return key.kty !== 'oct' && typeof key.d === 'undefined';
11
- }
12
- function isSecretJWK(key) {
13
- return isJWK(key) && key.kty === 'oct' && typeof key.k === 'string';
14
- }
15
-
16
- export { isJWK, isPrivateJWK, isPublicJWK, isSecretJWK };
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function isObjectLike(value) {
6
- return typeof value === 'object' && value !== null;
7
- }
8
- function isObject(input) {
9
- if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {
10
- return false;
11
- }
12
- if (Object.getPrototypeOf(input) === null) {
13
- return true;
14
- }
15
- let proto = input;
16
- while (Object.getPrototypeOf(proto) !== null) {
17
- proto = Object.getPrototypeOf(proto);
18
- }
19
- return Object.getPrototypeOf(input) === proto;
20
- }
21
-
22
- exports.default = isObject;
@@ -1,18 +0,0 @@
1
- function isObjectLike(value) {
2
- return typeof value === 'object' && value !== null;
3
- }
4
- function isObject(input) {
5
- if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {
6
- return false;
7
- }
8
- if (Object.getPrototypeOf(input) === null) {
9
- return true;
10
- }
11
- let proto = input;
12
- while (Object.getPrototypeOf(proto) !== null) {
13
- proto = Object.getPrototypeOf(proto);
14
- }
15
- return Object.getPrototypeOf(input) === proto;
16
- }
17
-
18
- export { isObject as default };
@@ -1,111 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var errors = require('../util/errors.js');
6
- var buffer_utils = require('./buffer_utils.js');
7
- var epoch = require('./epoch.js');
8
- var secs = require('./secs.js');
9
- var is_object = require('./is_object.js');
10
-
11
- const normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, '');
12
- const checkAudiencePresence = (audPayload, audOption) => {
13
- if (typeof audPayload === 'string') {
14
- return audOption.includes(audPayload);
15
- }
16
- if (Array.isArray(audPayload)) {
17
- return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
18
- }
19
- return false;
20
- };
21
- var jwtPayload = (protectedHeader, encodedPayload, options = {}) => {
22
- let payload;
23
- try {
24
- payload = JSON.parse(buffer_utils.decoder.decode(encodedPayload));
25
- }
26
- catch {
27
- }
28
- if (!is_object.default(payload)) {
29
- throw new errors.JWTInvalid('JWT Claims Set must be a top-level JSON object');
30
- }
31
- const { typ } = options;
32
- if (typ &&
33
- (typeof protectedHeader.typ !== 'string' ||
34
- normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
35
- throw new errors.JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, 'typ', 'check_failed');
36
- }
37
- const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
38
- const presenceCheck = [...requiredClaims];
39
- if (maxTokenAge !== undefined)
40
- presenceCheck.push('iat');
41
- if (audience !== undefined)
42
- presenceCheck.push('aud');
43
- if (subject !== undefined)
44
- presenceCheck.push('sub');
45
- if (issuer !== undefined)
46
- presenceCheck.push('iss');
47
- for (const claim of new Set(presenceCheck.reverse())) {
48
- if (!(claim in payload)) {
49
- throw new errors.JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, 'missing');
50
- }
51
- }
52
- if (issuer &&
53
- !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
54
- throw new errors.JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');
55
- }
56
- if (subject && payload.sub !== subject) {
57
- throw new errors.JWTClaimValidationFailed('unexpected "sub" claim value', payload, 'sub', 'check_failed');
58
- }
59
- if (audience &&
60
- !checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) {
61
- throw new errors.JWTClaimValidationFailed('unexpected "aud" claim value', payload, 'aud', 'check_failed');
62
- }
63
- let tolerance;
64
- switch (typeof options.clockTolerance) {
65
- case 'string':
66
- tolerance = secs.default(options.clockTolerance);
67
- break;
68
- case 'number':
69
- tolerance = options.clockTolerance;
70
- break;
71
- case 'undefined':
72
- tolerance = 0;
73
- break;
74
- default:
75
- throw new TypeError('Invalid clockTolerance option type');
76
- }
77
- const { currentDate } = options;
78
- const now = epoch.default(currentDate || new Date());
79
- if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== 'number') {
80
- throw new errors.JWTClaimValidationFailed('"iat" claim must be a number', payload, 'iat', 'invalid');
81
- }
82
- if (payload.nbf !== undefined) {
83
- if (typeof payload.nbf !== 'number') {
84
- throw new errors.JWTClaimValidationFailed('"nbf" claim must be a number', payload, 'nbf', 'invalid');
85
- }
86
- if (payload.nbf > now + tolerance) {
87
- throw new errors.JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, 'nbf', 'check_failed');
88
- }
89
- }
90
- if (payload.exp !== undefined) {
91
- if (typeof payload.exp !== 'number') {
92
- throw new errors.JWTClaimValidationFailed('"exp" claim must be a number', payload, 'exp', 'invalid');
93
- }
94
- if (payload.exp <= now - tolerance) {
95
- throw new errors.JWTExpired('"exp" claim timestamp check failed', payload, 'exp', 'check_failed');
96
- }
97
- }
98
- if (maxTokenAge) {
99
- const age = now - payload.iat;
100
- const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs.default(maxTokenAge);
101
- if (age - tolerance > max) {
102
- throw new errors.JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, 'iat', 'check_failed');
103
- }
104
- if (age < 0 - tolerance) {
105
- throw new errors.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, 'iat', 'check_failed');
106
- }
107
- }
108
- return payload;
109
- };
110
-
111
- exports.default = jwtPayload;
@@ -1,107 +0,0 @@
1
- import { JWTInvalid, JWTClaimValidationFailed, JWTExpired } from '../util/errors.mjs';
2
- import { decoder } from './buffer_utils.mjs';
3
- import epoch from './epoch.mjs';
4
- import secs from './secs.mjs';
5
- import isObject from './is_object.mjs';
6
-
7
- const normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, '');
8
- const checkAudiencePresence = (audPayload, audOption) => {
9
- if (typeof audPayload === 'string') {
10
- return audOption.includes(audPayload);
11
- }
12
- if (Array.isArray(audPayload)) {
13
- return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
14
- }
15
- return false;
16
- };
17
- var jwtPayload = (protectedHeader, encodedPayload, options = {}) => {
18
- let payload;
19
- try {
20
- payload = JSON.parse(decoder.decode(encodedPayload));
21
- }
22
- catch {
23
- }
24
- if (!isObject(payload)) {
25
- throw new JWTInvalid('JWT Claims Set must be a top-level JSON object');
26
- }
27
- const { typ } = options;
28
- if (typ &&
29
- (typeof protectedHeader.typ !== 'string' ||
30
- normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
31
- throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, 'typ', 'check_failed');
32
- }
33
- const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
34
- const presenceCheck = [...requiredClaims];
35
- if (maxTokenAge !== undefined)
36
- presenceCheck.push('iat');
37
- if (audience !== undefined)
38
- presenceCheck.push('aud');
39
- if (subject !== undefined)
40
- presenceCheck.push('sub');
41
- if (issuer !== undefined)
42
- presenceCheck.push('iss');
43
- for (const claim of new Set(presenceCheck.reverse())) {
44
- if (!(claim in payload)) {
45
- throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, 'missing');
46
- }
47
- }
48
- if (issuer &&
49
- !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
50
- throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, 'iss', 'check_failed');
51
- }
52
- if (subject && payload.sub !== subject) {
53
- throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload, 'sub', 'check_failed');
54
- }
55
- if (audience &&
56
- !checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) {
57
- throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload, 'aud', 'check_failed');
58
- }
59
- let tolerance;
60
- switch (typeof options.clockTolerance) {
61
- case 'string':
62
- tolerance = secs(options.clockTolerance);
63
- break;
64
- case 'number':
65
- tolerance = options.clockTolerance;
66
- break;
67
- case 'undefined':
68
- tolerance = 0;
69
- break;
70
- default:
71
- throw new TypeError('Invalid clockTolerance option type');
72
- }
73
- const { currentDate } = options;
74
- const now = epoch(currentDate || new Date());
75
- if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== 'number') {
76
- throw new JWTClaimValidationFailed('"iat" claim must be a number', payload, 'iat', 'invalid');
77
- }
78
- if (payload.nbf !== undefined) {
79
- if (typeof payload.nbf !== 'number') {
80
- throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload, 'nbf', 'invalid');
81
- }
82
- if (payload.nbf > now + tolerance) {
83
- throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, 'nbf', 'check_failed');
84
- }
85
- }
86
- if (payload.exp !== undefined) {
87
- if (typeof payload.exp !== 'number') {
88
- throw new JWTClaimValidationFailed('"exp" claim must be a number', payload, 'exp', 'invalid');
89
- }
90
- if (payload.exp <= now - tolerance) {
91
- throw new JWTExpired('"exp" claim timestamp check failed', payload, 'exp', 'check_failed');
92
- }
93
- }
94
- if (maxTokenAge) {
95
- const age = now - payload.iat;
96
- const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge);
97
- if (age - tolerance > max) {
98
- throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, 'iat', 'check_failed');
99
- }
100
- if (age < 0 - tolerance) {
101
- throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, 'iat', 'check_failed');
102
- }
103
- }
104
- return payload;
105
- };
106
-
107
- export { jwtPayload as default };
@@ -1,61 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const minute = 60;
6
- const hour = minute * 60;
7
- const day = hour * 24;
8
- const week = day * 7;
9
- const year = day * 365.25;
10
- const REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
11
- var secs = (str) => {
12
- const matched = REGEX.exec(str);
13
- if (!matched || (matched[4] && matched[1])) {
14
- throw new TypeError('Invalid time period format');
15
- }
16
- const value = parseFloat(matched[2]);
17
- const unit = matched[3].toLowerCase();
18
- let numericDate;
19
- switch (unit) {
20
- case 'sec':
21
- case 'secs':
22
- case 'second':
23
- case 'seconds':
24
- case 's':
25
- numericDate = Math.round(value);
26
- break;
27
- case 'minute':
28
- case 'minutes':
29
- case 'min':
30
- case 'mins':
31
- case 'm':
32
- numericDate = Math.round(value * minute);
33
- break;
34
- case 'hour':
35
- case 'hours':
36
- case 'hr':
37
- case 'hrs':
38
- case 'h':
39
- numericDate = Math.round(value * hour);
40
- break;
41
- case 'day':
42
- case 'days':
43
- case 'd':
44
- numericDate = Math.round(value * day);
45
- break;
46
- case 'week':
47
- case 'weeks':
48
- case 'w':
49
- numericDate = Math.round(value * week);
50
- break;
51
- default:
52
- numericDate = Math.round(value * year);
53
- break;
54
- }
55
- if (matched[1] === '-' || matched[4] === 'ago') {
56
- return -numericDate;
57
- }
58
- return numericDate;
59
- };
60
-
61
- exports.default = secs;
@@ -1,57 +0,0 @@
1
- const minute = 60;
2
- const hour = minute * 60;
3
- const day = hour * 24;
4
- const week = day * 7;
5
- const year = day * 365.25;
6
- const REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
7
- var secs = (str) => {
8
- const matched = REGEX.exec(str);
9
- if (!matched || (matched[4] && matched[1])) {
10
- throw new TypeError('Invalid time period format');
11
- }
12
- const value = parseFloat(matched[2]);
13
- const unit = matched[3].toLowerCase();
14
- let numericDate;
15
- switch (unit) {
16
- case 'sec':
17
- case 'secs':
18
- case 'second':
19
- case 'seconds':
20
- case 's':
21
- numericDate = Math.round(value);
22
- break;
23
- case 'minute':
24
- case 'minutes':
25
- case 'min':
26
- case 'mins':
27
- case 'm':
28
- numericDate = Math.round(value * minute);
29
- break;
30
- case 'hour':
31
- case 'hours':
32
- case 'hr':
33
- case 'hrs':
34
- case 'h':
35
- numericDate = Math.round(value * hour);
36
- break;
37
- case 'day':
38
- case 'days':
39
- case 'd':
40
- numericDate = Math.round(value * day);
41
- break;
42
- case 'week':
43
- case 'weeks':
44
- case 'w':
45
- numericDate = Math.round(value * week);
46
- break;
47
- default:
48
- numericDate = Math.round(value * year);
49
- break;
50
- }
51
- if (matched[1] === '-' || matched[4] === 'ago') {
52
- return -numericDate;
53
- }
54
- return numericDate;
55
- };
56
-
57
- export { secs as default };
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const validateAlgorithms = (option, algorithms) => {
6
- if (algorithms !== undefined &&
7
- (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))) {
8
- throw new TypeError(`"${option}" option must be an array of strings`);
9
- }
10
- if (!algorithms) {
11
- return undefined;
12
- }
13
- return new Set(algorithms);
14
- };
15
-
16
- exports.default = validateAlgorithms;