wherdr 0.0.0-stage → 1.3.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 (828) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/01adBkx4.js +1 -0
  3. package/.output/public/_nuxt/AgentView.DE2GDt4O.css +1 -0
  4. package/.output/public/_nuxt/BB3uOVbO.js +93 -0
  5. package/.output/public/_nuxt/BDNMzG2s.js +1 -0
  6. package/.output/public/_nuxt/BJsf0WRn.js +2 -0
  7. package/.output/public/_nuxt/Bd17z0YL.js +2 -0
  8. package/.output/public/_nuxt/BpQH8Ho1.js +1 -0
  9. package/.output/public/_nuxt/Bta8at9w.js +6 -0
  10. package/.output/public/_nuxt/C3BWhslt.js +1 -0
  11. package/.output/public/_nuxt/C3P2P5Mv.js +1 -0
  12. package/.output/public/_nuxt/CWwyK2XK.js +2 -0
  13. package/.output/public/_nuxt/CXG-cOdh.js +1 -0
  14. package/.output/public/_nuxt/Cc2bsOcu.js +83 -0
  15. package/.output/public/_nuxt/Ci8N4mWR.js +1 -0
  16. package/.output/public/_nuxt/DKmoLFfn.js +30 -0
  17. package/.output/public/_nuxt/DLLQgP0d.js +1 -0
  18. package/.output/public/_nuxt/DcCZr0Ya.js +17 -0
  19. package/.output/public/_nuxt/DsD2R-37.js +23 -0
  20. package/.output/public/_nuxt/OAXEskzA.js +65 -0
  21. package/.output/public/_nuxt/SiL1FJ5s.js +3 -0
  22. package/.output/public/_nuxt/archivo-latin-ext-wght-normal.C4zznr8T.woff2 +0 -0
  23. package/.output/public/_nuxt/archivo-latin-wght-normal.E0tuGl4L.woff2 +0 -0
  24. package/.output/public/_nuxt/archivo-vietnamese-wght-normal.XAtsl5Q_.woff2 +0 -0
  25. package/.output/public/_nuxt/bLP7Jj-b.js +1 -0
  26. package/.output/public/_nuxt/builds/latest.json +1 -0
  27. package/.output/public/_nuxt/builds/meta/ff11fc8b-1e70-4261-a76e-a52155efb196.json +1 -0
  28. package/.output/public/_nuxt/entry.SHBiCXBL.css +2 -0
  29. package/.output/public/_nuxt/error-404.Bb87HomL.css +1 -0
  30. package/.output/public/_nuxt/error-500.Bwd7zAaE.css +1 -0
  31. package/.output/public/_nuxt/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
  32. package/.output/public/_nuxt/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
  33. package/.output/public/_nuxt/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
  34. package/.output/public/_nuxt/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
  35. package/.output/public/_nuxt/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
  36. package/.output/public/_nuxt/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
  37. package/.output/public/_nuxt/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
  38. package/.output/public/_nuxt/jetbrains-mono-cyrillic-wght-normal.D73BlboJ.woff2 +0 -0
  39. package/.output/public/_nuxt/jetbrains-mono-greek-wght-normal.Bw9x6K1M.woff2 +0 -0
  40. package/.output/public/_nuxt/jetbrains-mono-latin-ext-wght-normal.DBQx-q_a.woff2 +0 -0
  41. package/.output/public/_nuxt/jetbrains-mono-latin-wght-normal.B9CIFXIH.woff2 +0 -0
  42. package/.output/public/_nuxt/jetbrains-mono-vietnamese-wght-normal.Bt-aOZkq.woff2 +0 -0
  43. package/.output/public/_nuxt/wherdr-nerd-awesome.DQ3_iAfa.woff2 +0 -0
  44. package/.output/public/_nuxt/wherdr-nerd-codicons.CtEsfSAf.woff2 +0 -0
  45. package/.output/public/_nuxt/wherdr-nerd-devicons.ZMSFX1sW.woff2 +0 -0
  46. package/.output/public/_nuxt/wherdr-nerd-extension.Dai_ky39.woff2 +0 -0
  47. package/.output/public/_nuxt/wherdr-nerd-material-1.BdvqkCqW.woff2 +0 -0
  48. package/.output/public/_nuxt/wherdr-nerd-material-2.C_flbBWO.woff2 +0 -0
  49. package/.output/public/_nuxt/wherdr-nerd-material-3.8xz7iX-Y.woff2 +0 -0
  50. package/.output/public/_nuxt/wherdr-nerd-material-4.CO_PudDR.woff2 +0 -0
  51. package/.output/public/_nuxt/wherdr-nerd-octicons.Hl4VEx8m.woff2 +0 -0
  52. package/.output/public/_nuxt/wherdr-nerd-powerline.B_kAMxXr.woff2 +0 -0
  53. package/.output/public/_nuxt/wherdr-symbols.C1LsPKmg.woff2 +0 -0
  54. package/.output/public/_nuxt/yzABg5xl.js +1 -0
  55. package/.output/public/manifest-en.webmanifest +18 -0
  56. package/.output/public/manifest.webmanifest +18 -0
  57. package/.output/public/sw.js +99 -0
  58. package/.output/server/chunks/_/awake.mjs +170 -0
  59. package/.output/server/chunks/_/branding.mjs +28 -0
  60. package/.output/server/chunks/_/changes.mjs +199 -0
  61. package/.output/server/chunks/_/error-500.mjs +20 -0
  62. package/.output/server/chunks/_/machineOrder.mjs +40 -0
  63. package/.output/server/chunks/_/onboarding.mjs +26 -0
  64. package/.output/server/chunks/_/phone.mjs +343 -0
  65. package/.output/server/chunks/_/plugins.mjs +248 -0
  66. package/.output/server/chunks/_/projectBoard.mjs +275 -0
  67. package/.output/server/chunks/_/projectsActions.mjs +143 -0
  68. package/.output/server/chunks/_/projectsPlugin.mjs +56 -0
  69. package/.output/server/chunks/_/restart.mjs +459 -0
  70. package/.output/server/chunks/_/reveal.mjs +137 -0
  71. package/.output/server/chunks/_/worktrees.mjs +74 -0
  72. package/.output/server/chunks/_/ws.mjs +57 -0
  73. package/.output/server/chunks/nitro/nitro.mjs +20841 -0
  74. package/.output/server/chunks/raw/apple-touch-icon.mjs +7 -0
  75. package/.output/server/chunks/raw/build-nerd-font.mjs +7 -0
  76. package/.output/server/chunks/raw/build-terminal-font.mjs +7 -0
  77. package/.output/server/chunks/raw/check-leaks.mjs +5 -0
  78. package/.output/server/chunks/raw/dev.wherdr.open.mjs +7 -0
  79. package/.output/server/chunks/raw/docker-entrypoint.mjs +7 -0
  80. package/.output/server/chunks/raw/favicon-32.mjs +7 -0
  81. package/.output/server/chunks/raw/favicon.mjs +7 -0
  82. package/.output/server/chunks/raw/herdr-plugin.mjs +7 -0
  83. package/.output/server/chunks/raw/icon-192.mjs +7 -0
  84. package/.output/server/chunks/raw/icon-512-maskable.mjs +7 -0
  85. package/.output/server/chunks/raw/icon-512.mjs +7 -0
  86. package/.output/server/chunks/raw/icon-maskable.mjs +7 -0
  87. package/.output/server/chunks/raw/icon.mjs +7 -0
  88. package/.output/server/chunks/raw/install-claude-statusline.mjs +7 -0
  89. package/.output/server/chunks/raw/install-host-open.mjs +7 -0
  90. package/.output/server/chunks/raw/pack-output.mjs +5 -0
  91. package/.output/server/chunks/raw/reveal.mjs +7 -0
  92. package/.output/server/chunks/raw/wherdr-open.mjs +7 -0
  93. package/.output/server/chunks/routes/api/_..._.mjs +31 -0
  94. package/.output/server/chunks/routes/api/agents.post.mjs +31 -0
  95. package/.output/server/chunks/routes/api/ask-tab.post.mjs +50 -0
  96. package/.output/server/chunks/routes/api/attach.post.mjs +36 -0
  97. package/.output/server/chunks/routes/api/auth/disable.post.mjs +31 -0
  98. package/.output/server/chunks/routes/api/auth/lock-all.post.mjs +31 -0
  99. package/.output/server/chunks/routes/api/auth/lock.post.mjs +31 -0
  100. package/.output/server/chunks/routes/api/auth/login/options.post.mjs +31 -0
  101. package/.output/server/chunks/routes/api/auth/login/verify.post.mjs +31 -0
  102. package/.output/server/chunks/routes/api/auth/max-session.post.mjs +31 -0
  103. package/.output/server/chunks/routes/api/auth/register/options.post.mjs +31 -0
  104. package/.output/server/chunks/routes/api/auth/register/verify.post.mjs +31 -0
  105. package/.output/server/chunks/routes/api/auth/status.get.mjs +34 -0
  106. package/.output/server/chunks/routes/api/changes.get.mjs +39 -0
  107. package/.output/server/chunks/routes/api/chat/image.get.mjs +41 -0
  108. package/.output/server/chunks/routes/api/chat.get.mjs +94 -0
  109. package/.output/server/chunks/routes/api/choose.post.mjs +136 -0
  110. package/.output/server/chunks/routes/api/claude-statusline.post.mjs +36 -0
  111. package/.output/server/chunks/routes/api/close/status.get.mjs +37 -0
  112. package/.output/server/chunks/routes/api/close.post.mjs +38 -0
  113. package/.output/server/chunks/routes/api/codex-update.post.mjs +42 -0
  114. package/.output/server/chunks/routes/api/commands.get.mjs +43 -0
  115. package/.output/server/chunks/routes/api/config.get.mjs +87 -0
  116. package/.output/server/chunks/routes/api/dirs.get.mjs +34 -0
  117. package/.output/server/chunks/routes/api/dismiss.post.mjs +34 -0
  118. package/.output/server/chunks/routes/api/effort.post.mjs +37 -0
  119. package/.output/server/chunks/routes/api/efforts.get.mjs +38 -0
  120. package/.output/server/chunks/routes/api/file.post.mjs +35 -0
  121. package/.output/server/chunks/routes/api/gitroot.get.mjs +38 -0
  122. package/.output/server/chunks/routes/api/index.get.mjs +37 -0
  123. package/.output/server/chunks/routes/api/input.post.mjs +44 -0
  124. package/.output/server/chunks/routes/api/interrupt.post.mjs +49 -0
  125. package/.output/server/chunks/routes/api/isgit.get.mjs +38 -0
  126. package/.output/server/chunks/routes/api/machine/awake.get.mjs +40 -0
  127. package/.output/server/chunks/routes/api/machine/awake.post.mjs +41 -0
  128. package/.output/server/chunks/routes/api/machine/order.get.mjs +32 -0
  129. package/.output/server/chunks/routes/api/machine/order.post.mjs +37 -0
  130. package/.output/server/chunks/routes/api/machine/rename.post.mjs +40 -0
  131. package/.output/server/chunks/routes/api/menu.post.mjs +77 -0
  132. package/.output/server/chunks/routes/api/model.post.mjs +37 -0
  133. package/.output/server/chunks/routes/api/models.get.mjs +36 -0
  134. package/.output/server/chunks/routes/api/nav.post.mjs +59 -0
  135. package/.output/server/chunks/routes/api/onboarding.get.mjs +32 -0
  136. package/.output/server/chunks/routes/api/onboarding.post.mjs +35 -0
  137. package/.output/server/chunks/routes/api/phone.get.mjs +39 -0
  138. package/.output/server/chunks/routes/api/phone.post.mjs +39 -0
  139. package/.output/server/chunks/routes/api/plugins/actions.get.mjs +37 -0
  140. package/.output/server/chunks/routes/api/plugins/invoke.post.mjs +34 -0
  141. package/.output/server/chunks/routes/api/plugins/profiles.get.mjs +36 -0
  142. package/.output/server/chunks/routes/api/plugins/projects.get.mjs +38 -0
  143. package/.output/server/chunks/routes/api/plugins/projects.post.mjs +38 -0
  144. package/.output/server/chunks/routes/api/plugins/thread-limits.get.mjs +31 -0
  145. package/.output/server/chunks/routes/api/plugins/thread-limits.post.mjs +41 -0
  146. package/.output/server/chunks/routes/api/project/report.get.mjs +37 -0
  147. package/.output/server/chunks/routes/api/prompt.post.mjs +88 -0
  148. package/.output/server/chunks/routes/api/push/quiet.post.mjs +50 -0
  149. package/.output/server/chunks/routes/api/push/subscribe.post.mjs +52 -0
  150. package/.output/server/chunks/routes/api/push/test.post.mjs +33 -0
  151. package/.output/server/chunks/routes/api/push/unsubscribe.post.mjs +35 -0
  152. package/.output/server/chunks/routes/api/quotas.get.mjs +31 -0
  153. package/.output/server/chunks/routes/api/rename.post.mjs +37 -0
  154. package/.output/server/chunks/routes/api/requeue.post.mjs +35 -0
  155. package/.output/server/chunks/routes/api/restart.get.mjs +39 -0
  156. package/.output/server/chunks/routes/api/restart.post.mjs +40 -0
  157. package/.output/server/chunks/routes/api/reveal.post.mjs +32 -0
  158. package/.output/server/chunks/routes/api/screen-key.post.mjs +42 -0
  159. package/.output/server/chunks/routes/api/screen.get.mjs +77 -0
  160. package/.output/server/chunks/routes/api/search.get.mjs +77 -0
  161. package/.output/server/chunks/routes/api/seen.post.mjs +34 -0
  162. package/.output/server/chunks/routes/api/sessions.get.mjs +34 -0
  163. package/.output/server/chunks/routes/api/sessions.post.mjs +34 -0
  164. package/.output/server/chunks/routes/api/space.post.mjs +259 -0
  165. package/.output/server/chunks/routes/api/state.get.mjs +31 -0
  166. package/.output/server/chunks/routes/api/unqueue.post.mjs +36 -0
  167. package/.output/server/chunks/routes/api/update.get.mjs +79 -0
  168. package/.output/server/chunks/routes/api/upload.post.mjs +34 -0
  169. package/.output/server/chunks/routes/api/worktrees/remove.post.mjs +35 -0
  170. package/.output/server/chunks/routes/api/worktrees.get.mjs +32 -0
  171. package/.output/server/chunks/routes/favicon.ico.get.mjs +32 -0
  172. package/.output/server/chunks/routes/icons/_name_.get.mjs +32 -0
  173. package/.output/server/chunks/routes/renderer.mjs +359 -0
  174. package/.output/server/chunks/routes/uploads/_...name_.get.mjs +40 -0
  175. package/.output/server/chunks/routes/ws/_..._.mjs +33 -0
  176. package/.output/server/chunks/routes/ws/events.mjs +58 -0
  177. package/.output/server/chunks/routes/ws/mirror.mjs +157 -0
  178. package/.output/server/chunks/routes/ws/term.mjs +57 -0
  179. package/.output/server/chunks/virtual/_raw-helpers.mjs +12 -0
  180. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
  181. package/.output/server/chunks/virtual/precomputed.mjs +4 -0
  182. package/.output/server/index.mjs +27 -0
  183. package/.output/server/node_modules/@babel/parser/lib/index.js +14616 -0
  184. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  185. package/.output/server/node_modules/@hexagon/base64/package.json +73 -0
  186. package/.output/server/node_modules/@hexagon/base64/src/base64.js +190 -0
  187. package/.output/server/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor.js +440 -0
  188. package/.output/server/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor_internal.js +111 -0
  189. package/.output/server/node_modules/@levischuck/tiny-cbor/esm/index.js +1 -0
  190. package/.output/server/node_modules/@levischuck/tiny-cbor/esm/package.json +3 -0
  191. package/.output/server/node_modules/@levischuck/tiny-cbor/package.json +25 -0
  192. package/.output/server/node_modules/@peculiar/asn1-android/build/es2015/attestation.js +34 -0
  193. package/.output/server/node_modules/@peculiar/asn1-android/build/es2015/index.js +3 -0
  194. package/.output/server/node_modules/@peculiar/asn1-android/build/es2015/key_description.js +512 -0
  195. package/.output/server/node_modules/@peculiar/asn1-android/build/es2015/nonstandard.js +103 -0
  196. package/.output/server/node_modules/@peculiar/asn1-android/build/es2015/package.json +3 -0
  197. package/.output/server/node_modules/@peculiar/asn1-android/node_modules/tslib/modules/index.js +70 -0
  198. package/.output/server/node_modules/@peculiar/asn1-android/node_modules/tslib/modules/package.json +3 -0
  199. package/.output/server/node_modules/@peculiar/asn1-android/node_modules/tslib/package.json +47 -0
  200. package/.output/server/node_modules/@peculiar/asn1-android/node_modules/tslib/tslib.js +484 -0
  201. package/.output/server/node_modules/@peculiar/asn1-android/package.json +64 -0
  202. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/attribute.js +22 -0
  203. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/attributes/counter_signature.js +13 -0
  204. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/attributes/index.js +8 -0
  205. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/attributes/message_digest.js +8 -0
  206. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/attributes/signing_time.js +13 -0
  207. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/certificate_choices.js +64 -0
  208. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/content_info.js +22 -0
  209. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/encapsulated_content_info.js +40 -0
  210. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/encrypted_content_info.js +56 -0
  211. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/enveloped_data.js +60 -0
  212. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/index.js +24 -0
  213. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/issuer_and_serial_number.js +23 -0
  214. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/kek_recipient_info.js +53 -0
  215. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/key_agree_recipient_info.js +167 -0
  216. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/key_trans_recipient_info.js +51 -0
  217. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/object_identifiers.js +10 -0
  218. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/originator_info.js +31 -0
  219. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/other_key_attribute.js +22 -0
  220. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/password_recipient_info.js +32 -0
  221. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/recipient_info.js +75 -0
  222. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/recipient_infos.js +20 -0
  223. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/revocation_info_choice.js +54 -0
  224. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/signed_data.js +64 -0
  225. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/signer_identifier.js +28 -0
  226. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/signer_info.js +70 -0
  227. package/.output/server/node_modules/@peculiar/asn1-cms/build/cjs/types.js +51 -0
  228. package/.output/server/node_modules/@peculiar/asn1-cms/node_modules/tslib/modules/index.js +70 -0
  229. package/.output/server/node_modules/@peculiar/asn1-cms/node_modules/tslib/modules/package.json +3 -0
  230. package/.output/server/node_modules/@peculiar/asn1-cms/node_modules/tslib/package.json +47 -0
  231. package/.output/server/node_modules/@peculiar/asn1-cms/node_modules/tslib/tslib.js +484 -0
  232. package/.output/server/node_modules/@peculiar/asn1-cms/package.json +65 -0
  233. package/.output/server/node_modules/@peculiar/asn1-csr/build/cjs/attributes.js +20 -0
  234. package/.output/server/node_modules/@peculiar/asn1-csr/build/cjs/certification_request.js +29 -0
  235. package/.output/server/node_modules/@peculiar/asn1-csr/build/cjs/certification_request_info.js +34 -0
  236. package/.output/server/node_modules/@peculiar/asn1-csr/build/cjs/index.js +6 -0
  237. package/.output/server/node_modules/@peculiar/asn1-csr/node_modules/tslib/modules/index.js +70 -0
  238. package/.output/server/node_modules/@peculiar/asn1-csr/node_modules/tslib/modules/package.json +3 -0
  239. package/.output/server/node_modules/@peculiar/asn1-csr/node_modules/tslib/package.json +47 -0
  240. package/.output/server/node_modules/@peculiar/asn1-csr/node_modules/tslib/tslib.js +484 -0
  241. package/.output/server/node_modules/@peculiar/asn1-csr/package.json +65 -0
  242. package/.output/server/node_modules/@peculiar/asn1-ecc/build/cjs/algorithms.js +14 -0
  243. package/.output/server/node_modules/@peculiar/asn1-ecc/build/cjs/ec_parameters.js +27 -0
  244. package/.output/server/node_modules/@peculiar/asn1-ecc/build/cjs/ec_private_key.js +36 -0
  245. package/.output/server/node_modules/@peculiar/asn1-ecc/build/cjs/ec_signature_value.js +25 -0
  246. package/.output/server/node_modules/@peculiar/asn1-ecc/build/cjs/index.js +9 -0
  247. package/.output/server/node_modules/@peculiar/asn1-ecc/build/cjs/object_identifiers.js +26 -0
  248. package/.output/server/node_modules/@peculiar/asn1-ecc/build/cjs/rfc3279.js +95 -0
  249. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/algorithms.js +10 -0
  250. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/ec_parameters.js +24 -0
  251. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/ec_private_key.js +32 -0
  252. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/ec_signature_value.js +21 -0
  253. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/index.js +6 -0
  254. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/object_identifiers.js +23 -0
  255. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/package.json +3 -0
  256. package/.output/server/node_modules/@peculiar/asn1-ecc/build/es2015/rfc3279.js +90 -0
  257. package/.output/server/node_modules/@peculiar/asn1-ecc/node_modules/tslib/modules/index.js +70 -0
  258. package/.output/server/node_modules/@peculiar/asn1-ecc/node_modules/tslib/modules/package.json +3 -0
  259. package/.output/server/node_modules/@peculiar/asn1-ecc/node_modules/tslib/package.json +47 -0
  260. package/.output/server/node_modules/@peculiar/asn1-ecc/node_modules/tslib/tslib.js +484 -0
  261. package/.output/server/node_modules/@peculiar/asn1-ecc/package.json +66 -0
  262. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/attribute.js +36 -0
  263. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/authenticated_safe.js +20 -0
  264. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/bags/cert_bag.js +26 -0
  265. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/bags/crl_bag.js +25 -0
  266. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/bags/index.js +9 -0
  267. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/bags/key_bag.js +12 -0
  268. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/bags/pkcs8_shrouded_key_bag.js +12 -0
  269. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/bags/secret_bag.js +22 -0
  270. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/bags/types.js +11 -0
  271. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/index.js +10 -0
  272. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/mac_data.js +27 -0
  273. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/object_identifiers.js +14 -0
  274. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/pfx.js +28 -0
  275. package/.output/server/node_modules/@peculiar/asn1-pfx/build/cjs/safe_bag.js +45 -0
  276. package/.output/server/node_modules/@peculiar/asn1-pfx/node_modules/tslib/modules/index.js +70 -0
  277. package/.output/server/node_modules/@peculiar/asn1-pfx/node_modules/tslib/modules/package.json +3 -0
  278. package/.output/server/node_modules/@peculiar/asn1-pfx/node_modules/tslib/package.json +47 -0
  279. package/.output/server/node_modules/@peculiar/asn1-pfx/node_modules/tslib/tslib.js +484 -0
  280. package/.output/server/node_modules/@peculiar/asn1-pfx/package.json +67 -0
  281. package/.output/server/node_modules/@peculiar/asn1-pkcs8/build/cjs/encrypted_private_key_info.js +23 -0
  282. package/.output/server/node_modules/@peculiar/asn1-pkcs8/build/cjs/index.js +5 -0
  283. package/.output/server/node_modules/@peculiar/asn1-pkcs8/build/cjs/private_key_info.js +54 -0
  284. package/.output/server/node_modules/@peculiar/asn1-pkcs8/node_modules/tslib/modules/index.js +70 -0
  285. package/.output/server/node_modules/@peculiar/asn1-pkcs8/node_modules/tslib/modules/package.json +3 -0
  286. package/.output/server/node_modules/@peculiar/asn1-pkcs8/node_modules/tslib/package.json +47 -0
  287. package/.output/server/node_modules/@peculiar/asn1-pkcs8/node_modules/tslib/tslib.js +484 -0
  288. package/.output/server/node_modules/@peculiar/asn1-pkcs8/package.json +63 -0
  289. package/.output/server/node_modules/@peculiar/asn1-pkcs9/build/cjs/index.js +301 -0
  290. package/.output/server/node_modules/@peculiar/asn1-pkcs9/node_modules/tslib/modules/index.js +70 -0
  291. package/.output/server/node_modules/@peculiar/asn1-pkcs9/node_modules/tslib/modules/package.json +3 -0
  292. package/.output/server/node_modules/@peculiar/asn1-pkcs9/node_modules/tslib/package.json +47 -0
  293. package/.output/server/node_modules/@peculiar/asn1-pkcs9/node_modules/tslib/tslib.js +484 -0
  294. package/.output/server/node_modules/@peculiar/asn1-pkcs9/package.json +67 -0
  295. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/algorithms.js +40 -0
  296. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/index.js +9 -0
  297. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/object_identifiers.js +28 -0
  298. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/other_prime_info.js +46 -0
  299. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/index.js +6 -0
  300. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/rsaes_oaep.js +45 -0
  301. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/rsassa_pkcs1_v1_5.js +20 -0
  302. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/parameters/rsassa_pss.js +53 -0
  303. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/rsa_private_key.js +79 -0
  304. package/.output/server/node_modules/@peculiar/asn1-rsa/build/cjs/rsa_public_key.js +25 -0
  305. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/algorithms.js +36 -0
  306. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/index.js +6 -0
  307. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/object_identifiers.js +25 -0
  308. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/other_prime_info.js +42 -0
  309. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/package.json +3 -0
  310. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/parameters/index.js +3 -0
  311. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsaes_oaep.js +41 -0
  312. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsassa_pkcs1_v1_5.js +16 -0
  313. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsassa_pss.js +49 -0
  314. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/rsa_private_key.js +75 -0
  315. package/.output/server/node_modules/@peculiar/asn1-rsa/build/es2015/rsa_public_key.js +21 -0
  316. package/.output/server/node_modules/@peculiar/asn1-rsa/node_modules/tslib/modules/index.js +70 -0
  317. package/.output/server/node_modules/@peculiar/asn1-rsa/node_modules/tslib/modules/package.json +3 -0
  318. package/.output/server/node_modules/@peculiar/asn1-rsa/node_modules/tslib/package.json +47 -0
  319. package/.output/server/node_modules/@peculiar/asn1-rsa/node_modules/tslib/tslib.js +484 -0
  320. package/.output/server/node_modules/@peculiar/asn1-rsa/package.json +64 -0
  321. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/convert.js +25 -0
  322. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/converters.js +148 -0
  323. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/decorators.js +52 -0
  324. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/enums.js +40 -0
  325. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/errors/index.js +4 -0
  326. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/errors/schema_validation.js +7 -0
  327. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/helper.js +44 -0
  328. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/index.js +22 -0
  329. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/objects.js +17 -0
  330. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/parser.js +313 -0
  331. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/schema.js +165 -0
  332. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/serializer.js +150 -0
  333. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/storage.js +5 -0
  334. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/types/bit_string.js +71 -0
  335. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/types/index.js +5 -0
  336. package/.output/server/node_modules/@peculiar/asn1-schema/build/cjs/types/octet_string.js +45 -0
  337. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/convert.js +20 -0
  338. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/converters.js +143 -0
  339. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/decorators.js +43 -0
  340. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/enums.js +37 -0
  341. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/errors/index.js +1 -0
  342. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/errors/schema_validation.js +3 -0
  343. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/helper.js +39 -0
  344. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/index.js +9 -0
  345. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/objects.js +13 -0
  346. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/package.json +3 -0
  347. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/parser.js +308 -0
  348. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/schema.js +160 -0
  349. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/serializer.js +145 -0
  350. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/storage.js +2 -0
  351. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/types/bit_string.js +66 -0
  352. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/types/index.js +2 -0
  353. package/.output/server/node_modules/@peculiar/asn1-schema/build/es2015/types/octet_string.js +40 -0
  354. package/.output/server/node_modules/@peculiar/asn1-schema/node_modules/tslib/modules/index.js +70 -0
  355. package/.output/server/node_modules/@peculiar/asn1-schema/node_modules/tslib/modules/package.json +3 -0
  356. package/.output/server/node_modules/@peculiar/asn1-schema/node_modules/tslib/package.json +47 -0
  357. package/.output/server/node_modules/@peculiar/asn1-schema/node_modules/tslib/tslib.js +484 -0
  358. package/.output/server/node_modules/@peculiar/asn1-schema/package.json +74 -0
  359. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/algorithm_identifier.js +28 -0
  360. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/attribute.js +22 -0
  361. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/certificate.js +29 -0
  362. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/certificate_list.js +29 -0
  363. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extension.js +41 -0
  364. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/authority_information_access.js +36 -0
  365. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/authority_key_identifier.js +48 -0
  366. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/basic_constraints.js +27 -0
  367. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/certificate_issuer.js +19 -0
  368. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/certificate_policies.js +136 -0
  369. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_delta_indicator.js +14 -0
  370. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_distribution_points.js +132 -0
  371. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_freshest.js +22 -0
  372. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_issuing_distribution_point.js +68 -0
  373. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_number.js +20 -0
  374. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/crl_reason.js +39 -0
  375. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/entrust_version_info.js +46 -0
  376. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/extended_key_usage.js +28 -0
  377. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/index.js +28 -0
  378. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/inhibit_any_policy.js +23 -0
  379. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/invalidity_date.js +22 -0
  380. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/issuer_alternative_name.js +19 -0
  381. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/key_usage.js +56 -0
  382. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/name_constraints.js +74 -0
  383. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/policy_constraints.js +33 -0
  384. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/policy_mappings.js +35 -0
  385. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/private_key_usage_period.js +31 -0
  386. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_alternative_name.js +19 -0
  387. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_directory_attributes.js +22 -0
  388. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_info_access.js +22 -0
  389. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/extensions/subject_key_identifier.js +9 -0
  390. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/general_name.js +132 -0
  391. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/general_names.js +20 -0
  392. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/index.js +19 -0
  393. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/ip_converter.js +177 -0
  394. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/name.js +110 -0
  395. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/object_identifiers.js +16 -0
  396. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/subject_public_key_info.js +20 -0
  397. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/tbs_cert_list.js +83 -0
  398. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/tbs_certificate.js +78 -0
  399. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/time.js +43 -0
  400. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/types.js +9 -0
  401. package/.output/server/node_modules/@peculiar/asn1-x509/build/cjs/validity.js +23 -0
  402. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/algorithm_identifier.js +24 -0
  403. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/attribute.js +18 -0
  404. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/certificate.js +25 -0
  405. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/certificate_list.js +25 -0
  406. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extension.js +37 -0
  407. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/authority_information_access.js +32 -0
  408. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/authority_key_identifier.js +43 -0
  409. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/basic_constraints.js +23 -0
  410. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/certificate_issuer.js +16 -0
  411. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/certificate_policies.js +129 -0
  412. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_delta_indicator.js +11 -0
  413. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_distribution_points.js +127 -0
  414. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_freshest.js +19 -0
  415. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_issuing_distribution_point.js +64 -0
  416. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_number.js +17 -0
  417. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_reason.js +36 -0
  418. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/entrust_version_info.js +41 -0
  419. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/extended_key_usage.js +25 -0
  420. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/index.js +25 -0
  421. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/inhibit_any_policy.js +20 -0
  422. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/invalidity_date.js +19 -0
  423. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/issuer_alternative_name.js +16 -0
  424. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/key_usage.js +52 -0
  425. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/name_constraints.js +69 -0
  426. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/policy_constraints.js +29 -0
  427. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/policy_mappings.js +31 -0
  428. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/private_key_usage_period.js +27 -0
  429. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_alternative_name.js +16 -0
  430. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_directory_attributes.js +19 -0
  431. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_info_access.js +19 -0
  432. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_key_identifier.js +5 -0
  433. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/general_name.js +127 -0
  434. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/general_names.js +17 -0
  435. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/index.js +16 -0
  436. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/ip_converter.js +173 -0
  437. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/name.js +106 -0
  438. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/object_identifiers.js +13 -0
  439. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/package.json +3 -0
  440. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/subject_public_key_info.js +16 -0
  441. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/tbs_cert_list.js +78 -0
  442. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/tbs_certificate.js +74 -0
  443. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/time.js +40 -0
  444. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/types.js +6 -0
  445. package/.output/server/node_modules/@peculiar/asn1-x509/build/es2015/validity.js +19 -0
  446. package/.output/server/node_modules/@peculiar/asn1-x509/node_modules/tslib/modules/index.js +70 -0
  447. package/.output/server/node_modules/@peculiar/asn1-x509/node_modules/tslib/modules/package.json +3 -0
  448. package/.output/server/node_modules/@peculiar/asn1-x509/node_modules/tslib/package.json +47 -0
  449. package/.output/server/node_modules/@peculiar/asn1-x509/node_modules/tslib/tslib.js +484 -0
  450. package/.output/server/node_modules/@peculiar/asn1-x509/package.json +64 -0
  451. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/aa_clear_attrs.js +27 -0
  452. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/aa_controls.js +44 -0
  453. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/attr_cert_issuer.js +31 -0
  454. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/attr_cert_validity_period.js +19 -0
  455. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/attr_spec.js +19 -0
  456. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/attribute_certificate.js +25 -0
  457. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/attribute_certificate_info.js +67 -0
  458. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/class_list.js +16 -0
  459. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/clearance.js +31 -0
  460. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/holder.js +41 -0
  461. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/ietf_attr_syntax.js +46 -0
  462. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/index.js +23 -0
  463. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/issuer_serial.js +30 -0
  464. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/object_digest_info.js +37 -0
  465. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/object_identifiers.js +17 -0
  466. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/proxy_info.js +20 -0
  467. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/role_syntax.js +29 -0
  468. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/security_category.js +27 -0
  469. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/svce_auth_info.js +27 -0
  470. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/target.js +79 -0
  471. package/.output/server/node_modules/@peculiar/asn1-x509-attr/build/cjs/v2_form.js +39 -0
  472. package/.output/server/node_modules/@peculiar/asn1-x509-attr/node_modules/tslib/modules/index.js +70 -0
  473. package/.output/server/node_modules/@peculiar/asn1-x509-attr/node_modules/tslib/modules/package.json +3 -0
  474. package/.output/server/node_modules/@peculiar/asn1-x509-attr/node_modules/tslib/package.json +47 -0
  475. package/.output/server/node_modules/@peculiar/asn1-x509-attr/node_modules/tslib/tslib.js +484 -0
  476. package/.output/server/node_modules/@peculiar/asn1-x509-attr/package.json +64 -0
  477. package/.output/server/node_modules/@peculiar/utils/build/cjs/bytes/buffer-source.js +115 -0
  478. package/.output/server/node_modules/@peculiar/utils/build/cjs/bytes/concat.js +41 -0
  479. package/.output/server/node_modules/@peculiar/utils/build/cjs/bytes/equal.js +17 -0
  480. package/.output/server/node_modules/@peculiar/utils/build/cjs/bytes/index.js +31 -0
  481. package/.output/server/node_modules/@peculiar/utils/build/cjs/bytes/sequence.js +161 -0
  482. package/.output/server/node_modules/@peculiar/utils/build/cjs/converters/convert.js +74 -0
  483. package/.output/server/node_modules/@peculiar/utils/build/cjs/converters/defaults.js +72 -0
  484. package/.output/server/node_modules/@peculiar/utils/build/cjs/converters/index.js +18 -0
  485. package/.output/server/node_modules/@peculiar/utils/build/cjs/converters/registry.js +188 -0
  486. package/.output/server/node_modules/@peculiar/utils/build/cjs/encoding/base64.js +48 -0
  487. package/.output/server/node_modules/@peculiar/utils/build/cjs/encoding/base64url.js +26 -0
  488. package/.output/server/node_modules/@peculiar/utils/build/cjs/encoding/binary.js +26 -0
  489. package/.output/server/node_modules/@peculiar/utils/build/cjs/encoding/hex.js +229 -0
  490. package/.output/server/node_modules/@peculiar/utils/build/cjs/encoding/index.js +10 -0
  491. package/.output/server/node_modules/@peculiar/utils/build/cjs/encoding/utf16.js +24 -0
  492. package/.output/server/node_modules/@peculiar/utils/build/cjs/encoding/utf8.js +13 -0
  493. package/.output/server/node_modules/@peculiar/utils/build/cjs/index.js +10 -0
  494. package/.output/server/node_modules/@peculiar/utils/build/cjs/legacy/buffer-source-converter.js +37 -0
  495. package/.output/server/node_modules/@peculiar/utils/build/cjs/legacy/convert.js +72 -0
  496. package/.output/server/node_modules/@peculiar/utils/build/cjs/legacy/functions.js +23 -0
  497. package/.output/server/node_modules/@peculiar/utils/build/cjs/legacy/index.js +11 -0
  498. package/.output/server/node_modules/@peculiar/utils/build/cjs/package.json +3 -0
  499. package/.output/server/node_modules/@peculiar/utils/build/cjs/pem/index.js +14 -0
  500. package/.output/server/node_modules/@peculiar/utils/build/cjs/pem/pem.js +140 -0
  501. package/.output/server/node_modules/@peculiar/utils/build/esm/bytes/buffer-source.js +101 -0
  502. package/.output/server/node_modules/@peculiar/utils/build/esm/bytes/concat.js +37 -0
  503. package/.output/server/node_modules/@peculiar/utils/build/esm/bytes/equal.js +14 -0
  504. package/.output/server/node_modules/@peculiar/utils/build/esm/bytes/index.js +4 -0
  505. package/.output/server/node_modules/@peculiar/utils/build/esm/bytes/sequence.js +150 -0
  506. package/.output/server/node_modules/@peculiar/utils/build/esm/converters/convert.js +71 -0
  507. package/.output/server/node_modules/@peculiar/utils/build/esm/converters/defaults.js +68 -0
  508. package/.output/server/node_modules/@peculiar/utils/build/esm/converters/index.js +3 -0
  509. package/.output/server/node_modules/@peculiar/utils/build/esm/converters/registry.js +185 -0
  510. package/.output/server/node_modules/@peculiar/utils/build/esm/encoding/base64.js +40 -0
  511. package/.output/server/node_modules/@peculiar/utils/build/esm/encoding/base64url.js +19 -0
  512. package/.output/server/node_modules/@peculiar/utils/build/esm/encoding/binary.js +20 -0
  513. package/.output/server/node_modules/@peculiar/utils/build/esm/encoding/hex.js +220 -0
  514. package/.output/server/node_modules/@peculiar/utils/build/esm/encoding/index.js +6 -0
  515. package/.output/server/node_modules/@peculiar/utils/build/esm/encoding/utf16.js +19 -0
  516. package/.output/server/node_modules/@peculiar/utils/build/esm/encoding/utf8.js +8 -0
  517. package/.output/server/node_modules/@peculiar/utils/build/esm/index.js +6 -0
  518. package/.output/server/node_modules/@peculiar/utils/build/esm/legacy/buffer-source-converter.js +33 -0
  519. package/.output/server/node_modules/@peculiar/utils/build/esm/legacy/convert.js +68 -0
  520. package/.output/server/node_modules/@peculiar/utils/build/esm/legacy/functions.js +18 -0
  521. package/.output/server/node_modules/@peculiar/utils/build/esm/legacy/index.js +3 -0
  522. package/.output/server/node_modules/@peculiar/utils/build/esm/pem/index.js +1 -0
  523. package/.output/server/node_modules/@peculiar/utils/build/esm/pem/pem.js +129 -0
  524. package/.output/server/node_modules/@peculiar/utils/node_modules/tslib/modules/index.js +70 -0
  525. package/.output/server/node_modules/@peculiar/utils/node_modules/tslib/modules/package.json +3 -0
  526. package/.output/server/node_modules/@peculiar/utils/node_modules/tslib/package.json +47 -0
  527. package/.output/server/node_modules/@peculiar/utils/node_modules/tslib/tslib.js +484 -0
  528. package/.output/server/node_modules/@peculiar/utils/package.json +111 -0
  529. package/.output/server/node_modules/@peculiar/x509/build/x509.cjs.js +3445 -0
  530. package/.output/server/node_modules/@peculiar/x509/node_modules/tslib/modules/index.js +70 -0
  531. package/.output/server/node_modules/@peculiar/x509/node_modules/tslib/modules/package.json +3 -0
  532. package/.output/server/node_modules/@peculiar/x509/node_modules/tslib/package.json +47 -0
  533. package/.output/server/node_modules/@peculiar/x509/node_modules/tslib/tslib.js +484 -0
  534. package/.output/server/node_modules/@peculiar/x509/package.json +94 -0
  535. package/.output/server/node_modules/@simplewebauthn/server/esm/authentication/generateAuthenticationOptions.js +41 -0
  536. package/.output/server/node_modules/@simplewebauthn/server/esm/authentication/verifyAuthenticationResponse.js +171 -0
  537. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/convertAAGUIDToString.js +17 -0
  538. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/convertCOSEtoPKCS.js +21 -0
  539. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/convertCertBufferToPEM.js +31 -0
  540. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/convertPEMToBytes.js +11 -0
  541. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/convertX509PublicKeyToCOSE.js +73 -0
  542. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/cose.js +90 -0
  543. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/decodeAttestationObject.js +16 -0
  544. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/decodeAuthenticatorExtensions.js +34 -0
  545. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/decodeClientDataJSON.js +16 -0
  546. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/decodeCredentialPublicKey.js +11 -0
  547. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/fetch.js +14 -0
  548. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/generateChallenge.js +24 -0
  549. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/generateUserID.js +20 -0
  550. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/getCertificateInfo.js +77 -0
  551. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/index.js +17 -0
  552. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/isCertRevoked.js +96 -0
  553. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/index.js +11 -0
  554. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoBase64URL.js +72 -0
  555. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCBOR.js +35 -0
  556. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/digest.js +14 -0
  557. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/getRandomValues.js +11 -0
  558. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/getWebCrypto.js +49 -0
  559. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/importKey.js +8 -0
  560. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/index.js +7 -0
  561. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +20 -0
  562. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +19 -0
  563. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/unwrapEC2Signature.js +73 -0
  564. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/verify.js +32 -0
  565. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/verifyEC2.js +73 -0
  566. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/verifyOKP.js +51 -0
  567. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoCrypto/verifyRSA.js +91 -0
  568. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/iso/isoUint8Array.js +79 -0
  569. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/logging.js +19 -0
  570. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/mapJWSAlgToCOSEAlg.js +31 -0
  571. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/mapX509SignatureAlgToCOSEAlg.js +35 -0
  572. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/matchExpectedRPID.js +41 -0
  573. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/parseAuthenticatorData.js +106 -0
  574. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/parseBackupFlags.js +25 -0
  575. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/toHash.js +12 -0
  576. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/validateCertificatePath.js +134 -0
  577. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/validateExtFIDOGenCEAAGUID.js +34 -0
  578. package/.output/server/node_modules/@simplewebauthn/server/esm/helpers/verifySignature.js +35 -0
  579. package/.output/server/node_modules/@simplewebauthn/server/esm/index.js +8 -0
  580. package/.output/server/node_modules/@simplewebauthn/server/esm/metadata/mdsTypes.js +17 -0
  581. package/.output/server/node_modules/@simplewebauthn/server/esm/metadata/parseJWT.js +12 -0
  582. package/.output/server/node_modules/@simplewebauthn/server/esm/metadata/verifyAttestationWithMetadata.js +159 -0
  583. package/.output/server/node_modules/@simplewebauthn/server/esm/metadata/verifyJWT.js +42 -0
  584. package/.output/server/node_modules/@simplewebauthn/server/esm/metadata/verifyMDSBlob.js +59 -0
  585. package/.output/server/node_modules/@simplewebauthn/server/esm/package.json +3 -0
  586. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/generateRegistrationOptions.js +181 -0
  587. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/tpm/constants.js +137 -0
  588. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/tpm/parseCertInfo.js +58 -0
  589. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/tpm/parsePubArea.js +94 -0
  590. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/tpm/verifyAttestationTPM.js +331 -0
  591. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/verifyAttestationAndroidKey.js +120 -0
  592. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/verifyAttestationAndroidSafetyNet.js +113 -0
  593. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/verifyAttestationApple.js +58 -0
  594. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/verifyAttestationFIDOU2F.js +48 -0
  595. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifications/verifyAttestationPacked.js +113 -0
  596. package/.output/server/node_modules/@simplewebauthn/server/esm/registration/verifyRegistrationResponse.js +213 -0
  597. package/.output/server/node_modules/@simplewebauthn/server/esm/services/defaultRootCerts/android-key.js +171 -0
  598. package/.output/server/node_modules/@simplewebauthn/server/esm/services/defaultRootCerts/android-safetynet.js +32 -0
  599. package/.output/server/node_modules/@simplewebauthn/server/esm/services/defaultRootCerts/apple.js +25 -0
  600. package/.output/server/node_modules/@simplewebauthn/server/esm/services/defaultRootCerts/mds.js +74 -0
  601. package/.output/server/node_modules/@simplewebauthn/server/esm/services/metadataService.js +268 -0
  602. package/.output/server/node_modules/@simplewebauthn/server/esm/services/settingsService.js +74 -0
  603. package/.output/server/node_modules/@simplewebauthn/server/esm/types/index.js +1 -0
  604. package/.output/server/node_modules/@simplewebauthn/server/package.json +65 -0
  605. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6801 -0
  606. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  607. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +692 -0
  608. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  609. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1420 -0
  610. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  611. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1905 -0
  612. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  613. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +7006 -0
  614. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  615. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1867 -0
  616. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  617. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +904 -0
  618. package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
  619. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +655 -0
  620. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  621. package/.output/server/node_modules/agent-base/dist/helpers.js +66 -0
  622. package/.output/server/node_modules/agent-base/dist/index.js +178 -0
  623. package/.output/server/node_modules/agent-base/package.json +46 -0
  624. package/.output/server/node_modules/asn1.js/lib/asn1/api.js +57 -0
  625. package/.output/server/node_modules/asn1.js/lib/asn1/base/buffer.js +153 -0
  626. package/.output/server/node_modules/asn1.js/lib/asn1/base/index.js +8 -0
  627. package/.output/server/node_modules/asn1.js/lib/asn1/base/node.js +638 -0
  628. package/.output/server/node_modules/asn1.js/lib/asn1/base/reporter.js +123 -0
  629. package/.output/server/node_modules/asn1.js/lib/asn1/constants/der.js +58 -0
  630. package/.output/server/node_modules/asn1.js/lib/asn1/constants/index.js +21 -0
  631. package/.output/server/node_modules/asn1.js/lib/asn1/decoders/der.js +335 -0
  632. package/.output/server/node_modules/asn1.js/lib/asn1/decoders/index.js +6 -0
  633. package/.output/server/node_modules/asn1.js/lib/asn1/decoders/pem.js +51 -0
  634. package/.output/server/node_modules/asn1.js/lib/asn1/encoders/der.js +295 -0
  635. package/.output/server/node_modules/asn1.js/lib/asn1/encoders/index.js +6 -0
  636. package/.output/server/node_modules/asn1.js/lib/asn1/encoders/pem.js +23 -0
  637. package/.output/server/node_modules/asn1.js/lib/asn1.js +11 -0
  638. package/.output/server/node_modules/asn1.js/package.json +36 -0
  639. package/.output/server/node_modules/asn1js/build/index.js +3266 -0
  640. package/.output/server/node_modules/asn1js/package.json +86 -0
  641. package/.output/server/node_modules/bn.js/lib/bn.js +3463 -0
  642. package/.output/server/node_modules/bn.js/package.json +36 -0
  643. package/.output/server/node_modules/buffer-equal-constant-time/index.js +41 -0
  644. package/.output/server/node_modules/buffer-equal-constant-time/package.json +21 -0
  645. package/.output/server/node_modules/debug/package.json +64 -0
  646. package/.output/server/node_modules/debug/src/browser.js +272 -0
  647. package/.output/server/node_modules/debug/src/common.js +292 -0
  648. package/.output/server/node_modules/debug/src/index.js +10 -0
  649. package/.output/server/node_modules/debug/src/node.js +263 -0
  650. package/.output/server/node_modules/devalue/index.js +17 -0
  651. package/.output/server/node_modules/devalue/package.json +39 -0
  652. package/.output/server/node_modules/devalue/src/base64.js +60 -0
  653. package/.output/server/node_modules/devalue/src/constants.js +12 -0
  654. package/.output/server/node_modules/devalue/src/operations.js +221 -0
  655. package/.output/server/node_modules/devalue/src/parse.js +279 -0
  656. package/.output/server/node_modules/devalue/src/stringify.js +433 -0
  657. package/.output/server/node_modules/devalue/src/uneval.js +698 -0
  658. package/.output/server/node_modules/devalue/src/utils.js +190 -0
  659. package/.output/server/node_modules/ecdsa-sig-formatter/package.json +46 -0
  660. package/.output/server/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js +187 -0
  661. package/.output/server/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js +23 -0
  662. package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  663. package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  664. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  665. package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  666. package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  667. package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  668. package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
  669. package/.output/server/node_modules/entities/package.json +120 -0
  670. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  671. package/.output/server/node_modules/estree-walker/package.json +37 -0
  672. package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  673. package/.output/server/node_modules/hookable/package.json +54 -0
  674. package/.output/server/node_modules/http_ece/ece.js +528 -0
  675. package/.output/server/node_modules/http_ece/package.json +29 -0
  676. package/.output/server/node_modules/https-proxy-agent/dist/index.js +180 -0
  677. package/.output/server/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
  678. package/.output/server/node_modules/https-proxy-agent/package.json +50 -0
  679. package/.output/server/node_modules/inherits/inherits.js +9 -0
  680. package/.output/server/node_modules/inherits/inherits_browser.js +27 -0
  681. package/.output/server/node_modules/inherits/package.json +29 -0
  682. package/.output/server/node_modules/jwa/index.js +266 -0
  683. package/.output/server/node_modules/jwa/package.json +37 -0
  684. package/.output/server/node_modules/jws/index.js +22 -0
  685. package/.output/server/node_modules/jws/lib/data-stream.js +55 -0
  686. package/.output/server/node_modules/jws/lib/sign-stream.js +83 -0
  687. package/.output/server/node_modules/jws/lib/tostring.js +10 -0
  688. package/.output/server/node_modules/jws/lib/verify-stream.js +125 -0
  689. package/.output/server/node_modules/jws/package.json +34 -0
  690. package/.output/server/node_modules/minimalistic-assert/index.js +11 -0
  691. package/.output/server/node_modules/minimalistic-assert/package.json +19 -0
  692. package/.output/server/node_modules/ms/index.js +162 -0
  693. package/.output/server/node_modules/ms/package.json +38 -0
  694. package/.output/server/node_modules/nostics/dist/formatters/ansi.mjs +19 -0
  695. package/.output/server/node_modules/nostics/dist/index.mjs +194 -0
  696. package/.output/server/node_modules/nostics/package.json +126 -0
  697. package/.output/server/node_modules/pvtsutils/build/index.js +399 -0
  698. package/.output/server/node_modules/pvtsutils/package.json +76 -0
  699. package/.output/server/node_modules/pvutils/build/utils.js +361 -0
  700. package/.output/server/node_modules/pvutils/package.json +63 -0
  701. package/.output/server/node_modules/qrcode-terminal/package.json +47 -0
  702. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js +22 -0
  703. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js +38 -0
  704. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js +7 -0
  705. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js +10 -0
  706. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js +44 -0
  707. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js +6 -0
  708. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js +66 -0
  709. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js +298 -0
  710. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js +272 -0
  711. package/.output/server/node_modules/qrcode-terminal/vendor/QRCode/index.js +462 -0
  712. package/.output/server/node_modules/reflect-metadata/Reflect.js +1415 -0
  713. package/.output/server/node_modules/reflect-metadata/package.json +68 -0
  714. package/.output/server/node_modules/safe-buffer/index.js +65 -0
  715. package/.output/server/node_modules/safe-buffer/package.json +51 -0
  716. package/.output/server/node_modules/safer-buffer/package.json +34 -0
  717. package/.output/server/node_modules/safer-buffer/safer.js +77 -0
  718. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  719. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  720. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  721. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  722. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  723. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  724. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  725. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  726. package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  727. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  728. package/.output/server/node_modules/source-map-js/package.json +71 -0
  729. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  730. package/.output/server/node_modules/supports-color/index.js +202 -0
  731. package/.output/server/node_modules/supports-color/package.json +64 -0
  732. package/.output/server/node_modules/tslib/modules/index.js +70 -0
  733. package/.output/server/node_modules/tslib/modules/package.json +3 -0
  734. package/.output/server/node_modules/tslib/package.json +47 -0
  735. package/.output/server/node_modules/tslib/tslib.js +484 -0
  736. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/auto-injectable.js +46 -0
  737. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/index.js +20 -0
  738. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/inject-all-with-transform.js +13 -0
  739. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/inject-all.js +12 -0
  740. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/inject-with-transform.js +10 -0
  741. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/inject.js +12 -0
  742. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/injectable.js +21 -0
  743. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/registry.js +14 -0
  744. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/scoped.js +13 -0
  745. package/.output/server/node_modules/tsyringe/dist/cjs/decorators/singleton.js +11 -0
  746. package/.output/server/node_modules/tsyringe/dist/cjs/dependency-container.js +341 -0
  747. package/.output/server/node_modules/tsyringe/dist/cjs/error-helpers.js +19 -0
  748. package/.output/server/node_modules/tsyringe/dist/cjs/factories/index.js +8 -0
  749. package/.output/server/node_modules/tsyringe/dist/cjs/factories/instance-caching-factory.js +12 -0
  750. package/.output/server/node_modules/tsyringe/dist/cjs/factories/instance-per-container-caching-factory.js +14 -0
  751. package/.output/server/node_modules/tsyringe/dist/cjs/factories/predicate-aware-class-factory.js +19 -0
  752. package/.output/server/node_modules/tsyringe/dist/cjs/index.js +15 -0
  753. package/.output/server/node_modules/tsyringe/dist/cjs/interceptors.js +17 -0
  754. package/.output/server/node_modules/tsyringe/dist/cjs/lazy-helpers.js +54 -0
  755. package/.output/server/node_modules/tsyringe/dist/cjs/providers/class-provider.js +7 -0
  756. package/.output/server/node_modules/tsyringe/dist/cjs/providers/factory-provider.js +7 -0
  757. package/.output/server/node_modules/tsyringe/dist/cjs/providers/index.js +12 -0
  758. package/.output/server/node_modules/tsyringe/dist/cjs/providers/injection-token.js +24 -0
  759. package/.output/server/node_modules/tsyringe/dist/cjs/providers/provider.js +14 -0
  760. package/.output/server/node_modules/tsyringe/dist/cjs/providers/token-provider.js +7 -0
  761. package/.output/server/node_modules/tsyringe/dist/cjs/providers/value-provider.js +7 -0
  762. package/.output/server/node_modules/tsyringe/dist/cjs/reflection-helpers.js +27 -0
  763. package/.output/server/node_modules/tsyringe/dist/cjs/registry-base.js +39 -0
  764. package/.output/server/node_modules/tsyringe/dist/cjs/registry.js +6 -0
  765. package/.output/server/node_modules/tsyringe/dist/cjs/resolution-context.js +8 -0
  766. package/.output/server/node_modules/tsyringe/dist/cjs/types/disposable.js +13 -0
  767. package/.output/server/node_modules/tsyringe/dist/cjs/types/index.js +4 -0
  768. package/.output/server/node_modules/tsyringe/dist/cjs/types/lifecycle.js +10 -0
  769. package/.output/server/node_modules/tsyringe/node_modules/tslib/package.json +37 -0
  770. package/.output/server/node_modules/tsyringe/node_modules/tslib/tslib.js +284 -0
  771. package/.output/server/node_modules/tsyringe/package.json +63 -0
  772. package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  773. package/.output/server/node_modules/ufo/package.json +48 -0
  774. package/.output/server/node_modules/unhead/dist/client.mjs +22 -0
  775. package/.output/server/node_modules/unhead/dist/legacy.mjs +33 -0
  776. package/.output/server/node_modules/unhead/dist/minify.mjs +183 -0
  777. package/.output/server/node_modules/unhead/dist/parser.mjs +518 -0
  778. package/.output/server/node_modules/unhead/dist/plugins.mjs +746 -0
  779. package/.output/server/node_modules/unhead/dist/server.mjs +99 -0
  780. package/.output/server/node_modules/unhead/dist/shared/unhead.-hZVKou0.mjs +400 -0
  781. package/.output/server/node_modules/unhead/dist/shared/unhead.BEmVMkeA.mjs +673 -0
  782. package/.output/server/node_modules/unhead/dist/shared/unhead.BGFxPGPQ.mjs +47 -0
  783. package/.output/server/node_modules/unhead/dist/shared/unhead.BQWSw36o.mjs +192 -0
  784. package/.output/server/node_modules/unhead/dist/shared/unhead.Bf_fPVYA.mjs +6 -0
  785. package/.output/server/node_modules/unhead/dist/shared/unhead.Bjbp1C8D.mjs +224 -0
  786. package/.output/server/node_modules/unhead/dist/shared/unhead.Bm4Y6XQI.mjs +17 -0
  787. package/.output/server/node_modules/unhead/dist/shared/unhead.C5Bksi2B.mjs +49 -0
  788. package/.output/server/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs +32 -0
  789. package/.output/server/node_modules/unhead/dist/shared/unhead.CHEy9ana.mjs +7 -0
  790. package/.output/server/node_modules/unhead/dist/shared/unhead.C_7zwq8E.mjs +11 -0
  791. package/.output/server/node_modules/unhead/dist/shared/unhead.D7HkBzZn.mjs +59 -0
  792. package/.output/server/node_modules/unhead/dist/shared/unhead.Dssd7L5I.mjs +196 -0
  793. package/.output/server/node_modules/unhead/dist/shared/unhead.jEy9BmRq.mjs +264 -0
  794. package/.output/server/node_modules/unhead/dist/shared/unhead.oZ7pkTV1.mjs +19 -0
  795. package/.output/server/node_modules/unhead/dist/shared/unhead.tQnRaXfX.mjs +240 -0
  796. package/.output/server/node_modules/unhead/dist/stream/client.mjs +33 -0
  797. package/.output/server/node_modules/unhead/dist/stream/iife.mjs +2 -0
  798. package/.output/server/node_modules/unhead/dist/stream/server.mjs +436 -0
  799. package/.output/server/node_modules/unhead/dist/utils.mjs +7 -0
  800. package/.output/server/node_modules/unhead/package.json +179 -0
  801. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  802. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  803. package/.output/server/node_modules/vue/index.js +7 -0
  804. package/.output/server/node_modules/vue/index.mjs +1 -0
  805. package/.output/server/node_modules/vue/package.json +112 -0
  806. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  807. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +687 -0
  808. package/.output/server/node_modules/vue-bundle-renderer/package.json +66 -0
  809. package/.output/server/node_modules/web-push/package.json +55 -0
  810. package/.output/server/node_modules/web-push/src/encryption-helper.js +62 -0
  811. package/.output/server/node_modules/web-push/src/index.js +21 -0
  812. package/.output/server/node_modules/web-push/src/urlsafe-base64-helper.js +13 -0
  813. package/.output/server/node_modules/web-push/src/vapid-helper.js +255 -0
  814. package/.output/server/node_modules/web-push/src/web-push-constants.js +17 -0
  815. package/.output/server/node_modules/web-push/src/web-push-error.js +16 -0
  816. package/.output/server/node_modules/web-push/src/web-push-lib.js +413 -0
  817. package/.output/server/package.json +67 -0
  818. package/LICENSE +21 -0
  819. package/README.md +963 -2
  820. package/bin/lib/commands.mjs +432 -0
  821. package/bin/lib/core.mjs +150 -0
  822. package/bin/lib/panel.mjs +208 -0
  823. package/bin/lib/runtime.mjs +74 -0
  824. package/bin/lib/service.mjs +133 -0
  825. package/bin/lib/tailnet.d.mts +32 -0
  826. package/bin/lib/tailnet.mjs +185 -0
  827. package/bin/wherdr.mjs +23 -0
  828. package/package.json +75 -4
@@ -0,0 +1,3445 @@
1
+ /*!
2
+ * MIT License
3
+ *
4
+ * Copyright (c) Peculiar Ventures. All rights reserved.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ *
24
+ */
25
+ 'use strict';
26
+
27
+ require('reflect-metadata');
28
+ var asn1Schema = require('@peculiar/asn1-schema');
29
+ var asn1X509 = require('@peculiar/asn1-x509');
30
+ var pvtsutils = require('pvtsutils');
31
+ var tslib = require('tslib');
32
+ var asn1Cms = require('@peculiar/asn1-cms');
33
+ var asn1Ecc = require('@peculiar/asn1-ecc');
34
+ var asn1Rsa = require('@peculiar/asn1-rsa');
35
+ var tsyringe = require('tsyringe');
36
+ var asnPkcs9 = require('@peculiar/asn1-pkcs9');
37
+ var asn1Csr = require('@peculiar/asn1-csr');
38
+
39
+ function _interopNamespaceDefault(e) {
40
+ var n = Object.create(null);
41
+ if (e) {
42
+ Object.keys(e).forEach(function (k) {
43
+ if (k !== 'default') {
44
+ var d = Object.getOwnPropertyDescriptor(e, k);
45
+ Object.defineProperty(n, k, d.get ? d : {
46
+ enumerable: true,
47
+ get: function () { return e[k]; }
48
+ });
49
+ }
50
+ });
51
+ }
52
+ n.default = e;
53
+ return Object.freeze(n);
54
+ }
55
+
56
+ var asn1X509__namespace = /*#__PURE__*/_interopNamespaceDefault(asn1X509);
57
+ var asn1Cms__namespace = /*#__PURE__*/_interopNamespaceDefault(asn1Cms);
58
+ var asn1Ecc__namespace = /*#__PURE__*/_interopNamespaceDefault(asn1Ecc);
59
+ var asn1Rsa__namespace = /*#__PURE__*/_interopNamespaceDefault(asn1Rsa);
60
+ var asnPkcs9__namespace = /*#__PURE__*/_interopNamespaceDefault(asnPkcs9);
61
+
62
+ const diAlgorithm = "crypto.algorithm";
63
+ class AlgorithmProvider {
64
+ getAlgorithms() {
65
+ return tsyringe.container.resolveAll(diAlgorithm);
66
+ }
67
+ toAsnAlgorithm(alg) {
68
+ ({ ...alg });
69
+ for (const algorithm of this.getAlgorithms()) {
70
+ const res = algorithm.toAsnAlgorithm(alg);
71
+ if (res) {
72
+ return res;
73
+ }
74
+ }
75
+ if (/^[0-9.]+$/.test(alg.name)) {
76
+ const res = new asn1X509.AlgorithmIdentifier({ algorithm: alg.name });
77
+ if ("parameters" in alg) {
78
+ const unknown = alg;
79
+ res.parameters = unknown.parameters;
80
+ }
81
+ return res;
82
+ }
83
+ throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm");
84
+ }
85
+ toWebAlgorithm(alg) {
86
+ for (const algorithm of this.getAlgorithms()) {
87
+ const res = algorithm.toWebAlgorithm(alg);
88
+ if (res) {
89
+ return res;
90
+ }
91
+ }
92
+ const unknown = {
93
+ name: alg.algorithm,
94
+ parameters: alg.parameters,
95
+ };
96
+ return unknown;
97
+ }
98
+ }
99
+ const diAlgorithmProvider = "crypto.algorithmProvider";
100
+ tsyringe.container.registerSingleton(diAlgorithmProvider, AlgorithmProvider);
101
+
102
+ var EcAlgorithm_1;
103
+ const idVersionOne = "1.3.36.3.3.2.8.1.1";
104
+ const idBrainpoolP160r1 = `${idVersionOne}.1`;
105
+ const idBrainpoolP160t1 = `${idVersionOne}.2`;
106
+ const idBrainpoolP192r1 = `${idVersionOne}.3`;
107
+ const idBrainpoolP192t1 = `${idVersionOne}.4`;
108
+ const idBrainpoolP224r1 = `${idVersionOne}.5`;
109
+ const idBrainpoolP224t1 = `${idVersionOne}.6`;
110
+ const idBrainpoolP256r1 = `${idVersionOne}.7`;
111
+ const idBrainpoolP256t1 = `${idVersionOne}.8`;
112
+ const idBrainpoolP320r1 = `${idVersionOne}.9`;
113
+ const idBrainpoolP320t1 = `${idVersionOne}.10`;
114
+ const idBrainpoolP384r1 = `${idVersionOne}.11`;
115
+ const idBrainpoolP384t1 = `${idVersionOne}.12`;
116
+ const idBrainpoolP512r1 = `${idVersionOne}.13`;
117
+ const idBrainpoolP512t1 = `${idVersionOne}.14`;
118
+ const brainpoolP160r1 = "brainpoolP160r1";
119
+ const brainpoolP160t1 = "brainpoolP160t1";
120
+ const brainpoolP192r1 = "brainpoolP192r1";
121
+ const brainpoolP192t1 = "brainpoolP192t1";
122
+ const brainpoolP224r1 = "brainpoolP224r1";
123
+ const brainpoolP224t1 = "brainpoolP224t1";
124
+ const brainpoolP256r1 = "brainpoolP256r1";
125
+ const brainpoolP256t1 = "brainpoolP256t1";
126
+ const brainpoolP320r1 = "brainpoolP320r1";
127
+ const brainpoolP320t1 = "brainpoolP320t1";
128
+ const brainpoolP384r1 = "brainpoolP384r1";
129
+ const brainpoolP384t1 = "brainpoolP384t1";
130
+ const brainpoolP512r1 = "brainpoolP512r1";
131
+ const brainpoolP512t1 = "brainpoolP512t1";
132
+ const ECDSA = "ECDSA";
133
+ exports.EcAlgorithm = EcAlgorithm_1 = class EcAlgorithm {
134
+ toAsnAlgorithm(alg) {
135
+ switch (alg.name.toLowerCase()) {
136
+ case ECDSA.toLowerCase():
137
+ if ("hash" in alg) {
138
+ const hash = typeof alg.hash === "string" ? alg.hash : alg.hash.name;
139
+ switch (hash.toLowerCase()) {
140
+ case "sha-1":
141
+ return asn1Ecc__namespace.ecdsaWithSHA1;
142
+ case "sha-256":
143
+ return asn1Ecc__namespace.ecdsaWithSHA256;
144
+ case "sha-384":
145
+ return asn1Ecc__namespace.ecdsaWithSHA384;
146
+ case "sha-512":
147
+ return asn1Ecc__namespace.ecdsaWithSHA512;
148
+ }
149
+ }
150
+ else if ("namedCurve" in alg) {
151
+ let parameters = "";
152
+ switch (alg.namedCurve) {
153
+ case "P-256":
154
+ parameters = asn1Ecc__namespace.id_secp256r1;
155
+ break;
156
+ case "K-256":
157
+ parameters = EcAlgorithm_1.SECP256K1;
158
+ break;
159
+ case "P-384":
160
+ parameters = asn1Ecc__namespace.id_secp384r1;
161
+ break;
162
+ case "P-521":
163
+ parameters = asn1Ecc__namespace.id_secp521r1;
164
+ break;
165
+ case brainpoolP160r1:
166
+ parameters = idBrainpoolP160r1;
167
+ break;
168
+ case brainpoolP160t1:
169
+ parameters = idBrainpoolP160t1;
170
+ break;
171
+ case brainpoolP192r1:
172
+ parameters = idBrainpoolP192r1;
173
+ break;
174
+ case brainpoolP192t1:
175
+ parameters = idBrainpoolP192t1;
176
+ break;
177
+ case brainpoolP224r1:
178
+ parameters = idBrainpoolP224r1;
179
+ break;
180
+ case brainpoolP224t1:
181
+ parameters = idBrainpoolP224t1;
182
+ break;
183
+ case brainpoolP256r1:
184
+ parameters = idBrainpoolP256r1;
185
+ break;
186
+ case brainpoolP256t1:
187
+ parameters = idBrainpoolP256t1;
188
+ break;
189
+ case brainpoolP320r1:
190
+ parameters = idBrainpoolP320r1;
191
+ break;
192
+ case brainpoolP320t1:
193
+ parameters = idBrainpoolP320t1;
194
+ break;
195
+ case brainpoolP384r1:
196
+ parameters = idBrainpoolP384r1;
197
+ break;
198
+ case brainpoolP384t1:
199
+ parameters = idBrainpoolP384t1;
200
+ break;
201
+ case brainpoolP512r1:
202
+ parameters = idBrainpoolP512r1;
203
+ break;
204
+ case brainpoolP512t1:
205
+ parameters = idBrainpoolP512t1;
206
+ break;
207
+ }
208
+ if (parameters) {
209
+ return new asn1X509.AlgorithmIdentifier({
210
+ algorithm: asn1Ecc__namespace.id_ecPublicKey,
211
+ parameters: asn1Schema.AsnConvert.serialize(new asn1Ecc__namespace.ECParameters({ namedCurve: parameters })),
212
+ });
213
+ }
214
+ }
215
+ }
216
+ return null;
217
+ }
218
+ toWebAlgorithm(alg) {
219
+ switch (alg.algorithm) {
220
+ case asn1Ecc__namespace.id_ecdsaWithSHA1:
221
+ return {
222
+ name: ECDSA, hash: { name: "SHA-1" },
223
+ };
224
+ case asn1Ecc__namespace.id_ecdsaWithSHA256:
225
+ return {
226
+ name: ECDSA, hash: { name: "SHA-256" },
227
+ };
228
+ case asn1Ecc__namespace.id_ecdsaWithSHA384:
229
+ return {
230
+ name: ECDSA, hash: { name: "SHA-384" },
231
+ };
232
+ case asn1Ecc__namespace.id_ecdsaWithSHA512:
233
+ return {
234
+ name: ECDSA, hash: { name: "SHA-512" },
235
+ };
236
+ case asn1Ecc__namespace.id_ecPublicKey: {
237
+ if (!alg.parameters) {
238
+ throw new TypeError("Cannot get required parameters from EC algorithm");
239
+ }
240
+ const parameters = asn1Schema.AsnConvert.parse(alg.parameters, asn1Ecc__namespace.ECParameters);
241
+ switch (parameters.namedCurve) {
242
+ case asn1Ecc__namespace.id_secp256r1:
243
+ return {
244
+ name: ECDSA, namedCurve: "P-256",
245
+ };
246
+ case EcAlgorithm_1.SECP256K1:
247
+ return {
248
+ name: ECDSA, namedCurve: "K-256",
249
+ };
250
+ case asn1Ecc__namespace.id_secp384r1:
251
+ return {
252
+ name: ECDSA, namedCurve: "P-384",
253
+ };
254
+ case asn1Ecc__namespace.id_secp521r1:
255
+ return {
256
+ name: ECDSA, namedCurve: "P-521",
257
+ };
258
+ case idBrainpoolP160r1:
259
+ return {
260
+ name: ECDSA, namedCurve: brainpoolP160r1,
261
+ };
262
+ case idBrainpoolP160t1:
263
+ return {
264
+ name: ECDSA, namedCurve: brainpoolP160t1,
265
+ };
266
+ case idBrainpoolP192r1:
267
+ return {
268
+ name: ECDSA, namedCurve: brainpoolP192r1,
269
+ };
270
+ case idBrainpoolP192t1:
271
+ return {
272
+ name: ECDSA, namedCurve: brainpoolP192t1,
273
+ };
274
+ case idBrainpoolP224r1:
275
+ return {
276
+ name: ECDSA, namedCurve: brainpoolP224r1,
277
+ };
278
+ case idBrainpoolP224t1:
279
+ return {
280
+ name: ECDSA, namedCurve: brainpoolP224t1,
281
+ };
282
+ case idBrainpoolP256r1:
283
+ return {
284
+ name: ECDSA, namedCurve: brainpoolP256r1,
285
+ };
286
+ case idBrainpoolP256t1:
287
+ return {
288
+ name: ECDSA, namedCurve: brainpoolP256t1,
289
+ };
290
+ case idBrainpoolP320r1:
291
+ return {
292
+ name: ECDSA, namedCurve: brainpoolP320r1,
293
+ };
294
+ case idBrainpoolP320t1:
295
+ return {
296
+ name: ECDSA, namedCurve: brainpoolP320t1,
297
+ };
298
+ case idBrainpoolP384r1:
299
+ return {
300
+ name: ECDSA, namedCurve: brainpoolP384r1,
301
+ };
302
+ case idBrainpoolP384t1:
303
+ return {
304
+ name: ECDSA, namedCurve: brainpoolP384t1,
305
+ };
306
+ case idBrainpoolP512r1:
307
+ return {
308
+ name: ECDSA, namedCurve: brainpoolP512r1,
309
+ };
310
+ case idBrainpoolP512t1:
311
+ return {
312
+ name: ECDSA, namedCurve: brainpoolP512t1,
313
+ };
314
+ }
315
+ }
316
+ }
317
+ return null;
318
+ }
319
+ };
320
+ exports.EcAlgorithm.SECP256K1 = "1.3.132.0.10";
321
+ exports.EcAlgorithm = EcAlgorithm_1 = tslib.__decorate([
322
+ tsyringe.injectable()
323
+ ], exports.EcAlgorithm);
324
+ tsyringe.container.registerSingleton(diAlgorithm, exports.EcAlgorithm);
325
+
326
+ const NAME = Symbol("name");
327
+ const VALUE = Symbol("value");
328
+ class TextObject {
329
+ constructor(name, items = {}, value = "") {
330
+ this[NAME] = name;
331
+ this[VALUE] = value;
332
+ for (const key in items) {
333
+ this[key] = items[key];
334
+ }
335
+ }
336
+ }
337
+ TextObject.NAME = NAME;
338
+ TextObject.VALUE = VALUE;
339
+ class DefaultAlgorithmSerializer {
340
+ static toTextObject(alg) {
341
+ const obj = new TextObject("Algorithm Identifier", {}, OidSerializer.toString(alg.algorithm));
342
+ if (alg.parameters) {
343
+ switch (alg.algorithm) {
344
+ case asn1Ecc__namespace.id_ecPublicKey: {
345
+ const ecAlg = new exports.EcAlgorithm().toWebAlgorithm(alg);
346
+ if (ecAlg && "namedCurve" in ecAlg) {
347
+ obj["Named Curve"] = ecAlg.namedCurve;
348
+ }
349
+ else {
350
+ obj["Parameters"] = alg.parameters;
351
+ }
352
+ break;
353
+ }
354
+ default:
355
+ obj["Parameters"] = alg.parameters;
356
+ }
357
+ }
358
+ return obj;
359
+ }
360
+ }
361
+ class OidSerializer {
362
+ static toString(oid) {
363
+ const name = this.items[oid];
364
+ if (name) {
365
+ return name;
366
+ }
367
+ return oid;
368
+ }
369
+ }
370
+ OidSerializer.items = {
371
+ [asn1Rsa__namespace.id_sha1]: "sha1",
372
+ [asn1Rsa__namespace.id_sha224]: "sha224",
373
+ [asn1Rsa__namespace.id_sha256]: "sha256",
374
+ [asn1Rsa__namespace.id_sha384]: "sha384",
375
+ [asn1Rsa__namespace.id_sha512]: "sha512",
376
+ [asn1Rsa__namespace.id_rsaEncryption]: "rsaEncryption",
377
+ [asn1Rsa__namespace.id_sha1WithRSAEncryption]: "sha1WithRSAEncryption",
378
+ [asn1Rsa__namespace.id_sha224WithRSAEncryption]: "sha224WithRSAEncryption",
379
+ [asn1Rsa__namespace.id_sha256WithRSAEncryption]: "sha256WithRSAEncryption",
380
+ [asn1Rsa__namespace.id_sha384WithRSAEncryption]: "sha384WithRSAEncryption",
381
+ [asn1Rsa__namespace.id_sha512WithRSAEncryption]: "sha512WithRSAEncryption",
382
+ [asn1Ecc__namespace.id_ecPublicKey]: "ecPublicKey",
383
+ [asn1Ecc__namespace.id_ecdsaWithSHA1]: "ecdsaWithSHA1",
384
+ [asn1Ecc__namespace.id_ecdsaWithSHA224]: "ecdsaWithSHA224",
385
+ [asn1Ecc__namespace.id_ecdsaWithSHA256]: "ecdsaWithSHA256",
386
+ [asn1Ecc__namespace.id_ecdsaWithSHA384]: "ecdsaWithSHA384",
387
+ [asn1Ecc__namespace.id_ecdsaWithSHA512]: "ecdsaWithSHA512",
388
+ [asn1X509__namespace.id_kp_serverAuth]: "TLS WWW server authentication",
389
+ [asn1X509__namespace.id_kp_clientAuth]: "TLS WWW client authentication",
390
+ [asn1X509__namespace.id_kp_codeSigning]: "Code Signing",
391
+ [asn1X509__namespace.id_kp_emailProtection]: "E-mail Protection",
392
+ [asn1X509__namespace.id_kp_timeStamping]: "Time Stamping",
393
+ [asn1X509__namespace.id_kp_OCSPSigning]: "OCSP Signing",
394
+ [asn1Cms__namespace.id_signedData]: "Signed Data",
395
+ };
396
+ class TextConverter {
397
+ static serialize(obj) {
398
+ return this.serializeObj(obj).join("\n");
399
+ }
400
+ static pad(deep = 0) {
401
+ return "".padStart(2 * deep, " ");
402
+ }
403
+ static serializeObj(obj, deep = 0) {
404
+ const res = [];
405
+ let pad = this.pad(deep++);
406
+ let value = "";
407
+ const objValue = obj[TextObject.VALUE];
408
+ if (objValue) {
409
+ value = ` ${objValue}`;
410
+ }
411
+ res.push(`${pad}${obj[TextObject.NAME]}:${value}`);
412
+ pad = this.pad(deep);
413
+ for (const key in obj) {
414
+ if (typeof key === "symbol") {
415
+ continue;
416
+ }
417
+ const value = obj[key];
418
+ const keyValue = key ? `${key}: ` : "";
419
+ if (typeof value === "string"
420
+ || typeof value === "number"
421
+ || typeof value === "boolean") {
422
+ res.push(`${pad}${keyValue}${value}`);
423
+ }
424
+ else if (value instanceof Date) {
425
+ res.push(`${pad}${keyValue}${value.toUTCString()}`);
426
+ }
427
+ else if (Array.isArray(value)) {
428
+ for (const obj of value) {
429
+ obj[TextObject.NAME] = key;
430
+ res.push(...this.serializeObj(obj, deep));
431
+ }
432
+ }
433
+ else if (value instanceof TextObject) {
434
+ value[TextObject.NAME] = key;
435
+ res.push(...this.serializeObj(value, deep));
436
+ }
437
+ else if (pvtsutils.BufferSourceConverter.isBufferSource(value)) {
438
+ if (key) {
439
+ res.push(`${pad}${keyValue}`);
440
+ res.push(...this.serializeBufferSource(value, deep + 1));
441
+ }
442
+ else {
443
+ res.push(...this.serializeBufferSource(value, deep));
444
+ }
445
+ }
446
+ else if ("toTextObject" in value) {
447
+ const obj = value.toTextObject();
448
+ obj[TextObject.NAME] = key;
449
+ res.push(...this.serializeObj(obj, deep));
450
+ }
451
+ else {
452
+ throw new TypeError("Cannot serialize data in text format. Unsupported type.");
453
+ }
454
+ }
455
+ return res;
456
+ }
457
+ static serializeBufferSource(buffer, deep = 0) {
458
+ const pad = this.pad(deep);
459
+ const view = pvtsutils.BufferSourceConverter.toUint8Array(buffer);
460
+ const res = [];
461
+ for (let i = 0; i < view.length;) {
462
+ const row = [];
463
+ for (let j = 0; j < 16 && i < view.length; j++) {
464
+ if (j === 8) {
465
+ row.push("");
466
+ }
467
+ const hex = view[i++].toString(16).padStart(2, "0");
468
+ row.push(hex);
469
+ }
470
+ res.push(`${pad}${row.join(" ")}`);
471
+ }
472
+ return res;
473
+ }
474
+ static serializeAlgorithm(alg) {
475
+ return this.algorithmSerializer.toTextObject(alg);
476
+ }
477
+ }
478
+ TextConverter.oidSerializer = OidSerializer;
479
+ TextConverter.algorithmSerializer = DefaultAlgorithmSerializer;
480
+
481
+ var _AsnData_rawData;
482
+ class AsnData {
483
+ get rawData() {
484
+ if (!tslib.__classPrivateFieldGet(this, _AsnData_rawData, "f")) {
485
+ tslib.__classPrivateFieldSet(this, _AsnData_rawData, asn1Schema.AsnConvert.serialize(this.asn), "f");
486
+ }
487
+ return tslib.__classPrivateFieldGet(this, _AsnData_rawData, "f");
488
+ }
489
+ constructor(...args) {
490
+ _AsnData_rawData.set(this, void 0);
491
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
492
+ this.asn = asn1Schema.AsnConvert.parse(args[0], args[1]);
493
+ tslib.__classPrivateFieldSet(this, _AsnData_rawData, pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]), "f");
494
+ this.onInit(this.asn);
495
+ }
496
+ else {
497
+ this.asn = args[0];
498
+ this.onInit(this.asn);
499
+ }
500
+ }
501
+ equal(data) {
502
+ if (data instanceof AsnData) {
503
+ return pvtsutils.isEqual(data.rawData, this.rawData);
504
+ }
505
+ return false;
506
+ }
507
+ toString(format = "text") {
508
+ switch (format) {
509
+ case "asn":
510
+ return asn1Schema.AsnConvert.toString(this.rawData);
511
+ case "text":
512
+ return TextConverter.serialize(this.toTextObject());
513
+ case "hex":
514
+ return pvtsutils.Convert.ToHex(this.rawData);
515
+ case "base64":
516
+ return pvtsutils.Convert.ToBase64(this.rawData);
517
+ case "base64url":
518
+ return pvtsutils.Convert.ToBase64Url(this.rawData);
519
+ default:
520
+ throw TypeError("Argument 'format' is unsupported value");
521
+ }
522
+ }
523
+ getTextName() {
524
+ const constructor = this.constructor;
525
+ return constructor.NAME;
526
+ }
527
+ toTextObject() {
528
+ const obj = this.toTextObjectEmpty();
529
+ obj[""] = this.rawData;
530
+ return obj;
531
+ }
532
+ toTextObjectEmpty(value) {
533
+ return new TextObject(this.getTextName(), {}, value);
534
+ }
535
+ }
536
+ _AsnData_rawData = new WeakMap();
537
+ AsnData.NAME = "ASN";
538
+
539
+ class Extension extends AsnData {
540
+ constructor(...args) {
541
+ let raw;
542
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
543
+ raw = pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]);
544
+ }
545
+ else {
546
+ raw = asn1Schema.AsnConvert.serialize(new asn1X509.Extension({
547
+ extnID: args[0],
548
+ critical: args[1],
549
+ extnValue: new asn1Schema.OctetString(pvtsutils.BufferSourceConverter.toArrayBuffer(args[2])),
550
+ }));
551
+ }
552
+ super(raw, asn1X509.Extension);
553
+ }
554
+ onInit(asn) {
555
+ this.type = asn.extnID;
556
+ this.critical = asn.critical;
557
+ this.value = asn.extnValue.buffer;
558
+ }
559
+ toTextObject() {
560
+ const obj = this.toTextObjectWithoutValue();
561
+ obj[""] = this.value;
562
+ return obj;
563
+ }
564
+ toTextObjectWithoutValue() {
565
+ const obj = this.toTextObjectEmpty(this.critical ? "critical" : undefined);
566
+ if (obj[TextObject.NAME] === Extension.NAME) {
567
+ obj[TextObject.NAME] = OidSerializer.toString(this.type);
568
+ }
569
+ return obj;
570
+ }
571
+ }
572
+
573
+ var _a;
574
+ class CryptoProvider {
575
+ static isCryptoKeyPair(data) {
576
+ return data && data.privateKey && data.publicKey;
577
+ }
578
+ static isCryptoKey(data) {
579
+ return data && data.usages && data.type && data.algorithm && data.extractable !== undefined;
580
+ }
581
+ constructor() {
582
+ this.items = new Map();
583
+ this[_a] = "CryptoProvider";
584
+ if (typeof self !== "undefined" && typeof crypto !== "undefined") {
585
+ this.set(CryptoProvider.DEFAULT, crypto);
586
+ }
587
+ else if (typeof global !== "undefined" && global.crypto && global.crypto.subtle) {
588
+ this.set(CryptoProvider.DEFAULT, global.crypto);
589
+ }
590
+ }
591
+ clear() {
592
+ this.items.clear();
593
+ }
594
+ delete(key) {
595
+ return this.items.delete(key);
596
+ }
597
+ forEach(callbackfn, thisArg) {
598
+ return this.items.forEach(callbackfn, thisArg);
599
+ }
600
+ has(key) {
601
+ return this.items.has(key);
602
+ }
603
+ get size() {
604
+ return this.items.size;
605
+ }
606
+ entries() {
607
+ return this.items.entries();
608
+ }
609
+ keys() {
610
+ return this.items.keys();
611
+ }
612
+ values() {
613
+ return this.items.values();
614
+ }
615
+ [Symbol.iterator]() {
616
+ return this.items[Symbol.iterator]();
617
+ }
618
+ get(key = CryptoProvider.DEFAULT) {
619
+ const crypto = this.items.get(key.toLowerCase());
620
+ if (!crypto) {
621
+ throw new Error(`Cannot get Crypto by name '${key}'`);
622
+ }
623
+ return crypto;
624
+ }
625
+ set(key, value) {
626
+ if (typeof key === "string") {
627
+ if (!value) {
628
+ throw new TypeError("Argument 'value' is required");
629
+ }
630
+ this.items.set(key.toLowerCase(), value);
631
+ }
632
+ else {
633
+ this.items.set(CryptoProvider.DEFAULT, key);
634
+ }
635
+ return this;
636
+ }
637
+ }
638
+ _a = Symbol.toStringTag;
639
+ CryptoProvider.DEFAULT = "default";
640
+ const cryptoProvider = new CryptoProvider();
641
+
642
+ const OID_REGEX = /^[0-2](?:\.[1-9][0-9]*)+$/;
643
+ function isOID(id) {
644
+ return new RegExp(OID_REGEX).test(id);
645
+ }
646
+ class NameIdentifier {
647
+ constructor(names = {}) {
648
+ this.items = {};
649
+ for (const id in names) {
650
+ this.register(id, names[id]);
651
+ }
652
+ }
653
+ get(idOrName) {
654
+ return this.items[idOrName] || null;
655
+ }
656
+ findId(idOrName) {
657
+ if (!isOID(idOrName)) {
658
+ return this.get(idOrName);
659
+ }
660
+ return idOrName;
661
+ }
662
+ register(id, name) {
663
+ this.items[id] = name;
664
+ this.items[name] = id;
665
+ }
666
+ }
667
+ const names = new NameIdentifier();
668
+ names.register("CN", "2.5.4.3");
669
+ names.register("L", "2.5.4.7");
670
+ names.register("ST", "2.5.4.8");
671
+ names.register("O", "2.5.4.10");
672
+ names.register("OU", "2.5.4.11");
673
+ names.register("C", "2.5.4.6");
674
+ names.register("DC", "0.9.2342.19200300.100.1.25");
675
+ names.register("E", "1.2.840.113549.1.9.1");
676
+ names.register("G", "2.5.4.42");
677
+ names.register("I", "2.5.4.43");
678
+ names.register("SN", "2.5.4.4");
679
+ names.register("T", "2.5.4.12");
680
+ function replaceUnknownCharacter(text, char) {
681
+ return `\\${pvtsutils.Convert.ToHex(pvtsutils.Convert.FromUtf8String(char)).toUpperCase()}`;
682
+ }
683
+ function escape(data) {
684
+ return data
685
+ .replace(/([,+"\\<>;])/g, "\\$1")
686
+ .replace(/^([ #])/, "\\$1")
687
+ .replace(/([ ]$)/, "\\$1")
688
+ .replace(/([\r\n\t])/, replaceUnknownCharacter);
689
+ }
690
+ class Name {
691
+ static isASCII(text) {
692
+ for (let i = 0; i < text.length; i++) {
693
+ const code = text.charCodeAt(i);
694
+ if (code > 0xFF) {
695
+ return false;
696
+ }
697
+ }
698
+ return true;
699
+ }
700
+ static isPrintableString(text) {
701
+ return /^[A-Za-z0-9 '()+,-./:=?]*$/g.test(text);
702
+ }
703
+ constructor(data, extraNames = {}) {
704
+ this.extraNames = new NameIdentifier();
705
+ this.asn = new asn1X509.Name();
706
+ for (const key in extraNames) {
707
+ if (Object.prototype.hasOwnProperty.call(extraNames, key)) {
708
+ const value = extraNames[key];
709
+ this.extraNames.register(key, value);
710
+ }
711
+ }
712
+ if (typeof data === "string") {
713
+ this.asn = this.fromString(data);
714
+ }
715
+ else if (data instanceof asn1X509.Name) {
716
+ this.asn = data;
717
+ }
718
+ else if (pvtsutils.BufferSourceConverter.isBufferSource(data)) {
719
+ this.asn = asn1Schema.AsnConvert.parse(data, asn1X509.Name);
720
+ }
721
+ else {
722
+ this.asn = this.fromJSON(data);
723
+ }
724
+ }
725
+ getField(idOrName) {
726
+ const id = this.extraNames.findId(idOrName) || names.findId(idOrName);
727
+ const res = [];
728
+ for (const name of this.asn) {
729
+ for (const rdn of name) {
730
+ if (rdn.type === id) {
731
+ res.push(rdn.value.toString());
732
+ }
733
+ }
734
+ }
735
+ return res;
736
+ }
737
+ getName(idOrName) {
738
+ return this.extraNames.get(idOrName) || names.get(idOrName);
739
+ }
740
+ toString() {
741
+ return this.asn.map((rdn) => rdn.map((o) => {
742
+ const type = this.getName(o.type) || o.type;
743
+ const value = o.value.anyValue
744
+ ? `#${pvtsutils.Convert.ToHex(o.value.anyValue)}`
745
+ : escape(o.value.toString());
746
+ return `${type}=${value}`;
747
+ })
748
+ .join("+"))
749
+ .join(", ");
750
+ }
751
+ toJSON() {
752
+ var _a;
753
+ const json = [];
754
+ for (const rdn of this.asn) {
755
+ const jsonItem = {};
756
+ for (const attr of rdn) {
757
+ const type = this.getName(attr.type) || attr.type;
758
+ (_a = jsonItem[type]) !== null && _a !== void 0 ? _a : (jsonItem[type] = []);
759
+ jsonItem[type].push(attr.value.anyValue ? `#${pvtsutils.Convert.ToHex(attr.value.anyValue)}` : attr.value.toString());
760
+ }
761
+ json.push(jsonItem);
762
+ }
763
+ return json;
764
+ }
765
+ fromString(data) {
766
+ const asn = new asn1X509.Name();
767
+ const regex = /(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;
768
+ let matches = null;
769
+ let level = ",";
770
+ while (matches = regex.exec(`${data},`)) {
771
+ let [, type, value] = matches;
772
+ const lastChar = value[value.length - 1];
773
+ if (lastChar === "," || lastChar === "+") {
774
+ value = value.slice(0, value.length - 1);
775
+ matches[3] = lastChar;
776
+ }
777
+ const next = matches[3];
778
+ type = this.getTypeOid(type);
779
+ const attr = this.createAttribute(type, value);
780
+ if (level === "+") {
781
+ asn[asn.length - 1].push(attr);
782
+ }
783
+ else {
784
+ asn.push(new asn1X509.RelativeDistinguishedName([attr]));
785
+ }
786
+ level = next;
787
+ }
788
+ return asn;
789
+ }
790
+ fromJSON(data) {
791
+ const asn = new asn1X509.Name();
792
+ for (const item of data) {
793
+ const asnRdn = new asn1X509.RelativeDistinguishedName();
794
+ for (const type in item) {
795
+ const typeId = this.getTypeOid(type);
796
+ const values = item[type];
797
+ for (const value of values) {
798
+ const asnAttr = this.createAttribute(typeId, value);
799
+ asnRdn.push(asnAttr);
800
+ }
801
+ }
802
+ asn.push(asnRdn);
803
+ }
804
+ return asn;
805
+ }
806
+ getTypeOid(type) {
807
+ if (!/[\d.]+/.test(type)) {
808
+ type = this.getName(type) || "";
809
+ }
810
+ if (!type) {
811
+ throw new Error(`Cannot get OID for name type '${type}'`);
812
+ }
813
+ return type;
814
+ }
815
+ createAttribute(type, value) {
816
+ const attr = new asn1X509.AttributeTypeAndValue({ type });
817
+ if (typeof value === "object") {
818
+ for (const key in value) {
819
+ switch (key) {
820
+ case "ia5String":
821
+ attr.value.ia5String = value[key];
822
+ break;
823
+ case "utf8String":
824
+ attr.value.utf8String = value[key];
825
+ break;
826
+ case "universalString":
827
+ attr.value.universalString = value[key];
828
+ break;
829
+ case "bmpString":
830
+ attr.value.bmpString = value[key];
831
+ break;
832
+ case "printableString":
833
+ attr.value.printableString = value[key];
834
+ break;
835
+ }
836
+ }
837
+ }
838
+ else if (value[0] === "#") {
839
+ attr.value.anyValue = pvtsutils.Convert.FromHex(value.slice(1));
840
+ }
841
+ else {
842
+ const processedValue = this.processStringValue(value);
843
+ if (type === this.getName("E") || type === this.getName("DC")) {
844
+ attr.value.ia5String = processedValue;
845
+ }
846
+ else {
847
+ if (Name.isPrintableString(processedValue)) {
848
+ attr.value.printableString = processedValue;
849
+ }
850
+ else {
851
+ attr.value.utf8String = processedValue;
852
+ }
853
+ }
854
+ }
855
+ return attr;
856
+ }
857
+ processStringValue(value) {
858
+ const quotedMatches = /"(.*?[^\\])?"/.exec(value);
859
+ if (quotedMatches) {
860
+ value = quotedMatches[1];
861
+ }
862
+ return value
863
+ .replace(/\\0a/ig, "\n")
864
+ .replace(/\\0d/ig, "\r")
865
+ .replace(/\\0g/ig, "\t")
866
+ .replace(/\\(.)/g, "$1");
867
+ }
868
+ toArrayBuffer() {
869
+ return asn1Schema.AsnConvert.serialize(this.asn);
870
+ }
871
+ async getThumbprint(...args) {
872
+ var _a;
873
+ let crypto;
874
+ let algorithm = "SHA-1";
875
+ if (args.length >= 1 && !((_a = args[0]) === null || _a === void 0 ? void 0 : _a.subtle)) {
876
+ algorithm = args[0] || algorithm;
877
+ crypto = args[1] || cryptoProvider.get();
878
+ }
879
+ else {
880
+ crypto = args[0] || cryptoProvider.get();
881
+ }
882
+ return await crypto.subtle.digest(algorithm, this.toArrayBuffer());
883
+ }
884
+ }
885
+
886
+ const ERR_GN_CONSTRUCTOR = "Cannot initialize GeneralName from ASN.1 data.";
887
+ const ERR_GN_STRING_FORMAT = `${ERR_GN_CONSTRUCTOR} Unsupported string format in use.`;
888
+ const ERR_GUID = `${ERR_GN_CONSTRUCTOR} Value doesn't match to GUID regular expression.`;
889
+ const GUID_REGEX = /^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i;
890
+ const id_GUID = "1.3.6.1.4.1.311.25.1";
891
+ const id_UPN = "1.3.6.1.4.1.311.20.2.3";
892
+ const DNS = "dns";
893
+ const DN = "dn";
894
+ const EMAIL = "email";
895
+ const IP = "ip";
896
+ const URL = "url";
897
+ const GUID = "guid";
898
+ const UPN = "upn";
899
+ const REGISTERED_ID = "id";
900
+ class GeneralName extends AsnData {
901
+ constructor(...args) {
902
+ let name;
903
+ if (args.length === 2) {
904
+ switch (args[0]) {
905
+ case DN: {
906
+ const derName = new Name(args[1]).toArrayBuffer();
907
+ const asnName = asn1Schema.AsnConvert.parse(derName, asn1X509__namespace.Name);
908
+ name = new asn1X509__namespace.GeneralName({ directoryName: asnName });
909
+ break;
910
+ }
911
+ case DNS:
912
+ name = new asn1X509__namespace.GeneralName({ dNSName: args[1] });
913
+ break;
914
+ case EMAIL:
915
+ name = new asn1X509__namespace.GeneralName({ rfc822Name: args[1] });
916
+ break;
917
+ case GUID: {
918
+ const matches = new RegExp(GUID_REGEX, "i").exec(args[1]);
919
+ if (!matches) {
920
+ throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");
921
+ }
922
+ const hex = matches
923
+ .slice(1)
924
+ .map((o, i) => {
925
+ if (i < 3) {
926
+ return pvtsutils.Convert.ToHex(new Uint8Array(pvtsutils.Convert.FromHex(o)).reverse());
927
+ }
928
+ return o;
929
+ })
930
+ .join("");
931
+ name = new asn1X509__namespace.GeneralName({
932
+ otherName: new asn1X509__namespace.OtherName({
933
+ typeId: id_GUID,
934
+ value: asn1Schema.AsnConvert.serialize(new asn1Schema.OctetString(pvtsutils.Convert.FromHex(hex))),
935
+ }),
936
+ });
937
+ break;
938
+ }
939
+ case IP:
940
+ name = new asn1X509__namespace.GeneralName({ iPAddress: args[1] });
941
+ break;
942
+ case REGISTERED_ID:
943
+ name = new asn1X509__namespace.GeneralName({ registeredID: args[1] });
944
+ break;
945
+ case UPN: {
946
+ name = new asn1X509__namespace.GeneralName({
947
+ otherName: new asn1X509__namespace.OtherName({
948
+ typeId: id_UPN,
949
+ value: asn1Schema.AsnConvert.serialize(asn1Schema.AsnUtf8StringConverter.toASN(args[1])),
950
+ }),
951
+ });
952
+ break;
953
+ }
954
+ case URL:
955
+ name = new asn1X509__namespace.GeneralName({ uniformResourceIdentifier: args[1] });
956
+ break;
957
+ default:
958
+ throw new Error("Cannot create GeneralName. Unsupported type of the name");
959
+ }
960
+ }
961
+ else if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
962
+ name = asn1Schema.AsnConvert.parse(args[0], asn1X509__namespace.GeneralName);
963
+ }
964
+ else {
965
+ name = args[0];
966
+ }
967
+ super(name);
968
+ }
969
+ onInit(asn) {
970
+ if (asn.dNSName != undefined) {
971
+ this.type = DNS;
972
+ this.value = asn.dNSName;
973
+ }
974
+ else if (asn.rfc822Name != undefined) {
975
+ this.type = EMAIL;
976
+ this.value = asn.rfc822Name;
977
+ }
978
+ else if (asn.iPAddress != undefined) {
979
+ this.type = IP;
980
+ this.value = asn.iPAddress;
981
+ }
982
+ else if (asn.uniformResourceIdentifier != undefined) {
983
+ this.type = URL;
984
+ this.value = asn.uniformResourceIdentifier;
985
+ }
986
+ else if (asn.registeredID != undefined) {
987
+ this.type = REGISTERED_ID;
988
+ this.value = asn.registeredID;
989
+ }
990
+ else if (asn.directoryName != undefined) {
991
+ this.type = DN;
992
+ this.value = new Name(asn.directoryName).toString();
993
+ }
994
+ else if (asn.otherName != undefined) {
995
+ if (asn.otherName.typeId === id_GUID) {
996
+ this.type = GUID;
997
+ const guid = asn1Schema.AsnConvert.parse(asn.otherName.value, asn1Schema.OctetString);
998
+ const matches = new RegExp(GUID_REGEX, "i").exec(pvtsutils.Convert.ToHex(guid));
999
+ if (!matches) {
1000
+ throw new Error(ERR_GUID);
1001
+ }
1002
+ this.value = matches
1003
+ .slice(1)
1004
+ .map((o, i) => {
1005
+ if (i < 3) {
1006
+ return pvtsutils.Convert.ToHex(new Uint8Array(pvtsutils.Convert.FromHex(o)).reverse());
1007
+ }
1008
+ return o;
1009
+ })
1010
+ .join("-");
1011
+ }
1012
+ else if (asn.otherName.typeId === id_UPN) {
1013
+ this.type = UPN;
1014
+ this.value = asn1Schema.AsnConvert.parse(asn.otherName.value, asn1X509__namespace.DirectoryString).toString();
1015
+ }
1016
+ else {
1017
+ throw new Error(ERR_GN_STRING_FORMAT);
1018
+ }
1019
+ }
1020
+ else {
1021
+ throw new Error(ERR_GN_STRING_FORMAT);
1022
+ }
1023
+ }
1024
+ toJSON() {
1025
+ return {
1026
+ type: this.type,
1027
+ value: this.value,
1028
+ };
1029
+ }
1030
+ toTextObject() {
1031
+ let type;
1032
+ switch (this.type) {
1033
+ case DN:
1034
+ case DNS:
1035
+ case GUID:
1036
+ case IP:
1037
+ case REGISTERED_ID:
1038
+ case UPN:
1039
+ case URL:
1040
+ type = this.type.toUpperCase();
1041
+ break;
1042
+ case EMAIL:
1043
+ type = "Email";
1044
+ break;
1045
+ default:
1046
+ throw new Error("Unsupported GeneralName type");
1047
+ }
1048
+ let value = this.value;
1049
+ if (this.type === REGISTERED_ID) {
1050
+ value = OidSerializer.toString(value);
1051
+ }
1052
+ return new TextObject(type, undefined, value);
1053
+ }
1054
+ }
1055
+ class GeneralNames extends AsnData {
1056
+ constructor(params) {
1057
+ let names;
1058
+ if (params instanceof asn1X509__namespace.GeneralNames) {
1059
+ names = params;
1060
+ }
1061
+ else if (Array.isArray(params)) {
1062
+ const items = [];
1063
+ for (const name of params) {
1064
+ if (name instanceof asn1X509__namespace.GeneralName) {
1065
+ items.push(name);
1066
+ }
1067
+ else {
1068
+ const asnName = asn1Schema.AsnConvert.parse(new GeneralName(name.type, name.value).rawData, asn1X509__namespace.GeneralName);
1069
+ items.push(asnName);
1070
+ }
1071
+ }
1072
+ names = new asn1X509__namespace.GeneralNames(items);
1073
+ }
1074
+ else if (pvtsutils.BufferSourceConverter.isBufferSource(params)) {
1075
+ names = asn1Schema.AsnConvert.parse(params, asn1X509__namespace.GeneralNames);
1076
+ }
1077
+ else {
1078
+ throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");
1079
+ }
1080
+ super(names);
1081
+ }
1082
+ onInit(asn) {
1083
+ const items = [];
1084
+ for (const asnName of asn) {
1085
+ let name = null;
1086
+ try {
1087
+ name = new GeneralName(asnName);
1088
+ }
1089
+ catch {
1090
+ continue;
1091
+ }
1092
+ items.push(name);
1093
+ }
1094
+ this.items = items;
1095
+ }
1096
+ toJSON() {
1097
+ return this.items.map((o) => o.toJSON());
1098
+ }
1099
+ toTextObject() {
1100
+ const res = super.toTextObjectEmpty();
1101
+ for (const name of this.items) {
1102
+ const nameObj = name.toTextObject();
1103
+ let field = res[nameObj[TextObject.NAME]];
1104
+ if (!Array.isArray(field)) {
1105
+ field = [];
1106
+ res[nameObj[TextObject.NAME]] = field;
1107
+ }
1108
+ field.push(nameObj);
1109
+ }
1110
+ return res;
1111
+ }
1112
+ }
1113
+ GeneralNames.NAME = "GeneralNames";
1114
+
1115
+ const rPaddingTag = "-{5}";
1116
+ const rEolChars = "\\n";
1117
+ const rNameTag = `[^${rEolChars}]+`;
1118
+ const rBeginTag = `${rPaddingTag}BEGIN (${rNameTag}(?=${rPaddingTag}))${rPaddingTag}`;
1119
+ const rEndTag = `${rPaddingTag}END \\1${rPaddingTag}`;
1120
+ const rEolGroup = "\\n";
1121
+ const rHeaderKey = `[^:${rEolChars}]+`;
1122
+ const rHeaderValue = `(?:[^${rEolChars}]+${rEolGroup}(?: +[^${rEolChars}]+${rEolGroup})*)`;
1123
+ const rBase64Chars = "[a-zA-Z0-9=+/]+";
1124
+ const rBase64 = `(?:${rBase64Chars}${rEolGroup})+`;
1125
+ const rPem = `${rBeginTag}${rEolGroup}(?:((?:${rHeaderKey}: ${rHeaderValue})+))?${rEolGroup}?(${rBase64})${rEndTag}`;
1126
+ class PemConverter {
1127
+ static isPem(data) {
1128
+ return typeof data === "string"
1129
+ && new RegExp(rPem, "g").test(data.replace(/\r/g, ""));
1130
+ }
1131
+ static decodeWithHeaders(pem) {
1132
+ pem = pem.replace(/\r/g, "");
1133
+ const pattern = new RegExp(rPem, "g");
1134
+ const res = [];
1135
+ let matches = null;
1136
+ while (matches = pattern.exec(pem)) {
1137
+ const base64 = matches[3]
1138
+ .replace(new RegExp(`[${rEolChars}]+`, "g"), "");
1139
+ const pemStruct = {
1140
+ type: matches[1],
1141
+ headers: [],
1142
+ rawData: pvtsutils.Convert.FromBase64(base64),
1143
+ };
1144
+ const headersString = matches[2];
1145
+ if (headersString) {
1146
+ const headers = headersString.split(new RegExp(rEolGroup, "g"));
1147
+ let lastHeader = null;
1148
+ for (const header of headers) {
1149
+ const [key, value] = header.split(/:(.*)/);
1150
+ if (value === undefined) {
1151
+ if (!lastHeader) {
1152
+ throw new Error("Cannot parse PEM string. Incorrect header value");
1153
+ }
1154
+ lastHeader.value += key.trim();
1155
+ }
1156
+ else {
1157
+ if (lastHeader) {
1158
+ pemStruct.headers.push(lastHeader);
1159
+ }
1160
+ lastHeader = {
1161
+ key, value: value.trim(),
1162
+ };
1163
+ }
1164
+ }
1165
+ if (lastHeader) {
1166
+ pemStruct.headers.push(lastHeader);
1167
+ }
1168
+ }
1169
+ res.push(pemStruct);
1170
+ }
1171
+ return res;
1172
+ }
1173
+ static decode(pem) {
1174
+ const blocks = this.decodeWithHeaders(pem);
1175
+ return blocks.map((o) => o.rawData);
1176
+ }
1177
+ static decodeFirst(pem) {
1178
+ const items = this.decode(pem);
1179
+ if (!items.length) {
1180
+ throw new RangeError("PEM string doesn't contain any objects");
1181
+ }
1182
+ return items[0];
1183
+ }
1184
+ static encode(rawData, tag) {
1185
+ if (Array.isArray(rawData)) {
1186
+ const raws = new Array();
1187
+ if (tag) {
1188
+ rawData.forEach((element) => {
1189
+ if (!pvtsutils.BufferSourceConverter.isBufferSource(element)) {
1190
+ throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");
1191
+ }
1192
+ raws.push(this.encodeStruct({
1193
+ type: tag,
1194
+ rawData: pvtsutils.BufferSourceConverter.toArrayBuffer(element),
1195
+ }));
1196
+ });
1197
+ }
1198
+ else {
1199
+ rawData.forEach((element) => {
1200
+ if (!("type" in element)) {
1201
+ throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");
1202
+ }
1203
+ raws.push(this.encodeStruct(element));
1204
+ });
1205
+ }
1206
+ return raws.join("\n");
1207
+ }
1208
+ else {
1209
+ if (!tag) {
1210
+ throw new Error("Required argument 'tag' is missed");
1211
+ }
1212
+ return this.encodeStruct({
1213
+ type: tag,
1214
+ rawData: pvtsutils.BufferSourceConverter.toArrayBuffer(rawData),
1215
+ });
1216
+ }
1217
+ }
1218
+ static encodeStruct(pem) {
1219
+ var _a;
1220
+ const upperCaseType = pem.type.toLocaleUpperCase();
1221
+ const res = [];
1222
+ res.push(`-----BEGIN ${upperCaseType}-----`);
1223
+ if ((_a = pem.headers) === null || _a === void 0 ? void 0 : _a.length) {
1224
+ for (const header of pem.headers) {
1225
+ res.push(`${header.key}: ${header.value}`);
1226
+ }
1227
+ res.push("");
1228
+ }
1229
+ const base64 = pvtsutils.Convert.ToBase64(pem.rawData);
1230
+ let sliced;
1231
+ let offset = 0;
1232
+ const rows = Array();
1233
+ while (offset < base64.length) {
1234
+ if (base64.length - offset < 64) {
1235
+ sliced = base64.substring(offset);
1236
+ }
1237
+ else {
1238
+ sliced = base64.substring(offset, offset + 64);
1239
+ offset += 64;
1240
+ }
1241
+ if (sliced.length !== 0) {
1242
+ rows.push(sliced);
1243
+ if (sliced.length < 64) {
1244
+ break;
1245
+ }
1246
+ }
1247
+ else {
1248
+ break;
1249
+ }
1250
+ }
1251
+ res.push(...rows);
1252
+ res.push(`-----END ${upperCaseType}-----`);
1253
+ return res.join("\n");
1254
+ }
1255
+ }
1256
+ PemConverter.CertificateTag = "CERTIFICATE";
1257
+ PemConverter.CrlTag = "CRL";
1258
+ PemConverter.CertificateRequestTag = "CERTIFICATE REQUEST";
1259
+ PemConverter.PublicKeyTag = "PUBLIC KEY";
1260
+ PemConverter.PrivateKeyTag = "PRIVATE KEY";
1261
+
1262
+ class PemData extends AsnData {
1263
+ static isAsnEncoded(data) {
1264
+ return pvtsutils.BufferSourceConverter.isBufferSource(data) || typeof data === "string";
1265
+ }
1266
+ static toArrayBuffer(raw) {
1267
+ if (typeof raw === "string") {
1268
+ if (PemConverter.isPem(raw)) {
1269
+ return PemConverter.decode(raw)[0];
1270
+ }
1271
+ else if (pvtsutils.Convert.isHex(raw)) {
1272
+ return pvtsutils.Convert.FromHex(raw);
1273
+ }
1274
+ else if (pvtsutils.Convert.isBase64(raw)) {
1275
+ return pvtsutils.Convert.FromBase64(raw);
1276
+ }
1277
+ else if (pvtsutils.Convert.isBase64Url(raw)) {
1278
+ return pvtsutils.Convert.FromBase64Url(raw);
1279
+ }
1280
+ else {
1281
+ throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url");
1282
+ }
1283
+ }
1284
+ else {
1285
+ const buffer = pvtsutils.BufferSourceConverter.toUint8Array(raw);
1286
+ if (buffer.length > 0 && buffer[0] === 0x30) {
1287
+ return pvtsutils.BufferSourceConverter.toArrayBuffer(raw);
1288
+ }
1289
+ const stringRaw = pvtsutils.Convert.ToBinary(raw);
1290
+ if (PemConverter.isPem(stringRaw)) {
1291
+ return PemConverter.decode(stringRaw)[0];
1292
+ }
1293
+ else if (pvtsutils.Convert.isHex(stringRaw)) {
1294
+ return pvtsutils.Convert.FromHex(stringRaw);
1295
+ }
1296
+ else if (pvtsutils.Convert.isBase64(stringRaw)) {
1297
+ return pvtsutils.Convert.FromBase64(stringRaw);
1298
+ }
1299
+ else if (pvtsutils.Convert.isBase64Url(stringRaw)) {
1300
+ return pvtsutils.Convert.FromBase64Url(stringRaw);
1301
+ }
1302
+ throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url");
1303
+ }
1304
+ }
1305
+ constructor(...args) {
1306
+ if (PemData.isAsnEncoded(args[0])) {
1307
+ super(PemData.toArrayBuffer(args[0]), args[1]);
1308
+ }
1309
+ else {
1310
+ super(args[0]);
1311
+ }
1312
+ }
1313
+ toString(format = "pem") {
1314
+ switch (format) {
1315
+ case "pem":
1316
+ return PemConverter.encode(this.rawData, this.tag);
1317
+ default:
1318
+ return super.toString(format);
1319
+ }
1320
+ }
1321
+ }
1322
+
1323
+ class PublicKey extends PemData {
1324
+ static async create(data, crypto = cryptoProvider.get()) {
1325
+ if (data instanceof PublicKey) {
1326
+ return data;
1327
+ }
1328
+ else if (CryptoProvider.isCryptoKey(data)) {
1329
+ if (data.type !== "public") {
1330
+ throw new TypeError("Public key is required");
1331
+ }
1332
+ const spki = await crypto.subtle.exportKey("spki", data);
1333
+ return new PublicKey(spki);
1334
+ }
1335
+ else if (data.publicKey) {
1336
+ return data.publicKey;
1337
+ }
1338
+ else if (pvtsutils.BufferSourceConverter.isBufferSource(data)) {
1339
+ return new PublicKey(data);
1340
+ }
1341
+ else {
1342
+ throw new TypeError("Unsupported PublicKeyType");
1343
+ }
1344
+ }
1345
+ constructor(param) {
1346
+ if (PemData.isAsnEncoded(param)) {
1347
+ super(param, asn1X509.SubjectPublicKeyInfo);
1348
+ }
1349
+ else {
1350
+ super(param);
1351
+ }
1352
+ this.tag = PemConverter.PublicKeyTag;
1353
+ }
1354
+ async export(...args) {
1355
+ let crypto;
1356
+ let keyUsages = ["verify"];
1357
+ let algorithm = {
1358
+ hash: "SHA-256", ...this.algorithm,
1359
+ };
1360
+ if (args.length > 1) {
1361
+ algorithm = args[0] || algorithm;
1362
+ keyUsages = args[1] || keyUsages;
1363
+ crypto = args[2] || cryptoProvider.get();
1364
+ }
1365
+ else {
1366
+ crypto = args[0] || cryptoProvider.get();
1367
+ }
1368
+ let raw = this.rawData;
1369
+ const asnSpki = asn1Schema.AsnConvert.parse(this.rawData, asn1X509.SubjectPublicKeyInfo);
1370
+ if (asnSpki.algorithm.algorithm === asn1Rsa.id_RSASSA_PSS) {
1371
+ raw = convertSpkiToRsaPkcs1(asnSpki, raw);
1372
+ }
1373
+ return crypto.subtle.importKey("spki", raw, algorithm, true, keyUsages);
1374
+ }
1375
+ onInit(asn) {
1376
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
1377
+ const algorithm = this.algorithm = algProv.toWebAlgorithm(asn.algorithm);
1378
+ switch (asn.algorithm.algorithm) {
1379
+ case asn1Rsa.id_rsaEncryption:
1380
+ {
1381
+ const rsaPublicKey = asn1Schema.AsnConvert.parse(asn.subjectPublicKey, asn1Rsa.RSAPublicKey);
1382
+ const modulus = pvtsutils.BufferSourceConverter.toUint8Array(rsaPublicKey.modulus);
1383
+ algorithm.publicExponent = pvtsutils.BufferSourceConverter.toUint8Array(rsaPublicKey.publicExponent);
1384
+ algorithm.modulusLength = (!modulus[0] ? modulus.slice(1) : modulus).byteLength << 3;
1385
+ break;
1386
+ }
1387
+ }
1388
+ }
1389
+ async getThumbprint(...args) {
1390
+ var _a;
1391
+ let crypto;
1392
+ let algorithm = "SHA-1";
1393
+ if (args.length >= 1 && !((_a = args[0]) === null || _a === void 0 ? void 0 : _a.subtle)) {
1394
+ algorithm = args[0] || algorithm;
1395
+ crypto = args[1] || cryptoProvider.get();
1396
+ }
1397
+ else {
1398
+ crypto = args[0] || cryptoProvider.get();
1399
+ }
1400
+ return await crypto.subtle.digest(algorithm, this.rawData);
1401
+ }
1402
+ async getKeyIdentifier(...args) {
1403
+ let crypto;
1404
+ let algorithm = "SHA-1";
1405
+ if (args.length === 1) {
1406
+ if (typeof args[0] === "string") {
1407
+ algorithm = args[0];
1408
+ crypto = cryptoProvider.get();
1409
+ }
1410
+ else {
1411
+ crypto = args[0];
1412
+ }
1413
+ }
1414
+ else if (args.length === 2) {
1415
+ algorithm = args[0];
1416
+ crypto = args[1];
1417
+ }
1418
+ else {
1419
+ crypto = cryptoProvider.get();
1420
+ }
1421
+ const asn = asn1Schema.AsnConvert.parse(this.rawData, asn1X509.SubjectPublicKeyInfo);
1422
+ return await crypto.subtle.digest(algorithm, asn.subjectPublicKey);
1423
+ }
1424
+ toTextObject() {
1425
+ const obj = this.toTextObjectEmpty();
1426
+ const asn = asn1Schema.AsnConvert.parse(this.rawData, asn1X509.SubjectPublicKeyInfo);
1427
+ obj["Algorithm"] = TextConverter.serializeAlgorithm(asn.algorithm);
1428
+ switch (asn.algorithm.algorithm) {
1429
+ case asn1Ecc.id_ecPublicKey:
1430
+ obj["EC Point"] = asn.subjectPublicKey;
1431
+ break;
1432
+ case asn1Rsa.id_rsaEncryption:
1433
+ default:
1434
+ obj["Raw Data"] = asn.subjectPublicKey;
1435
+ }
1436
+ return obj;
1437
+ }
1438
+ }
1439
+ function convertSpkiToRsaPkcs1(asnSpki, raw) {
1440
+ asnSpki.algorithm = new asn1X509.AlgorithmIdentifier({
1441
+ algorithm: asn1Rsa.id_rsaEncryption,
1442
+ parameters: null,
1443
+ });
1444
+ raw = asn1Schema.AsnConvert.serialize(asnSpki);
1445
+ return raw;
1446
+ }
1447
+
1448
+ class AuthorityKeyIdentifierExtension extends Extension {
1449
+ static async create(param, critical = false, crypto = cryptoProvider.get()) {
1450
+ if ("name" in param && "serialNumber" in param) {
1451
+ return new AuthorityKeyIdentifierExtension(param, critical);
1452
+ }
1453
+ const key = await PublicKey.create(param, crypto);
1454
+ const id = await key.getKeyIdentifier(crypto);
1455
+ return new AuthorityKeyIdentifierExtension(pvtsutils.Convert.ToHex(id), critical);
1456
+ }
1457
+ constructor(...args) {
1458
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1459
+ super(args[0]);
1460
+ }
1461
+ else if (typeof args[0] === "string") {
1462
+ const value = new asn1X509__namespace.AuthorityKeyIdentifier({ keyIdentifier: new asn1X509__namespace.KeyIdentifier(pvtsutils.Convert.FromHex(args[0])) });
1463
+ super(asn1X509__namespace.id_ce_authorityKeyIdentifier, args[1], asn1Schema.AsnConvert.serialize(value));
1464
+ }
1465
+ else {
1466
+ const certId = args[0];
1467
+ const certIdName = certId.name instanceof GeneralNames
1468
+ ? asn1Schema.AsnConvert.parse(certId.name.rawData, asn1X509__namespace.GeneralNames)
1469
+ : certId.name;
1470
+ const value = new asn1X509__namespace.AuthorityKeyIdentifier({
1471
+ authorityCertIssuer: certIdName,
1472
+ authorityCertSerialNumber: pvtsutils.Convert.FromHex(certId.serialNumber),
1473
+ });
1474
+ super(asn1X509__namespace.id_ce_authorityKeyIdentifier, args[1], asn1Schema.AsnConvert.serialize(value));
1475
+ }
1476
+ }
1477
+ onInit(asn) {
1478
+ super.onInit(asn);
1479
+ const aki = asn1Schema.AsnConvert.parse(asn.extnValue, asn1X509__namespace.AuthorityKeyIdentifier);
1480
+ if (aki.keyIdentifier) {
1481
+ this.keyId = pvtsutils.Convert.ToHex(aki.keyIdentifier);
1482
+ }
1483
+ if (aki.authorityCertIssuer || aki.authorityCertSerialNumber) {
1484
+ this.certId = {
1485
+ name: aki.authorityCertIssuer || [],
1486
+ serialNumber: aki.authorityCertSerialNumber ? pvtsutils.Convert.ToHex(aki.authorityCertSerialNumber) : "",
1487
+ };
1488
+ }
1489
+ }
1490
+ toTextObject() {
1491
+ const obj = this.toTextObjectWithoutValue();
1492
+ const asn = asn1Schema.AsnConvert.parse(this.value, asn1X509__namespace.AuthorityKeyIdentifier);
1493
+ if (asn.authorityCertIssuer) {
1494
+ obj["Authority Issuer"] = new GeneralNames(asn.authorityCertIssuer).toTextObject();
1495
+ }
1496
+ if (asn.authorityCertSerialNumber) {
1497
+ obj["Authority Serial Number"] = asn.authorityCertSerialNumber;
1498
+ }
1499
+ if (asn.keyIdentifier) {
1500
+ obj[""] = asn.keyIdentifier;
1501
+ }
1502
+ return obj;
1503
+ }
1504
+ }
1505
+ AuthorityKeyIdentifierExtension.NAME = "Authority Key Identifier";
1506
+
1507
+ class BasicConstraintsExtension extends Extension {
1508
+ constructor(...args) {
1509
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1510
+ super(args[0]);
1511
+ const value = asn1Schema.AsnConvert.parse(this.value, asn1X509.BasicConstraints);
1512
+ this.ca = value.cA;
1513
+ this.pathLength = value.pathLenConstraint;
1514
+ }
1515
+ else {
1516
+ const value = new asn1X509.BasicConstraints({
1517
+ cA: args[0],
1518
+ pathLenConstraint: args[1],
1519
+ });
1520
+ super(asn1X509.id_ce_basicConstraints, args[2], asn1Schema.AsnConvert.serialize(value));
1521
+ this.ca = args[0];
1522
+ this.pathLength = args[1];
1523
+ }
1524
+ }
1525
+ toTextObject() {
1526
+ const obj = this.toTextObjectWithoutValue();
1527
+ if (this.ca) {
1528
+ obj["CA"] = this.ca;
1529
+ }
1530
+ if (this.pathLength !== undefined) {
1531
+ obj["Path Length"] = this.pathLength;
1532
+ }
1533
+ return obj;
1534
+ }
1535
+ }
1536
+ BasicConstraintsExtension.NAME = "Basic Constraints";
1537
+
1538
+ exports.ExtendedKeyUsage = void 0;
1539
+ (function (ExtendedKeyUsage) {
1540
+ ExtendedKeyUsage["serverAuth"] = "1.3.6.1.5.5.7.3.1";
1541
+ ExtendedKeyUsage["clientAuth"] = "1.3.6.1.5.5.7.3.2";
1542
+ ExtendedKeyUsage["codeSigning"] = "1.3.6.1.5.5.7.3.3";
1543
+ ExtendedKeyUsage["emailProtection"] = "1.3.6.1.5.5.7.3.4";
1544
+ ExtendedKeyUsage["timeStamping"] = "1.3.6.1.5.5.7.3.8";
1545
+ ExtendedKeyUsage["ocspSigning"] = "1.3.6.1.5.5.7.3.9";
1546
+ })(exports.ExtendedKeyUsage || (exports.ExtendedKeyUsage = {}));
1547
+ class ExtendedKeyUsageExtension extends Extension {
1548
+ constructor(...args) {
1549
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1550
+ super(args[0]);
1551
+ const value = asn1Schema.AsnConvert.parse(this.value, asn1X509__namespace.ExtendedKeyUsage);
1552
+ this.usages = value.map((o) => o);
1553
+ }
1554
+ else {
1555
+ const value = new asn1X509__namespace.ExtendedKeyUsage(args[0]);
1556
+ super(asn1X509__namespace.id_ce_extKeyUsage, args[1], asn1Schema.AsnConvert.serialize(value));
1557
+ this.usages = args[0];
1558
+ }
1559
+ }
1560
+ toTextObject() {
1561
+ const obj = this.toTextObjectWithoutValue();
1562
+ obj[""] = this.usages.map((o) => OidSerializer.toString(o)).join(", ");
1563
+ return obj;
1564
+ }
1565
+ }
1566
+ ExtendedKeyUsageExtension.NAME = "Extended Key Usages";
1567
+
1568
+ exports.KeyUsageFlags = void 0;
1569
+ (function (KeyUsageFlags) {
1570
+ KeyUsageFlags[KeyUsageFlags["digitalSignature"] = 1] = "digitalSignature";
1571
+ KeyUsageFlags[KeyUsageFlags["nonRepudiation"] = 2] = "nonRepudiation";
1572
+ KeyUsageFlags[KeyUsageFlags["keyEncipherment"] = 4] = "keyEncipherment";
1573
+ KeyUsageFlags[KeyUsageFlags["dataEncipherment"] = 8] = "dataEncipherment";
1574
+ KeyUsageFlags[KeyUsageFlags["keyAgreement"] = 16] = "keyAgreement";
1575
+ KeyUsageFlags[KeyUsageFlags["keyCertSign"] = 32] = "keyCertSign";
1576
+ KeyUsageFlags[KeyUsageFlags["cRLSign"] = 64] = "cRLSign";
1577
+ KeyUsageFlags[KeyUsageFlags["encipherOnly"] = 128] = "encipherOnly";
1578
+ KeyUsageFlags[KeyUsageFlags["decipherOnly"] = 256] = "decipherOnly";
1579
+ })(exports.KeyUsageFlags || (exports.KeyUsageFlags = {}));
1580
+ class KeyUsagesExtension extends Extension {
1581
+ constructor(...args) {
1582
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1583
+ super(args[0]);
1584
+ const value = asn1Schema.AsnConvert.parse(this.value, asn1X509.KeyUsage);
1585
+ this.usages = value.toNumber();
1586
+ }
1587
+ else {
1588
+ const value = new asn1X509.KeyUsage(args[0]);
1589
+ super(asn1X509.id_ce_keyUsage, args[1], asn1Schema.AsnConvert.serialize(value));
1590
+ this.usages = args[0];
1591
+ }
1592
+ }
1593
+ toTextObject() {
1594
+ const obj = this.toTextObjectWithoutValue();
1595
+ const asn = asn1Schema.AsnConvert.parse(this.value, asn1X509.KeyUsage);
1596
+ obj[""] = asn.toJSON().join(", ");
1597
+ return obj;
1598
+ }
1599
+ }
1600
+ KeyUsagesExtension.NAME = "Key Usages";
1601
+
1602
+ class SubjectKeyIdentifierExtension extends Extension {
1603
+ static async create(publicKey, critical = false, crypto = cryptoProvider.get()) {
1604
+ const key = await PublicKey.create(publicKey, crypto);
1605
+ const id = await key.getKeyIdentifier(crypto);
1606
+ return new SubjectKeyIdentifierExtension(pvtsutils.Convert.ToHex(id), critical);
1607
+ }
1608
+ constructor(...args) {
1609
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1610
+ super(args[0]);
1611
+ const value = asn1Schema.AsnConvert.parse(this.value, asn1X509__namespace.SubjectKeyIdentifier);
1612
+ this.keyId = pvtsutils.Convert.ToHex(value);
1613
+ }
1614
+ else {
1615
+ const identifier = typeof args[0] === "string"
1616
+ ? pvtsutils.Convert.FromHex(args[0])
1617
+ : args[0];
1618
+ const value = new asn1X509__namespace.SubjectKeyIdentifier(identifier);
1619
+ super(asn1X509__namespace.id_ce_subjectKeyIdentifier, args[1], asn1Schema.AsnConvert.serialize(value));
1620
+ this.keyId = pvtsutils.Convert.ToHex(identifier);
1621
+ }
1622
+ }
1623
+ toTextObject() {
1624
+ const obj = this.toTextObjectWithoutValue();
1625
+ const asn = asn1Schema.AsnConvert.parse(this.value, asn1X509__namespace.SubjectKeyIdentifier);
1626
+ obj[""] = asn;
1627
+ return obj;
1628
+ }
1629
+ }
1630
+ SubjectKeyIdentifierExtension.NAME = "Subject Key Identifier";
1631
+
1632
+ class SubjectAlternativeNameExtension extends Extension {
1633
+ constructor(...args) {
1634
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1635
+ super(args[0]);
1636
+ }
1637
+ else {
1638
+ super(asn1X509__namespace.id_ce_subjectAltName, args[1], new GeneralNames(args[0] || []).rawData);
1639
+ }
1640
+ }
1641
+ onInit(asn) {
1642
+ super.onInit(asn);
1643
+ const value = asn1Schema.AsnConvert.parse(asn.extnValue, asn1X509__namespace.SubjectAlternativeName);
1644
+ this.names = new GeneralNames(value);
1645
+ }
1646
+ toTextObject() {
1647
+ const obj = this.toTextObjectWithoutValue();
1648
+ const namesObj = this.names.toTextObject();
1649
+ for (const key in namesObj) {
1650
+ obj[key] = namesObj[key];
1651
+ }
1652
+ return obj;
1653
+ }
1654
+ }
1655
+ SubjectAlternativeNameExtension.NAME = "Subject Alternative Name";
1656
+
1657
+ class ExtensionFactory {
1658
+ static register(id, type) {
1659
+ this.items.set(id, type);
1660
+ }
1661
+ static create(data) {
1662
+ const extension = new Extension(data);
1663
+ const Type = this.items.get(extension.type);
1664
+ if (Type) {
1665
+ return new Type(data);
1666
+ }
1667
+ return extension;
1668
+ }
1669
+ }
1670
+ ExtensionFactory.items = new Map();
1671
+
1672
+ class CertificatePolicyExtension extends Extension {
1673
+ constructor(...args) {
1674
+ var _a;
1675
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1676
+ super(args[0]);
1677
+ const asnPolicies = asn1Schema.AsnConvert.parse(this.value, asn1X509__namespace.CertificatePolicies);
1678
+ this.policies = asnPolicies.map((o) => o.policyIdentifier);
1679
+ }
1680
+ else {
1681
+ const policies = args[0];
1682
+ const critical = (_a = args[1]) !== null && _a !== void 0 ? _a : false;
1683
+ const value = new asn1X509__namespace.CertificatePolicies(policies.map((o) => (new asn1X509__namespace.PolicyInformation({ policyIdentifier: o }))));
1684
+ super(asn1X509__namespace.id_ce_certificatePolicies, critical, asn1Schema.AsnConvert.serialize(value));
1685
+ this.policies = policies;
1686
+ }
1687
+ }
1688
+ toTextObject() {
1689
+ const obj = this.toTextObjectWithoutValue();
1690
+ obj["Policy"] = this.policies.map((o) => new TextObject("", {}, OidSerializer.toString(o)));
1691
+ return obj;
1692
+ }
1693
+ }
1694
+ CertificatePolicyExtension.NAME = "Certificate Policies";
1695
+ ExtensionFactory.register(asn1X509__namespace.id_ce_certificatePolicies, CertificatePolicyExtension);
1696
+
1697
+ class CRLDistributionPointsExtension extends Extension {
1698
+ constructor(...args) {
1699
+ var _a;
1700
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1701
+ super(args[0]);
1702
+ }
1703
+ else if (Array.isArray(args[0]) && typeof args[0][0] === "string") {
1704
+ const urls = args[0];
1705
+ const dps = urls.map((url) => {
1706
+ return new asn1X509__namespace.DistributionPoint({
1707
+ distributionPoint: new asn1X509__namespace.DistributionPointName({ fullName: [new asn1X509__namespace.GeneralName({ uniformResourceIdentifier: url })] }),
1708
+ });
1709
+ });
1710
+ const value = new asn1X509__namespace.CRLDistributionPoints(dps);
1711
+ super(asn1X509__namespace.id_ce_cRLDistributionPoints, args[1], asn1Schema.AsnConvert.serialize(value));
1712
+ }
1713
+ else {
1714
+ const value = new asn1X509__namespace.CRLDistributionPoints(args[0]);
1715
+ super(asn1X509__namespace.id_ce_cRLDistributionPoints, args[1], asn1Schema.AsnConvert.serialize(value));
1716
+ }
1717
+ (_a = this.distributionPoints) !== null && _a !== void 0 ? _a : (this.distributionPoints = []);
1718
+ }
1719
+ onInit(asn) {
1720
+ super.onInit(asn);
1721
+ const crlExt = asn1Schema.AsnConvert.parse(asn.extnValue, asn1X509__namespace.CRLDistributionPoints);
1722
+ this.distributionPoints = crlExt;
1723
+ }
1724
+ toTextObject() {
1725
+ const obj = this.toTextObjectWithoutValue();
1726
+ obj["Distribution Point"] = this.distributionPoints.map((dp) => {
1727
+ var _a;
1728
+ const dpObj = {};
1729
+ if (dp.distributionPoint) {
1730
+ dpObj[""] = (_a = dp.distributionPoint.fullName) === null || _a === void 0 ? void 0 : _a.map((name) => new GeneralName(name).toString()).join(", ");
1731
+ }
1732
+ if (dp.reasons) {
1733
+ dpObj["Reasons"] = dp.reasons.toString();
1734
+ }
1735
+ if (dp.cRLIssuer) {
1736
+ dpObj["CRL Issuer"] = dp.cRLIssuer.map((issuer) => issuer.toString()).join(", ");
1737
+ }
1738
+ return dpObj;
1739
+ });
1740
+ return obj;
1741
+ }
1742
+ }
1743
+ CRLDistributionPointsExtension.NAME = "CRL Distribution Points";
1744
+
1745
+ class AuthorityInfoAccessExtension extends Extension {
1746
+ constructor(...args) {
1747
+ var _a, _b, _c, _d;
1748
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1749
+ super(args[0]);
1750
+ }
1751
+ else if (args[0] instanceof asn1X509__namespace.AuthorityInfoAccessSyntax) {
1752
+ const value = new asn1X509__namespace.AuthorityInfoAccessSyntax(args[0]);
1753
+ super(asn1X509__namespace.id_pe_authorityInfoAccess, args[1], asn1Schema.AsnConvert.serialize(value));
1754
+ }
1755
+ else {
1756
+ const params = args[0];
1757
+ const value = new asn1X509__namespace.AuthorityInfoAccessSyntax();
1758
+ addAccessDescriptions(value, params, asn1X509__namespace.id_ad_ocsp, "ocsp");
1759
+ addAccessDescriptions(value, params, asn1X509__namespace.id_ad_caIssuers, "caIssuers");
1760
+ addAccessDescriptions(value, params, asn1X509__namespace.id_ad_timeStamping, "timeStamping");
1761
+ addAccessDescriptions(value, params, asn1X509__namespace.id_ad_caRepository, "caRepository");
1762
+ super(asn1X509__namespace.id_pe_authorityInfoAccess, args[1], asn1Schema.AsnConvert.serialize(value));
1763
+ }
1764
+ (_a = this.ocsp) !== null && _a !== void 0 ? _a : (this.ocsp = []);
1765
+ (_b = this.caIssuers) !== null && _b !== void 0 ? _b : (this.caIssuers = []);
1766
+ (_c = this.timeStamping) !== null && _c !== void 0 ? _c : (this.timeStamping = []);
1767
+ (_d = this.caRepository) !== null && _d !== void 0 ? _d : (this.caRepository = []);
1768
+ }
1769
+ onInit(asn) {
1770
+ super.onInit(asn);
1771
+ this.ocsp = [];
1772
+ this.caIssuers = [];
1773
+ this.timeStamping = [];
1774
+ this.caRepository = [];
1775
+ const aia = asn1Schema.AsnConvert.parse(asn.extnValue, asn1X509__namespace.AuthorityInfoAccessSyntax);
1776
+ aia.forEach((accessDescription) => {
1777
+ switch (accessDescription.accessMethod) {
1778
+ case asn1X509__namespace.id_ad_ocsp:
1779
+ this.ocsp.push(new GeneralName(accessDescription.accessLocation));
1780
+ break;
1781
+ case asn1X509__namespace.id_ad_caIssuers:
1782
+ this.caIssuers.push(new GeneralName(accessDescription.accessLocation));
1783
+ break;
1784
+ case asn1X509__namespace.id_ad_timeStamping:
1785
+ this.timeStamping.push(new GeneralName(accessDescription.accessLocation));
1786
+ break;
1787
+ case asn1X509__namespace.id_ad_caRepository:
1788
+ this.caRepository.push(new GeneralName(accessDescription.accessLocation));
1789
+ break;
1790
+ }
1791
+ });
1792
+ }
1793
+ toTextObject() {
1794
+ const obj = this.toTextObjectWithoutValue();
1795
+ if (this.ocsp.length) {
1796
+ addUrlsToObject(obj, "OCSP", this.ocsp);
1797
+ }
1798
+ if (this.caIssuers.length) {
1799
+ addUrlsToObject(obj, "CA Issuers", this.caIssuers);
1800
+ }
1801
+ if (this.timeStamping.length) {
1802
+ addUrlsToObject(obj, "Time Stamping", this.timeStamping);
1803
+ }
1804
+ if (this.caRepository.length) {
1805
+ addUrlsToObject(obj, "CA Repository", this.caRepository);
1806
+ }
1807
+ return obj;
1808
+ }
1809
+ }
1810
+ AuthorityInfoAccessExtension.NAME = "Authority Info Access";
1811
+ function addUrlsToObject(obj, key, urls) {
1812
+ if (urls.length === 1) {
1813
+ obj[key] = urls[0].toTextObject();
1814
+ }
1815
+ else {
1816
+ const names = new TextObject("");
1817
+ urls.forEach((name, index) => {
1818
+ const nameObj = name.toTextObject();
1819
+ const indexedKey = `${nameObj[TextObject.NAME]} ${index + 1}`;
1820
+ let field = names[indexedKey];
1821
+ if (!Array.isArray(field)) {
1822
+ field = [];
1823
+ names[indexedKey] = field;
1824
+ }
1825
+ field.push(nameObj);
1826
+ });
1827
+ obj[key] = names;
1828
+ }
1829
+ }
1830
+ function addAccessDescriptions(value, params, method, key) {
1831
+ const items = params[key];
1832
+ if (items) {
1833
+ const array = Array.isArray(items) ? items : [items];
1834
+ array.forEach((url) => {
1835
+ if (typeof url === "string") {
1836
+ url = new GeneralName("url", url);
1837
+ }
1838
+ value.push(new asn1X509__namespace.AccessDescription({
1839
+ accessMethod: method,
1840
+ accessLocation: asn1Schema.AsnConvert.parse(url.rawData, asn1X509__namespace.GeneralName),
1841
+ }));
1842
+ });
1843
+ }
1844
+ }
1845
+
1846
+ class IssuerAlternativeNameExtension extends Extension {
1847
+ constructor(...args) {
1848
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1849
+ super(args[0]);
1850
+ }
1851
+ else {
1852
+ super(asn1X509__namespace.id_ce_issuerAltName, args[1], new GeneralNames(args[0] || []).rawData);
1853
+ }
1854
+ }
1855
+ onInit(asn) {
1856
+ super.onInit(asn);
1857
+ const value = asn1Schema.AsnConvert.parse(asn.extnValue, asn1X509__namespace.GeneralNames);
1858
+ this.names = new GeneralNames(value);
1859
+ }
1860
+ toTextObject() {
1861
+ const obj = this.toTextObjectWithoutValue();
1862
+ const namesObj = this.names.toTextObject();
1863
+ for (const key in namesObj) {
1864
+ obj[key] = namesObj[key];
1865
+ }
1866
+ return obj;
1867
+ }
1868
+ }
1869
+ IssuerAlternativeNameExtension.NAME = "Issuer Alternative Name";
1870
+
1871
+ class Attribute extends AsnData {
1872
+ constructor(...args) {
1873
+ let raw;
1874
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1875
+ raw = pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]);
1876
+ }
1877
+ else {
1878
+ const type = args[0];
1879
+ const values = Array.isArray(args[1])
1880
+ ? args[1].map((o) => pvtsutils.BufferSourceConverter.toArrayBuffer(o))
1881
+ : [];
1882
+ raw = asn1Schema.AsnConvert.serialize(new asn1X509.Attribute({
1883
+ type, values,
1884
+ }));
1885
+ }
1886
+ super(raw, asn1X509.Attribute);
1887
+ }
1888
+ onInit(asn) {
1889
+ this.type = asn.type;
1890
+ this.values = asn.values;
1891
+ }
1892
+ toTextObject() {
1893
+ const obj = this.toTextObjectWithoutValue();
1894
+ obj["Value"] = this.values.map((o) => new TextObject("", { "": o }));
1895
+ return obj;
1896
+ }
1897
+ toTextObjectWithoutValue() {
1898
+ const obj = this.toTextObjectEmpty();
1899
+ if (obj[TextObject.NAME] === Attribute.NAME) {
1900
+ obj[TextObject.NAME] = OidSerializer.toString(this.type);
1901
+ }
1902
+ return obj;
1903
+ }
1904
+ }
1905
+ Attribute.NAME = "Attribute";
1906
+
1907
+ class ChallengePasswordAttribute extends Attribute {
1908
+ constructor(...args) {
1909
+ var _a;
1910
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1911
+ super(args[0]);
1912
+ }
1913
+ else {
1914
+ const value = new asnPkcs9__namespace.ChallengePassword({ printableString: args[0] });
1915
+ super(asnPkcs9__namespace.id_pkcs9_at_challengePassword, [asn1Schema.AsnConvert.serialize(value)]);
1916
+ }
1917
+ (_a = this.password) !== null && _a !== void 0 ? _a : (this.password = "");
1918
+ }
1919
+ onInit(asn) {
1920
+ super.onInit(asn);
1921
+ if (this.values[0]) {
1922
+ const value = asn1Schema.AsnConvert.parse(this.values[0], asnPkcs9__namespace.ChallengePassword);
1923
+ this.password = value.toString();
1924
+ }
1925
+ }
1926
+ toTextObject() {
1927
+ const obj = this.toTextObjectWithoutValue();
1928
+ obj[TextObject.VALUE] = this.password;
1929
+ return obj;
1930
+ }
1931
+ }
1932
+ ChallengePasswordAttribute.NAME = "Challenge Password";
1933
+
1934
+ class ExtensionsAttribute extends Attribute {
1935
+ constructor(...args) {
1936
+ var _a;
1937
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
1938
+ super(args[0]);
1939
+ }
1940
+ else {
1941
+ const extensions = args[0];
1942
+ const value = new asn1X509__namespace.Extensions();
1943
+ for (const extension of extensions) {
1944
+ value.push(asn1Schema.AsnConvert.parse(extension.rawData, asn1X509__namespace.Extension));
1945
+ }
1946
+ super(asnPkcs9__namespace.id_pkcs9_at_extensionRequest, [asn1Schema.AsnConvert.serialize(value)]);
1947
+ }
1948
+ (_a = this.items) !== null && _a !== void 0 ? _a : (this.items = []);
1949
+ }
1950
+ onInit(asn) {
1951
+ super.onInit(asn);
1952
+ if (this.values[0]) {
1953
+ const value = asn1Schema.AsnConvert.parse(this.values[0], asn1X509__namespace.Extensions);
1954
+ this.items = value.map((o) => ExtensionFactory.create(asn1Schema.AsnConvert.serialize(o)));
1955
+ }
1956
+ }
1957
+ toTextObject() {
1958
+ const obj = this.toTextObjectWithoutValue();
1959
+ const extensions = this.items.map((o) => o.toTextObject());
1960
+ for (const extension of extensions) {
1961
+ obj[extension[TextObject.NAME]] = extension;
1962
+ }
1963
+ return obj;
1964
+ }
1965
+ }
1966
+ ExtensionsAttribute.NAME = "Extensions";
1967
+
1968
+ class AttributeFactory {
1969
+ static register(id, type) {
1970
+ this.items.set(id, type);
1971
+ }
1972
+ static create(data) {
1973
+ const attribute = new Attribute(data);
1974
+ const Type = this.items.get(attribute.type);
1975
+ if (Type) {
1976
+ return new Type(data);
1977
+ }
1978
+ return attribute;
1979
+ }
1980
+ }
1981
+ AttributeFactory.items = new Map();
1982
+
1983
+ const diAsnSignatureFormatter = "crypto.signatureFormatter";
1984
+ class AsnDefaultSignatureFormatter {
1985
+ toAsnSignature(algorithm, signature) {
1986
+ return pvtsutils.BufferSourceConverter.toArrayBuffer(signature);
1987
+ }
1988
+ toWebSignature(algorithm, signature) {
1989
+ return pvtsutils.BufferSourceConverter.toArrayBuffer(signature);
1990
+ }
1991
+ }
1992
+
1993
+ var RsaAlgorithm_1;
1994
+ exports.RsaAlgorithm = RsaAlgorithm_1 = class RsaAlgorithm {
1995
+ static createPssParams(hash, saltLength) {
1996
+ const hashAlgorithm = RsaAlgorithm_1.getHashAlgorithm(hash);
1997
+ if (!hashAlgorithm) {
1998
+ return null;
1999
+ }
2000
+ return new asn1Rsa__namespace.RsaSaPssParams({
2001
+ hashAlgorithm,
2002
+ maskGenAlgorithm: new asn1X509.AlgorithmIdentifier({
2003
+ algorithm: asn1Rsa__namespace.id_mgf1,
2004
+ parameters: asn1Schema.AsnConvert.serialize(hashAlgorithm),
2005
+ }),
2006
+ saltLength,
2007
+ });
2008
+ }
2009
+ static getHashAlgorithm(alg) {
2010
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
2011
+ if (typeof alg === "string") {
2012
+ return algProv.toAsnAlgorithm({ name: alg });
2013
+ }
2014
+ if (typeof alg === "object" && alg && "name" in alg) {
2015
+ return algProv.toAsnAlgorithm(alg);
2016
+ }
2017
+ return null;
2018
+ }
2019
+ toAsnAlgorithm(alg) {
2020
+ switch (alg.name.toLowerCase()) {
2021
+ case "rsassa-pkcs1-v1_5":
2022
+ if ("hash" in alg) {
2023
+ let hash;
2024
+ if (typeof alg.hash === "string") {
2025
+ hash = alg.hash;
2026
+ }
2027
+ else if (alg.hash && typeof alg.hash === "object"
2028
+ && "name" in alg.hash && typeof alg.hash.name === "string") {
2029
+ hash = alg.hash.name.toUpperCase();
2030
+ }
2031
+ else {
2032
+ throw new Error("Cannot get hash algorithm name");
2033
+ }
2034
+ switch (hash.toLowerCase()) {
2035
+ case "sha-1":
2036
+ return new asn1X509.AlgorithmIdentifier({
2037
+ algorithm: asn1Rsa__namespace.id_sha1WithRSAEncryption, parameters: null,
2038
+ });
2039
+ case "sha-256":
2040
+ return new asn1X509.AlgorithmIdentifier({
2041
+ algorithm: asn1Rsa__namespace.id_sha256WithRSAEncryption, parameters: null,
2042
+ });
2043
+ case "sha-384":
2044
+ return new asn1X509.AlgorithmIdentifier({
2045
+ algorithm: asn1Rsa__namespace.id_sha384WithRSAEncryption, parameters: null,
2046
+ });
2047
+ case "sha-512":
2048
+ return new asn1X509.AlgorithmIdentifier({
2049
+ algorithm: asn1Rsa__namespace.id_sha512WithRSAEncryption, parameters: null,
2050
+ });
2051
+ }
2052
+ }
2053
+ else {
2054
+ return new asn1X509.AlgorithmIdentifier({
2055
+ algorithm: asn1Rsa__namespace.id_rsaEncryption, parameters: null,
2056
+ });
2057
+ }
2058
+ break;
2059
+ case "rsa-pss":
2060
+ if ("hash" in alg) {
2061
+ if (!("saltLength" in alg && typeof alg.saltLength === "number")) {
2062
+ throw new Error("Cannot get 'saltLength' from 'alg' argument");
2063
+ }
2064
+ const pssParams = RsaAlgorithm_1.createPssParams(alg.hash, alg.saltLength);
2065
+ if (!pssParams) {
2066
+ throw new Error("Cannot create PSS parameters");
2067
+ }
2068
+ return new asn1X509.AlgorithmIdentifier({
2069
+ algorithm: asn1Rsa__namespace.id_RSASSA_PSS, parameters: asn1Schema.AsnConvert.serialize(pssParams),
2070
+ });
2071
+ }
2072
+ else {
2073
+ return new asn1X509.AlgorithmIdentifier({
2074
+ algorithm: asn1Rsa__namespace.id_RSASSA_PSS, parameters: null,
2075
+ });
2076
+ }
2077
+ }
2078
+ return null;
2079
+ }
2080
+ toWebAlgorithm(alg) {
2081
+ switch (alg.algorithm) {
2082
+ case asn1Rsa__namespace.id_rsaEncryption:
2083
+ return { name: "RSASSA-PKCS1-v1_5" };
2084
+ case asn1Rsa__namespace.id_sha1WithRSAEncryption:
2085
+ return {
2086
+ name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-1" },
2087
+ };
2088
+ case asn1Rsa__namespace.id_sha256WithRSAEncryption:
2089
+ return {
2090
+ name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" },
2091
+ };
2092
+ case asn1Rsa__namespace.id_sha384WithRSAEncryption:
2093
+ return {
2094
+ name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-384" },
2095
+ };
2096
+ case asn1Rsa__namespace.id_sha512WithRSAEncryption:
2097
+ return {
2098
+ name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-512" },
2099
+ };
2100
+ case asn1Rsa__namespace.id_RSASSA_PSS:
2101
+ if (alg.parameters) {
2102
+ const pssParams = asn1Schema.AsnConvert.parse(alg.parameters, asn1Rsa__namespace.RsaSaPssParams);
2103
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
2104
+ const hashAlg = algProv.toWebAlgorithm(pssParams.hashAlgorithm);
2105
+ return {
2106
+ name: "RSA-PSS",
2107
+ hash: hashAlg,
2108
+ saltLength: pssParams.saltLength,
2109
+ };
2110
+ }
2111
+ else {
2112
+ return { name: "RSA-PSS" };
2113
+ }
2114
+ }
2115
+ return null;
2116
+ }
2117
+ };
2118
+ exports.RsaAlgorithm = RsaAlgorithm_1 = tslib.__decorate([
2119
+ tsyringe.injectable()
2120
+ ], exports.RsaAlgorithm);
2121
+ tsyringe.container.registerSingleton(diAlgorithm, exports.RsaAlgorithm);
2122
+
2123
+ exports.ShaAlgorithm = class ShaAlgorithm {
2124
+ toAsnAlgorithm(alg) {
2125
+ switch (alg.name.toLowerCase()) {
2126
+ case "sha-1":
2127
+ return new asn1X509.AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha1 });
2128
+ case "sha-256":
2129
+ return new asn1X509.AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha256 });
2130
+ case "sha-384":
2131
+ return new asn1X509.AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha384 });
2132
+ case "sha-512":
2133
+ return new asn1X509.AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha512 });
2134
+ }
2135
+ return null;
2136
+ }
2137
+ toWebAlgorithm(alg) {
2138
+ switch (alg.algorithm) {
2139
+ case asn1Rsa.id_sha1:
2140
+ return { name: "SHA-1" };
2141
+ case asn1Rsa.id_sha256:
2142
+ return { name: "SHA-256" };
2143
+ case asn1Rsa.id_sha384:
2144
+ return { name: "SHA-384" };
2145
+ case asn1Rsa.id_sha512:
2146
+ return { name: "SHA-512" };
2147
+ }
2148
+ return null;
2149
+ }
2150
+ };
2151
+ exports.ShaAlgorithm = tslib.__decorate([
2152
+ tsyringe.injectable()
2153
+ ], exports.ShaAlgorithm);
2154
+ tsyringe.container.registerSingleton(diAlgorithm, exports.ShaAlgorithm);
2155
+
2156
+ class AsnEcSignatureFormatter {
2157
+ addPadding(pointSize, data) {
2158
+ const bytes = pvtsutils.BufferSourceConverter.toUint8Array(data);
2159
+ const res = new Uint8Array(pointSize);
2160
+ res.set(bytes, pointSize - bytes.length);
2161
+ return res.buffer;
2162
+ }
2163
+ removePadding(data, positive = false) {
2164
+ let bytes = pvtsutils.BufferSourceConverter.toUint8Array(data);
2165
+ for (let i = 0; i < bytes.length; i++) {
2166
+ if (!bytes[i]) {
2167
+ continue;
2168
+ }
2169
+ bytes = bytes.slice(i);
2170
+ break;
2171
+ }
2172
+ if (positive && bytes[0] > 127) {
2173
+ const result = new Uint8Array(bytes.length + 1);
2174
+ result.set(bytes, 1);
2175
+ return result.buffer;
2176
+ }
2177
+ return bytes.buffer;
2178
+ }
2179
+ toAsnSignature(algorithm, signature) {
2180
+ if (algorithm.name === "ECDSA") {
2181
+ const namedCurve = algorithm.namedCurve;
2182
+ const pointSize = AsnEcSignatureFormatter.namedCurveSize.get(namedCurve)
2183
+ || AsnEcSignatureFormatter.defaultNamedCurveSize;
2184
+ const ecSignature = new asn1Ecc.ECDSASigValue();
2185
+ const uint8Signature = pvtsutils.BufferSourceConverter.toUint8Array(signature);
2186
+ ecSignature.r = this.removePadding(uint8Signature.slice(0, pointSize), true);
2187
+ ecSignature.s = this.removePadding(uint8Signature.slice(pointSize, pointSize + pointSize), true);
2188
+ return asn1Schema.AsnConvert.serialize(ecSignature);
2189
+ }
2190
+ return null;
2191
+ }
2192
+ toWebSignature(algorithm, signature) {
2193
+ if (algorithm.name === "ECDSA") {
2194
+ const ecSigValue = asn1Schema.AsnConvert.parse(signature, asn1Ecc.ECDSASigValue);
2195
+ const namedCurve = algorithm.namedCurve;
2196
+ const pointSize = AsnEcSignatureFormatter.namedCurveSize.get(namedCurve)
2197
+ || AsnEcSignatureFormatter.defaultNamedCurveSize;
2198
+ const r = this.addPadding(pointSize, this.removePadding(ecSigValue.r));
2199
+ const s = this.addPadding(pointSize, this.removePadding(ecSigValue.s));
2200
+ return pvtsutils.combine(r, s);
2201
+ }
2202
+ return null;
2203
+ }
2204
+ }
2205
+ AsnEcSignatureFormatter.namedCurveSize = new Map();
2206
+ AsnEcSignatureFormatter.defaultNamedCurveSize = 32;
2207
+
2208
+ const idX25519 = "1.3.101.110";
2209
+ const idX448 = "1.3.101.111";
2210
+ const idEd25519 = "1.3.101.112";
2211
+ const idEd448 = "1.3.101.113";
2212
+ exports.EdAlgorithm = class EdAlgorithm {
2213
+ toAsnAlgorithm(alg) {
2214
+ let algorithm = null;
2215
+ switch (alg.name.toLowerCase()) {
2216
+ case "ed25519":
2217
+ algorithm = idEd25519;
2218
+ break;
2219
+ case "x25519":
2220
+ algorithm = idX25519;
2221
+ break;
2222
+ case "eddsa":
2223
+ switch (alg.namedCurve.toLowerCase()) {
2224
+ case "ed25519":
2225
+ algorithm = idEd25519;
2226
+ break;
2227
+ case "ed448":
2228
+ algorithm = idEd448;
2229
+ break;
2230
+ }
2231
+ break;
2232
+ case "ecdh-es":
2233
+ switch (alg.namedCurve.toLowerCase()) {
2234
+ case "x25519":
2235
+ algorithm = idX25519;
2236
+ break;
2237
+ case "x448":
2238
+ algorithm = idX448;
2239
+ break;
2240
+ }
2241
+ }
2242
+ if (algorithm) {
2243
+ return new asn1X509.AlgorithmIdentifier({ algorithm });
2244
+ }
2245
+ return null;
2246
+ }
2247
+ toWebAlgorithm(alg) {
2248
+ switch (alg.algorithm) {
2249
+ case idEd25519:
2250
+ return { name: "Ed25519" };
2251
+ case idEd448:
2252
+ return {
2253
+ name: "EdDSA", namedCurve: "Ed448",
2254
+ };
2255
+ case idX25519:
2256
+ return { name: "X25519" };
2257
+ case idX448:
2258
+ return {
2259
+ name: "ECDH-ES", namedCurve: "X448",
2260
+ };
2261
+ }
2262
+ return null;
2263
+ }
2264
+ };
2265
+ exports.EdAlgorithm = tslib.__decorate([
2266
+ tsyringe.injectable()
2267
+ ], exports.EdAlgorithm);
2268
+ tsyringe.container.registerSingleton(diAlgorithm, exports.EdAlgorithm);
2269
+
2270
+ var _Pkcs10CertificateRequest_tbs, _Pkcs10CertificateRequest_subjectName, _Pkcs10CertificateRequest_subject, _Pkcs10CertificateRequest_signatureAlgorithm, _Pkcs10CertificateRequest_signature, _Pkcs10CertificateRequest_publicKey, _Pkcs10CertificateRequest_attributes, _Pkcs10CertificateRequest_extensions;
2271
+ class Pkcs10CertificateRequest extends PemData {
2272
+ get subjectName() {
2273
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_subjectName, "f")) {
2274
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_subjectName, new Name(this.asn.certificationRequestInfo.subject), "f");
2275
+ }
2276
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_subjectName, "f");
2277
+ }
2278
+ get subject() {
2279
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_subject, "f")) {
2280
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_subject, this.subjectName.toString(), "f");
2281
+ }
2282
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_subject, "f");
2283
+ }
2284
+ get signatureAlgorithm() {
2285
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_signatureAlgorithm, "f")) {
2286
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
2287
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_signatureAlgorithm, algProv.toWebAlgorithm(this.asn.signatureAlgorithm), "f");
2288
+ }
2289
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_signatureAlgorithm, "f");
2290
+ }
2291
+ get signature() {
2292
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_signature, "f")) {
2293
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_signature, this.asn.signature, "f");
2294
+ }
2295
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_signature, "f");
2296
+ }
2297
+ get publicKey() {
2298
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_publicKey, "f")) {
2299
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_publicKey, new PublicKey(this.asn.certificationRequestInfo.subjectPKInfo), "f");
2300
+ }
2301
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_publicKey, "f");
2302
+ }
2303
+ get attributes() {
2304
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_attributes, "f")) {
2305
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_attributes, this.asn.certificationRequestInfo.attributes
2306
+ .map((o) => AttributeFactory.create(asn1Schema.AsnConvert.serialize(o))), "f");
2307
+ }
2308
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_attributes, "f");
2309
+ }
2310
+ get extensions() {
2311
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_extensions, "f")) {
2312
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_extensions, [], "f");
2313
+ const extensions = this.getAttribute(asnPkcs9.id_pkcs9_at_extensionRequest);
2314
+ if (extensions instanceof ExtensionsAttribute) {
2315
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_extensions, extensions.items, "f");
2316
+ }
2317
+ }
2318
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_extensions, "f");
2319
+ }
2320
+ get tbs() {
2321
+ if (!tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_tbs, "f")) {
2322
+ tslib.__classPrivateFieldSet(this, _Pkcs10CertificateRequest_tbs, this.asn.certificationRequestInfoRaw
2323
+ || asn1Schema.AsnConvert.serialize(this.asn.certificationRequestInfo), "f");
2324
+ }
2325
+ return tslib.__classPrivateFieldGet(this, _Pkcs10CertificateRequest_tbs, "f");
2326
+ }
2327
+ constructor(param) {
2328
+ const args = PemData.isAsnEncoded(param) ? [param, asn1Csr.CertificationRequest] : [param];
2329
+ super(args[0], args[1]);
2330
+ _Pkcs10CertificateRequest_tbs.set(this, void 0);
2331
+ _Pkcs10CertificateRequest_subjectName.set(this, void 0);
2332
+ _Pkcs10CertificateRequest_subject.set(this, void 0);
2333
+ _Pkcs10CertificateRequest_signatureAlgorithm.set(this, void 0);
2334
+ _Pkcs10CertificateRequest_signature.set(this, void 0);
2335
+ _Pkcs10CertificateRequest_publicKey.set(this, void 0);
2336
+ _Pkcs10CertificateRequest_attributes.set(this, void 0);
2337
+ _Pkcs10CertificateRequest_extensions.set(this, void 0);
2338
+ this.tag = PemConverter.CertificateRequestTag;
2339
+ }
2340
+ onInit(_asn) {
2341
+ }
2342
+ getAttribute(type) {
2343
+ for (const attr of this.attributes) {
2344
+ if (attr.type === type) {
2345
+ return attr;
2346
+ }
2347
+ }
2348
+ return null;
2349
+ }
2350
+ getAttributes(type) {
2351
+ return this.attributes.filter((o) => o.type === type);
2352
+ }
2353
+ getExtension(type) {
2354
+ for (const ext of this.extensions) {
2355
+ if (ext.type === type) {
2356
+ return ext;
2357
+ }
2358
+ }
2359
+ return null;
2360
+ }
2361
+ getExtensions(type) {
2362
+ return this.extensions.filter((o) => o.type === type);
2363
+ }
2364
+ async verify(crypto = cryptoProvider.get()) {
2365
+ const algorithm = {
2366
+ ...this.publicKey.algorithm, ...this.signatureAlgorithm,
2367
+ };
2368
+ const publicKey = await this.publicKey.export(algorithm, ["verify"], crypto);
2369
+ const signatureFormatters = tsyringe.container
2370
+ .resolveAll(diAsnSignatureFormatter)
2371
+ .reverse();
2372
+ let signature = null;
2373
+ for (const signatureFormatter of signatureFormatters) {
2374
+ signature = signatureFormatter.toWebSignature(algorithm, this.signature);
2375
+ if (signature) {
2376
+ break;
2377
+ }
2378
+ }
2379
+ if (!signature) {
2380
+ throw Error("Cannot convert WebCrypto signature value to ASN.1 format");
2381
+ }
2382
+ const ok = await crypto.subtle.verify(this.signatureAlgorithm, publicKey, signature, this.tbs);
2383
+ return ok;
2384
+ }
2385
+ toTextObject() {
2386
+ const obj = this.toTextObjectEmpty();
2387
+ const req = asn1Schema.AsnConvert.parse(this.rawData, asn1Csr.CertificationRequest);
2388
+ const tbs = req.certificationRequestInfo;
2389
+ const data = new TextObject("", {
2390
+ Version: `${asn1X509.Version[tbs.version]} (${tbs.version})`,
2391
+ Subject: this.subject,
2392
+ "Subject Public Key Info": this.publicKey,
2393
+ });
2394
+ if (this.attributes.length) {
2395
+ const attrs = new TextObject("");
2396
+ for (const ext of this.attributes) {
2397
+ const attrObj = ext.toTextObject();
2398
+ attrs[attrObj[TextObject.NAME]] = attrObj;
2399
+ }
2400
+ data["Attributes"] = attrs;
2401
+ }
2402
+ obj["Data"] = data;
2403
+ obj["Signature"] = new TextObject("", {
2404
+ Algorithm: TextConverter.serializeAlgorithm(req.signatureAlgorithm),
2405
+ "": req.signature,
2406
+ });
2407
+ return obj;
2408
+ }
2409
+ }
2410
+ _Pkcs10CertificateRequest_tbs = new WeakMap(), _Pkcs10CertificateRequest_subjectName = new WeakMap(), _Pkcs10CertificateRequest_subject = new WeakMap(), _Pkcs10CertificateRequest_signatureAlgorithm = new WeakMap(), _Pkcs10CertificateRequest_signature = new WeakMap(), _Pkcs10CertificateRequest_publicKey = new WeakMap(), _Pkcs10CertificateRequest_attributes = new WeakMap(), _Pkcs10CertificateRequest_extensions = new WeakMap();
2411
+ Pkcs10CertificateRequest.NAME = "PKCS#10 Certificate Request";
2412
+
2413
+ class Pkcs10CertificateRequestGenerator {
2414
+ static async create(params, crypto = cryptoProvider.get()) {
2415
+ if (!params.keys.privateKey) {
2416
+ throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");
2417
+ }
2418
+ if (!params.keys.publicKey) {
2419
+ throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");
2420
+ }
2421
+ const spki = await crypto.subtle.exportKey("spki", params.keys.publicKey);
2422
+ const asnReq = new asn1Csr.CertificationRequest({
2423
+ certificationRequestInfo: new asn1Csr.CertificationRequestInfo({ subjectPKInfo: asn1Schema.AsnConvert.parse(spki, asn1X509.SubjectPublicKeyInfo) }),
2424
+ });
2425
+ if (params.name) {
2426
+ const name = params.name instanceof Name
2427
+ ? params.name
2428
+ : new Name(params.name);
2429
+ asnReq.certificationRequestInfo.subject = asn1Schema.AsnConvert.parse(name.toArrayBuffer(), asn1X509.Name);
2430
+ }
2431
+ if (params.attributes) {
2432
+ for (const o of params.attributes) {
2433
+ asnReq.certificationRequestInfo.attributes.push(asn1Schema.AsnConvert.parse(o.rawData, asn1X509.Attribute));
2434
+ }
2435
+ }
2436
+ if (params.extensions && params.extensions.length) {
2437
+ const attr = new asn1X509.Attribute({ type: asnPkcs9.id_pkcs9_at_extensionRequest });
2438
+ const extensions = new asn1X509.Extensions();
2439
+ for (const o of params.extensions) {
2440
+ extensions.push(asn1Schema.AsnConvert.parse(o.rawData, asn1X509.Extension));
2441
+ }
2442
+ attr.values.push(asn1Schema.AsnConvert.serialize(extensions));
2443
+ asnReq.certificationRequestInfo.attributes.push(attr);
2444
+ }
2445
+ const signingAlgorithm = {
2446
+ ...params.signingAlgorithm, ...params.keys.privateKey.algorithm,
2447
+ };
2448
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
2449
+ asnReq.signatureAlgorithm = algProv.toAsnAlgorithm(signingAlgorithm);
2450
+ const tbs = asn1Schema.AsnConvert.serialize(asnReq.certificationRequestInfo);
2451
+ const signature = await crypto.subtle.sign(signingAlgorithm, params.keys.privateKey, tbs);
2452
+ const signatureFormatters = tsyringe.container
2453
+ .resolveAll(diAsnSignatureFormatter)
2454
+ .reverse();
2455
+ let asnSignature = null;
2456
+ for (const signatureFormatter of signatureFormatters) {
2457
+ asnSignature = signatureFormatter.toAsnSignature(signingAlgorithm, signature);
2458
+ if (asnSignature) {
2459
+ break;
2460
+ }
2461
+ }
2462
+ if (!asnSignature) {
2463
+ throw Error("Cannot convert WebCrypto signature value to ASN.1 format");
2464
+ }
2465
+ asnReq.signature = asnSignature;
2466
+ return new Pkcs10CertificateRequest(asn1Schema.AsnConvert.serialize(asnReq));
2467
+ }
2468
+ }
2469
+
2470
+ var _X509Certificate_tbs, _X509Certificate_serialNumber, _X509Certificate_subjectName, _X509Certificate_subject, _X509Certificate_issuerName, _X509Certificate_issuer, _X509Certificate_notBefore, _X509Certificate_notAfter, _X509Certificate_signatureAlgorithm, _X509Certificate_signature, _X509Certificate_extensions, _X509Certificate_publicKey;
2471
+ class X509Certificate extends PemData {
2472
+ get publicKey() {
2473
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_publicKey, "f")) {
2474
+ tslib.__classPrivateFieldSet(this, _X509Certificate_publicKey, new PublicKey(this.asn.tbsCertificate.subjectPublicKeyInfo), "f");
2475
+ }
2476
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_publicKey, "f");
2477
+ }
2478
+ get serialNumber() {
2479
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_serialNumber, "f")) {
2480
+ const tbs = this.asn.tbsCertificate;
2481
+ let serialNumberBytes = new Uint8Array(tbs.serialNumber);
2482
+ if (serialNumberBytes.length > 1
2483
+ && serialNumberBytes[0] === 0x00
2484
+ && serialNumberBytes[1] > 0x7F) {
2485
+ serialNumberBytes = serialNumberBytes.slice(1);
2486
+ }
2487
+ tslib.__classPrivateFieldSet(this, _X509Certificate_serialNumber, pvtsutils.Convert.ToHex(serialNumberBytes), "f");
2488
+ }
2489
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_serialNumber, "f");
2490
+ }
2491
+ get subjectName() {
2492
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_subjectName, "f")) {
2493
+ tslib.__classPrivateFieldSet(this, _X509Certificate_subjectName, new Name(this.asn.tbsCertificate.subject), "f");
2494
+ }
2495
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_subjectName, "f");
2496
+ }
2497
+ get subject() {
2498
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_subject, "f")) {
2499
+ tslib.__classPrivateFieldSet(this, _X509Certificate_subject, this.subjectName.toString(), "f");
2500
+ }
2501
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_subject, "f");
2502
+ }
2503
+ get issuerName() {
2504
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_issuerName, "f")) {
2505
+ tslib.__classPrivateFieldSet(this, _X509Certificate_issuerName, new Name(this.asn.tbsCertificate.issuer), "f");
2506
+ }
2507
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_issuerName, "f");
2508
+ }
2509
+ get issuer() {
2510
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_issuer, "f")) {
2511
+ tslib.__classPrivateFieldSet(this, _X509Certificate_issuer, this.issuerName.toString(), "f");
2512
+ }
2513
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_issuer, "f");
2514
+ }
2515
+ get notBefore() {
2516
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_notBefore, "f")) {
2517
+ const notBefore = this.asn.tbsCertificate.validity.notBefore.utcTime
2518
+ || this.asn.tbsCertificate.validity.notBefore.generalTime;
2519
+ if (!notBefore) {
2520
+ throw new Error("Cannot get 'notBefore' value");
2521
+ }
2522
+ tslib.__classPrivateFieldSet(this, _X509Certificate_notBefore, notBefore, "f");
2523
+ }
2524
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_notBefore, "f");
2525
+ }
2526
+ get notAfter() {
2527
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_notAfter, "f")) {
2528
+ const notAfter = this.asn.tbsCertificate.validity.notAfter.utcTime
2529
+ || this.asn.tbsCertificate.validity.notAfter.generalTime;
2530
+ if (!notAfter) {
2531
+ throw new Error("Cannot get 'notAfter' value");
2532
+ }
2533
+ tslib.__classPrivateFieldSet(this, _X509Certificate_notAfter, notAfter, "f");
2534
+ }
2535
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_notAfter, "f");
2536
+ }
2537
+ get signatureAlgorithm() {
2538
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_signatureAlgorithm, "f")) {
2539
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
2540
+ tslib.__classPrivateFieldSet(this, _X509Certificate_signatureAlgorithm, algProv
2541
+ .toWebAlgorithm(this.asn.signatureAlgorithm), "f");
2542
+ }
2543
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_signatureAlgorithm, "f");
2544
+ }
2545
+ get signature() {
2546
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_signature, "f")) {
2547
+ tslib.__classPrivateFieldSet(this, _X509Certificate_signature, this.asn.signatureValue, "f");
2548
+ }
2549
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_signature, "f");
2550
+ }
2551
+ get extensions() {
2552
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_extensions, "f")) {
2553
+ tslib.__classPrivateFieldSet(this, _X509Certificate_extensions, [], "f");
2554
+ if (this.asn.tbsCertificate.extensions) {
2555
+ tslib.__classPrivateFieldSet(this, _X509Certificate_extensions, this.asn.tbsCertificate.extensions.map((o) => (ExtensionFactory.create(asn1Schema.AsnConvert.serialize(o)))), "f");
2556
+ }
2557
+ }
2558
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_extensions, "f");
2559
+ }
2560
+ get tbs() {
2561
+ if (!tslib.__classPrivateFieldGet(this, _X509Certificate_tbs, "f")) {
2562
+ tslib.__classPrivateFieldSet(this, _X509Certificate_tbs, this.asn.tbsCertificateRaw || asn1Schema.AsnConvert.serialize(this.asn.tbsCertificate), "f");
2563
+ }
2564
+ return tslib.__classPrivateFieldGet(this, _X509Certificate_tbs, "f");
2565
+ }
2566
+ constructor(param) {
2567
+ const args = PemData.isAsnEncoded(param) ? [param, asn1X509.Certificate] : [param];
2568
+ super(args[0], args[1]);
2569
+ _X509Certificate_tbs.set(this, void 0);
2570
+ _X509Certificate_serialNumber.set(this, void 0);
2571
+ _X509Certificate_subjectName.set(this, void 0);
2572
+ _X509Certificate_subject.set(this, void 0);
2573
+ _X509Certificate_issuerName.set(this, void 0);
2574
+ _X509Certificate_issuer.set(this, void 0);
2575
+ _X509Certificate_notBefore.set(this, void 0);
2576
+ _X509Certificate_notAfter.set(this, void 0);
2577
+ _X509Certificate_signatureAlgorithm.set(this, void 0);
2578
+ _X509Certificate_signature.set(this, void 0);
2579
+ _X509Certificate_extensions.set(this, void 0);
2580
+ _X509Certificate_publicKey.set(this, void 0);
2581
+ this.tag = PemConverter.CertificateTag;
2582
+ }
2583
+ onInit(_asn) {
2584
+ }
2585
+ getExtension(type) {
2586
+ for (const ext of this.extensions) {
2587
+ if (typeof type === "string") {
2588
+ if (ext.type === type) {
2589
+ return ext;
2590
+ }
2591
+ }
2592
+ else {
2593
+ if (ext instanceof type) {
2594
+ return ext;
2595
+ }
2596
+ }
2597
+ }
2598
+ return null;
2599
+ }
2600
+ getExtensions(type) {
2601
+ return this.extensions.filter((o) => {
2602
+ if (typeof type === "string") {
2603
+ return o.type === type;
2604
+ }
2605
+ else {
2606
+ return o instanceof type;
2607
+ }
2608
+ });
2609
+ }
2610
+ async verify(params = {}, crypto = cryptoProvider.get()) {
2611
+ let keyAlgorithm;
2612
+ let publicKey;
2613
+ const paramsKey = params.publicKey;
2614
+ try {
2615
+ if (!paramsKey) {
2616
+ keyAlgorithm = {
2617
+ ...this.publicKey.algorithm, ...this.signatureAlgorithm,
2618
+ };
2619
+ publicKey = await this.publicKey.export(keyAlgorithm, ["verify"], crypto);
2620
+ }
2621
+ else if ("publicKey" in paramsKey) {
2622
+ keyAlgorithm = {
2623
+ ...paramsKey.publicKey.algorithm, ...this.signatureAlgorithm,
2624
+ };
2625
+ publicKey = await paramsKey.publicKey.export(keyAlgorithm, ["verify"], crypto);
2626
+ }
2627
+ else if (paramsKey instanceof PublicKey) {
2628
+ keyAlgorithm = {
2629
+ ...paramsKey.algorithm, ...this.signatureAlgorithm,
2630
+ };
2631
+ publicKey = await paramsKey.export(keyAlgorithm, ["verify"], crypto);
2632
+ }
2633
+ else if (pvtsutils.BufferSourceConverter.isBufferSource(paramsKey)) {
2634
+ const key = new PublicKey(paramsKey);
2635
+ keyAlgorithm = {
2636
+ ...key.algorithm, ...this.signatureAlgorithm,
2637
+ };
2638
+ publicKey = await key.export(keyAlgorithm, ["verify"], crypto);
2639
+ }
2640
+ else {
2641
+ keyAlgorithm = {
2642
+ ...paramsKey.algorithm, ...this.signatureAlgorithm,
2643
+ };
2644
+ publicKey = paramsKey;
2645
+ }
2646
+ }
2647
+ catch {
2648
+ return false;
2649
+ }
2650
+ const signatureFormatters = tsyringe.container
2651
+ .resolveAll(diAsnSignatureFormatter)
2652
+ .reverse();
2653
+ let signature = null;
2654
+ for (const signatureFormatter of signatureFormatters) {
2655
+ signature = signatureFormatter.toWebSignature(keyAlgorithm, this.signature);
2656
+ if (signature) {
2657
+ break;
2658
+ }
2659
+ }
2660
+ if (!signature) {
2661
+ throw Error("Cannot convert ASN.1 signature value to WebCrypto format");
2662
+ }
2663
+ const ok = await crypto.subtle.verify(this.signatureAlgorithm, publicKey, signature, this.tbs);
2664
+ if (params.signatureOnly) {
2665
+ return ok;
2666
+ }
2667
+ else {
2668
+ const date = params.date || new Date();
2669
+ const time = date.getTime();
2670
+ return ok && this.notBefore.getTime() < time && time < this.notAfter.getTime();
2671
+ }
2672
+ }
2673
+ async getThumbprint(...args) {
2674
+ let crypto;
2675
+ let algorithm = "SHA-1";
2676
+ if (args[0]) {
2677
+ if (!args[0].subtle) {
2678
+ algorithm = args[0] || algorithm;
2679
+ crypto = args[1];
2680
+ }
2681
+ else {
2682
+ crypto = args[0];
2683
+ }
2684
+ }
2685
+ crypto !== null && crypto !== void 0 ? crypto : (crypto = cryptoProvider.get());
2686
+ return await crypto.subtle.digest(algorithm, this.rawData);
2687
+ }
2688
+ async isSelfSigned(crypto = cryptoProvider.get()) {
2689
+ return this.subject === this.issuer && await this.verify({ signatureOnly: true }, crypto);
2690
+ }
2691
+ toTextObject() {
2692
+ const obj = this.toTextObjectEmpty();
2693
+ const cert = asn1Schema.AsnConvert.parse(this.rawData, asn1X509.Certificate);
2694
+ const tbs = cert.tbsCertificate;
2695
+ const data = new TextObject("", {
2696
+ Version: `${asn1X509.Version[tbs.version]} (${tbs.version})`,
2697
+ "Serial Number": tbs.serialNumber,
2698
+ "Signature Algorithm": TextConverter.serializeAlgorithm(tbs.signature),
2699
+ Issuer: this.issuer,
2700
+ Validity: new TextObject("", {
2701
+ "Not Before": tbs.validity.notBefore.getTime(),
2702
+ "Not After": tbs.validity.notAfter.getTime(),
2703
+ }),
2704
+ Subject: this.subject,
2705
+ "Subject Public Key Info": this.publicKey,
2706
+ });
2707
+ if (tbs.issuerUniqueID) {
2708
+ data["Issuer Unique ID"] = tbs.issuerUniqueID;
2709
+ }
2710
+ if (tbs.subjectUniqueID) {
2711
+ data["Subject Unique ID"] = tbs.subjectUniqueID;
2712
+ }
2713
+ if (this.extensions.length) {
2714
+ const extensions = new TextObject("");
2715
+ for (const ext of this.extensions) {
2716
+ const extObj = ext.toTextObject();
2717
+ extensions[extObj[TextObject.NAME]] = extObj;
2718
+ }
2719
+ data["Extensions"] = extensions;
2720
+ }
2721
+ obj["Data"] = data;
2722
+ obj["Signature"] = new TextObject("", {
2723
+ Algorithm: TextConverter.serializeAlgorithm(cert.signatureAlgorithm),
2724
+ "": cert.signatureValue,
2725
+ });
2726
+ return obj;
2727
+ }
2728
+ }
2729
+ _X509Certificate_tbs = new WeakMap(), _X509Certificate_serialNumber = new WeakMap(), _X509Certificate_subjectName = new WeakMap(), _X509Certificate_subject = new WeakMap(), _X509Certificate_issuerName = new WeakMap(), _X509Certificate_issuer = new WeakMap(), _X509Certificate_notBefore = new WeakMap(), _X509Certificate_notAfter = new WeakMap(), _X509Certificate_signatureAlgorithm = new WeakMap(), _X509Certificate_signature = new WeakMap(), _X509Certificate_extensions = new WeakMap(), _X509Certificate_publicKey = new WeakMap();
2730
+ X509Certificate.NAME = "Certificate";
2731
+
2732
+ class X509Certificates extends Array {
2733
+ constructor(param) {
2734
+ super();
2735
+ if (PemData.isAsnEncoded(param)) {
2736
+ this.import(param);
2737
+ }
2738
+ else if (param instanceof X509Certificate) {
2739
+ this.push(param);
2740
+ }
2741
+ else if (Array.isArray(param)) {
2742
+ for (const item of param) {
2743
+ this.push(item);
2744
+ }
2745
+ }
2746
+ }
2747
+ export(format) {
2748
+ const signedData = new asn1Cms__namespace.SignedData();
2749
+ signedData.version = 1;
2750
+ signedData.encapContentInfo.eContentType = asn1Cms__namespace.id_data;
2751
+ signedData.encapContentInfo.eContent = new asn1Cms__namespace.EncapsulatedContent({ single: new asn1Schema.OctetString() });
2752
+ signedData.certificates = new asn1Cms__namespace.CertificateSet(this.map((o) => new asn1Cms__namespace.CertificateChoices({ certificate: asn1Schema.AsnConvert.parse(o.rawData, asn1X509.Certificate) })));
2753
+ const cms = new asn1Cms__namespace.ContentInfo({
2754
+ contentType: asn1Cms__namespace.id_signedData,
2755
+ content: asn1Schema.AsnConvert.serialize(signedData),
2756
+ });
2757
+ const raw = asn1Schema.AsnConvert.serialize(cms);
2758
+ if (format === "raw") {
2759
+ return raw;
2760
+ }
2761
+ return this.toString(format);
2762
+ }
2763
+ import(data) {
2764
+ const raw = PemData.toArrayBuffer(data);
2765
+ const cms = asn1Schema.AsnConvert.parse(raw, asn1Cms__namespace.ContentInfo);
2766
+ if (cms.contentType !== asn1Cms__namespace.id_signedData) {
2767
+ throw new TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");
2768
+ }
2769
+ const signedData = asn1Schema.AsnConvert.parse(cms.content, asn1Cms__namespace.SignedData);
2770
+ this.clear();
2771
+ for (const item of signedData.certificates || []) {
2772
+ if (item.certificate) {
2773
+ this.push(new X509Certificate(item.certificate));
2774
+ }
2775
+ }
2776
+ }
2777
+ clear() {
2778
+ while (this.pop()) {
2779
+ }
2780
+ }
2781
+ toString(format = "pem") {
2782
+ const raw = this.export("raw");
2783
+ switch (format) {
2784
+ case "pem":
2785
+ return PemConverter.encode(raw, "CMS");
2786
+ case "pem-chain":
2787
+ return this
2788
+ .map((o) => o.toString("pem"))
2789
+ .join("\n");
2790
+ case "asn":
2791
+ return asn1Schema.AsnConvert.toString(raw);
2792
+ case "hex":
2793
+ return pvtsutils.Convert.ToHex(raw);
2794
+ case "base64":
2795
+ return pvtsutils.Convert.ToBase64(raw);
2796
+ case "base64url":
2797
+ return pvtsutils.Convert.ToBase64Url(raw);
2798
+ case "text":
2799
+ return TextConverter.serialize(this.toTextObject());
2800
+ default:
2801
+ throw TypeError("Argument 'format' is unsupported value");
2802
+ }
2803
+ }
2804
+ toTextObject() {
2805
+ const contentInfo = asn1Schema.AsnConvert.parse(this.export("raw"), asn1Cms__namespace.ContentInfo);
2806
+ const signedData = asn1Schema.AsnConvert.parse(contentInfo.content, asn1Cms__namespace.SignedData);
2807
+ const obj = new TextObject("X509Certificates", {
2808
+ "Content Type": OidSerializer.toString(contentInfo.contentType),
2809
+ Content: new TextObject("", {
2810
+ Version: `${asn1Cms__namespace.CMSVersion[signedData.version]} (${signedData.version})`,
2811
+ Certificates: new TextObject("", { Certificate: this.map((o) => o.toTextObject()) }),
2812
+ }),
2813
+ });
2814
+ return obj;
2815
+ }
2816
+ }
2817
+
2818
+ class X509ChainBuilder {
2819
+ constructor(params = {}) {
2820
+ this.certificates = [];
2821
+ if (params.certificates) {
2822
+ this.certificates = params.certificates;
2823
+ }
2824
+ }
2825
+ async build(cert, crypto = cryptoProvider.get()) {
2826
+ const chain = new X509Certificates(cert);
2827
+ let current = cert;
2828
+ while (current = await this.findIssuer(current, crypto)) {
2829
+ const thumbprint = await current.getThumbprint(crypto);
2830
+ for (const item of chain) {
2831
+ const thumbprint2 = await item.getThumbprint(crypto);
2832
+ if (pvtsutils.isEqual(thumbprint, thumbprint2)) {
2833
+ throw new Error("Cannot build a certificate chain. Circular dependency.");
2834
+ }
2835
+ }
2836
+ chain.push(current);
2837
+ }
2838
+ return chain;
2839
+ }
2840
+ async findIssuer(cert, crypto = cryptoProvider.get()) {
2841
+ if (!await cert.isSelfSigned(crypto)) {
2842
+ const akiExt = cert.getExtension(asn1X509__namespace.id_ce_authorityKeyIdentifier);
2843
+ for (const item of this.certificates) {
2844
+ if (item.subject !== cert.issuer) {
2845
+ continue;
2846
+ }
2847
+ if (akiExt) {
2848
+ if (akiExt.keyId) {
2849
+ const skiExt = item.getExtension(asn1X509__namespace.id_ce_subjectKeyIdentifier);
2850
+ if (skiExt && skiExt.keyId !== akiExt.keyId) {
2851
+ continue;
2852
+ }
2853
+ }
2854
+ else if (akiExt.certId) {
2855
+ const sanExt = item.getExtension(asn1X509__namespace.id_ce_subjectAltName);
2856
+ if (sanExt
2857
+ && !(akiExt.certId.serialNumber === item.serialNumber && pvtsutils.isEqual(asn1Schema.AsnConvert.serialize(akiExt.certId.name), asn1Schema.AsnConvert.serialize(sanExt)))) {
2858
+ continue;
2859
+ }
2860
+ }
2861
+ }
2862
+ try {
2863
+ const algorithm = {
2864
+ ...item.publicKey.algorithm, ...cert.signatureAlgorithm,
2865
+ };
2866
+ const publicKey = await item.publicKey.export(algorithm, ["verify"], crypto);
2867
+ const ok = await cert.verify({
2868
+ publicKey, signatureOnly: true,
2869
+ }, crypto);
2870
+ if (!ok) {
2871
+ continue;
2872
+ }
2873
+ }
2874
+ catch {
2875
+ continue;
2876
+ }
2877
+ return item;
2878
+ }
2879
+ }
2880
+ return null;
2881
+ }
2882
+ }
2883
+
2884
+ function generateCertificateSerialNumber(input, crypto = cryptoProvider.get()) {
2885
+ const inputView = pvtsutils.BufferSourceConverter.toUint8Array(pvtsutils.Convert.FromHex(input || ""));
2886
+ let serialNumber = inputView && inputView.length && inputView.some((o) => o > 0)
2887
+ ? new Uint8Array(inputView)
2888
+ : undefined;
2889
+ if (!serialNumber) {
2890
+ serialNumber = crypto.getRandomValues(new Uint8Array(16));
2891
+ }
2892
+ let firstNonZero = 0;
2893
+ while (firstNonZero < serialNumber.length - 1 && serialNumber[firstNonZero] === 0) {
2894
+ firstNonZero++;
2895
+ }
2896
+ serialNumber = serialNumber.slice(firstNonZero);
2897
+ if (serialNumber[0] > 0x7F) {
2898
+ const newSerialNumber = new Uint8Array(serialNumber.length + 1);
2899
+ newSerialNumber[0] = 0x00;
2900
+ newSerialNumber.set(serialNumber, 1);
2901
+ serialNumber = newSerialNumber;
2902
+ }
2903
+ return serialNumber.buffer;
2904
+ }
2905
+
2906
+ class X509CertificateGenerator {
2907
+ static async createSelfSigned(params, crypto = cryptoProvider.get()) {
2908
+ if (!params.keys.privateKey) {
2909
+ throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");
2910
+ }
2911
+ if (!params.keys.publicKey) {
2912
+ throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");
2913
+ }
2914
+ return this.create({
2915
+ serialNumber: params.serialNumber,
2916
+ subject: params.name,
2917
+ issuer: params.name,
2918
+ notBefore: params.notBefore,
2919
+ notAfter: params.notAfter,
2920
+ publicKey: params.keys.publicKey,
2921
+ signingKey: params.keys.privateKey,
2922
+ signingAlgorithm: params.signingAlgorithm,
2923
+ extensions: params.extensions,
2924
+ }, crypto);
2925
+ }
2926
+ static async create(params, crypto = cryptoProvider.get()) {
2927
+ var _a;
2928
+ let spki;
2929
+ if (params.publicKey instanceof PublicKey) {
2930
+ spki = params.publicKey.rawData;
2931
+ }
2932
+ else if ("publicKey" in params.publicKey) {
2933
+ spki = params.publicKey.publicKey.rawData;
2934
+ }
2935
+ else if (pvtsutils.BufferSourceConverter.isBufferSource(params.publicKey)) {
2936
+ spki = params.publicKey;
2937
+ }
2938
+ else {
2939
+ spki = await crypto.subtle.exportKey("spki", params.publicKey);
2940
+ }
2941
+ const serialNumber = generateCertificateSerialNumber(params.serialNumber, crypto);
2942
+ const notBefore = params.notBefore || new Date();
2943
+ const notAfter = params.notAfter || new Date(notBefore.getTime() + 31536000000);
2944
+ const asnX509 = new asn1X509__namespace.Certificate({
2945
+ tbsCertificate: new asn1X509__namespace.TBSCertificate({
2946
+ version: asn1X509__namespace.Version.v3,
2947
+ serialNumber,
2948
+ validity: new asn1X509__namespace.Validity({
2949
+ notBefore,
2950
+ notAfter,
2951
+ }),
2952
+ extensions: new asn1X509__namespace.Extensions(((_a = params.extensions) === null || _a === void 0 ? void 0 : _a.map((o) => asn1Schema.AsnConvert.parse(o.rawData, asn1X509__namespace.Extension))) || []),
2953
+ subjectPublicKeyInfo: asn1Schema.AsnConvert.parse(spki, asn1X509__namespace.SubjectPublicKeyInfo),
2954
+ }),
2955
+ });
2956
+ if (params.subject) {
2957
+ const name = params.subject instanceof Name
2958
+ ? params.subject
2959
+ : new Name(params.subject);
2960
+ asnX509.tbsCertificate.subject = asn1Schema.AsnConvert.parse(name.toArrayBuffer(), asn1X509__namespace.Name);
2961
+ }
2962
+ if (params.issuer) {
2963
+ const name = params.issuer instanceof Name
2964
+ ? params.issuer
2965
+ : new Name(params.issuer);
2966
+ asnX509.tbsCertificate.issuer = asn1Schema.AsnConvert.parse(name.toArrayBuffer(), asn1X509__namespace.Name);
2967
+ }
2968
+ const defaultSigningAlgorithm = { hash: "SHA-256" };
2969
+ const signatureAlgorithm = ("signingKey" in params)
2970
+ ? {
2971
+ ...defaultSigningAlgorithm, ...params.signingAlgorithm, ...params.signingKey.algorithm,
2972
+ }
2973
+ : {
2974
+ ...defaultSigningAlgorithm, ...params.signingAlgorithm,
2975
+ };
2976
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
2977
+ asnX509.tbsCertificate.signature = asnX509.signatureAlgorithm = algProv
2978
+ .toAsnAlgorithm(signatureAlgorithm);
2979
+ const tbs = asn1Schema.AsnConvert.serialize(asnX509.tbsCertificate);
2980
+ const signatureValue = ("signingKey" in params)
2981
+ ? await crypto.subtle.sign(signatureAlgorithm, params.signingKey, tbs)
2982
+ : params.signature;
2983
+ const signatureFormatters = tsyringe.container
2984
+ .resolveAll(diAsnSignatureFormatter)
2985
+ .reverse();
2986
+ let asnSignature = null;
2987
+ for (const signatureFormatter of signatureFormatters) {
2988
+ asnSignature = signatureFormatter.toAsnSignature(signatureAlgorithm, signatureValue);
2989
+ if (asnSignature) {
2990
+ break;
2991
+ }
2992
+ }
2993
+ if (!asnSignature) {
2994
+ throw Error("Cannot convert ASN.1 signature value to WebCrypto format");
2995
+ }
2996
+ asnX509.signatureValue = asnSignature;
2997
+ return new X509Certificate(asn1Schema.AsnConvert.serialize(asnX509));
2998
+ }
2999
+ }
3000
+
3001
+ var _X509CrlEntry_serialNumber, _X509CrlEntry_revocationDate, _X509CrlEntry_reason, _X509CrlEntry_invalidity, _X509CrlEntry_extensions;
3002
+ exports.X509CrlReason = void 0;
3003
+ (function (X509CrlReason) {
3004
+ X509CrlReason[X509CrlReason["unspecified"] = 0] = "unspecified";
3005
+ X509CrlReason[X509CrlReason["keyCompromise"] = 1] = "keyCompromise";
3006
+ X509CrlReason[X509CrlReason["cACompromise"] = 2] = "cACompromise";
3007
+ X509CrlReason[X509CrlReason["affiliationChanged"] = 3] = "affiliationChanged";
3008
+ X509CrlReason[X509CrlReason["superseded"] = 4] = "superseded";
3009
+ X509CrlReason[X509CrlReason["cessationOfOperation"] = 5] = "cessationOfOperation";
3010
+ X509CrlReason[X509CrlReason["certificateHold"] = 6] = "certificateHold";
3011
+ X509CrlReason[X509CrlReason["removeFromCRL"] = 8] = "removeFromCRL";
3012
+ X509CrlReason[X509CrlReason["privilegeWithdrawn"] = 9] = "privilegeWithdrawn";
3013
+ X509CrlReason[X509CrlReason["aACompromise"] = 10] = "aACompromise";
3014
+ })(exports.X509CrlReason || (exports.X509CrlReason = {}));
3015
+ class X509CrlEntry extends AsnData {
3016
+ get serialNumber() {
3017
+ if (!tslib.__classPrivateFieldGet(this, _X509CrlEntry_serialNumber, "f")) {
3018
+ tslib.__classPrivateFieldSet(this, _X509CrlEntry_serialNumber, pvtsutils.Convert.ToHex(this.asn.userCertificate), "f");
3019
+ }
3020
+ return tslib.__classPrivateFieldGet(this, _X509CrlEntry_serialNumber, "f");
3021
+ }
3022
+ get revocationDate() {
3023
+ if (!tslib.__classPrivateFieldGet(this, _X509CrlEntry_revocationDate, "f")) {
3024
+ tslib.__classPrivateFieldSet(this, _X509CrlEntry_revocationDate, this.asn.revocationDate.getTime(), "f");
3025
+ }
3026
+ return tslib.__classPrivateFieldGet(this, _X509CrlEntry_revocationDate, "f");
3027
+ }
3028
+ get reason() {
3029
+ if (tslib.__classPrivateFieldGet(this, _X509CrlEntry_reason, "f") === undefined) {
3030
+ void this.extensions;
3031
+ }
3032
+ return tslib.__classPrivateFieldGet(this, _X509CrlEntry_reason, "f");
3033
+ }
3034
+ get invalidity() {
3035
+ if (tslib.__classPrivateFieldGet(this, _X509CrlEntry_invalidity, "f") === undefined) {
3036
+ void this.extensions;
3037
+ }
3038
+ return tslib.__classPrivateFieldGet(this, _X509CrlEntry_invalidity, "f");
3039
+ }
3040
+ get extensions() {
3041
+ if (!tslib.__classPrivateFieldGet(this, _X509CrlEntry_extensions, "f")) {
3042
+ tslib.__classPrivateFieldSet(this, _X509CrlEntry_extensions, [], "f");
3043
+ if (this.asn.crlEntryExtensions) {
3044
+ tslib.__classPrivateFieldSet(this, _X509CrlEntry_extensions, this.asn.crlEntryExtensions.map((o) => {
3045
+ const extension = ExtensionFactory.create(asn1Schema.AsnConvert.serialize(o));
3046
+ switch (extension.type) {
3047
+ case asn1X509.id_ce_cRLReasons:
3048
+ if (tslib.__classPrivateFieldGet(this, _X509CrlEntry_reason, "f") === undefined) {
3049
+ tslib.__classPrivateFieldSet(this, _X509CrlEntry_reason, asn1Schema.AsnConvert
3050
+ .parse(extension.value, asn1X509.CRLReason).reason, "f");
3051
+ }
3052
+ break;
3053
+ case asn1X509.id_ce_invalidityDate:
3054
+ if (tslib.__classPrivateFieldGet(this, _X509CrlEntry_invalidity, "f") === undefined) {
3055
+ tslib.__classPrivateFieldSet(this, _X509CrlEntry_invalidity, asn1Schema.AsnConvert.parse(extension.value, asn1X509.InvalidityDate).value, "f");
3056
+ }
3057
+ break;
3058
+ }
3059
+ return extension;
3060
+ }), "f");
3061
+ }
3062
+ }
3063
+ return tslib.__classPrivateFieldGet(this, _X509CrlEntry_extensions, "f");
3064
+ }
3065
+ constructor(...args) {
3066
+ let raw;
3067
+ if (pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
3068
+ raw = pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]);
3069
+ }
3070
+ else if (typeof args[0] === "string") {
3071
+ raw = asn1Schema.AsnConvert.serialize(new asn1X509.RevokedCertificate({
3072
+ userCertificate: generateCertificateSerialNumber(args[0]),
3073
+ revocationDate: new asn1X509.Time(args[1]),
3074
+ crlEntryExtensions: args[2],
3075
+ }));
3076
+ }
3077
+ else if (args[0] instanceof asn1X509.RevokedCertificate) {
3078
+ raw = args[0];
3079
+ }
3080
+ if (!raw) {
3081
+ throw new TypeError("Cannot create X509CrlEntry instance. Wrong constructor arguments.");
3082
+ }
3083
+ super(raw, asn1X509.RevokedCertificate);
3084
+ _X509CrlEntry_serialNumber.set(this, void 0);
3085
+ _X509CrlEntry_revocationDate.set(this, void 0);
3086
+ _X509CrlEntry_reason.set(this, void 0);
3087
+ _X509CrlEntry_invalidity.set(this, void 0);
3088
+ _X509CrlEntry_extensions.set(this, void 0);
3089
+ }
3090
+ onInit(_asn) {
3091
+ }
3092
+ }
3093
+ _X509CrlEntry_serialNumber = new WeakMap(), _X509CrlEntry_revocationDate = new WeakMap(), _X509CrlEntry_reason = new WeakMap(), _X509CrlEntry_invalidity = new WeakMap(), _X509CrlEntry_extensions = new WeakMap();
3094
+
3095
+ var _X509Crl_tbs, _X509Crl_signatureAlgorithm, _X509Crl_issuerName, _X509Crl_thisUpdate, _X509Crl_nextUpdate, _X509Crl_entries, _X509Crl_extensions;
3096
+ class X509Crl extends PemData {
3097
+ get version() {
3098
+ return this.asn.tbsCertList.version;
3099
+ }
3100
+ get signatureAlgorithm() {
3101
+ if (!tslib.__classPrivateFieldGet(this, _X509Crl_signatureAlgorithm, "f")) {
3102
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
3103
+ tslib.__classPrivateFieldSet(this, _X509Crl_signatureAlgorithm, algProv
3104
+ .toWebAlgorithm(this.asn.signatureAlgorithm), "f");
3105
+ }
3106
+ return tslib.__classPrivateFieldGet(this, _X509Crl_signatureAlgorithm, "f");
3107
+ }
3108
+ get signature() {
3109
+ return this.asn.signature;
3110
+ }
3111
+ get issuer() {
3112
+ return this.issuerName.toString();
3113
+ }
3114
+ get issuerName() {
3115
+ if (!tslib.__classPrivateFieldGet(this, _X509Crl_issuerName, "f")) {
3116
+ tslib.__classPrivateFieldSet(this, _X509Crl_issuerName, new Name(this.asn.tbsCertList.issuer), "f");
3117
+ }
3118
+ return tslib.__classPrivateFieldGet(this, _X509Crl_issuerName, "f");
3119
+ }
3120
+ get thisUpdate() {
3121
+ if (!tslib.__classPrivateFieldGet(this, _X509Crl_thisUpdate, "f")) {
3122
+ const thisUpdate = this.asn.tbsCertList.thisUpdate.getTime();
3123
+ if (!thisUpdate) {
3124
+ throw new Error("Cannot get 'thisUpdate' value");
3125
+ }
3126
+ tslib.__classPrivateFieldSet(this, _X509Crl_thisUpdate, thisUpdate, "f");
3127
+ }
3128
+ return tslib.__classPrivateFieldGet(this, _X509Crl_thisUpdate, "f");
3129
+ }
3130
+ get nextUpdate() {
3131
+ var _a;
3132
+ if (tslib.__classPrivateFieldGet(this, _X509Crl_nextUpdate, "f") === undefined) {
3133
+ tslib.__classPrivateFieldSet(this, _X509Crl_nextUpdate, ((_a = this.asn.tbsCertList.nextUpdate) === null || _a === void 0 ? void 0 : _a.getTime()) || undefined, "f");
3134
+ }
3135
+ return tslib.__classPrivateFieldGet(this, _X509Crl_nextUpdate, "f");
3136
+ }
3137
+ get entries() {
3138
+ var _a;
3139
+ if (!tslib.__classPrivateFieldGet(this, _X509Crl_entries, "f")) {
3140
+ tslib.__classPrivateFieldSet(this, _X509Crl_entries, ((_a = this.asn.tbsCertList
3141
+ .revokedCertificates) === null || _a === void 0 ? void 0 : _a.map((o) => new X509CrlEntry(o))) || [], "f");
3142
+ }
3143
+ return tslib.__classPrivateFieldGet(this, _X509Crl_entries, "f");
3144
+ }
3145
+ get extensions() {
3146
+ if (!tslib.__classPrivateFieldGet(this, _X509Crl_extensions, "f")) {
3147
+ tslib.__classPrivateFieldSet(this, _X509Crl_extensions, [], "f");
3148
+ if (this.asn.tbsCertList.crlExtensions) {
3149
+ tslib.__classPrivateFieldSet(this, _X509Crl_extensions, this.asn.tbsCertList.crlExtensions.map((o) => ExtensionFactory.create(asn1Schema.AsnConvert.serialize(o))), "f");
3150
+ }
3151
+ }
3152
+ return tslib.__classPrivateFieldGet(this, _X509Crl_extensions, "f");
3153
+ }
3154
+ get tbs() {
3155
+ if (!tslib.__classPrivateFieldGet(this, _X509Crl_tbs, "f")) {
3156
+ tslib.__classPrivateFieldSet(this, _X509Crl_tbs, this.asn.tbsCertListRaw || asn1Schema.AsnConvert.serialize(this.asn.tbsCertList), "f");
3157
+ }
3158
+ return tslib.__classPrivateFieldGet(this, _X509Crl_tbs, "f");
3159
+ }
3160
+ get tbsCertListSignatureAlgorithm() {
3161
+ return this.asn.tbsCertList.signature;
3162
+ }
3163
+ get certListSignatureAlgorithm() {
3164
+ return this.asn.signatureAlgorithm;
3165
+ }
3166
+ constructor(param) {
3167
+ super(param, PemData.isAsnEncoded(param) ? asn1X509.CertificateList : undefined);
3168
+ this.tag = PemConverter.CrlTag;
3169
+ _X509Crl_tbs.set(this, void 0);
3170
+ _X509Crl_signatureAlgorithm.set(this, void 0);
3171
+ _X509Crl_issuerName.set(this, void 0);
3172
+ _X509Crl_thisUpdate.set(this, void 0);
3173
+ _X509Crl_nextUpdate.set(this, void 0);
3174
+ _X509Crl_entries.set(this, void 0);
3175
+ _X509Crl_extensions.set(this, void 0);
3176
+ }
3177
+ onInit(_asn) {
3178
+ }
3179
+ getExtension(type) {
3180
+ for (const ext of this.extensions) {
3181
+ if (typeof type === "string") {
3182
+ if (ext.type === type) {
3183
+ return ext;
3184
+ }
3185
+ }
3186
+ else {
3187
+ if (ext instanceof type) {
3188
+ return ext;
3189
+ }
3190
+ }
3191
+ }
3192
+ return null;
3193
+ }
3194
+ getExtensions(type) {
3195
+ return this.extensions.filter((o) => {
3196
+ if (typeof type === "string") {
3197
+ return o.type === type;
3198
+ }
3199
+ else {
3200
+ return o instanceof type;
3201
+ }
3202
+ });
3203
+ }
3204
+ async verify(params, crypto = cryptoProvider.get()) {
3205
+ if (!this.certListSignatureAlgorithm.isEqual(this.tbsCertListSignatureAlgorithm)) {
3206
+ throw new Error("algorithm identifier in the sequence tbsCertList and CertificateList mismatch");
3207
+ }
3208
+ let keyAlgorithm;
3209
+ let publicKey;
3210
+ const paramsKey = params.publicKey;
3211
+ try {
3212
+ if (paramsKey instanceof X509Certificate) {
3213
+ keyAlgorithm = {
3214
+ ...paramsKey.publicKey.algorithm,
3215
+ ...paramsKey.signatureAlgorithm,
3216
+ };
3217
+ publicKey = await paramsKey.publicKey.export(keyAlgorithm, ["verify"]);
3218
+ }
3219
+ else if (paramsKey instanceof PublicKey) {
3220
+ keyAlgorithm = {
3221
+ ...paramsKey.algorithm, ...this.signatureAlgorithm,
3222
+ };
3223
+ publicKey = await paramsKey.export(keyAlgorithm, ["verify"]);
3224
+ }
3225
+ else {
3226
+ keyAlgorithm = {
3227
+ ...paramsKey.algorithm, ...this.signatureAlgorithm,
3228
+ };
3229
+ publicKey = paramsKey;
3230
+ }
3231
+ }
3232
+ catch {
3233
+ return false;
3234
+ }
3235
+ const signatureFormatters = tsyringe.container
3236
+ .resolveAll(diAsnSignatureFormatter)
3237
+ .reverse();
3238
+ let signature = null;
3239
+ for (const signatureFormatter of signatureFormatters) {
3240
+ signature = signatureFormatter.toWebSignature(keyAlgorithm, this.signature);
3241
+ if (signature) {
3242
+ break;
3243
+ }
3244
+ }
3245
+ if (!signature) {
3246
+ throw Error("Cannot convert ASN.1 signature value to WebCrypto format");
3247
+ }
3248
+ return await crypto.subtle.verify(this.signatureAlgorithm, publicKey, signature, this.tbs);
3249
+ }
3250
+ async getThumbprint(...args) {
3251
+ let crypto;
3252
+ let algorithm = "SHA-1";
3253
+ if (args[0]) {
3254
+ if (!args[0].subtle) {
3255
+ algorithm = args[0] || algorithm;
3256
+ crypto = args[1];
3257
+ }
3258
+ else {
3259
+ crypto = args[0];
3260
+ }
3261
+ }
3262
+ crypto !== null && crypto !== void 0 ? crypto : (crypto = cryptoProvider.get());
3263
+ return await crypto.subtle.digest(algorithm, this.rawData);
3264
+ }
3265
+ findRevoked(certOrSerialNumber) {
3266
+ const serialNumber = typeof certOrSerialNumber === "string" ? certOrSerialNumber : certOrSerialNumber.serialNumber;
3267
+ const serialBuffer = generateCertificateSerialNumber(serialNumber);
3268
+ for (const revoked of this.asn.tbsCertList.revokedCertificates || []) {
3269
+ if (pvtsutils.BufferSourceConverter.isEqual(revoked.userCertificate, serialBuffer)) {
3270
+ return new X509CrlEntry(asn1Schema.AsnConvert.serialize(revoked));
3271
+ }
3272
+ }
3273
+ return null;
3274
+ }
3275
+ }
3276
+ _X509Crl_tbs = new WeakMap(), _X509Crl_signatureAlgorithm = new WeakMap(), _X509Crl_issuerName = new WeakMap(), _X509Crl_thisUpdate = new WeakMap(), _X509Crl_nextUpdate = new WeakMap(), _X509Crl_entries = new WeakMap(), _X509Crl_extensions = new WeakMap();
3277
+
3278
+ class X509CrlGenerator {
3279
+ static async create(params, crypto = cryptoProvider.get()) {
3280
+ var _a;
3281
+ const name = params.issuer instanceof Name
3282
+ ? params.issuer
3283
+ : new Name(params.issuer);
3284
+ const asnX509Crl = new asn1X509__namespace.CertificateList({
3285
+ tbsCertList: new asn1X509__namespace.TBSCertList({
3286
+ version: asn1X509__namespace.Version.v2,
3287
+ issuer: asn1Schema.AsnConvert.parse(name.toArrayBuffer(), asn1X509__namespace.Name),
3288
+ thisUpdate: new asn1X509.Time(params.thisUpdate || new Date()),
3289
+ }),
3290
+ });
3291
+ if (params.nextUpdate) {
3292
+ asnX509Crl.tbsCertList.nextUpdate = new asn1X509.Time(params.nextUpdate);
3293
+ }
3294
+ if (params.extensions && params.extensions.length) {
3295
+ asnX509Crl.tbsCertList.crlExtensions = new asn1X509__namespace.Extensions(params.extensions.map((o) => asn1Schema.AsnConvert.parse(o.rawData, asn1X509__namespace.Extension)) || []);
3296
+ }
3297
+ if (params.entries && params.entries.length) {
3298
+ asnX509Crl.tbsCertList.revokedCertificates = [];
3299
+ for (const entry of params.entries) {
3300
+ const userCertificate = PemData.toArrayBuffer(entry.serialNumber);
3301
+ const index = asnX509Crl.tbsCertList.revokedCertificates
3302
+ .findIndex((cert) => pvtsutils.isEqual(cert.userCertificate, userCertificate));
3303
+ if (index > -1) {
3304
+ throw new Error(`Certificate serial number ${entry.serialNumber} already exists in tbsCertList`);
3305
+ }
3306
+ const revokedCert = new asn1X509.RevokedCertificate({
3307
+ userCertificate: userCertificate,
3308
+ revocationDate: new asn1X509.Time(entry.revocationDate || new Date()),
3309
+ });
3310
+ if ("extensions" in entry && ((_a = entry.extensions) === null || _a === void 0 ? void 0 : _a.length)) {
3311
+ revokedCert.crlEntryExtensions = entry.extensions.map((o) => (asn1Schema.AsnConvert.parse(o.rawData, asn1X509__namespace.Extension)));
3312
+ }
3313
+ else {
3314
+ revokedCert.crlEntryExtensions = [];
3315
+ }
3316
+ if (!(entry instanceof X509CrlEntry)) {
3317
+ if (entry.reason) {
3318
+ revokedCert.crlEntryExtensions.push(new asn1X509__namespace.Extension({
3319
+ extnID: asn1X509__namespace.id_ce_cRLReasons,
3320
+ critical: false,
3321
+ extnValue: new asn1Schema.OctetString(asn1Schema.AsnConvert.serialize(new asn1X509__namespace.CRLReason(entry.reason))),
3322
+ }));
3323
+ }
3324
+ if (entry.invalidity) {
3325
+ revokedCert.crlEntryExtensions.push(new asn1X509__namespace.Extension({
3326
+ extnID: asn1X509__namespace.id_ce_invalidityDate,
3327
+ critical: false,
3328
+ extnValue: new asn1Schema.OctetString(asn1Schema.AsnConvert.serialize(new asn1X509__namespace.InvalidityDate(entry.invalidity))),
3329
+ }));
3330
+ }
3331
+ if (entry.issuer) {
3332
+ const name = params.issuer instanceof Name
3333
+ ? params.issuer
3334
+ : new Name(params.issuer);
3335
+ revokedCert.crlEntryExtensions.push(new asn1X509__namespace.Extension({
3336
+ extnID: asn1X509__namespace.id_ce_certificateIssuer,
3337
+ critical: false,
3338
+ extnValue: new asn1Schema.OctetString(asn1Schema.AsnConvert.serialize(asn1Schema.AsnConvert.parse(name.toArrayBuffer(), asn1X509__namespace.Name))),
3339
+ }));
3340
+ }
3341
+ }
3342
+ asnX509Crl.tbsCertList.revokedCertificates.push(revokedCert);
3343
+ }
3344
+ }
3345
+ const signingAlgorithm = {
3346
+ ...params.signingAlgorithm, ...params.signingKey.algorithm,
3347
+ };
3348
+ const algProv = tsyringe.container.resolve(diAlgorithmProvider);
3349
+ asnX509Crl.tbsCertList.signature = asnX509Crl.signatureAlgorithm = algProv
3350
+ .toAsnAlgorithm(signingAlgorithm);
3351
+ const tbs = asn1Schema.AsnConvert.serialize(asnX509Crl.tbsCertList);
3352
+ const signature = await crypto.subtle.sign(signingAlgorithm, params.signingKey, tbs);
3353
+ const signatureFormatters = tsyringe.container
3354
+ .resolveAll(diAsnSignatureFormatter)
3355
+ .reverse();
3356
+ let asnSignature = null;
3357
+ for (const signatureFormatter of signatureFormatters) {
3358
+ asnSignature = signatureFormatter.toAsnSignature(signingAlgorithm, signature);
3359
+ if (asnSignature) {
3360
+ break;
3361
+ }
3362
+ }
3363
+ if (!asnSignature) {
3364
+ throw Error("Cannot convert ASN.1 signature value to WebCrypto format");
3365
+ }
3366
+ asnX509Crl.signature = asnSignature;
3367
+ return new X509Crl(asn1Schema.AsnConvert.serialize(asnX509Crl));
3368
+ }
3369
+ }
3370
+
3371
+ ExtensionFactory.register(asn1X509__namespace.id_ce_basicConstraints, BasicConstraintsExtension);
3372
+ ExtensionFactory.register(asn1X509__namespace.id_ce_extKeyUsage, ExtendedKeyUsageExtension);
3373
+ ExtensionFactory.register(asn1X509__namespace.id_ce_keyUsage, KeyUsagesExtension);
3374
+ ExtensionFactory.register(asn1X509__namespace.id_ce_subjectKeyIdentifier, SubjectKeyIdentifierExtension);
3375
+ ExtensionFactory.register(asn1X509__namespace.id_ce_authorityKeyIdentifier, AuthorityKeyIdentifierExtension);
3376
+ ExtensionFactory.register(asn1X509__namespace.id_ce_subjectAltName, SubjectAlternativeNameExtension);
3377
+ ExtensionFactory.register(asn1X509__namespace.id_ce_cRLDistributionPoints, CRLDistributionPointsExtension);
3378
+ ExtensionFactory.register(asn1X509__namespace.id_pe_authorityInfoAccess, AuthorityInfoAccessExtension);
3379
+ ExtensionFactory.register(asn1X509__namespace.id_ce_issuerAltName, IssuerAlternativeNameExtension);
3380
+ AttributeFactory.register(asnPkcs9__namespace.id_pkcs9_at_challengePassword, ChallengePasswordAttribute);
3381
+ AttributeFactory.register(asnPkcs9__namespace.id_pkcs9_at_extensionRequest, ExtensionsAttribute);
3382
+ tsyringe.container.registerSingleton(diAsnSignatureFormatter, AsnDefaultSignatureFormatter);
3383
+ tsyringe.container.registerSingleton(diAsnSignatureFormatter, AsnEcSignatureFormatter);
3384
+ AsnEcSignatureFormatter.namedCurveSize.set("P-256", 32);
3385
+ AsnEcSignatureFormatter.namedCurveSize.set("K-256", 32);
3386
+ AsnEcSignatureFormatter.namedCurveSize.set("P-384", 48);
3387
+ AsnEcSignatureFormatter.namedCurveSize.set("P-521", 66);
3388
+
3389
+ exports.AlgorithmProvider = AlgorithmProvider;
3390
+ exports.AsnData = AsnData;
3391
+ exports.AsnDefaultSignatureFormatter = AsnDefaultSignatureFormatter;
3392
+ exports.AsnEcSignatureFormatter = AsnEcSignatureFormatter;
3393
+ exports.Attribute = Attribute;
3394
+ exports.AttributeFactory = AttributeFactory;
3395
+ exports.AuthorityInfoAccessExtension = AuthorityInfoAccessExtension;
3396
+ exports.AuthorityKeyIdentifierExtension = AuthorityKeyIdentifierExtension;
3397
+ exports.BasicConstraintsExtension = BasicConstraintsExtension;
3398
+ exports.CRLDistributionPointsExtension = CRLDistributionPointsExtension;
3399
+ exports.CertificatePolicyExtension = CertificatePolicyExtension;
3400
+ exports.ChallengePasswordAttribute = ChallengePasswordAttribute;
3401
+ exports.CryptoProvider = CryptoProvider;
3402
+ exports.DN = DN;
3403
+ exports.DNS = DNS;
3404
+ exports.DefaultAlgorithmSerializer = DefaultAlgorithmSerializer;
3405
+ exports.EMAIL = EMAIL;
3406
+ exports.ExtendedKeyUsageExtension = ExtendedKeyUsageExtension;
3407
+ exports.Extension = Extension;
3408
+ exports.ExtensionFactory = ExtensionFactory;
3409
+ exports.ExtensionsAttribute = ExtensionsAttribute;
3410
+ exports.GUID = GUID;
3411
+ exports.GeneralName = GeneralName;
3412
+ exports.GeneralNames = GeneralNames;
3413
+ exports.IP = IP;
3414
+ exports.IssuerAlternativeNameExtension = IssuerAlternativeNameExtension;
3415
+ exports.KeyUsagesExtension = KeyUsagesExtension;
3416
+ exports.Name = Name;
3417
+ exports.NameIdentifier = NameIdentifier;
3418
+ exports.OidSerializer = OidSerializer;
3419
+ exports.PemConverter = PemConverter;
3420
+ exports.PemData = PemData;
3421
+ exports.Pkcs10CertificateRequest = Pkcs10CertificateRequest;
3422
+ exports.Pkcs10CertificateRequestGenerator = Pkcs10CertificateRequestGenerator;
3423
+ exports.PublicKey = PublicKey;
3424
+ exports.REGISTERED_ID = REGISTERED_ID;
3425
+ exports.SubjectAlternativeNameExtension = SubjectAlternativeNameExtension;
3426
+ exports.SubjectKeyIdentifierExtension = SubjectKeyIdentifierExtension;
3427
+ exports.TextConverter = TextConverter;
3428
+ exports.TextObject = TextObject;
3429
+ exports.UPN = UPN;
3430
+ exports.URL = URL;
3431
+ exports.X509Certificate = X509Certificate;
3432
+ exports.X509CertificateGenerator = X509CertificateGenerator;
3433
+ exports.X509Certificates = X509Certificates;
3434
+ exports.X509ChainBuilder = X509ChainBuilder;
3435
+ exports.X509Crl = X509Crl;
3436
+ exports.X509CrlEntry = X509CrlEntry;
3437
+ exports.X509CrlGenerator = X509CrlGenerator;
3438
+ exports.cryptoProvider = cryptoProvider;
3439
+ exports.diAlgorithm = diAlgorithm;
3440
+ exports.diAlgorithmProvider = diAlgorithmProvider;
3441
+ exports.diAsnSignatureFormatter = diAsnSignatureFormatter;
3442
+ exports.idEd25519 = idEd25519;
3443
+ exports.idEd448 = idEd448;
3444
+ exports.idX25519 = idX25519;
3445
+ exports.idX448 = idX448;