@suveren/gateway 0.40.0 → 0.41.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 (300) hide show
  1. package/dist/control-plane/index.mjs +182 -37
  2. package/dist/mcp-server/http.mjs +355 -71
  3. package/dist/ui/assets/{index-C-lA_7Lt.js → index-CO-dj98E.js} +27 -27
  4. package/dist/ui/index.html +1 -1
  5. package/node_modules/@hap/core/README.md +3 -3
  6. package/node_modules/@hap/core/dist/index.d.mts +567 -123
  7. package/node_modules/@hap/core/dist/index.d.ts +567 -123
  8. package/node_modules/@hap/core/dist/index.js +869 -23
  9. package/node_modules/@hap/core/dist/index.mjs +829 -22
  10. package/node_modules/@hap/core/node_modules/@hpke/core/LICENSE +21 -0
  11. package/node_modules/@hap/core/node_modules/@hpke/core/README.md +263 -0
  12. package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts +11 -0
  13. package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts.map +1 -0
  14. package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.js +6 -0
  15. package/node_modules/@hap/core/node_modules/@hpke/core/esm/package.json +3 -0
  16. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts +80 -0
  17. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts.map +1 -0
  18. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.js +167 -0
  19. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts +34 -0
  20. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts.map +1 -0
  21. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.js +56 -0
  22. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts +145 -0
  23. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts.map +1 -0
  24. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.js +326 -0
  25. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts +15 -0
  26. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts.map +1 -0
  27. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.js +68 -0
  28. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts +19 -0
  29. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts.map +1 -0
  30. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.js +62 -0
  31. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts +17 -0
  32. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts.map +1 -0
  33. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.js +1 -0
  34. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts +13 -0
  35. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
  36. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.js +1 -0
  37. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts +8 -0
  38. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts.map +1 -0
  39. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.js +1 -0
  40. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts +40 -0
  41. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts.map +1 -0
  42. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.js +1 -0
  43. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts +17 -0
  44. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts.map +1 -0
  45. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.js +1 -0
  46. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts +7 -0
  47. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts.map +1 -0
  48. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.js +1 -0
  49. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts +10 -0
  50. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts.map +1 -0
  51. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.js +1 -0
  52. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts +26 -0
  53. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts.map +1 -0
  54. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.js +112 -0
  55. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
  56. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
  57. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +214 -0
  58. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +24 -0
  59. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
  60. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +214 -0
  61. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts +38 -0
  62. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts.map +1 -0
  63. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.js +66 -0
  64. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts +38 -0
  65. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts.map +1 -0
  66. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.js +66 -0
  67. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts +5 -0
  68. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts.map +1 -0
  69. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.js +28 -0
  70. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts +236 -0
  71. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts.map +1 -0
  72. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.js +235 -0
  73. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts +6 -0
  74. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts.map +1 -0
  75. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.js +38 -0
  76. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts +11 -0
  77. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts.map +1 -0
  78. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.js +45 -0
  79. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts +2 -0
  80. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts.map +1 -0
  81. package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js +6 -0
  82. package/node_modules/@hap/core/node_modules/@hpke/core/package.json +46 -0
  83. package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts +11 -0
  84. package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts.map +1 -0
  85. package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.js +47 -0
  86. package/node_modules/@hap/core/node_modules/@hpke/core/script/package.json +3 -0
  87. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts +80 -0
  88. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts.map +1 -0
  89. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.js +183 -0
  90. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts +34 -0
  91. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts.map +1 -0
  92. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.js +70 -0
  93. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts +145 -0
  94. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts.map +1 -0
  95. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.js +340 -0
  96. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts +15 -0
  97. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts.map +1 -0
  98. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.js +82 -0
  99. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts +19 -0
  100. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts.map +1 -0
  101. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.js +78 -0
  102. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts +17 -0
  103. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts.map +1 -0
  104. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.js +12 -0
  105. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts +13 -0
  106. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
  107. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.js +12 -0
  108. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts +8 -0
  109. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts.map +1 -0
  110. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.js +12 -0
  111. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts +40 -0
  112. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts.map +1 -0
  113. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.js +12 -0
  114. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts +17 -0
  115. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts.map +1 -0
  116. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.js +12 -0
  117. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts +7 -0
  118. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts.map +1 -0
  119. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.js +12 -0
  120. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts +10 -0
  121. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts.map +1 -0
  122. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.js +12 -0
  123. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts +26 -0
  124. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts.map +1 -0
  125. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.js +128 -0
  126. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
  127. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
  128. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +228 -0
  129. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +24 -0
  130. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
  131. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +228 -0
  132. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts +38 -0
  133. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts.map +1 -0
  134. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.js +80 -0
  135. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts +38 -0
  136. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts.map +1 -0
  137. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.js +80 -0
  138. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts +5 -0
  139. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts.map +1 -0
  140. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.js +42 -0
  141. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts +236 -0
  142. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts.map +1 -0
  143. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.js +255 -0
  144. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts +6 -0
  145. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts.map +1 -0
  146. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.js +52 -0
  147. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts +11 -0
  148. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts.map +1 -0
  149. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.js +59 -0
  150. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts +2 -0
  151. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts.map +1 -0
  152. package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.js +19 -0
  153. package/node_modules/@hap/core/package.json +2 -1
  154. package/node_modules/@hap/core/src/canonicalize.ts +9 -0
  155. package/node_modules/@hap/core/src/commitment-modes.ts +21 -9
  156. package/node_modules/@hap/core/src/errors.ts +24 -8
  157. package/node_modules/@hap/core/src/gatekeeper.ts +52 -8
  158. package/node_modules/@hap/core/src/index.ts +5 -1
  159. package/node_modules/@hap/core/src/issuance.ts +250 -0
  160. package/node_modules/@hap/core/src/mandate.ts +52 -14
  161. package/node_modules/@hap/core/src/owner-signature.ts +86 -39
  162. package/node_modules/@hap/core/src/profile.ts +45 -0
  163. package/node_modules/@hap/core/src/proposal-content.ts +219 -0
  164. package/node_modules/@hap/core/src/ticket-projection.ts +167 -0
  165. package/node_modules/@hap/core/src/ticket.ts +254 -20
  166. package/node_modules/@hap/core/src/types.ts +33 -5
  167. package/node_modules/@hap/core/src/verifier-policy.ts +178 -0
  168. package/node_modules/@hap/core/src/versions.ts +50 -19
  169. package/node_modules/@hono/node-server/dist/index.cjs +31 -6
  170. package/node_modules/@hono/node-server/dist/index.mjs +31 -6
  171. package/node_modules/@hono/node-server/package.json +1 -1
  172. package/node_modules/@hpke/common/esm/package.json +5 -1
  173. package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts +2 -2
  174. package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts.map +1 -1
  175. package/node_modules/@hpke/common/esm/src/curve/montgomery.js +41 -26
  176. package/node_modules/@hpke/common/esm/src/hash/sha3.d.ts.map +1 -1
  177. package/node_modules/@hpke/common/esm/src/hash/sha3.js +0 -15
  178. package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts +2 -1
  179. package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts.map +1 -1
  180. package/node_modules/@hpke/common/esm/src/kdfs/hkdf.js +12 -2
  181. package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
  182. package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.js +14 -3
  183. package/node_modules/@hpke/common/esm/src/utils/misc.d.ts +6 -0
  184. package/node_modules/@hpke/common/esm/src/utils/misc.d.ts.map +1 -1
  185. package/node_modules/@hpke/common/esm/src/utils/misc.js +43 -10
  186. package/node_modules/@hpke/common/esm/src/utils/noble.d.ts +1 -1
  187. package/node_modules/@hpke/common/esm/src/utils/noble.d.ts.map +1 -1
  188. package/node_modules/@hpke/common/esm/src/utils/noble.js +21 -10
  189. package/node_modules/@hpke/common/package.json +5 -1
  190. package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts +2 -2
  191. package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts.map +1 -1
  192. package/node_modules/@hpke/common/script/src/curve/montgomery.js +40 -25
  193. package/node_modules/@hpke/common/script/src/hash/sha3.d.ts.map +1 -1
  194. package/node_modules/@hpke/common/script/src/hash/sha3.js +0 -15
  195. package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts +2 -1
  196. package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts.map +1 -1
  197. package/node_modules/@hpke/common/script/src/kdfs/hkdf.js +12 -2
  198. package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
  199. package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.js +13 -2
  200. package/node_modules/@hpke/common/script/src/utils/misc.d.ts +6 -0
  201. package/node_modules/@hpke/common/script/src/utils/misc.d.ts.map +1 -1
  202. package/node_modules/@hpke/common/script/src/utils/misc.js +43 -9
  203. package/node_modules/@hpke/common/script/src/utils/noble.d.ts +1 -1
  204. package/node_modules/@hpke/common/script/src/utils/noble.d.ts.map +1 -1
  205. package/node_modules/@hpke/common/script/src/utils/noble.js +22 -11
  206. package/node_modules/@hpke/core/README.md +56 -56
  207. package/node_modules/@hpke/core/esm/package.json +2 -1
  208. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
  209. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
  210. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +3 -201
  211. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +3 -21
  212. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
  213. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +3 -201
  214. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
  215. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
  216. package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.js +216 -0
  217. package/node_modules/@hpke/core/package.json +6 -2
  218. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
  219. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
  220. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +4 -202
  221. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +3 -21
  222. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
  223. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +4 -202
  224. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
  225. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
  226. package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.js +230 -0
  227. package/node_modules/@types/node/README.md +1 -1
  228. package/node_modules/@types/node/package.json +2 -2
  229. package/node_modules/@types/node/zlib.d.ts +752 -0
  230. package/node_modules/encodeurl/README.md +14 -0
  231. package/node_modules/encodeurl/index.js +5 -10
  232. package/node_modules/encodeurl/package.json +10 -6
  233. package/node_modules/express-rate-limit/dist/index.cjs +7 -3
  234. package/node_modules/express-rate-limit/dist/index.mjs +7 -3
  235. package/node_modules/express-rate-limit/package.json +10 -10
  236. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
  237. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
  238. package/node_modules/hono/dist/cjs/context.js +1 -1
  239. package/node_modules/hono/dist/cjs/helper/css/common.js +3 -5
  240. package/node_modules/hono/dist/cjs/hono-base.js +4 -10
  241. package/node_modules/hono/dist/cjs/hono.js +0 -1
  242. package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -1
  243. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
  244. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +2 -2
  245. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +2 -2
  246. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +2 -2
  247. package/node_modules/hono/dist/cjs/middleware/mount/index.js +4 -4
  248. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +13 -11
  249. package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +4 -4
  250. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +39 -51
  251. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +15 -5
  252. package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +2 -1
  253. package/node_modules/hono/dist/cjs/utils/mount.js +35 -0
  254. package/node_modules/hono/dist/cjs/utils/url.js +10 -0
  255. package/node_modules/hono/dist/cjs/validator/validator.js +1 -1
  256. package/node_modules/hono/dist/context.js +1 -1
  257. package/node_modules/hono/dist/helper/css/common.js +3 -5
  258. package/node_modules/hono/dist/hono-base.js +4 -10
  259. package/node_modules/hono/dist/hono.js +0 -1
  260. package/node_modules/hono/dist/middleware/basic-auth/index.js +1 -1
  261. package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
  262. package/node_modules/hono/dist/middleware/csrf/index.js +2 -2
  263. package/node_modules/hono/dist/middleware/jwk/jwk.js +2 -2
  264. package/node_modules/hono/dist/middleware/jwt/jwt.js +2 -2
  265. package/node_modules/hono/dist/middleware/language/language.js +1 -1
  266. package/node_modules/hono/dist/middleware/mount/index.js +4 -4
  267. package/node_modules/hono/dist/router/reg-exp-router/node.js +13 -11
  268. package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +5 -5
  269. package/node_modules/hono/dist/router/reg-exp-router/router.js +40 -52
  270. package/node_modules/hono/dist/router/reg-exp-router/trie.js +15 -5
  271. package/node_modules/hono/dist/types/middleware/mount/index.d.ts +1 -0
  272. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -3
  273. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +1 -1
  274. package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
  275. package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
  276. package/node_modules/hono/dist/utils/jwt/jwt.js +2 -1
  277. package/node_modules/hono/dist/utils/mount.js +34 -0
  278. package/node_modules/hono/dist/utils/url.js +10 -1
  279. package/node_modules/hono/dist/validator/validator.js +1 -1
  280. package/node_modules/hono/package.json +1 -1
  281. package/node_modules/ip-address/README.md +39 -39
  282. package/node_modules/ip-address/dist/ipv6.js +1 -1
  283. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  284. package/node_modules/ip-address/package.json +1 -1
  285. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +3 -0
  286. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -0
  287. package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -0
  288. package/node_modules/jose/dist/types/types.d.ts +8 -0
  289. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -0
  290. package/node_modules/jose/dist/webapi/jwks/remote.js +3 -1
  291. package/node_modules/jose/dist/webapi/lib/deflate.js +2 -1
  292. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +2 -1
  293. package/node_modules/jose/package.json +1 -1
  294. package/node_modules/qs/CHANGELOG.md +29 -22
  295. package/node_modules/qs/dist/qs.js +14 -14
  296. package/node_modules/qs/eslint.config.mjs +6 -0
  297. package/node_modules/qs/lib/stringify.js +1 -1
  298. package/node_modules/qs/package.json +5 -5
  299. package/node_modules/qs/test/stringify.js +74 -0
  300. package/package.json +2 -2
@@ -1,5 +1,10 @@
1
1
  # Encode URL
2
2
 
3
+ [![NPM Version][npm-image]][npm-url]
4
+ [![NPM Downloads][downloads-image]][downloads-url]
5
+ [![Build Status][ci-image]][ci-url]
6
+ [![Test Coverage][coveralls-image]][coveralls-url]
7
+
3
8
  Encode a URL to a percent-encoded form, excluding already-encoded sequences.
4
9
 
5
10
  ## Installation
@@ -107,3 +112,12 @@ $ npm run lint
107
112
  ## License
108
113
 
109
114
  [MIT](LICENSE)
115
+
116
+ [npm-image]: https://img.shields.io/npm/v/encodeurl
117
+ [npm-url]: https://npmjs.org/package/encodeurl
118
+ [downloads-image]: https://img.shields.io/npm/dm/encodeurl
119
+ [downloads-url]: https://npmcharts.com/compare/encodeurl?minimal=true
120
+ [ci-image]: https://img.shields.io/github/actions/workflow/status/pillarjs/encodeurl/ci.yml?branch=master
121
+ [ci-url]: https://github.com/pillarjs/encodeurl/actions/workflows/ci.yml
122
+ [coveralls-image]: https://img.shields.io/coverallsCoverage/github/pillarjs/encodeurl?branch=master
123
+ [coveralls-url]: https://coveralls.io/r/pillarjs/encodeurl?branch=master
@@ -22,18 +22,11 @@ module.exports = encodeUrl
22
22
  var ENCODE_CHARS_REGEXP = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g
23
23
 
24
24
  /**
25
- * RegExp to match unmatched surrogate pair.
25
+ * RegExp to match surrogate pairs and unpaired surrogates.
26
26
  * @private
27
27
  */
28
28
 
29
- var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g
30
-
31
- /**
32
- * String to replace unmatched surrogate pair with.
33
- * @private
34
- */
35
-
36
- var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'
29
+ var SURROGATE_REGEXP = /([\uD800-\uDBFF][\uDC00-\uDFFF])|[\uD800-\uDFFF]/g
37
30
 
38
31
  /**
39
32
  * Encode a URL to a percent-encoded form, excluding already-encoded sequences.
@@ -55,6 +48,8 @@ var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'
55
48
 
56
49
  function encodeUrl (url) {
57
50
  return String(url)
58
- .replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
51
+ .replace(SURROGATE_REGEXP, function (_, pair) {
52
+ return pair || '\uFFFD'
53
+ })
59
54
  .replace(ENCODE_CHARS_REGEXP, encodeURI)
60
55
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "encodeurl",
3
3
  "description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "contributors": [
6
6
  "Douglas Christopher Wilson <doug@somethingdoug.com>"
7
7
  ],
@@ -12,6 +12,10 @@
12
12
  "url"
13
13
  ],
14
14
  "repository": "pillarjs/encodeurl",
15
+ "funding": {
16
+ "type": "opencollective",
17
+ "url": "https://opencollective.com/express"
18
+ },
15
19
  "devDependencies": {
16
20
  "eslint": "5.11.1",
17
21
  "eslint-config-standard": "12.0.0",
@@ -19,8 +23,8 @@
19
23
  "eslint-plugin-node": "7.0.1",
20
24
  "eslint-plugin-promise": "4.0.1",
21
25
  "eslint-plugin-standard": "4.0.0",
22
- "istanbul": "0.4.5",
23
- "mocha": "2.5.3"
26
+ "mocha": "~11.7.0",
27
+ "nyc": "~17.1.0"
24
28
  },
25
29
  "files": [
26
30
  "LICENSE",
@@ -33,8 +37,8 @@
33
37
  },
34
38
  "scripts": {
35
39
  "lint": "eslint .",
36
- "test": "mocha --reporter spec --bail --check-leaks test/",
37
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
38
- "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
40
+ "test": "mocha --check-leaks --reporter spec",
41
+ "test-ci": "nyc --reporter=lcov --reporter=text npm test",
42
+ "test-cov": "nyc --reporter=html --reporter=text npm test"
39
43
  }
40
44
  }
@@ -182,7 +182,7 @@ var MemoryStore = class {
182
182
  */
183
183
  resetClient(client, now = Date.now()) {
184
184
  client.totalHits = 0;
185
- client.resetTime.setTime(now + this.windowMs);
185
+ client.resetTime = new Date(now + this.windowMs);
186
186
  return client;
187
187
  }
188
188
  /**
@@ -931,7 +931,11 @@ var rateLimit = (passedOptions) => {
931
931
  try {
932
932
  const incrementResult = await config.store.increment(key);
933
933
  totalHits = incrementResult.totalHits;
934
- resetTime = incrementResult.resetTime;
934
+ if (incrementResult.resetTime && (config.skipFailedRequests || config.skipSuccessfulRequests)) {
935
+ resetTime = new Date(incrementResult.resetTime.getTime());
936
+ } else {
937
+ resetTime = incrementResult.resetTime;
938
+ }
935
939
  } catch (error) {
936
940
  if (config.passOnStoreError) {
937
941
  config.logger.error(
@@ -1057,7 +1061,7 @@ var rateLimit = (passedOptions) => {
1057
1061
  const retryAfter = await retrieveRetryAfter;
1058
1062
  setRetryAfterHeader(response, info, config.windowMs, retryAfter);
1059
1063
  }
1060
- config.handler(request, response, next, options);
1064
+ await config.handler(request, response, next, options);
1061
1065
  return;
1062
1066
  }
1063
1067
  next();
@@ -139,7 +139,7 @@ var MemoryStore = class {
139
139
  */
140
140
  resetClient(client, now = Date.now()) {
141
141
  client.totalHits = 0;
142
- client.resetTime.setTime(now + this.windowMs);
142
+ client.resetTime = new Date(now + this.windowMs);
143
143
  return client;
144
144
  }
145
145
  /**
@@ -888,7 +888,11 @@ var rateLimit = (passedOptions) => {
888
888
  try {
889
889
  const incrementResult = await config.store.increment(key);
890
890
  totalHits = incrementResult.totalHits;
891
- resetTime = incrementResult.resetTime;
891
+ if (incrementResult.resetTime && (config.skipFailedRequests || config.skipSuccessfulRequests)) {
892
+ resetTime = new Date(incrementResult.resetTime.getTime());
893
+ } else {
894
+ resetTime = incrementResult.resetTime;
895
+ }
892
896
  } catch (error) {
893
897
  if (config.passOnStoreError) {
894
898
  config.logger.error(
@@ -1014,7 +1018,7 @@ var rateLimit = (passedOptions) => {
1014
1018
  const retryAfter = await retrieveRetryAfter;
1015
1019
  setRetryAfterHeader(response, info, config.windowMs, retryAfter);
1016
1020
  }
1017
- config.handler(request, response, next, options);
1021
+ await config.handler(request, response, next, options);
1018
1022
  return;
1019
1023
  }
1020
1024
  next();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-rate-limit",
3
- "version": "8.7.1",
3
+ "version": "8.7.3",
4
4
  "description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.",
5
5
  "author": {
6
6
  "name": "Nathan Friedly",
@@ -86,25 +86,25 @@
86
86
  "@biomejs/biome": "2.4.6",
87
87
  "@express-rate-limit/prettier": "1.1.1",
88
88
  "@express-rate-limit/tsconfig": "1.0.5",
89
- "@jest/globals": "30.5.1",
89
+ "@jest/globals": "30.5.2",
90
90
  "@types/debug": "4.1.13",
91
91
  "@types/express": "5.0.6",
92
92
  "@types/jest": "30.0.0",
93
- "@types/node": "26.4.1",
93
+ "@types/node": "26.6.4",
94
94
  "@types/supertest": "7.2.1",
95
95
  "del-cli": "7.0.0",
96
96
  "dts-bundle-generator": "8.1.2",
97
97
  "esbuild": "0.28.2",
98
98
  "express": "5.2.1",
99
99
  "husky": "9.1.7",
100
- "jest": "30.5.1",
101
- "lint-staged": "17.4.1",
102
- "mintlify": "4.2.874",
100
+ "jest": "30.5.2",
101
+ "lint-staged": "17.6.0",
102
+ "mintlify": "4.2.988",
103
103
  "npm-run-all": "4.1.5",
104
- "prettier": "3.9.6",
105
- "ratelimit-header-parser": "0.1.0",
106
- "supertest": "7.2.2",
107
- "ts-jest": "29.4.12",
104
+ "prettier": "3.9.9",
105
+ "ratelimit-header-parser": "0.2.1",
106
+ "supertest": "7.3.1",
107
+ "ts-jest": "29.4.14",
108
108
  "ts-node": "10.9.2",
109
109
  "typescript": "5.9.3"
110
110
  },
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_middleware_serve_static_index = require("../../middleware/serve-static/index.js");
3
- let node_fs_promises = require("node:fs/promises");
4
3
  let node_path = require("node:path");
4
+ let node_fs_promises = require("node:fs/promises");
5
5
  //#region src/adapter/bun/serve-static.ts
6
6
  /**
7
7
  * @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_adapter_bun_server = require("./server.js");
3
2
  const require_helper_websocket_index = require("../../helper/websocket/index.js");
3
+ const require_adapter_bun_server = require("./server.js");
4
4
  //#region src/adapter/bun/websocket.ts
5
5
  /**
6
6
  * @internal
@@ -198,7 +198,7 @@ var Context = class {
198
198
  * ```
199
199
  */
200
200
  header = (name, value, options) => {
201
- if (this.finalized) this.#res = createResponseInstance(this.#res.body, this.#res);
201
+ if (this.finalized && !this.#res.bodyUsed) this.#res = createResponseInstance(this.#res.body, this.#res);
202
202
  const headers = this.#res ? this.#res.headers : this.#preparedHeaders ??= new Headers();
203
203
  if (value === void 0) headers.delete(name);
204
204
  else if (options?.append) headers.append(name, value);
@@ -80,10 +80,8 @@ const buildStyleString = (strings, values) => {
80
80
  for (let j = 0, len = vArray.length; j < len; j++) {
81
81
  let value = vArray[j];
82
82
  if (typeof value === "boolean" || value === null || value === void 0) continue;
83
- if (typeof value === "string") {
84
- if (/([\\"'\/])/.test(value)) styleString += value.replace(/([\\"']|(?<=<)\/)/g, "\\$1");
85
- else styleString += value;
86
- } else if (typeof value === "number") styleString += value;
83
+ if (typeof value === "string") styleString += value.replace(/[\\"']/g, "\\$&");
84
+ else if (typeof value === "number") styleString += value;
87
85
  else if (value[CSS_ESCAPED]) styleString += value[CSS_ESCAPED];
88
86
  else if (value[CLASS_NAME].startsWith("@keyframes ")) {
89
87
  selectors.push(value);
@@ -108,7 +106,7 @@ const buildStyleString = (strings, values) => {
108
106
  }
109
107
  return [
110
108
  label,
111
- minify(styleString),
109
+ minify(styleString).replace(/<\//g, "<\\/"),
112
110
  selectors,
113
111
  externalClassNames
114
112
  ];
@@ -4,6 +4,7 @@ const require_utils_url = require("./utils/url.js");
4
4
  const require_context = require("./context.js");
5
5
  const require_router = require("./router.js");
6
6
  const require_utils_constants = require("./utils/constants.js");
7
+ const require_utils_mount = require("./utils/mount.js");
7
8
  //#region src/hono-base.ts
8
9
  /**
9
10
  * @module
@@ -228,17 +229,10 @@ var Hono = class Hono {
228
229
  } catch {}
229
230
  return [c.env, executionContext];
230
231
  };
231
- replaceRequest ||= (() => {
232
- const mergedPath = require_utils_url.mergePath(this._basePath, path);
233
- const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
234
- return (request) => {
235
- const url = new URL(request.url);
236
- url.pathname = this.getPath(request).slice(pathPrefixLength) || "/";
237
- return new Request(url, request);
238
- };
239
- })();
232
+ const mergedPath = require_utils_url.mergePath(this._basePath, path);
233
+ const defaultReplaceRequest = (c) => require_utils_mount.createMountedRequest(c, mergedPath.replace(/\/$/, ""), require_utils_url.mergePath(mergedPath, "*"));
240
234
  const handler = async (c, next) => {
241
- const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));
235
+ const res = await applicationHandler(replaceRequest ? replaceRequest(c.req.raw) : defaultReplaceRequest(c), ...getOptions(c));
242
236
  if (res) return res;
243
237
  await next();
244
238
  };
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_hono_base = require("./hono-base.js");
3
3
  const require_router_reg_exp_router_router = require("./router/reg-exp-router/router.js");
4
- require("./router/reg-exp-router/index.js");
5
4
  const require_router_smart_router_router = require("./router/smart-router/router.js");
6
5
  const require_router_trie_router_router = require("./router/trie-router/router.js");
7
6
  require("./router/trie-router/index.js");
@@ -81,7 +81,7 @@ const basicAuth = (options, ...users) => {
81
81
  }
82
82
  }
83
83
  const status = 401;
84
- const headers = { "WWW-Authenticate": "Basic realm=\"" + options.realm?.replace(/"/g, "\\\"") + "\"" };
84
+ const headers = { "WWW-Authenticate": "Basic realm=\"" + options.realm?.replace(/[\\"]/g, "\\$&") + "\"" };
85
85
  const responseMessage = typeof options.invalidUserMessage === "function" ? await options.invalidUserMessage(ctx) : options.invalidUserMessage;
86
86
  const res = typeof responseMessage === "string" ? new Response(responseMessage, {
87
87
  status,
@@ -45,7 +45,7 @@ const bearerAuth = (options) => {
45
45
  if (!("token" in options || "verifyToken" in options)) throw new Error("bearer auth middleware requires options for \"token\" or \"verifyToken\"");
46
46
  if (!options.realm) options.realm = "";
47
47
  if (options.prefix === void 0) options.prefix = PREFIX;
48
- const realm = options.realm?.replace(/"/g, "\\\"");
48
+ const realm = options.realm?.replace(/[\\"]/g, "\\$&");
49
49
  const prefix = options.prefix;
50
50
  const tokenRegexp = new RegExp(`^${TOKEN_STRINGS}$`);
51
51
  const wwwAuthenticatePrefix = prefix === "" ? "" : `${prefix} `;
@@ -9,7 +9,7 @@ const secFetchSiteValues = [
9
9
  ];
10
10
  const isSecFetchSite = (value) => secFetchSiteValues.includes(value);
11
11
  const isSafeMethodRe = /^(GET|HEAD|OPTIONS)$/;
12
- const isRequestedByFormElementRe = /^\b(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)\b/i;
12
+ const isCsrfContentTypeRe = /^\b(application\/x-www-form-urlencoded|multipart\/form-data|text\/(?:plain|ping))\b/i;
13
13
  /**
14
14
  * CSRF Protection Middleware for Hono.
15
15
  *
@@ -95,7 +95,7 @@ const csrf = (options) => {
95
95
  return await secFetchSiteHandler(secFetchSite, c);
96
96
  };
97
97
  return async function csrf(c, next) {
98
- if (!isSafeMethodRe.test(c.req.method) && isRequestedByFormElementRe.test(c.req.header("content-type") || "text/plain") && !await isAllowedSecFetchSite(c.req.header("sec-fetch-site"), c) && !await isAllowedOrigin(c.req.header("origin"), c)) {
98
+ if (!isSafeMethodRe.test(c.req.method) && isCsrfContentTypeRe.test(c.req.header("content-type") || "text/plain") && !await isAllowedSecFetchSite(c.req.header("sec-fetch-site"), c) && !await isAllowedOrigin(c.req.header("origin"), c)) {
99
99
  const res = new Response("Forbidden", { status: 403 });
100
100
  throw new require_http_exception.HTTPException(403, { res });
101
101
  }
@@ -110,8 +110,8 @@ const jwk = (options, init) => {
110
110
  };
111
111
  };
112
112
  function unauthorizedResponse(opts) {
113
- const realm = (opts.realm ?? opts.ctx.req.url).replace(/"/g, "\\\"");
114
- const errDescription = opts.errDescription.replace(/"/g, "\\\"");
113
+ const realm = (opts.realm ?? opts.ctx.req.url).replace(/[\\"]/g, "\\$&");
114
+ const errDescription = opts.errDescription.replace(/[\\"]/g, "\\$&");
115
115
  return new Response("Unauthorized", {
116
116
  status: 401,
117
117
  statusText: opts.statusText,
@@ -104,8 +104,8 @@ const jwt = (options) => {
104
104
  };
105
105
  };
106
106
  function unauthorizedResponse(opts) {
107
- const realm = (opts.realm ?? opts.ctx.req.url).replace(/"/g, "\\\"");
108
- const errDescription = opts.errDescription.replace(/"/g, "\\\"");
107
+ const realm = (opts.realm ?? opts.ctx.req.url).replace(/[\\"]/g, "\\$&");
108
+ const errDescription = opts.errDescription.replace(/[\\"]/g, "\\$&");
109
109
  return new Response("Unauthorized", {
110
110
  status: 401,
111
111
  statusText: opts.statusText,
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_utils_mount = require("../../utils/mount.js");
2
3
  const require_helper_route_index = require("../../helper/route/index.js");
3
4
  //#region src/middleware/mount/index.ts
4
5
  const defaultReplaceRequest = (c) => {
5
- const pathPrefix = require_helper_route_index.routePath(c).replace(/\/\*$/, "");
6
- const url = new URL(c.req.raw.url);
7
- url.pathname = c.req.path.slice(pathPrefix.length) || "/";
8
- return new Request(url, c.req.raw);
6
+ const path = require_helper_route_index.routePath(c);
7
+ return require_utils_mount.createMountedRequest(c, path.replace(/\/?\*$/, ""), path);
9
8
  };
10
9
  const defaultGetOptions = (c) => {
11
10
  let executionContext = void 0;
@@ -22,6 +21,7 @@ const defaultGetOptions = (c) => {
22
21
  * @param {Function} applicationHandler - other Request Handler
23
22
  * @param {MountOptions} [options] - options of `mount()`
24
23
  * @returns {MiddlewareHandler} handler to register with `app.all()`
24
+ * @throws {Error} If the route ends with a wildcard inside a segment (e.g. `/assets*`), or automatic request rewriting encounters duplicate path parameter names.
25
25
  *
26
26
  * @example
27
27
  * ```ts
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_router_utils = require("../utils.js");
3
3
  //#region src/router/reg-exp-router/node.ts
4
4
  const LABEL_REG_EXP_STR = "[^/]+";
5
- const ONLY_WILDCARD_REG_EXP_STR = ".*";
6
- const TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
5
+ const ONLY_WILDCARD_REG_EXP_STR = "[^]*";
6
+ const TAIL_WILDCARD_REG_EXP_STR = "(?:|/[^]*)";
7
7
  const PATH_ERROR = Symbol();
8
8
  const regExpMetaChars = /* @__PURE__ */ new Set(".\\+*[^]$()");
9
9
  /**
@@ -16,8 +16,8 @@ const regExpMetaChars = /* @__PURE__ */ new Set(".\\+*[^]$()");
16
16
  function compareKey(a, b) {
17
17
  if (a.length === 1) return b.length === 1 ? a < b ? -1 : 1 : -1;
18
18
  if (b.length === 1) return 1;
19
- if (a === ".*" || a === "(?:|/.*)") return b === "(?:|/.*)" ? -1 : 1;
20
- else if (b === ".*" || b === "(?:|/.*)") return -1;
19
+ if (a === "[^]*" || a === "(?:|/[^]*)") return b === "[^]*" ? -1 : 1;
20
+ else if (b === "[^]*" || b === "(?:|/[^]*)") return -1;
21
21
  if (a === "[^/]+") return 1;
22
22
  else if (b === "[^/]+") return -1;
23
23
  return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;
@@ -26,14 +26,14 @@ var Node = class Node {
26
26
  #index;
27
27
  #varIndex;
28
28
  #children = require_router_utils.createNullObject();
29
- insert(tokens, index, paramMap, context, isStatic) {
29
+ insert(tokens, index, paramMap, context, keys) {
30
30
  let node = this;
31
31
  for (let i = 0, len = tokens.length; i < len; i++) {
32
32
  const token = tokens[i];
33
33
  const pattern = token.length === 1 ? token === "*" ? i === len - 1 ? [
34
34
  "",
35
35
  "",
36
- ".*"
36
+ ONLY_WILDCARD_REG_EXP_STR
37
37
  ] : [
38
38
  "",
39
39
  "",
@@ -48,15 +48,16 @@ var Node = class Node {
48
48
  const name = pattern[1];
49
49
  let regexpStr = pattern[2] || "[^/]+";
50
50
  if (name && pattern[2]) {
51
- if (regexpStr === ".*") throw PATH_ERROR;
51
+ if (new RegExp(regexpStr).test("")) throw PATH_ERROR;
52
52
  regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
53
53
  if (/\((?!\?:)/.test(regexpStr)) throw PATH_ERROR;
54
54
  if (regexpStr.length === 1 && regExpMetaChars.has(regexpStr)) throw PATH_ERROR;
55
55
  }
56
+ keys.push(regexpStr);
56
57
  nextNode = node.#children[regexpStr];
57
58
  if (!nextNode) {
58
- if (regexpStr !== ".*" && regexpStr !== "(?:|/.*)") {
59
- for (const k in node.#children) if ((regexpStr.length > 1 || k.length > 1) && k !== ".*" && k !== "(?:|/.*)") throw PATH_ERROR;
59
+ if (regexpStr !== "[^]*" && regexpStr !== "(?:|/[^]*)") {
60
+ for (const k in node.#children) if ((regexpStr.length > 1 || k.length > 1) && k !== "[^]*" && k !== "(?:|/[^]*)") throw PATH_ERROR;
60
61
  }
61
62
  nextNode = node.#children[regexpStr] = new Node();
62
63
  }
@@ -65,16 +66,17 @@ var Node = class Node {
65
66
  paramMap.push([name, nextNode.#varIndex]);
66
67
  }
67
68
  } else {
69
+ keys.push(token);
68
70
  nextNode = node.#children[token];
69
71
  if (!nextNode) {
70
- for (const k in node.#children) if (k.length > 1 && k !== ".*" && k !== "(?:|/.*)") throw PATH_ERROR;
72
+ for (const k in node.#children) if (k.length > 1 && k !== "[^]*" && k !== "(?:|/[^]*)") throw PATH_ERROR;
71
73
  nextNode = node.#children[token] = new Node();
72
74
  }
73
75
  }
74
76
  node = nextNode;
75
77
  }
76
78
  if (node.#index !== void 0) throw PATH_ERROR;
77
- node.#index = isStatic ? -1 : index;
79
+ node.#index = index;
78
80
  }
79
81
  buildRegExpStr() {
80
82
  const strList = Object.keys(this.#children).sort(compareKey).map((k) => {
@@ -28,7 +28,7 @@ var PreparedRegExpRouter = class {
28
28
  if (!this.#matchers[method]) {
29
29
  const all = this.#matchers["ALL"];
30
30
  const staticMap = {};
31
- for (const key in all[2]) staticMap[key] = [all[2][key][0].slice(), require_router_reg_exp_router_matcher.emptyParam];
31
+ for (const key in all[2]) staticMap[key] = [all[2][key][0].slice(), all[2][key][1]];
32
32
  this.#matchers[method] = [
33
33
  all[0],
34
34
  all[1].map((list) => Array.isArray(list) ? list.slice() : 0),
@@ -72,7 +72,7 @@ const buildInitParams = ({ paths }) => {
72
72
  ...map
73
73
  };
74
74
  else relocateMap[path] = [[[], map]];
75
- if (relocateMap[path][0][0].findIndex((j) => j === i) === -1) relocateMap[path][0][0].push(i);
75
+ if (!relocateMap[path][0][0].includes(i)) relocateMap[path][0][0].push(i);
76
76
  }
77
77
  });
78
78
  });
@@ -80,7 +80,7 @@ const buildInitParams = ({ paths }) => {
80
80
  if (p === path) {
81
81
  relocateMap[path] ||= [[[]]];
82
82
  const value = path2 === path ? "" : path2;
83
- if (relocateMap[path][0][0].findIndex((v) => v === value) === -1) relocateMap[path][0][0].push(value);
83
+ if (!relocateMap[path][0][0].includes(value)) relocateMap[path][0][0].push(value);
84
84
  }
85
85
  });
86
86
  }
@@ -89,7 +89,7 @@ const buildInitParams = ({ paths }) => {
89
89
  return [matchers, relocateMap];
90
90
  };
91
91
  const serializeInitParams = ([matchers, relocateMap]) => {
92
- return `[${JSON.stringify(matchers, (_, value) => value instanceof RegExp ? `##${value.toString()}##` : value).replace(/"##(.+?)##"/g, (_, str) => str.replace(/\\\\/g, "\\"))},${JSON.stringify(relocateMap)}]`;
92
+ return `[${JSON.stringify(matchers, (_, value) => value instanceof RegExp || value === void 0 ? `##${value}##` : value).replace(/"##(.+?)##"/g, (_, str) => str.replace(/\\\\/g, "\\"))},${JSON.stringify(relocateMap)}]`;
93
93
  };
94
94
  //#endregion
95
95
  exports.PreparedRegExpRouter = PreparedRegExpRouter;
@@ -6,21 +6,21 @@ const require_router_reg_exp_router_matcher = require("./matcher.js");
6
6
  const require_router_reg_exp_router_node = require("./node.js");
7
7
  const require_router_reg_exp_router_trie = require("./trie.js");
8
8
  //#region src/router/reg-exp-router/router.ts
9
- let wildcardRegExpCache = require_router_utils.createNullObject();
10
- function buildWildcardRegExp(path) {
11
- return wildcardRegExpCache[path] ??= new RegExp(`^${path.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g, (match, metaChar) => metaChar ? `\\${metaChar}` : match === "/*" ? require_router_reg_exp_router_node.TAIL_WILDCARD_REG_EXP_STR : match === "*" ? ".*" : `/:${require_router_reg_exp_router_node.LABEL_REG_EXP_STR}`)}$`);
9
+ function endsWithWildcard(keys) {
10
+ const tail = keys[keys.length - 1];
11
+ return tail === "[^]*" || tail === "(?:|/[^]*)";
12
12
  }
13
- function findMiddleware(middleware, path) {
14
- for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) if (buildWildcardRegExp(k).test(path)) return [...middleware[k]];
13
+ function covers(wildcard, target) {
14
+ const last = wildcard.length - 1;
15
+ for (let i = 0; i < last; i++) if (wildcard[i] !== target[i]) return false;
16
+ return wildcard[last] === "[^]*" || target.length === last || target[last] === "/";
15
17
  }
16
18
  var RegExpRouter = class {
17
19
  name = "RegExpRouter";
18
- #middleware;
19
- #routes;
20
+ #handlers;
20
21
  #tries;
21
22
  constructor() {
22
- this.#middleware = { ["ALL"]: require_router_utils.createNullObject() };
23
- this.#routes = { ["ALL"]: require_router_utils.createNullObject() };
23
+ this.#handlers = { ["ALL"]: [] };
24
24
  this.#tries = { ["ALL"]: new require_router_reg_exp_router_trie.Trie() };
25
25
  }
26
26
  #insertPath(method, path) {
@@ -31,65 +31,53 @@ var RegExpRouter = class {
31
31
  }
32
32
  }
33
33
  add(method, path, handler) {
34
- const middleware = this.#middleware;
35
- const routes = this.#routes;
36
- if (!middleware) throw new Error(require_router.MESSAGE_MATCHER_IS_ALREADY_BUILT);
37
- if (!middleware[method]) {
38
- this.#tries[method] = new require_router_reg_exp_router_trie.Trie();
39
- for (const handlerMap of [middleware, routes]) {
40
- handlerMap[method] = require_router_utils.createNullObject();
41
- for (const p in handlerMap["ALL"]) {
42
- handlerMap[method][p] = [...handlerMap["ALL"][p]];
43
- this.#insertPath(method, p);
44
- }
45
- }
34
+ const handlers = this.#handlers;
35
+ if (!handlers) throw new Error(require_router.MESSAGE_MATCHER_IS_ALREADY_BUILT);
36
+ const tries = this.#tries;
37
+ if (!handlers[method]) {
38
+ tries[method] = new require_router_reg_exp_router_trie.Trie();
39
+ handlers[method] = [...handlers["ALL"]];
40
+ for (const p in tries["ALL"].paths) this.#insertPath(method, p);
46
41
  }
47
42
  if (path === "/*") path = "*";
48
- const methods = method === "ALL" ? Object.keys(middleware) : [method];
49
- if (/\*$/.test(path)) {
50
- const re = buildWildcardRegExp(path);
51
- for (const m of methods) if (!middleware[m][path]) {
52
- this.#insertPath(m, path);
53
- middleware[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware["ALL"], path) || [];
54
- }
55
- for (const handlerMap of [middleware, routes]) for (const m of methods) for (const p in handlerMap[m]) re.test(p) && handlerMap[m][p].push([handler, path]);
56
- return;
57
- }
43
+ const methods = method === "ALL" ? Object.keys(handlers) : [method];
58
44
  const paths = require_utils_url.checkOptionalParameter(path) || [path];
59
45
  for (const path of paths) for (const m of methods) {
60
- if (!routes[m][path]) {
61
- this.#insertPath(m, path);
62
- routes[m][path] = findMiddleware(middleware[m], path) || findMiddleware(middleware["ALL"], path) || [];
63
- }
64
- routes[m][path].push([handler, path]);
46
+ if (!tries[m].paths[path]) this.#insertPath(m, path);
47
+ handlers[m].push([handler, path]);
65
48
  }
66
49
  }
67
50
  match = require_router_reg_exp_router_matcher.match;
68
51
  buildAllMatchers() {
69
52
  const matchers = require_router_utils.createNullObject();
70
- for (const method of Object.keys(this.#routes)) matchers[method] = this.#buildMatcher(method);
71
- this.#middleware = this.#routes = this.#tries = void 0;
72
- wildcardRegExpCache = require_router_utils.createNullObject();
53
+ for (const method of Object.keys(this.#handlers)) matchers[method] = this.#buildMatcher(method);
54
+ this.#handlers = this.#tries = void 0;
73
55
  return matchers;
74
56
  }
75
57
  #buildMatcher(method) {
76
- const middleware = this.#middleware[method];
77
- const routes = this.#routes[method];
58
+ const handlers = this.#handlers[method];
78
59
  const trie = this.#tries[method];
79
60
  const staticMap = require_router_utils.createNullObject();
80
61
  const handlerData = [];
81
62
  const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
82
- for (const r of [middleware, routes]) for (const path in r) {
83
- const handlers = r[path];
84
- const pathData = trie.paths[path];
85
- if (!pathData) {
86
- staticMap[path] = [handlers.map(([h]) => [h, require_router_utils.createNullObject()]), require_router_reg_exp_router_matcher.emptyParam];
87
- continue;
88
- }
89
- handlerData[pathData[0]] = handlers.map(([h, handlerPath]) => [h, trie.paths[handlerPath][1].reduceRight((map, [key], i) => {
90
- map[key] = paramReplacementMap[pathData[1][i][1]];
63
+ const own = require_router_utils.createNullObject();
64
+ const entries = handlers.map(([h, p], i) => {
65
+ (own[p] ??= []).push(i);
66
+ return [h, trie.paths[p][1].reduceRight((map, [key, varIndex]) => {
67
+ map[key] = paramReplacementMap[varIndex];
91
68
  return map;
92
- }, require_router_utils.createNullObject())]);
69
+ }, require_router_utils.createNullObject())];
70
+ });
71
+ const wildcards = Object.keys(own).filter((p) => endsWithWildcard(trie.paths[p][2]));
72
+ for (const path in trie.paths) {
73
+ const [index, , keys] = trie.paths[path];
74
+ const indexes = [...own[path]];
75
+ for (const p of wildcards) if (p !== path && covers(trie.paths[p][2], keys)) indexes.push(...own[p]);
76
+ const data = indexes.sort((a, b) => a - b).map((i) => entries[i]);
77
+ if (index === -1) {
78
+ const last = Math.max(-1, ...data.flatMap(([, map]) => Object.values(map)));
79
+ staticMap[path] = [data, last === -1 ? require_router_reg_exp_router_matcher.emptyParam : path.match(regexp).slice(0, last + 1)];
80
+ } else handlerData[index] = data;
93
81
  }
94
82
  return [
95
83
  regexp,