@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
@@ -0,0 +1,13 @@
1
+ import type { AeadId, AeadInterface, KdfId, KdfInterface, KemId, KemInterface } from "@hpke/common";
2
+ /**
3
+ * The parameters used to configure the `CipherSuite`.
4
+ */
5
+ export interface CipherSuiteParams {
6
+ /** The KEM (Key Encapsulation Mechanism) identifier or the KEM object. */
7
+ kem: KemId | KemInterface;
8
+ /** The KDF (Key Derivation Function) identifier or the KDF object. */
9
+ kdf: KdfId | KdfInterface;
10
+ /** The AEAD (Authenticated Encryption with Addtional Data) identifier or the AEAD object. */
11
+ aead: AeadId | AeadInterface;
12
+ }
13
+ //# sourceMappingURL=cipherSuiteParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cipherSuiteParams.d.ts","sourceRoot":"","sources":["../../../src/src/interfaces/cipherSuiteParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,KAAK,EACL,YAAY,EACZ,KAAK,EACL,YAAY,EACb,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,0EAA0E;IAC1E,GAAG,EAAE,KAAK,GAAG,YAAY,CAAC;IAE1B,sEAAsE;IACtE,GAAG,EAAE,KAAK,GAAG,YAAY,CAAC;IAE1B,6FAA6F;IAC7F,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;CAC9B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The sender specific interface for an encryption context.
3
+ */
4
+ export interface Encapsulator {
5
+ /** The encapsulated key generated by the sender. */
6
+ enc: ArrayBuffer;
7
+ }
8
+ //# sourceMappingURL=encapsulator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encapsulator.d.ts","sourceRoot":"","sources":["../../../src/src/interfaces/encapsulator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,GAAG,EAAE,WAAW,CAAC;CAClB"}
@@ -0,0 +1,40 @@
1
+ import type { Exporter } from "./exporter.js";
2
+ /**
3
+ * The encryption context interface for a recipient and a sender.
4
+ */
5
+ export interface EncryptionContext extends Exporter {
6
+ /**
7
+ * Encrypts data.
8
+ *
9
+ * If the error occurred, throws `SealError` | `MessageLimitReachedError`.
10
+ *
11
+ * @param data A plain text as bytes to be encrypted.
12
+ * @param aad Additional authenticated data as bytes fed by an application.
13
+ * @returns A cipher text as bytes.
14
+ * @throws {@link MessageLimitReachedError}, {@link SealError}
15
+ */
16
+ seal(data: ArrayBufferLike | ArrayBufferView, aad?: ArrayBufferLike | ArrayBufferView): Promise<ArrayBuffer>;
17
+ /**
18
+ * Decrypts data.
19
+ *
20
+ * If the error occurred, throws `OpenError`.
21
+ *
22
+ * @param data An encrypted text as bytes to be decrypted.
23
+ * @param aad Additional authenticated data as bytes fed by an application.
24
+ * @returns A decrypted plain text as bytes.
25
+ * @throws {@link OpenError}
26
+ */
27
+ open(data: ArrayBufferLike | ArrayBufferView, aad?: ArrayBufferLike | ArrayBufferView): Promise<ArrayBuffer>;
28
+ }
29
+ /**
30
+ * The recipient encryption context.
31
+ */
32
+ export type RecipientContext = EncryptionContext;
33
+ /**
34
+ * The sender encryption context.
35
+ */
36
+ export interface SenderContext extends EncryptionContext {
37
+ /** The encapsulated key generated by the sender. */
38
+ enc: ArrayBuffer;
39
+ }
40
+ //# sourceMappingURL=encryptionContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryptionContext.d.ts","sourceRoot":"","sources":["../../../src/src/interfaces/encryptionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD;;;;;;;;;OASG;IACH,IAAI,CACF,IAAI,EAAE,eAAe,GAAG,eAAe,EACvC,GAAG,CAAC,EAAE,eAAe,GAAG,eAAe,GACtC,OAAO,CAAC,WAAW,CAAC,CAAC;IAExB;;;;;;;;;OASG;IACH,IAAI,CACF,IAAI,EAAE,eAAe,GAAG,eAAe,EACvC,GAAG,CAAC,EAAE,eAAe,GAAG,eAAe,GACtC,OAAO,CAAC,WAAW,CAAC,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,oDAAoD;IACpD,GAAG,EAAE,WAAW,CAAC;CAClB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The exporter interface.
3
+ */
4
+ export interface Exporter {
5
+ /**
6
+ * Exports a secret using a variable-length pseudorandom function.
7
+ *
8
+ * If the error occurred, throws `ExportError`.
9
+ *
10
+ * @param exporterContext An exporter context string as bytes. The maximum length is 128 bytes.
11
+ * @param len A desired length in bytes of the output secret.
12
+ * @returns A secret string as bytes.
13
+ * @throws {@link ExportError}
14
+ */
15
+ export(exporterContext: ArrayBufferLike | ArrayBufferView, len: number): Promise<ArrayBuffer>;
16
+ }
17
+ //# sourceMappingURL=exporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/src/interfaces/exporter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;;;;;;OASG;IACH,MAAM,CACJ,eAAe,EAAE,eAAe,GAAG,eAAe,EAClD,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,WAAW,CAAC,CAAC;CACzB"}
@@ -0,0 +1,7 @@
1
+ import type { AeadEncryptionContext } from "@hpke/common";
2
+ export interface KeyInfo {
3
+ key: AeadEncryptionContext;
4
+ baseNonce: Uint8Array;
5
+ seq: number;
6
+ }
7
+ //# sourceMappingURL=keyInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyInfo.d.ts","sourceRoot":"","sources":["../../../src/src/interfaces/keyInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,qBAAqB,CAAC;IAC3B,SAAS,EAAE,UAAU,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The response of the single-shot seal API.
3
+ */
4
+ export interface CipherSuiteSealResponse {
5
+ /** The ciphertext as bytes. */
6
+ ct: ArrayBuffer;
7
+ /** The encapsulated key. */
8
+ enc: ArrayBuffer;
9
+ }
10
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../src/src/interfaces/responses.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,+BAA+B;IAC/B,EAAE,EAAE,WAAW,CAAC;IAChB,4BAA4B;IAC5B,GAAG,EAAE,WAAW,CAAC;CAClB"}
@@ -0,0 +1,26 @@
1
+ import { Dhkem, KemId } from "@hpke/common";
2
+ export declare class DhkemP256HkdfSha256Native extends Dhkem {
3
+ id: KemId;
4
+ secretSize: number;
5
+ encSize: number;
6
+ publicKeySize: number;
7
+ privateKeySize: number;
8
+ constructor();
9
+ }
10
+ export declare class DhkemP384HkdfSha384Native extends Dhkem {
11
+ id: KemId;
12
+ secretSize: number;
13
+ encSize: number;
14
+ publicKeySize: number;
15
+ privateKeySize: number;
16
+ constructor();
17
+ }
18
+ export declare class DhkemP521HkdfSha512Native extends Dhkem {
19
+ id: KemId;
20
+ secretSize: number;
21
+ encSize: number;
22
+ publicKeySize: number;
23
+ privateKeySize: number;
24
+ constructor();
25
+ }
26
+ //# sourceMappingURL=dhkemNative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dhkemNative.d.ts","sourceRoot":"","sources":["../../../src/src/kems/dhkemNative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAKL,KAAK,EACN,MAAM,cAAc,CAAC;AAEtB,qBAAa,yBAA0B,SAAQ,KAAK;IACzC,EAAE,EAAE,KAAK,CAA6B;IACtC,UAAU,EAAE,MAAM,CAAM;IACxB,OAAO,EAAE,MAAM,CAAM;IACrB,aAAa,EAAE,MAAM,CAAM;IAC3B,cAAc,EAAE,MAAM,CAAM;;CAOtC;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IACzC,EAAE,EAAE,KAAK,CAA6B;IACtC,UAAU,EAAE,MAAM,CAAM;IACxB,OAAO,EAAE,MAAM,CAAM;IACrB,aAAa,EAAE,MAAM,CAAM;IAC3B,cAAc,EAAE,MAAM,CAAM;;CAOtC;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IACzC,EAAE,EAAE,KAAK,CAA6B;IACtC,UAAU,EAAE,MAAM,CAAM;IACxB,OAAO,EAAE,MAAM,CAAO;IACtB,aAAa,EAAE,MAAM,CAAO;IAC5B,cAAc,EAAE,MAAM,CAAM;;CAOtC"}
@@ -0,0 +1,112 @@
1
+ import { Dhkem, Ec, HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, KemId, } from "@hpke/common";
2
+ export class DhkemP256HkdfSha256Native extends Dhkem {
3
+ constructor() {
4
+ const kdf = new HkdfSha256Native();
5
+ const prim = new Ec(KemId.DhkemP256HkdfSha256, kdf);
6
+ super(KemId.DhkemP256HkdfSha256, prim, kdf);
7
+ Object.defineProperty(this, "id", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: KemId.DhkemP256HkdfSha256
12
+ });
13
+ Object.defineProperty(this, "secretSize", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: 32
18
+ });
19
+ Object.defineProperty(this, "encSize", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: 65
24
+ });
25
+ Object.defineProperty(this, "publicKeySize", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: 65
30
+ });
31
+ Object.defineProperty(this, "privateKeySize", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: 32
36
+ });
37
+ }
38
+ }
39
+ export class DhkemP384HkdfSha384Native extends Dhkem {
40
+ constructor() {
41
+ const kdf = new HkdfSha384Native();
42
+ const prim = new Ec(KemId.DhkemP384HkdfSha384, kdf);
43
+ super(KemId.DhkemP384HkdfSha384, prim, kdf);
44
+ Object.defineProperty(this, "id", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ value: KemId.DhkemP384HkdfSha384
49
+ });
50
+ Object.defineProperty(this, "secretSize", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: 48
55
+ });
56
+ Object.defineProperty(this, "encSize", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: 97
61
+ });
62
+ Object.defineProperty(this, "publicKeySize", {
63
+ enumerable: true,
64
+ configurable: true,
65
+ writable: true,
66
+ value: 97
67
+ });
68
+ Object.defineProperty(this, "privateKeySize", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: 48
73
+ });
74
+ }
75
+ }
76
+ export class DhkemP521HkdfSha512Native extends Dhkem {
77
+ constructor() {
78
+ const kdf = new HkdfSha512Native();
79
+ const prim = new Ec(KemId.DhkemP521HkdfSha512, kdf);
80
+ super(KemId.DhkemP521HkdfSha512, prim, kdf);
81
+ Object.defineProperty(this, "id", {
82
+ enumerable: true,
83
+ configurable: true,
84
+ writable: true,
85
+ value: KemId.DhkemP521HkdfSha512
86
+ });
87
+ Object.defineProperty(this, "secretSize", {
88
+ enumerable: true,
89
+ configurable: true,
90
+ writable: true,
91
+ value: 64
92
+ });
93
+ Object.defineProperty(this, "encSize", {
94
+ enumerable: true,
95
+ configurable: true,
96
+ writable: true,
97
+ value: 133
98
+ });
99
+ Object.defineProperty(this, "publicKeySize", {
100
+ enumerable: true,
101
+ configurable: true,
102
+ writable: true,
103
+ value: 133
104
+ });
105
+ Object.defineProperty(this, "privateKeySize", {
106
+ enumerable: true,
107
+ configurable: true,
108
+ writable: true,
109
+ value: 64
110
+ });
111
+ }
112
+ }
@@ -0,0 +1,24 @@
1
+ import type { DhkemPrimitives, KdfInterface } from "@hpke/common";
2
+ import { NativeAlgorithm } from "@hpke/common";
3
+ export declare class X25519 extends NativeAlgorithm implements DhkemPrimitives {
4
+ private _hkdf;
5
+ private _alg;
6
+ private _nPk;
7
+ private _nSk;
8
+ private _nDh;
9
+ private _pkcs8AlgId;
10
+ constructor(hkdf: KdfInterface);
11
+ serializePublicKey(key: CryptoKey): Promise<ArrayBuffer>;
12
+ deserializePublicKey(key: ArrayBufferLike | ArrayBufferView): Promise<CryptoKey>;
13
+ serializePrivateKey(key: CryptoKey): Promise<ArrayBuffer>;
14
+ deserializePrivateKey(key: ArrayBufferLike | ArrayBufferView): Promise<CryptoKey>;
15
+ importKey(format: "raw" | "jwk", key: ArrayBuffer | JsonWebKey, isPublic: boolean): Promise<CryptoKey>;
16
+ generateKeyPair(): Promise<CryptoKeyPair>;
17
+ deriveKeyPair(ikm: ArrayBufferLike | ArrayBufferView): Promise<CryptoKeyPair>;
18
+ derivePublicKey(key: CryptoKey): Promise<CryptoKey>;
19
+ dh(sk: CryptoKey, pk: CryptoKey): Promise<ArrayBuffer>;
20
+ private _importRawKey;
21
+ private _importJWK;
22
+ private _deserializePkcs8Key;
23
+ }
24
+ //# sourceMappingURL=x25519.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x25519.d.ts","sourceRoot":"","sources":["../../../../src/src/kems/dhkemPrimitives/x25519.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,EAQL,eAAe,EAIhB,MAAM,cAAc,CAAC;AAgBtB,qBAAa,MAAO,SAAQ,eAAgB,YAAW,eAAe;IACpE,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAa;gBAEpB,IAAI,EAAE,YAAY;IAUjB,kBAAkB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IASxD,oBAAoB,CAC/B,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,SAAS,CAAC;IASR,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAazD,qBAAqB,CAChC,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,SAAS,CAAC;IASR,SAAS,CACpB,MAAM,EAAE,KAAK,GAAG,KAAK,EACrB,GAAG,EAAE,WAAW,GAAG,UAAU,EAC7B,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,SAAS,CAAC;IAgBR,eAAe,IAAI,OAAO,CAAC,aAAa,CAAC;IAazC,aAAa,CACxB,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,aAAa,CAAC;IA2BZ,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IA4CnD,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;YAiBrD,aAAa;YAsBb,UAAU;YAkCV,oBAAoB;CAcnC"}
@@ -0,0 +1,214 @@
1
+ import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, toArrayBuffer, } from "@hpke/common";
2
+ const ALG_NAME = "X25519";
3
+ // deno-fmt-ignore
4
+ const PKCS8_ALG_ID_X25519 = new Uint8Array([
5
+ 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,
6
+ 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20,
7
+ ]);
8
+ const BASE_POINT_X25519 = /* @__PURE__ */ (() => {
9
+ const p = new Uint8Array(32);
10
+ p[0] = 9;
11
+ return p;
12
+ })();
13
+ export class X25519 extends NativeAlgorithm {
14
+ constructor(hkdf) {
15
+ super();
16
+ Object.defineProperty(this, "_hkdf", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: void 0
21
+ });
22
+ Object.defineProperty(this, "_alg", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: void 0
27
+ });
28
+ Object.defineProperty(this, "_nPk", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: void 0
33
+ });
34
+ Object.defineProperty(this, "_nSk", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: void 0
39
+ });
40
+ Object.defineProperty(this, "_nDh", {
41
+ enumerable: true,
42
+ configurable: true,
43
+ writable: true,
44
+ value: void 0
45
+ });
46
+ Object.defineProperty(this, "_pkcs8AlgId", {
47
+ enumerable: true,
48
+ configurable: true,
49
+ writable: true,
50
+ value: void 0
51
+ });
52
+ this._alg = { name: ALG_NAME };
53
+ this._hkdf = hkdf;
54
+ this._nPk = 32;
55
+ this._nSk = 32;
56
+ this._nDh = 32;
57
+ this._pkcs8AlgId = PKCS8_ALG_ID_X25519;
58
+ }
59
+ async serializePublicKey(key) {
60
+ await this._setup();
61
+ try {
62
+ return await this._api.exportKey("raw", key);
63
+ }
64
+ catch (e) {
65
+ throw new SerializeError(e);
66
+ }
67
+ }
68
+ async deserializePublicKey(key) {
69
+ await this._setup();
70
+ try {
71
+ return await this._importRawKey(toArrayBuffer(key), true);
72
+ }
73
+ catch (e) {
74
+ throw new DeserializeError(e);
75
+ }
76
+ }
77
+ async serializePrivateKey(key) {
78
+ await this._setup();
79
+ try {
80
+ const jwk = await this._api.exportKey("jwk", key);
81
+ if (!("d" in jwk)) {
82
+ throw new Error("Not private key");
83
+ }
84
+ return base64UrlToBytes(jwk["d"]).buffer;
85
+ }
86
+ catch (e) {
87
+ throw new SerializeError(e);
88
+ }
89
+ }
90
+ async deserializePrivateKey(key) {
91
+ await this._setup();
92
+ try {
93
+ return await this._importRawKey(toArrayBuffer(key), false);
94
+ }
95
+ catch (e) {
96
+ throw new DeserializeError(e);
97
+ }
98
+ }
99
+ async importKey(format, key, isPublic) {
100
+ await this._setup();
101
+ try {
102
+ if (format === "raw") {
103
+ return await this._importRawKey(key, isPublic);
104
+ }
105
+ // jwk
106
+ if (key instanceof ArrayBuffer) {
107
+ throw new Error("Invalid jwk key format");
108
+ }
109
+ return await this._importJWK(key, isPublic);
110
+ }
111
+ catch (e) {
112
+ throw new DeserializeError(e);
113
+ }
114
+ }
115
+ async generateKeyPair() {
116
+ await this._setup();
117
+ try {
118
+ return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);
119
+ }
120
+ catch (e) {
121
+ throw new NotSupportedError(e);
122
+ }
123
+ }
124
+ async deriveKeyPair(ikm) {
125
+ await this._setup();
126
+ try {
127
+ const rawIkm = toArrayBuffer(ikm);
128
+ const dkpPrk = await this._hkdf.labeledExtract(EMPTY, LABEL_DKP_PRK, new Uint8Array(rawIkm));
129
+ const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);
130
+ const rawSkBytes = new Uint8Array(rawSk);
131
+ const sk = await this._deserializePkcs8Key(rawSkBytes);
132
+ rawSkBytes.fill(0);
133
+ return {
134
+ privateKey: sk,
135
+ publicKey: await this.derivePublicKey(sk),
136
+ };
137
+ }
138
+ catch (e) {
139
+ throw new DeriveKeyPairError(e);
140
+ }
141
+ }
142
+ async derivePublicKey(key) {
143
+ await this._setup();
144
+ try {
145
+ const jwk = await this._api.exportKey("jwk", key);
146
+ delete jwk["d"];
147
+ delete jwk["key_ops"];
148
+ return await this._api.importKey("jwk", jwk, this._alg, true, []);
149
+ }
150
+ catch {
151
+ try {
152
+ // Firefox fails to export JWK from some imported X25519 private keys.
153
+ const bp = await this._api.importKey("raw", BASE_POINT_X25519.buffer, this._alg, true, []);
154
+ const bits = await this._api.deriveBits({
155
+ name: ALG_NAME,
156
+ public: bp,
157
+ }, key, this._nPk * 8);
158
+ return await this._api.importKey("raw", bits, this._alg, true, []);
159
+ }
160
+ catch (e) {
161
+ throw new DeserializeError(e);
162
+ }
163
+ }
164
+ }
165
+ async dh(sk, pk) {
166
+ await this._setup();
167
+ try {
168
+ const bits = await this._api.deriveBits({
169
+ name: ALG_NAME,
170
+ public: pk,
171
+ }, sk, this._nDh * 8);
172
+ return bits;
173
+ }
174
+ catch (e) {
175
+ throw new SerializeError(e);
176
+ }
177
+ }
178
+ async _importRawKey(key, isPublic) {
179
+ if (isPublic && key.byteLength !== this._nPk) {
180
+ throw new Error("Invalid public key for the ciphersuite");
181
+ }
182
+ if (!isPublic && key.byteLength !== this._nSk) {
183
+ throw new Error("Invalid private key for the ciphersuite");
184
+ }
185
+ if (isPublic) {
186
+ return await this._api.importKey("raw", key, this._alg, true, []);
187
+ }
188
+ return await this._deserializePkcs8Key(new Uint8Array(key));
189
+ }
190
+ async _importJWK(key, isPublic) {
191
+ if (typeof key.kty === "undefined" || key.kty !== "OKP") {
192
+ throw new Error(`Invalid kty: ${key.crv}`);
193
+ }
194
+ if (typeof key.crv === "undefined" || key.crv !== ALG_NAME) {
195
+ throw new Error(`Invalid crv: ${key.crv}`);
196
+ }
197
+ if (isPublic) {
198
+ if (typeof key.d !== "undefined") {
199
+ throw new Error("Invalid key: `d` should not be set");
200
+ }
201
+ return await this._api.importKey("jwk", key, this._alg, true, []);
202
+ }
203
+ if (typeof key.d === "undefined") {
204
+ throw new Error("Invalid key: `d` not found");
205
+ }
206
+ return await this._api.importKey("jwk", key, this._alg, true, KEM_USAGES);
207
+ }
208
+ async _deserializePkcs8Key(k) {
209
+ const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);
210
+ pkcs8Key.set(this._pkcs8AlgId, 0);
211
+ pkcs8Key.set(k, this._pkcs8AlgId.length);
212
+ return await this._api.importKey("pkcs8", pkcs8Key, this._alg, true, KEM_USAGES);
213
+ }
214
+ }
@@ -0,0 +1,24 @@
1
+ import type { DhkemPrimitives, KdfInterface } from "@hpke/common";
2
+ import { NativeAlgorithm } from "@hpke/common";
3
+ export declare class X448 extends NativeAlgorithm implements DhkemPrimitives {
4
+ private _hkdf;
5
+ private _alg;
6
+ private _nPk;
7
+ private _nSk;
8
+ private _nDh;
9
+ private _pkcs8AlgId;
10
+ constructor(hkdf: KdfInterface);
11
+ serializePublicKey(key: CryptoKey): Promise<ArrayBuffer>;
12
+ deserializePublicKey(key: ArrayBufferLike | ArrayBufferView): Promise<CryptoKey>;
13
+ serializePrivateKey(key: CryptoKey): Promise<ArrayBuffer>;
14
+ deserializePrivateKey(key: ArrayBufferLike | ArrayBufferView): Promise<CryptoKey>;
15
+ importKey(format: "raw" | "jwk", key: ArrayBuffer | JsonWebKey, isPublic: boolean): Promise<CryptoKey>;
16
+ generateKeyPair(): Promise<CryptoKeyPair>;
17
+ deriveKeyPair(ikm: ArrayBufferLike | ArrayBufferView): Promise<CryptoKeyPair>;
18
+ derivePublicKey(key: CryptoKey): Promise<CryptoKey>;
19
+ dh(sk: CryptoKey, pk: CryptoKey): Promise<ArrayBuffer>;
20
+ private _importRawKey;
21
+ private _importJWK;
22
+ private _deserializePkcs8Key;
23
+ }
24
+ //# sourceMappingURL=x448.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x448.d.ts","sourceRoot":"","sources":["../../../../src/src/kems/dhkemPrimitives/x448.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,EAQL,eAAe,EAIhB,MAAM,cAAc,CAAC;AAgBtB,qBAAa,IAAK,SAAQ,eAAgB,YAAW,eAAe;IAClE,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAa;gBAEpB,IAAI,EAAE,YAAY;IAUjB,kBAAkB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IASxD,oBAAoB,CAC/B,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,SAAS,CAAC;IASR,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAazD,qBAAqB,CAChC,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,SAAS,CAAC;IASR,SAAS,CACpB,MAAM,EAAE,KAAK,GAAG,KAAK,EACrB,GAAG,EAAE,WAAW,GAAG,UAAU,EAC7B,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,SAAS,CAAC;IAgBR,eAAe,IAAI,OAAO,CAAC,aAAa,CAAC;IAazC,aAAa,CACxB,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,aAAa,CAAC;IA2BZ,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IA4CnD,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;YAiBrD,aAAa;YAsBb,UAAU;YAkCV,oBAAoB;CAcnC"}