@intlayer/backend 7.0.9-canary.0 → 7.0.9-canary.3

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 (915) hide show
  1. package/README.md +2 -1
  2. package/dist/assets/utils/AI/askDocQuestion/embeddings/docs/en/packages/intlayer/getLocalizedUrl.json +6146 -5120
  3. package/dist/assets/utils/AI/askDocQuestion/embeddings/docs/en/packages/intlayer/getMultilingualUrls.json +5124 -3072
  4. package/dist/assets/utils/AI/askDocQuestion/embeddings/docs/en/packages/intlayer/getPrefix.json +4106 -0
  5. package/dist/cjs/controllers/dictionary.controller.cjs +64 -41
  6. package/dist/cjs/controllers/dictionary.controller.cjs.map +1 -1
  7. package/dist/cjs/emails/MagicLinkEmail.cjs +242 -0
  8. package/dist/cjs/emails/MagicLinkEmail.cjs.map +1 -0
  9. package/dist/cjs/index.cjs +1 -1
  10. package/dist/cjs/index.cjs.map +1 -1
  11. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/index.cjs +16 -0
  12. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/index.cjs.map +1 -0
  13. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/templates/encrypted-key.tpl.xml.cjs +25 -0
  14. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/templates/encrypted-key.tpl.xml.cjs.map +1 -0
  15. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/templates/keyinfo.tpl.xml.cjs +31 -0
  16. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/templates/keyinfo.tpl.xml.cjs.map +1 -0
  17. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/utils.cjs +38 -0
  18. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/utils.cjs.map +1 -0
  19. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/xmlenc.cjs +231 -0
  20. package/dist/cjs/node_modules/@authenio/xml-encryption/lib/xmlenc.cjs.map +1 -0
  21. package/dist/cjs/node_modules/@better-auth/sso/dist/index.cjs +1210 -0
  22. package/dist/cjs/node_modules/@better-auth/sso/dist/index.cjs.map +1 -0
  23. package/dist/cjs/node_modules/@better-fetch/fetch/dist/index.cjs +362 -0
  24. package/dist/cjs/node_modules/@better-fetch/fetch/dist/index.cjs.map +1 -0
  25. package/dist/cjs/node_modules/@xmldom/is-dom-node/dist/index.cjs +89 -0
  26. package/dist/cjs/node_modules/@xmldom/is-dom-node/dist/index.cjs.map +1 -0
  27. package/dist/cjs/node_modules/@xmldom/xmldom/lib/conventions.cjs +110 -0
  28. package/dist/cjs/node_modules/@xmldom/xmldom/lib/conventions.cjs.map +1 -0
  29. package/dist/cjs/node_modules/@xmldom/xmldom/lib/dom-parser.cjs +248 -0
  30. package/dist/cjs/node_modules/@xmldom/xmldom/lib/dom-parser.cjs.map +1 -0
  31. package/dist/cjs/node_modules/@xmldom/xmldom/lib/dom.cjs +1309 -0
  32. package/dist/cjs/node_modules/@xmldom/xmldom/lib/dom.cjs.map +1 -0
  33. package/dist/cjs/node_modules/@xmldom/xmldom/lib/entities.cjs +2176 -0
  34. package/dist/cjs/node_modules/@xmldom/xmldom/lib/entities.cjs.map +1 -0
  35. package/dist/cjs/node_modules/@xmldom/xmldom/lib/index.cjs +20 -0
  36. package/dist/cjs/node_modules/@xmldom/xmldom/lib/index.cjs.map +1 -0
  37. package/dist/cjs/node_modules/@xmldom/xmldom/lib/sax.cjs +499 -0
  38. package/dist/cjs/node_modules/@xmldom/xmldom/lib/sax.cjs.map +1 -0
  39. package/dist/cjs/node_modules/asn1/lib/ber/errors.cjs +20 -0
  40. package/dist/cjs/node_modules/asn1/lib/ber/errors.cjs.map +1 -0
  41. package/dist/cjs/node_modules/asn1/lib/ber/index.cjs +28 -0
  42. package/dist/cjs/node_modules/asn1/lib/ber/index.cjs.map +1 -0
  43. package/dist/cjs/node_modules/asn1/lib/ber/reader.cjs +167 -0
  44. package/dist/cjs/node_modules/asn1/lib/ber/reader.cjs.map +1 -0
  45. package/dist/cjs/node_modules/asn1/lib/ber/types.cjs +47 -0
  46. package/dist/cjs/node_modules/asn1/lib/ber/types.cjs.map +1 -0
  47. package/dist/cjs/node_modules/asn1/lib/ber/writer.cjs +223 -0
  48. package/dist/cjs/node_modules/asn1/lib/ber/writer.cjs.map +1 -0
  49. package/dist/cjs/node_modules/asn1/lib/index.cjs +21 -0
  50. package/dist/cjs/node_modules/asn1/lib/index.cjs.map +1 -0
  51. package/dist/cjs/node_modules/camelcase/index.cjs +78 -0
  52. package/dist/cjs/node_modules/camelcase/index.cjs.map +1 -0
  53. package/dist/cjs/node_modules/escape-html/index.cjs +71 -0
  54. package/dist/cjs/node_modules/escape-html/index.cjs.map +1 -0
  55. package/dist/cjs/node_modules/fast-xml-parser/src/fxp.cjs +9 -0
  56. package/dist/cjs/node_modules/fast-xml-parser/src/fxp.cjs.map +1 -0
  57. package/dist/cjs/node_modules/fast-xml-parser/src/util.cjs +29 -0
  58. package/dist/cjs/node_modules/fast-xml-parser/src/util.cjs.map +1 -0
  59. package/dist/cjs/node_modules/fast-xml-parser/src/validator.cjs +244 -0
  60. package/dist/cjs/node_modules/fast-xml-parser/src/validator.cjs.map +1 -0
  61. package/dist/cjs/node_modules/jose/dist/webapi/lib/base64.cjs +14 -0
  62. package/dist/cjs/node_modules/jose/dist/webapi/lib/base64.cjs.map +1 -0
  63. package/dist/cjs/node_modules/jose/dist/webapi/lib/buffer_utils.cjs +10 -0
  64. package/dist/cjs/node_modules/jose/dist/webapi/lib/buffer_utils.cjs.map +1 -0
  65. package/dist/cjs/node_modules/jose/dist/webapi/lib/is_object.cjs +17 -0
  66. package/dist/cjs/node_modules/jose/dist/webapi/lib/is_object.cjs.map +1 -0
  67. package/dist/cjs/node_modules/jose/dist/webapi/util/base64url.cjs +20 -0
  68. package/dist/cjs/node_modules/jose/dist/webapi/util/base64url.cjs.map +1 -0
  69. package/dist/cjs/node_modules/jose/dist/webapi/util/decode_jwt.cjs +32 -0
  70. package/dist/cjs/node_modules/jose/dist/webapi/util/decode_jwt.cjs.map +1 -0
  71. package/dist/cjs/node_modules/jose/dist/webapi/util/errors.cjs +28 -0
  72. package/dist/cjs/node_modules/jose/dist/webapi/util/errors.cjs.map +1 -0
  73. package/dist/cjs/node_modules/node-forge/lib/aes.cjs +604 -0
  74. package/dist/cjs/node_modules/node-forge/lib/aes.cjs.map +1 -0
  75. package/dist/cjs/node_modules/node-forge/lib/aesCipherSuites.cjs +202 -0
  76. package/dist/cjs/node_modules/node-forge/lib/aesCipherSuites.cjs.map +1 -0
  77. package/dist/cjs/node_modules/node-forge/lib/asn1-validator.cjs +83 -0
  78. package/dist/cjs/node_modules/node-forge/lib/asn1-validator.cjs.map +1 -0
  79. package/dist/cjs/node_modules/node-forge/lib/asn1.cjs +945 -0
  80. package/dist/cjs/node_modules/node-forge/lib/asn1.cjs.map +1 -0
  81. package/dist/cjs/node_modules/node-forge/lib/baseN.cjs +144 -0
  82. package/dist/cjs/node_modules/node-forge/lib/baseN.cjs.map +1 -0
  83. package/dist/cjs/node_modules/node-forge/lib/cipher.cjs +193 -0
  84. package/dist/cjs/node_modules/node-forge/lib/cipher.cjs.map +1 -0
  85. package/dist/cjs/node_modules/node-forge/lib/cipherModes.cjs +604 -0
  86. package/dist/cjs/node_modules/node-forge/lib/cipherModes.cjs.map +1 -0
  87. package/dist/cjs/node_modules/node-forge/lib/des.cjs +1194 -0
  88. package/dist/cjs/node_modules/node-forge/lib/des.cjs.map +1 -0
  89. package/dist/cjs/node_modules/node-forge/lib/ed25519.cjs +1027 -0
  90. package/dist/cjs/node_modules/node-forge/lib/ed25519.cjs.map +1 -0
  91. package/dist/cjs/node_modules/node-forge/lib/forge.cjs +22 -0
  92. package/dist/cjs/node_modules/node-forge/lib/forge.cjs.map +1 -0
  93. package/dist/cjs/node_modules/node-forge/lib/hmac.cjs +114 -0
  94. package/dist/cjs/node_modules/node-forge/lib/hmac.cjs.map +1 -0
  95. package/dist/cjs/node_modules/node-forge/lib/index.cjs +73 -0
  96. package/dist/cjs/node_modules/node-forge/lib/index.cjs.map +1 -0
  97. package/dist/cjs/node_modules/node-forge/lib/jsbn.cjs +1263 -0
  98. package/dist/cjs/node_modules/node-forge/lib/jsbn.cjs.map +1 -0
  99. package/dist/cjs/node_modules/node-forge/lib/kem.cjs +153 -0
  100. package/dist/cjs/node_modules/node-forge/lib/kem.cjs.map +1 -0
  101. package/dist/cjs/node_modules/node-forge/lib/log.cjs +248 -0
  102. package/dist/cjs/node_modules/node-forge/lib/log.cjs.map +1 -0
  103. package/dist/cjs/node_modules/node-forge/lib/md.all.cjs +31 -0
  104. package/dist/cjs/node_modules/node-forge/lib/md.all.cjs.map +1 -0
  105. package/dist/cjs/node_modules/node-forge/lib/md.cjs +25 -0
  106. package/dist/cjs/node_modules/node-forge/lib/md.cjs.map +1 -0
  107. package/dist/cjs/node_modules/node-forge/lib/md5.cjs +331 -0
  108. package/dist/cjs/node_modules/node-forge/lib/md5.cjs.map +1 -0
  109. package/dist/cjs/node_modules/node-forge/lib/mgf.cjs +27 -0
  110. package/dist/cjs/node_modules/node-forge/lib/mgf.cjs.map +1 -0
  111. package/dist/cjs/node_modules/node-forge/lib/mgf1.cjs +51 -0
  112. package/dist/cjs/node_modules/node-forge/lib/mgf1.cjs.map +1 -0
  113. package/dist/cjs/node_modules/node-forge/lib/oids.cjs +160 -0
  114. package/dist/cjs/node_modules/node-forge/lib/oids.cjs.map +1 -0
  115. package/dist/cjs/node_modules/node-forge/lib/pbe.cjs +822 -0
  116. package/dist/cjs/node_modules/node-forge/lib/pbe.cjs.map +1 -0
  117. package/dist/cjs/node_modules/node-forge/lib/pbkdf2.cjs +132 -0
  118. package/dist/cjs/node_modules/node-forge/lib/pbkdf2.cjs.map +1 -0
  119. package/dist/cjs/node_modules/node-forge/lib/pem.cjs +182 -0
  120. package/dist/cjs/node_modules/node-forge/lib/pem.cjs.map +1 -0
  121. package/dist/cjs/node_modules/node-forge/lib/pkcs1.cjs +207 -0
  122. package/dist/cjs/node_modules/node-forge/lib/pkcs1.cjs.map +1 -0
  123. package/dist/cjs/node_modules/node-forge/lib/pkcs12.cjs +730 -0
  124. package/dist/cjs/node_modules/node-forge/lib/pkcs12.cjs.map +1 -0
  125. package/dist/cjs/node_modules/node-forge/lib/pkcs7.cjs +648 -0
  126. package/dist/cjs/node_modules/node-forge/lib/pkcs7.cjs.map +1 -0
  127. package/dist/cjs/node_modules/node-forge/lib/pkcs7asn1.cjs +412 -0
  128. package/dist/cjs/node_modules/node-forge/lib/pkcs7asn1.cjs.map +1 -0
  129. package/dist/cjs/node_modules/node-forge/lib/pki.cjs +108 -0
  130. package/dist/cjs/node_modules/node-forge/lib/pki.cjs.map +1 -0
  131. package/dist/cjs/node_modules/node-forge/lib/prime.cjs +200 -0
  132. package/dist/cjs/node_modules/node-forge/lib/prime.cjs.map +1 -0
  133. package/dist/cjs/node_modules/node-forge/lib/prng.cjs +297 -0
  134. package/dist/cjs/node_modules/node-forge/lib/prng.cjs.map +1 -0
  135. package/dist/cjs/node_modules/node-forge/lib/pss.cjs +148 -0
  136. package/dist/cjs/node_modules/node-forge/lib/pss.cjs.map +1 -0
  137. package/dist/cjs/node_modules/node-forge/lib/random.cjs +148 -0
  138. package/dist/cjs/node_modules/node-forge/lib/random.cjs.map +1 -0
  139. package/dist/cjs/node_modules/node-forge/lib/rc2.cjs +545 -0
  140. package/dist/cjs/node_modules/node-forge/lib/rc2.cjs.map +1 -0
  141. package/dist/cjs/node_modules/node-forge/lib/rsa.cjs +1306 -0
  142. package/dist/cjs/node_modules/node-forge/lib/rsa.cjs.map +1 -0
  143. package/dist/cjs/node_modules/node-forge/lib/sha1.cjs +237 -0
  144. package/dist/cjs/node_modules/node-forge/lib/sha1.cjs.map +1 -0
  145. package/dist/cjs/node_modules/node-forge/lib/sha256.cjs +274 -0
  146. package/dist/cjs/node_modules/node-forge/lib/sha256.cjs.map +1 -0
  147. package/dist/cjs/node_modules/node-forge/lib/sha512.cjs +420 -0
  148. package/dist/cjs/node_modules/node-forge/lib/sha512.cjs.map +1 -0
  149. package/dist/cjs/node_modules/node-forge/lib/ssh.cjs +201 -0
  150. package/dist/cjs/node_modules/node-forge/lib/ssh.cjs.map +1 -0
  151. package/dist/cjs/node_modules/node-forge/lib/tls.cjs +3662 -0
  152. package/dist/cjs/node_modules/node-forge/lib/tls.cjs.map +1 -0
  153. package/dist/cjs/node_modules/node-forge/lib/util.cjs +2124 -0
  154. package/dist/cjs/node_modules/node-forge/lib/util.cjs.map +1 -0
  155. package/dist/cjs/node_modules/node-forge/lib/x509.cjs +2171 -0
  156. package/dist/cjs/node_modules/node-forge/lib/x509.cjs.map +1 -0
  157. package/dist/cjs/node_modules/node-rsa/src/NodeRSA.cjs +341 -0
  158. package/dist/cjs/node_modules/node-rsa/src/NodeRSA.cjs.map +1 -0
  159. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/encryptEngines.cjs +26 -0
  160. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/encryptEngines.cjs.map +1 -0
  161. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/io.cjs +65 -0
  162. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/io.cjs.map +1 -0
  163. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/js.cjs +44 -0
  164. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/js.cjs.map +1 -0
  165. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/node12.cjs +49 -0
  166. package/dist/cjs/node_modules/node-rsa/src/encryptEngines/node12.cjs.map +1 -0
  167. package/dist/cjs/node_modules/node-rsa/src/formats/components.cjs +55 -0
  168. package/dist/cjs/node_modules/node-rsa/src/formats/components.cjs.map +1 -0
  169. package/dist/cjs/node_modules/node-rsa/src/formats/formats.cjs +86 -0
  170. package/dist/cjs/node_modules/node-rsa/src/formats/formats.cjs.map +1 -0
  171. package/dist/cjs/node_modules/node-rsa/src/formats/openssh.cjs +177 -0
  172. package/dist/cjs/node_modules/node-rsa/src/formats/openssh.cjs.map +1 -0
  173. package/dist/cjs/node_modules/node-rsa/src/formats/pkcs1.cjs +104 -0
  174. package/dist/cjs/node_modules/node-rsa/src/formats/pkcs1.cjs.map +1 -0
  175. package/dist/cjs/node_modules/node-rsa/src/formats/pkcs8.cjs +131 -0
  176. package/dist/cjs/node_modules/node-rsa/src/formats/pkcs8.cjs.map +1 -0
  177. package/dist/cjs/node_modules/node-rsa/src/libs/jsbn.cjs +1347 -0
  178. package/dist/cjs/node_modules/node-rsa/src/libs/jsbn.cjs.map +1 -0
  179. package/dist/cjs/node_modules/node-rsa/src/libs/rsa.cjs +231 -0
  180. package/dist/cjs/node_modules/node-rsa/src/libs/rsa.cjs.map +1 -0
  181. package/dist/cjs/node_modules/node-rsa/src/schemes/oaep.cjs +123 -0
  182. package/dist/cjs/node_modules/node-rsa/src/schemes/oaep.cjs.map +1 -0
  183. package/dist/cjs/node_modules/node-rsa/src/schemes/pkcs1.cjs +175 -0
  184. package/dist/cjs/node_modules/node-rsa/src/schemes/pkcs1.cjs.map +1 -0
  185. package/dist/cjs/node_modules/node-rsa/src/schemes/pss.cjs +123 -0
  186. package/dist/cjs/node_modules/node-rsa/src/schemes/pss.cjs.map +1 -0
  187. package/dist/cjs/node_modules/node-rsa/src/schemes/schemes.cjs +28 -0
  188. package/dist/cjs/node_modules/node-rsa/src/schemes/schemes.cjs.map +1 -0
  189. package/dist/cjs/node_modules/node-rsa/src/utils.cjs +84 -0
  190. package/dist/cjs/node_modules/node-rsa/src/utils.cjs.map +1 -0
  191. package/dist/cjs/node_modules/pako/index.cjs +25 -0
  192. package/dist/cjs/node_modules/pako/index.cjs.map +1 -0
  193. package/dist/cjs/node_modules/pako/lib/deflate.cjs +311 -0
  194. package/dist/cjs/node_modules/pako/lib/deflate.cjs.map +1 -0
  195. package/dist/cjs/node_modules/pako/lib/inflate.cjs +317 -0
  196. package/dist/cjs/node_modules/pako/lib/inflate.cjs.map +1 -0
  197. package/dist/cjs/node_modules/pako/lib/utils/common.cjs +77 -0
  198. package/dist/cjs/node_modules/pako/lib/utils/common.cjs.map +1 -0
  199. package/dist/cjs/node_modules/pako/lib/utils/strings.cjs +131 -0
  200. package/dist/cjs/node_modules/pako/lib/utils/strings.cjs.map +1 -0
  201. package/dist/cjs/node_modules/pako/lib/zlib/adler32.cjs +29 -0
  202. package/dist/cjs/node_modules/pako/lib/zlib/adler32.cjs.map +1 -0
  203. package/dist/cjs/node_modules/pako/lib/zlib/constants.cjs +43 -0
  204. package/dist/cjs/node_modules/pako/lib/zlib/constants.cjs.map +1 -0
  205. package/dist/cjs/node_modules/pako/lib/zlib/crc32.cjs +31 -0
  206. package/dist/cjs/node_modules/pako/lib/zlib/crc32.cjs.map +1 -0
  207. package/dist/cjs/node_modules/pako/lib/zlib/deflate.cjs +889 -0
  208. package/dist/cjs/node_modules/pako/lib/zlib/deflate.cjs.map +1 -0
  209. package/dist/cjs/node_modules/pako/lib/zlib/gzheader.cjs +27 -0
  210. package/dist/cjs/node_modules/pako/lib/zlib/gzheader.cjs.map +1 -0
  211. package/dist/cjs/node_modules/pako/lib/zlib/inffast.cjs +227 -0
  212. package/dist/cjs/node_modules/pako/lib/zlib/inffast.cjs.map +1 -0
  213. package/dist/cjs/node_modules/pako/lib/zlib/inflate.cjs +1038 -0
  214. package/dist/cjs/node_modules/pako/lib/zlib/inflate.cjs.map +1 -0
  215. package/dist/cjs/node_modules/pako/lib/zlib/inftrees.cjs +278 -0
  216. package/dist/cjs/node_modules/pako/lib/zlib/inftrees.cjs.map +1 -0
  217. package/dist/cjs/node_modules/pako/lib/zlib/messages.cjs +25 -0
  218. package/dist/cjs/node_modules/pako/lib/zlib/messages.cjs.map +1 -0
  219. package/dist/cjs/node_modules/pako/lib/zlib/trees.cjs +626 -0
  220. package/dist/cjs/node_modules/pako/lib/zlib/trees.cjs.map +1 -0
  221. package/dist/cjs/node_modules/pako/lib/zlib/zstream.cjs +29 -0
  222. package/dist/cjs/node_modules/pako/lib/zlib/zstream.cjs.map +1 -0
  223. package/dist/cjs/node_modules/safer-buffer/safer.cjs +52 -0
  224. package/dist/cjs/node_modules/safer-buffer/safer.cjs.map +1 -0
  225. package/dist/cjs/node_modules/samlify/build/index.cjs +120 -0
  226. package/dist/cjs/node_modules/samlify/build/index.cjs.map +1 -0
  227. package/dist/cjs/node_modules/samlify/build/src/api.cjs +36 -0
  228. package/dist/cjs/node_modules/samlify/build/src/api.cjs.map +1 -0
  229. package/dist/cjs/node_modules/samlify/build/src/binding-post.cjs +507 -0
  230. package/dist/cjs/node_modules/samlify/build/src/binding-post.cjs.map +1 -0
  231. package/dist/cjs/node_modules/samlify/build/src/binding-redirect.cjs +342 -0
  232. package/dist/cjs/node_modules/samlify/build/src/binding-redirect.cjs.map +1 -0
  233. package/dist/cjs/node_modules/samlify/build/src/binding-simplesign.cjs +361 -0
  234. package/dist/cjs/node_modules/samlify/build/src/binding-simplesign.cjs.map +1 -0
  235. package/dist/cjs/node_modules/samlify/build/src/entity-idp.cjs +282 -0
  236. package/dist/cjs/node_modules/samlify/build/src/entity-idp.cjs.map +1 -0
  237. package/dist/cjs/node_modules/samlify/build/src/entity-sp.cjs +145 -0
  238. package/dist/cjs/node_modules/samlify/build/src/entity-sp.cjs.map +1 -0
  239. package/dist/cjs/node_modules/samlify/build/src/entity.cjs +256 -0
  240. package/dist/cjs/node_modules/samlify/build/src/entity.cjs.map +1 -0
  241. package/dist/cjs/node_modules/samlify/build/src/extractor.cjs +355 -0
  242. package/dist/cjs/node_modules/samlify/build/src/extractor.cjs.map +1 -0
  243. package/dist/cjs/node_modules/samlify/build/src/flow.cjs +392 -0
  244. package/dist/cjs/node_modules/samlify/build/src/flow.cjs.map +1 -0
  245. package/dist/cjs/node_modules/samlify/build/src/libsaml.cjs +547 -0
  246. package/dist/cjs/node_modules/samlify/build/src/libsaml.cjs.map +1 -0
  247. package/dist/cjs/node_modules/samlify/build/src/metadata-idp.cjs +174 -0
  248. package/dist/cjs/node_modules/samlify/build/src/metadata-idp.cjs.map +1 -0
  249. package/dist/cjs/node_modules/samlify/build/src/metadata-sp.cjs +217 -0
  250. package/dist/cjs/node_modules/samlify/build/src/metadata-sp.cjs.map +1 -0
  251. package/dist/cjs/node_modules/samlify/build/src/metadata.cjs +203 -0
  252. package/dist/cjs/node_modules/samlify/build/src/metadata.cjs.map +1 -0
  253. package/dist/cjs/node_modules/samlify/build/src/urn.cjs +228 -0
  254. package/dist/cjs/node_modules/samlify/build/src/urn.cjs.map +1 -0
  255. package/dist/cjs/node_modules/samlify/build/src/utility.cjs +280 -0
  256. package/dist/cjs/node_modules/samlify/build/src/utility.cjs.map +1 -0
  257. package/dist/cjs/node_modules/samlify/build/src/validator.cjs +56 -0
  258. package/dist/cjs/node_modules/samlify/build/src/validator.cjs.map +1 -0
  259. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/index.cjs +50 -0
  260. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/index.cjs.map +1 -0
  261. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/md5.cjs +25 -0
  262. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/md5.cjs.map +1 -0
  263. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/nil.cjs +18 -0
  264. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/nil.cjs.map +1 -0
  265. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/parse.cjs +42 -0
  266. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/parse.cjs.map +1 -0
  267. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/regex.cjs +18 -0
  268. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/regex.cjs.map +1 -0
  269. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/rng.cjs +28 -0
  270. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/rng.cjs.map +1 -0
  271. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/sha1.cjs +25 -0
  272. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/sha1.cjs.map +1 -0
  273. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/stringify.cjs +27 -0
  274. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/stringify.cjs.map +1 -0
  275. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v1.cjs +69 -0
  276. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v1.cjs.map +1 -0
  277. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v3.cjs +23 -0
  278. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v3.cjs.map +1 -0
  279. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v35.cjs +54 -0
  280. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v35.cjs.map +1 -0
  281. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v4.cjs +34 -0
  282. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v4.cjs.map +1 -0
  283. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v5.cjs +23 -0
  284. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/v5.cjs.map +1 -0
  285. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/validate.cjs +23 -0
  286. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/validate.cjs.map +1 -0
  287. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/version.cjs +24 -0
  288. package/dist/cjs/node_modules/samlify/node_modules/uuid/dist/esm-node/version.cjs.map +1 -0
  289. package/dist/cjs/node_modules/xml/lib/escapeForXML.cjs +27 -0
  290. package/dist/cjs/node_modules/xml/lib/escapeForXML.cjs.map +1 -0
  291. package/dist/cjs/node_modules/xml/lib/xml.cjs +186 -0
  292. package/dist/cjs/node_modules/xml/lib/xml.cjs.map +1 -0
  293. package/dist/cjs/node_modules/xml-crypto/lib/c14n-canonicalization.cjs +202 -0
  294. package/dist/cjs/node_modules/xml-crypto/lib/c14n-canonicalization.cjs.map +1 -0
  295. package/dist/cjs/node_modules/xml-crypto/lib/enveloped-signature.cjs +52 -0
  296. package/dist/cjs/node_modules/xml-crypto/lib/enveloped-signature.cjs.map +1 -0
  297. package/dist/cjs/node_modules/xml-crypto/lib/exclusive-canonicalization.cjs +223 -0
  298. package/dist/cjs/node_modules/xml-crypto/lib/exclusive-canonicalization.cjs.map +1 -0
  299. package/dist/cjs/node_modules/xml-crypto/lib/hash-algorithms.cjs +56 -0
  300. package/dist/cjs/node_modules/xml-crypto/lib/hash-algorithms.cjs.map +1 -0
  301. package/dist/cjs/node_modules/xml-crypto/lib/index.cjs +73 -0
  302. package/dist/cjs/node_modules/xml-crypto/lib/index.cjs.map +1 -0
  303. package/dist/cjs/node_modules/xml-crypto/lib/signature-algorithms.cjs +91 -0
  304. package/dist/cjs/node_modules/xml-crypto/lib/signature-algorithms.cjs.map +1 -0
  305. package/dist/cjs/node_modules/xml-crypto/lib/signed-xml.cjs +695 -0
  306. package/dist/cjs/node_modules/xml-crypto/lib/signed-xml.cjs.map +1 -0
  307. package/dist/cjs/node_modules/xml-crypto/lib/types.cjs +58 -0
  308. package/dist/cjs/node_modules/xml-crypto/lib/types.cjs.map +1 -0
  309. package/dist/cjs/node_modules/xml-crypto/lib/utils.cjs +213 -0
  310. package/dist/cjs/node_modules/xml-crypto/lib/utils.cjs.map +1 -0
  311. package/dist/cjs/node_modules/xml-crypto/node_modules/xpath/xpath.cjs +3445 -0
  312. package/dist/cjs/node_modules/xml-crypto/node_modules/xpath/xpath.cjs.map +1 -0
  313. package/dist/cjs/node_modules/xml-escape/index.cjs +30 -0
  314. package/dist/cjs/node_modules/xml-escape/index.cjs.map +1 -0
  315. package/dist/cjs/node_modules/xpath/xpath.cjs +3410 -0
  316. package/dist/cjs/node_modules/xpath/xpath.cjs.map +1 -0
  317. package/dist/cjs/node_modules/zod/v4/classic/errors.cjs +31 -0
  318. package/dist/cjs/node_modules/zod/v4/classic/errors.cjs.map +1 -0
  319. package/dist/cjs/node_modules/zod/v4/classic/iso.cjs +42 -0
  320. package/dist/cjs/node_modules/zod/v4/classic/iso.cjs.map +1 -0
  321. package/dist/cjs/node_modules/zod/v4/classic/parse.cjs +32 -0
  322. package/dist/cjs/node_modules/zod/v4/classic/parse.cjs.map +1 -0
  323. package/dist/cjs/node_modules/zod/v4/classic/schemas.cjs +527 -0
  324. package/dist/cjs/node_modules/zod/v4/classic/schemas.cjs.map +1 -0
  325. package/dist/cjs/node_modules/zod/v4/core/api.cjs +443 -0
  326. package/dist/cjs/node_modules/zod/v4/core/api.cjs.map +1 -0
  327. package/dist/cjs/node_modules/zod/v4/core/checks.cjs +238 -0
  328. package/dist/cjs/node_modules/zod/v4/core/checks.cjs.map +1 -0
  329. package/dist/cjs/node_modules/zod/v4/core/core.cjs +63 -0
  330. package/dist/cjs/node_modules/zod/v4/core/core.cjs.map +1 -0
  331. package/dist/cjs/node_modules/zod/v4/core/doc.cjs +36 -0
  332. package/dist/cjs/node_modules/zod/v4/core/doc.cjs.map +1 -0
  333. package/dist/cjs/node_modules/zod/v4/core/errors.cjs +67 -0
  334. package/dist/cjs/node_modules/zod/v4/core/errors.cjs.map +1 -0
  335. package/dist/cjs/node_modules/zod/v4/core/parse.cjs +124 -0
  336. package/dist/cjs/node_modules/zod/v4/core/parse.cjs.map +1 -0
  337. package/dist/cjs/node_modules/zod/v4/core/regexes.cjs +87 -0
  338. package/dist/cjs/node_modules/zod/v4/core/regexes.cjs.map +1 -0
  339. package/dist/cjs/node_modules/zod/v4/core/registries.cjs +55 -0
  340. package/dist/cjs/node_modules/zod/v4/core/registries.cjs.map +1 -0
  341. package/dist/cjs/node_modules/zod/v4/core/schemas.cjs +1115 -0
  342. package/dist/cjs/node_modules/zod/v4/core/schemas.cjs.map +1 -0
  343. package/dist/cjs/node_modules/zod/v4/core/util.cjs +333 -0
  344. package/dist/cjs/node_modules/zod/v4/core/util.cjs.map +1 -0
  345. package/dist/cjs/node_modules/zod/v4/core/versions.cjs +12 -0
  346. package/dist/cjs/node_modules/zod/v4/core/versions.cjs.map +1 -0
  347. package/dist/cjs/schemas/user.schema.cjs +17 -0
  348. package/dist/cjs/schemas/user.schema.cjs.map +1 -1
  349. package/dist/cjs/services/dictionary.service.cjs +7 -31
  350. package/dist/cjs/services/dictionary.service.cjs.map +1 -1
  351. package/dist/cjs/services/email.service.cjs +13 -0
  352. package/dist/cjs/services/email.service.cjs.map +1 -1
  353. package/dist/cjs/types/user.types.cjs.map +1 -1
  354. package/dist/cjs/utils/auth/getAuth.cjs +60 -26
  355. package/dist/cjs/utils/auth/getAuth.cjs.map +1 -1
  356. package/dist/cjs/utils/mongoDB/connectDB.cjs.map +1 -1
  357. package/dist/esm/_virtual/rolldown_runtime.mjs +43 -0
  358. package/dist/esm/controllers/dictionary.controller.mjs +65 -42
  359. package/dist/esm/controllers/dictionary.controller.mjs.map +1 -1
  360. package/dist/esm/emails/MagicLinkEmail.mjs +239 -0
  361. package/dist/esm/emails/MagicLinkEmail.mjs.map +1 -0
  362. package/dist/esm/index.mjs +1 -1
  363. package/dist/esm/index.mjs.map +1 -1
  364. package/dist/esm/node_modules/@authenio/xml-encryption/lib/index.mjs +13 -0
  365. package/dist/esm/node_modules/@authenio/xml-encryption/lib/index.mjs.map +1 -0
  366. package/dist/esm/node_modules/@authenio/xml-encryption/lib/templates/encrypted-key.tpl.xml.mjs +22 -0
  367. package/dist/esm/node_modules/@authenio/xml-encryption/lib/templates/encrypted-key.tpl.xml.mjs.map +1 -0
  368. package/dist/esm/node_modules/@authenio/xml-encryption/lib/templates/keyinfo.tpl.xml.mjs +28 -0
  369. package/dist/esm/node_modules/@authenio/xml-encryption/lib/templates/keyinfo.tpl.xml.mjs.map +1 -0
  370. package/dist/esm/node_modules/@authenio/xml-encryption/lib/utils.mjs +35 -0
  371. package/dist/esm/node_modules/@authenio/xml-encryption/lib/utils.mjs.map +1 -0
  372. package/dist/esm/node_modules/@authenio/xml-encryption/lib/xmlenc.mjs +228 -0
  373. package/dist/esm/node_modules/@authenio/xml-encryption/lib/xmlenc.mjs.map +1 -0
  374. package/dist/esm/node_modules/@better-auth/sso/dist/index.mjs +1210 -0
  375. package/dist/esm/node_modules/@better-auth/sso/dist/index.mjs.map +1 -0
  376. package/dist/esm/node_modules/@better-fetch/fetch/dist/index.mjs +359 -0
  377. package/dist/esm/node_modules/@better-fetch/fetch/dist/index.mjs.map +1 -0
  378. package/dist/esm/node_modules/@xmldom/is-dom-node/dist/index.mjs +86 -0
  379. package/dist/esm/node_modules/@xmldom/is-dom-node/dist/index.mjs.map +1 -0
  380. package/dist/esm/node_modules/@xmldom/xmldom/lib/conventions.mjs +107 -0
  381. package/dist/esm/node_modules/@xmldom/xmldom/lib/conventions.mjs.map +1 -0
  382. package/dist/esm/node_modules/@xmldom/xmldom/lib/dom-parser.mjs +245 -0
  383. package/dist/esm/node_modules/@xmldom/xmldom/lib/dom-parser.mjs.map +1 -0
  384. package/dist/esm/node_modules/@xmldom/xmldom/lib/dom.mjs +1306 -0
  385. package/dist/esm/node_modules/@xmldom/xmldom/lib/dom.mjs.map +1 -0
  386. package/dist/esm/node_modules/@xmldom/xmldom/lib/entities.mjs +2173 -0
  387. package/dist/esm/node_modules/@xmldom/xmldom/lib/entities.mjs.map +1 -0
  388. package/dist/esm/node_modules/@xmldom/xmldom/lib/index.mjs +17 -0
  389. package/dist/esm/node_modules/@xmldom/xmldom/lib/index.mjs.map +1 -0
  390. package/dist/esm/node_modules/@xmldom/xmldom/lib/sax.mjs +496 -0
  391. package/dist/esm/node_modules/@xmldom/xmldom/lib/sax.mjs.map +1 -0
  392. package/dist/esm/node_modules/asn1/lib/ber/errors.mjs +17 -0
  393. package/dist/esm/node_modules/asn1/lib/ber/errors.mjs.map +1 -0
  394. package/dist/esm/node_modules/asn1/lib/ber/index.mjs +25 -0
  395. package/dist/esm/node_modules/asn1/lib/ber/index.mjs.map +1 -0
  396. package/dist/esm/node_modules/asn1/lib/ber/reader.mjs +164 -0
  397. package/dist/esm/node_modules/asn1/lib/ber/reader.mjs.map +1 -0
  398. package/dist/esm/node_modules/asn1/lib/ber/types.mjs +44 -0
  399. package/dist/esm/node_modules/asn1/lib/ber/types.mjs.map +1 -0
  400. package/dist/esm/node_modules/asn1/lib/ber/writer.mjs +220 -0
  401. package/dist/esm/node_modules/asn1/lib/ber/writer.mjs.map +1 -0
  402. package/dist/esm/node_modules/asn1/lib/index.mjs +18 -0
  403. package/dist/esm/node_modules/asn1/lib/index.mjs.map +1 -0
  404. package/dist/esm/node_modules/available-typed-arrays/index.mjs +20 -0
  405. package/dist/esm/node_modules/available-typed-arrays/index.mjs.map +1 -0
  406. package/dist/esm/node_modules/base64-js/index.mjs +95 -0
  407. package/dist/esm/node_modules/base64-js/index.mjs.map +1 -0
  408. package/dist/esm/node_modules/buffer/index.mjs +1114 -0
  409. package/dist/esm/node_modules/buffer/index.mjs.map +1 -0
  410. package/dist/esm/node_modules/call-bind/index.mjs +26 -0
  411. package/dist/esm/node_modules/call-bind/index.mjs.map +1 -0
  412. package/dist/esm/node_modules/call-bind-apply-helpers/actualApply.mjs +21 -0
  413. package/dist/esm/node_modules/call-bind-apply-helpers/actualApply.mjs.map +1 -0
  414. package/dist/esm/node_modules/call-bind-apply-helpers/applyBind.mjs +21 -0
  415. package/dist/esm/node_modules/call-bind-apply-helpers/applyBind.mjs.map +1 -0
  416. package/dist/esm/node_modules/call-bind-apply-helpers/functionApply.mjs +13 -0
  417. package/dist/esm/node_modules/call-bind-apply-helpers/functionApply.mjs.map +1 -0
  418. package/dist/esm/node_modules/call-bind-apply-helpers/functionCall.mjs +13 -0
  419. package/dist/esm/node_modules/call-bind-apply-helpers/functionCall.mjs.map +1 -0
  420. package/dist/esm/node_modules/call-bind-apply-helpers/index.mjs +24 -0
  421. package/dist/esm/node_modules/call-bind-apply-helpers/index.mjs.map +1 -0
  422. package/dist/esm/node_modules/call-bind-apply-helpers/reflectApply.mjs +13 -0
  423. package/dist/esm/node_modules/call-bind-apply-helpers/reflectApply.mjs.map +1 -0
  424. package/dist/esm/node_modules/call-bound/index.mjs +23 -0
  425. package/dist/esm/node_modules/call-bound/index.mjs.map +1 -0
  426. package/dist/esm/node_modules/camelcase/index.mjs +75 -0
  427. package/dist/esm/node_modules/camelcase/index.mjs.map +1 -0
  428. package/dist/esm/node_modules/define-data-property/index.mjs +41 -0
  429. package/dist/esm/node_modules/define-data-property/index.mjs.map +1 -0
  430. package/dist/esm/node_modules/dunder-proto/get.mjs +28 -0
  431. package/dist/esm/node_modules/dunder-proto/get.mjs.map +1 -0
  432. package/dist/esm/node_modules/es-define-property/index.mjs +19 -0
  433. package/dist/esm/node_modules/es-define-property/index.mjs.map +1 -0
  434. package/dist/esm/node_modules/es-errors/eval.mjs +13 -0
  435. package/dist/esm/node_modules/es-errors/eval.mjs.map +1 -0
  436. package/dist/esm/node_modules/es-errors/index.mjs +13 -0
  437. package/dist/esm/node_modules/es-errors/index.mjs.map +1 -0
  438. package/dist/esm/node_modules/es-errors/range.mjs +13 -0
  439. package/dist/esm/node_modules/es-errors/range.mjs.map +1 -0
  440. package/dist/esm/node_modules/es-errors/ref.mjs +13 -0
  441. package/dist/esm/node_modules/es-errors/ref.mjs.map +1 -0
  442. package/dist/esm/node_modules/es-errors/syntax.mjs +13 -0
  443. package/dist/esm/node_modules/es-errors/syntax.mjs.map +1 -0
  444. package/dist/esm/node_modules/es-errors/type.mjs +13 -0
  445. package/dist/esm/node_modules/es-errors/type.mjs.map +1 -0
  446. package/dist/esm/node_modules/es-errors/uri.mjs +13 -0
  447. package/dist/esm/node_modules/es-errors/uri.mjs.map +1 -0
  448. package/dist/esm/node_modules/es-object-atoms/index.mjs +13 -0
  449. package/dist/esm/node_modules/es-object-atoms/index.mjs.map +1 -0
  450. package/dist/esm/node_modules/escape-html/index.mjs +68 -0
  451. package/dist/esm/node_modules/escape-html/index.mjs.map +1 -0
  452. package/dist/esm/node_modules/fast-xml-parser/src/fxp.mjs +8 -0
  453. package/dist/esm/node_modules/fast-xml-parser/src/fxp.mjs.map +1 -0
  454. package/dist/esm/node_modules/fast-xml-parser/src/util.mjs +26 -0
  455. package/dist/esm/node_modules/fast-xml-parser/src/util.mjs.map +1 -0
  456. package/dist/esm/node_modules/fast-xml-parser/src/validator.mjs +243 -0
  457. package/dist/esm/node_modules/fast-xml-parser/src/validator.mjs.map +1 -0
  458. package/dist/esm/node_modules/for-each/index.mjs +43 -0
  459. package/dist/esm/node_modules/for-each/index.mjs.map +1 -0
  460. package/dist/esm/node_modules/function-bind/implementation.mjs +59 -0
  461. package/dist/esm/node_modules/function-bind/implementation.mjs.map +1 -0
  462. package/dist/esm/node_modules/function-bind/index.mjs +14 -0
  463. package/dist/esm/node_modules/function-bind/index.mjs.map +1 -0
  464. package/dist/esm/node_modules/generator-function/index.mjs +14 -0
  465. package/dist/esm/node_modules/generator-function/index.mjs.map +1 -0
  466. package/dist/esm/node_modules/get-intrinsic/index.mjs +358 -0
  467. package/dist/esm/node_modules/get-intrinsic/index.mjs.map +1 -0
  468. package/dist/esm/node_modules/get-proto/Object.getPrototypeOf.mjs +15 -0
  469. package/dist/esm/node_modules/get-proto/Object.getPrototypeOf.mjs.map +1 -0
  470. package/dist/esm/node_modules/get-proto/Reflect.getPrototypeOf.mjs +13 -0
  471. package/dist/esm/node_modules/get-proto/Reflect.getPrototypeOf.mjs.map +1 -0
  472. package/dist/esm/node_modules/get-proto/index.mjs +26 -0
  473. package/dist/esm/node_modules/get-proto/index.mjs.map +1 -0
  474. package/dist/esm/node_modules/gopd/gOPD.mjs +13 -0
  475. package/dist/esm/node_modules/gopd/gOPD.mjs.map +1 -0
  476. package/dist/esm/node_modules/gopd/index.mjs +20 -0
  477. package/dist/esm/node_modules/gopd/index.mjs.map +1 -0
  478. package/dist/esm/node_modules/has-property-descriptors/index.mjs +25 -0
  479. package/dist/esm/node_modules/has-property-descriptors/index.mjs.map +1 -0
  480. package/dist/esm/node_modules/has-symbols/index.mjs +22 -0
  481. package/dist/esm/node_modules/has-symbols/index.mjs.map +1 -0
  482. package/dist/esm/node_modules/has-symbols/shams.mjs +36 -0
  483. package/dist/esm/node_modules/has-symbols/shams.mjs.map +1 -0
  484. package/dist/esm/node_modules/has-tostringtag/shams.mjs +17 -0
  485. package/dist/esm/node_modules/has-tostringtag/shams.mjs.map +1 -0
  486. package/dist/esm/node_modules/hasown/index.mjs +17 -0
  487. package/dist/esm/node_modules/hasown/index.mjs.map +1 -0
  488. package/dist/esm/node_modules/ieee754/index.mjs +80 -0
  489. package/dist/esm/node_modules/ieee754/index.mjs.map +1 -0
  490. package/dist/esm/node_modules/inherits/inherits_browser.mjs +31 -0
  491. package/dist/esm/node_modules/inherits/inherits_browser.mjs.map +1 -0
  492. package/dist/esm/node_modules/is-arguments/index.mjs +31 -0
  493. package/dist/esm/node_modules/is-arguments/index.mjs.map +1 -0
  494. package/dist/esm/node_modules/is-callable/index.mjs +87 -0
  495. package/dist/esm/node_modules/is-callable/index.mjs.map +1 -0
  496. package/dist/esm/node_modules/is-generator-function/index.mjs +32 -0
  497. package/dist/esm/node_modules/is-generator-function/index.mjs.map +1 -0
  498. package/dist/esm/node_modules/is-regex/index.mjs +58 -0
  499. package/dist/esm/node_modules/is-regex/index.mjs.map +1 -0
  500. package/dist/esm/node_modules/is-typed-array/index.mjs +17 -0
  501. package/dist/esm/node_modules/is-typed-array/index.mjs.map +1 -0
  502. package/dist/esm/node_modules/jose/dist/webapi/lib/base64.mjs +12 -0
  503. package/dist/esm/node_modules/jose/dist/webapi/lib/base64.mjs.map +1 -0
  504. package/dist/esm/node_modules/jose/dist/webapi/lib/buffer_utils.mjs +8 -0
  505. package/dist/esm/node_modules/jose/dist/webapi/lib/buffer_utils.mjs.map +1 -0
  506. package/dist/esm/node_modules/jose/dist/webapi/lib/is_object.mjs +15 -0
  507. package/dist/esm/node_modules/jose/dist/webapi/lib/is_object.mjs.map +1 -0
  508. package/dist/esm/node_modules/jose/dist/webapi/util/base64url.mjs +19 -0
  509. package/dist/esm/node_modules/jose/dist/webapi/util/base64url.mjs.map +1 -0
  510. package/dist/esm/node_modules/jose/dist/webapi/util/decode_jwt.mjs +31 -0
  511. package/dist/esm/node_modules/jose/dist/webapi/util/decode_jwt.mjs.map +1 -0
  512. package/dist/esm/node_modules/jose/dist/webapi/util/errors.mjs +26 -0
  513. package/dist/esm/node_modules/jose/dist/webapi/util/errors.mjs.map +1 -0
  514. package/dist/esm/node_modules/math-intrinsics/abs.mjs +13 -0
  515. package/dist/esm/node_modules/math-intrinsics/abs.mjs.map +1 -0
  516. package/dist/esm/node_modules/math-intrinsics/floor.mjs +13 -0
  517. package/dist/esm/node_modules/math-intrinsics/floor.mjs.map +1 -0
  518. package/dist/esm/node_modules/math-intrinsics/isNaN.mjs +15 -0
  519. package/dist/esm/node_modules/math-intrinsics/isNaN.mjs.map +1 -0
  520. package/dist/esm/node_modules/math-intrinsics/max.mjs +13 -0
  521. package/dist/esm/node_modules/math-intrinsics/max.mjs.map +1 -0
  522. package/dist/esm/node_modules/math-intrinsics/min.mjs +13 -0
  523. package/dist/esm/node_modules/math-intrinsics/min.mjs.map +1 -0
  524. package/dist/esm/node_modules/math-intrinsics/pow.mjs +13 -0
  525. package/dist/esm/node_modules/math-intrinsics/pow.mjs.map +1 -0
  526. package/dist/esm/node_modules/math-intrinsics/round.mjs +13 -0
  527. package/dist/esm/node_modules/math-intrinsics/round.mjs.map +1 -0
  528. package/dist/esm/node_modules/math-intrinsics/sign.mjs +18 -0
  529. package/dist/esm/node_modules/math-intrinsics/sign.mjs.map +1 -0
  530. package/dist/esm/node_modules/node-forge/lib/aes.mjs +601 -0
  531. package/dist/esm/node_modules/node-forge/lib/aes.mjs.map +1 -0
  532. package/dist/esm/node_modules/node-forge/lib/aesCipherSuites.mjs +199 -0
  533. package/dist/esm/node_modules/node-forge/lib/aesCipherSuites.mjs.map +1 -0
  534. package/dist/esm/node_modules/node-forge/lib/asn1-validator.mjs +80 -0
  535. package/dist/esm/node_modules/node-forge/lib/asn1-validator.mjs.map +1 -0
  536. package/dist/esm/node_modules/node-forge/lib/asn1.mjs +942 -0
  537. package/dist/esm/node_modules/node-forge/lib/asn1.mjs.map +1 -0
  538. package/dist/esm/node_modules/node-forge/lib/baseN.mjs +141 -0
  539. package/dist/esm/node_modules/node-forge/lib/baseN.mjs.map +1 -0
  540. package/dist/esm/node_modules/node-forge/lib/cipher.mjs +190 -0
  541. package/dist/esm/node_modules/node-forge/lib/cipher.mjs.map +1 -0
  542. package/dist/esm/node_modules/node-forge/lib/cipherModes.mjs +601 -0
  543. package/dist/esm/node_modules/node-forge/lib/cipherModes.mjs.map +1 -0
  544. package/dist/esm/node_modules/node-forge/lib/des.mjs +1191 -0
  545. package/dist/esm/node_modules/node-forge/lib/des.mjs.map +1 -0
  546. package/dist/esm/node_modules/node-forge/lib/ed25519.mjs +1024 -0
  547. package/dist/esm/node_modules/node-forge/lib/ed25519.mjs.map +1 -0
  548. package/dist/esm/node_modules/node-forge/lib/forge.mjs +19 -0
  549. package/dist/esm/node_modules/node-forge/lib/forge.mjs.map +1 -0
  550. package/dist/esm/node_modules/node-forge/lib/hmac.mjs +111 -0
  551. package/dist/esm/node_modules/node-forge/lib/hmac.mjs.map +1 -0
  552. package/dist/esm/node_modules/node-forge/lib/index.mjs +70 -0
  553. package/dist/esm/node_modules/node-forge/lib/index.mjs.map +1 -0
  554. package/dist/esm/node_modules/node-forge/lib/jsbn.mjs +1260 -0
  555. package/dist/esm/node_modules/node-forge/lib/jsbn.mjs.map +1 -0
  556. package/dist/esm/node_modules/node-forge/lib/kem.mjs +150 -0
  557. package/dist/esm/node_modules/node-forge/lib/kem.mjs.map +1 -0
  558. package/dist/esm/node_modules/node-forge/lib/log.mjs +245 -0
  559. package/dist/esm/node_modules/node-forge/lib/log.mjs.map +1 -0
  560. package/dist/esm/node_modules/node-forge/lib/md.all.mjs +28 -0
  561. package/dist/esm/node_modules/node-forge/lib/md.all.mjs.map +1 -0
  562. package/dist/esm/node_modules/node-forge/lib/md.mjs +22 -0
  563. package/dist/esm/node_modules/node-forge/lib/md.mjs.map +1 -0
  564. package/dist/esm/node_modules/node-forge/lib/md5.mjs +328 -0
  565. package/dist/esm/node_modules/node-forge/lib/md5.mjs.map +1 -0
  566. package/dist/esm/node_modules/node-forge/lib/mgf.mjs +24 -0
  567. package/dist/esm/node_modules/node-forge/lib/mgf.mjs.map +1 -0
  568. package/dist/esm/node_modules/node-forge/lib/mgf1.mjs +48 -0
  569. package/dist/esm/node_modules/node-forge/lib/mgf1.mjs.map +1 -0
  570. package/dist/esm/node_modules/node-forge/lib/oids.mjs +157 -0
  571. package/dist/esm/node_modules/node-forge/lib/oids.mjs.map +1 -0
  572. package/dist/esm/node_modules/node-forge/lib/pbe.mjs +819 -0
  573. package/dist/esm/node_modules/node-forge/lib/pbe.mjs.map +1 -0
  574. package/dist/esm/node_modules/node-forge/lib/pbkdf2.mjs +130 -0
  575. package/dist/esm/node_modules/node-forge/lib/pbkdf2.mjs.map +1 -0
  576. package/dist/esm/node_modules/node-forge/lib/pem.mjs +179 -0
  577. package/dist/esm/node_modules/node-forge/lib/pem.mjs.map +1 -0
  578. package/dist/esm/node_modules/node-forge/lib/pkcs1.mjs +204 -0
  579. package/dist/esm/node_modules/node-forge/lib/pkcs1.mjs.map +1 -0
  580. package/dist/esm/node_modules/node-forge/lib/pkcs12.mjs +727 -0
  581. package/dist/esm/node_modules/node-forge/lib/pkcs12.mjs.map +1 -0
  582. package/dist/esm/node_modules/node-forge/lib/pkcs7.mjs +645 -0
  583. package/dist/esm/node_modules/node-forge/lib/pkcs7.mjs.map +1 -0
  584. package/dist/esm/node_modules/node-forge/lib/pkcs7asn1.mjs +409 -0
  585. package/dist/esm/node_modules/node-forge/lib/pkcs7asn1.mjs.map +1 -0
  586. package/dist/esm/node_modules/node-forge/lib/pki.mjs +105 -0
  587. package/dist/esm/node_modules/node-forge/lib/pki.mjs.map +1 -0
  588. package/dist/esm/node_modules/node-forge/lib/prime.mjs +197 -0
  589. package/dist/esm/node_modules/node-forge/lib/prime.mjs.map +1 -0
  590. package/dist/esm/node_modules/node-forge/lib/prng.mjs +295 -0
  591. package/dist/esm/node_modules/node-forge/lib/prng.mjs.map +1 -0
  592. package/dist/esm/node_modules/node-forge/lib/pss.mjs +145 -0
  593. package/dist/esm/node_modules/node-forge/lib/pss.mjs.map +1 -0
  594. package/dist/esm/node_modules/node-forge/lib/random.mjs +145 -0
  595. package/dist/esm/node_modules/node-forge/lib/random.mjs.map +1 -0
  596. package/dist/esm/node_modules/node-forge/lib/rc2.mjs +542 -0
  597. package/dist/esm/node_modules/node-forge/lib/rc2.mjs.map +1 -0
  598. package/dist/esm/node_modules/node-forge/lib/rsa.mjs +1304 -0
  599. package/dist/esm/node_modules/node-forge/lib/rsa.mjs.map +1 -0
  600. package/dist/esm/node_modules/node-forge/lib/sha1.mjs +234 -0
  601. package/dist/esm/node_modules/node-forge/lib/sha1.mjs.map +1 -0
  602. package/dist/esm/node_modules/node-forge/lib/sha256.mjs +271 -0
  603. package/dist/esm/node_modules/node-forge/lib/sha256.mjs.map +1 -0
  604. package/dist/esm/node_modules/node-forge/lib/sha512.mjs +417 -0
  605. package/dist/esm/node_modules/node-forge/lib/sha512.mjs.map +1 -0
  606. package/dist/esm/node_modules/node-forge/lib/ssh.mjs +198 -0
  607. package/dist/esm/node_modules/node-forge/lib/ssh.mjs.map +1 -0
  608. package/dist/esm/node_modules/node-forge/lib/tls.mjs +3659 -0
  609. package/dist/esm/node_modules/node-forge/lib/tls.mjs.map +1 -0
  610. package/dist/esm/node_modules/node-forge/lib/util.mjs +2121 -0
  611. package/dist/esm/node_modules/node-forge/lib/util.mjs.map +1 -0
  612. package/dist/esm/node_modules/node-forge/lib/x509.mjs +2168 -0
  613. package/dist/esm/node_modules/node-forge/lib/x509.mjs.map +1 -0
  614. package/dist/esm/node_modules/node-forge/lib.mjs +10 -0
  615. package/dist/esm/node_modules/node-forge/lib.mjs.map +1 -0
  616. package/dist/esm/node_modules/node-rsa/src/NodeRSA.mjs +338 -0
  617. package/dist/esm/node_modules/node-rsa/src/NodeRSA.mjs.map +1 -0
  618. package/dist/esm/node_modules/node-rsa/src/encryptEngines/encryptEngines.mjs +23 -0
  619. package/dist/esm/node_modules/node-rsa/src/encryptEngines/encryptEngines.mjs.map +1 -0
  620. package/dist/esm/node_modules/node-rsa/src/encryptEngines/io.mjs +62 -0
  621. package/dist/esm/node_modules/node-rsa/src/encryptEngines/io.mjs.map +1 -0
  622. package/dist/esm/node_modules/node-rsa/src/encryptEngines/js.mjs +41 -0
  623. package/dist/esm/node_modules/node-rsa/src/encryptEngines/js.mjs.map +1 -0
  624. package/dist/esm/node_modules/node-rsa/src/encryptEngines/node12.mjs +46 -0
  625. package/dist/esm/node_modules/node-rsa/src/encryptEngines/node12.mjs.map +1 -0
  626. package/dist/esm/node_modules/node-rsa/src/formats/components.mjs +52 -0
  627. package/dist/esm/node_modules/node-rsa/src/formats/components.mjs.map +1 -0
  628. package/dist/esm/node_modules/node-rsa/src/formats/formats.mjs +83 -0
  629. package/dist/esm/node_modules/node-rsa/src/formats/formats.mjs.map +1 -0
  630. package/dist/esm/node_modules/node-rsa/src/formats/openssh.mjs +174 -0
  631. package/dist/esm/node_modules/node-rsa/src/formats/openssh.mjs.map +1 -0
  632. package/dist/esm/node_modules/node-rsa/src/formats/pkcs1.mjs +101 -0
  633. package/dist/esm/node_modules/node-rsa/src/formats/pkcs1.mjs.map +1 -0
  634. package/dist/esm/node_modules/node-rsa/src/formats/pkcs8.mjs +128 -0
  635. package/dist/esm/node_modules/node-rsa/src/formats/pkcs8.mjs.map +1 -0
  636. package/dist/esm/node_modules/node-rsa/src/libs/jsbn.mjs +1344 -0
  637. package/dist/esm/node_modules/node-rsa/src/libs/jsbn.mjs.map +1 -0
  638. package/dist/esm/node_modules/node-rsa/src/libs/rsa.mjs +228 -0
  639. package/dist/esm/node_modules/node-rsa/src/libs/rsa.mjs.map +1 -0
  640. package/dist/esm/node_modules/node-rsa/src/schemes/oaep.mjs +120 -0
  641. package/dist/esm/node_modules/node-rsa/src/schemes/oaep.mjs.map +1 -0
  642. package/dist/esm/node_modules/node-rsa/src/schemes/pkcs1.mjs +172 -0
  643. package/dist/esm/node_modules/node-rsa/src/schemes/pkcs1.mjs.map +1 -0
  644. package/dist/esm/node_modules/node-rsa/src/schemes/pss.mjs +120 -0
  645. package/dist/esm/node_modules/node-rsa/src/schemes/pss.mjs.map +1 -0
  646. package/dist/esm/node_modules/node-rsa/src/schemes/schemes.mjs +25 -0
  647. package/dist/esm/node_modules/node-rsa/src/schemes/schemes.mjs.map +1 -0
  648. package/dist/esm/node_modules/node-rsa/src/utils.mjs +81 -0
  649. package/dist/esm/node_modules/node-rsa/src/utils.mjs.map +1 -0
  650. package/dist/esm/node_modules/pako/index.mjs +22 -0
  651. package/dist/esm/node_modules/pako/index.mjs.map +1 -0
  652. package/dist/esm/node_modules/pako/lib/deflate.mjs +308 -0
  653. package/dist/esm/node_modules/pako/lib/deflate.mjs.map +1 -0
  654. package/dist/esm/node_modules/pako/lib/inflate.mjs +314 -0
  655. package/dist/esm/node_modules/pako/lib/inflate.mjs.map +1 -0
  656. package/dist/esm/node_modules/pako/lib/utils/common.mjs +74 -0
  657. package/dist/esm/node_modules/pako/lib/utils/common.mjs.map +1 -0
  658. package/dist/esm/node_modules/pako/lib/utils/strings.mjs +128 -0
  659. package/dist/esm/node_modules/pako/lib/utils/strings.mjs.map +1 -0
  660. package/dist/esm/node_modules/pako/lib/zlib/adler32.mjs +26 -0
  661. package/dist/esm/node_modules/pako/lib/zlib/adler32.mjs.map +1 -0
  662. package/dist/esm/node_modules/pako/lib/zlib/constants.mjs +40 -0
  663. package/dist/esm/node_modules/pako/lib/zlib/constants.mjs.map +1 -0
  664. package/dist/esm/node_modules/pako/lib/zlib/crc32.mjs +28 -0
  665. package/dist/esm/node_modules/pako/lib/zlib/crc32.mjs.map +1 -0
  666. package/dist/esm/node_modules/pako/lib/zlib/deflate.mjs +886 -0
  667. package/dist/esm/node_modules/pako/lib/zlib/deflate.mjs.map +1 -0
  668. package/dist/esm/node_modules/pako/lib/zlib/gzheader.mjs +24 -0
  669. package/dist/esm/node_modules/pako/lib/zlib/gzheader.mjs.map +1 -0
  670. package/dist/esm/node_modules/pako/lib/zlib/inffast.mjs +224 -0
  671. package/dist/esm/node_modules/pako/lib/zlib/inffast.mjs.map +1 -0
  672. package/dist/esm/node_modules/pako/lib/zlib/inflate.mjs +1035 -0
  673. package/dist/esm/node_modules/pako/lib/zlib/inflate.mjs.map +1 -0
  674. package/dist/esm/node_modules/pako/lib/zlib/inftrees.mjs +275 -0
  675. package/dist/esm/node_modules/pako/lib/zlib/inftrees.mjs.map +1 -0
  676. package/dist/esm/node_modules/pako/lib/zlib/messages.mjs +22 -0
  677. package/dist/esm/node_modules/pako/lib/zlib/messages.mjs.map +1 -0
  678. package/dist/esm/node_modules/pako/lib/zlib/trees.mjs +623 -0
  679. package/dist/esm/node_modules/pako/lib/zlib/trees.mjs.map +1 -0
  680. package/dist/esm/node_modules/pako/lib/zlib/zstream.mjs +26 -0
  681. package/dist/esm/node_modules/pako/lib/zlib/zstream.mjs.map +1 -0
  682. package/dist/esm/node_modules/possible-typed-array-names/index.mjs +26 -0
  683. package/dist/esm/node_modules/possible-typed-array-names/index.mjs.map +1 -0
  684. package/dist/esm/node_modules/safe-regex-test/index.mjs +25 -0
  685. package/dist/esm/node_modules/safe-regex-test/index.mjs.map +1 -0
  686. package/dist/esm/node_modules/safer-buffer/safer.mjs +50 -0
  687. package/dist/esm/node_modules/safer-buffer/safer.mjs.map +1 -0
  688. package/dist/esm/node_modules/samlify/build/index.mjs +117 -0
  689. package/dist/esm/node_modules/samlify/build/index.mjs.map +1 -0
  690. package/dist/esm/node_modules/samlify/build/src/api.mjs +33 -0
  691. package/dist/esm/node_modules/samlify/build/src/api.mjs.map +1 -0
  692. package/dist/esm/node_modules/samlify/build/src/binding-post.mjs +504 -0
  693. package/dist/esm/node_modules/samlify/build/src/binding-post.mjs.map +1 -0
  694. package/dist/esm/node_modules/samlify/build/src/binding-redirect.mjs +339 -0
  695. package/dist/esm/node_modules/samlify/build/src/binding-redirect.mjs.map +1 -0
  696. package/dist/esm/node_modules/samlify/build/src/binding-simplesign.mjs +358 -0
  697. package/dist/esm/node_modules/samlify/build/src/binding-simplesign.mjs.map +1 -0
  698. package/dist/esm/node_modules/samlify/build/src/entity-idp.mjs +279 -0
  699. package/dist/esm/node_modules/samlify/build/src/entity-idp.mjs.map +1 -0
  700. package/dist/esm/node_modules/samlify/build/src/entity-sp.mjs +142 -0
  701. package/dist/esm/node_modules/samlify/build/src/entity-sp.mjs.map +1 -0
  702. package/dist/esm/node_modules/samlify/build/src/entity.mjs +253 -0
  703. package/dist/esm/node_modules/samlify/build/src/entity.mjs.map +1 -0
  704. package/dist/esm/node_modules/samlify/build/src/extractor.mjs +352 -0
  705. package/dist/esm/node_modules/samlify/build/src/extractor.mjs.map +1 -0
  706. package/dist/esm/node_modules/samlify/build/src/flow.mjs +389 -0
  707. package/dist/esm/node_modules/samlify/build/src/flow.mjs.map +1 -0
  708. package/dist/esm/node_modules/samlify/build/src/libsaml.mjs +544 -0
  709. package/dist/esm/node_modules/samlify/build/src/libsaml.mjs.map +1 -0
  710. package/dist/esm/node_modules/samlify/build/src/metadata-idp.mjs +171 -0
  711. package/dist/esm/node_modules/samlify/build/src/metadata-idp.mjs.map +1 -0
  712. package/dist/esm/node_modules/samlify/build/src/metadata-sp.mjs +214 -0
  713. package/dist/esm/node_modules/samlify/build/src/metadata-sp.mjs.map +1 -0
  714. package/dist/esm/node_modules/samlify/build/src/metadata.mjs +200 -0
  715. package/dist/esm/node_modules/samlify/build/src/metadata.mjs.map +1 -0
  716. package/dist/esm/node_modules/samlify/build/src/urn.mjs +225 -0
  717. package/dist/esm/node_modules/samlify/build/src/urn.mjs.map +1 -0
  718. package/dist/esm/node_modules/samlify/build/src/utility.mjs +277 -0
  719. package/dist/esm/node_modules/samlify/build/src/utility.mjs.map +1 -0
  720. package/dist/esm/node_modules/samlify/build/src/validator.mjs +53 -0
  721. package/dist/esm/node_modules/samlify/build/src/validator.mjs.map +1 -0
  722. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/index.mjs +39 -0
  723. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/index.mjs.map +1 -0
  724. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/md5.mjs +154 -0
  725. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/md5.mjs.map +1 -0
  726. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/nil.mjs +12 -0
  727. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/nil.mjs.map +1 -0
  728. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/parse.mjs +36 -0
  729. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/parse.mjs.map +1 -0
  730. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/regex.mjs +12 -0
  731. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/regex.mjs.map +1 -0
  732. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/rng.mjs +20 -0
  733. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/rng.mjs.map +1 -0
  734. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/sha1.mjs +101 -0
  735. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/sha1.mjs.map +1 -0
  736. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/stringify.mjs +22 -0
  737. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/stringify.mjs.map +1 -0
  738. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v1.mjs +63 -0
  739. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v1.mjs.map +1 -0
  740. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v3.mjs +17 -0
  741. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v3.mjs.map +1 -0
  742. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v35.mjs +48 -0
  743. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v35.mjs.map +1 -0
  744. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v4.mjs +28 -0
  745. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v4.mjs.map +1 -0
  746. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v5.mjs +17 -0
  747. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/v5.mjs.map +1 -0
  748. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/validate.mjs +17 -0
  749. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/validate.mjs.map +1 -0
  750. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/version.mjs +18 -0
  751. package/dist/esm/node_modules/samlify/node_modules/uuid/dist/esm-browser/version.mjs.map +1 -0
  752. package/dist/esm/node_modules/set-function-length/index.mjs +38 -0
  753. package/dist/esm/node_modules/set-function-length/index.mjs.map +1 -0
  754. package/dist/esm/node_modules/util/support/isBufferBrowser.mjs +14 -0
  755. package/dist/esm/node_modules/util/support/isBufferBrowser.mjs.map +1 -0
  756. package/dist/esm/node_modules/util/support/types.mjs +218 -0
  757. package/dist/esm/node_modules/util/support/types.mjs.map +1 -0
  758. package/dist/esm/node_modules/util/util.mjs +443 -0
  759. package/dist/esm/node_modules/util/util.mjs.map +1 -0
  760. package/dist/esm/node_modules/which-typed-array/index.mjs +93 -0
  761. package/dist/esm/node_modules/which-typed-array/index.mjs.map +1 -0
  762. package/dist/esm/node_modules/xml/lib/escapeForXML.mjs +24 -0
  763. package/dist/esm/node_modules/xml/lib/escapeForXML.mjs.map +1 -0
  764. package/dist/esm/node_modules/xml/lib/xml.mjs +183 -0
  765. package/dist/esm/node_modules/xml/lib/xml.mjs.map +1 -0
  766. package/dist/esm/node_modules/xml-crypto/lib/c14n-canonicalization.mjs +199 -0
  767. package/dist/esm/node_modules/xml-crypto/lib/c14n-canonicalization.mjs.map +1 -0
  768. package/dist/esm/node_modules/xml-crypto/lib/enveloped-signature.mjs +49 -0
  769. package/dist/esm/node_modules/xml-crypto/lib/enveloped-signature.mjs.map +1 -0
  770. package/dist/esm/node_modules/xml-crypto/lib/exclusive-canonicalization.mjs +220 -0
  771. package/dist/esm/node_modules/xml-crypto/lib/exclusive-canonicalization.mjs.map +1 -0
  772. package/dist/esm/node_modules/xml-crypto/lib/hash-algorithms.mjs +53 -0
  773. package/dist/esm/node_modules/xml-crypto/lib/hash-algorithms.mjs.map +1 -0
  774. package/dist/esm/node_modules/xml-crypto/lib/index.mjs +70 -0
  775. package/dist/esm/node_modules/xml-crypto/lib/index.mjs.map +1 -0
  776. package/dist/esm/node_modules/xml-crypto/lib/signature-algorithms.mjs +88 -0
  777. package/dist/esm/node_modules/xml-crypto/lib/signature-algorithms.mjs.map +1 -0
  778. package/dist/esm/node_modules/xml-crypto/lib/signed-xml.mjs +693 -0
  779. package/dist/esm/node_modules/xml-crypto/lib/signed-xml.mjs.map +1 -0
  780. package/dist/esm/node_modules/xml-crypto/lib/types.mjs +55 -0
  781. package/dist/esm/node_modules/xml-crypto/lib/types.mjs.map +1 -0
  782. package/dist/esm/node_modules/xml-crypto/lib/utils.mjs +210 -0
  783. package/dist/esm/node_modules/xml-crypto/lib/utils.mjs.map +1 -0
  784. package/dist/esm/node_modules/xml-crypto/node_modules/xpath/xpath.mjs +3442 -0
  785. package/dist/esm/node_modules/xml-crypto/node_modules/xpath/xpath.mjs.map +1 -0
  786. package/dist/esm/node_modules/xml-escape/index.mjs +27 -0
  787. package/dist/esm/node_modules/xml-escape/index.mjs.map +1 -0
  788. package/dist/esm/node_modules/xpath/xpath.mjs +3407 -0
  789. package/dist/esm/node_modules/xpath/xpath.mjs.map +1 -0
  790. package/dist/esm/node_modules/zod/v4/classic/errors.mjs +30 -0
  791. package/dist/esm/node_modules/zod/v4/classic/errors.mjs.map +1 -0
  792. package/dist/esm/node_modules/zod/v4/classic/iso.mjs +38 -0
  793. package/dist/esm/node_modules/zod/v4/classic/iso.mjs.map +1 -0
  794. package/dist/esm/node_modules/zod/v4/classic/parse.mjs +20 -0
  795. package/dist/esm/node_modules/zod/v4/classic/parse.mjs.map +1 -0
  796. package/dist/esm/node_modules/zod/v4/classic/schemas.mjs +519 -0
  797. package/dist/esm/node_modules/zod/v4/classic/schemas.mjs.map +1 -0
  798. package/dist/esm/node_modules/zod/v4/core/api.mjs +395 -0
  799. package/dist/esm/node_modules/zod/v4/core/api.mjs.map +1 -0
  800. package/dist/esm/node_modules/zod/v4/core/checks.mjs +226 -0
  801. package/dist/esm/node_modules/zod/v4/core/checks.mjs.map +1 -0
  802. package/dist/esm/node_modules/zod/v4/core/core.mjs +57 -0
  803. package/dist/esm/node_modules/zod/v4/core/core.mjs.map +1 -0
  804. package/dist/esm/node_modules/zod/v4/core/doc.mjs +34 -0
  805. package/dist/esm/node_modules/zod/v4/core/doc.mjs.map +1 -0
  806. package/dist/esm/node_modules/zod/v4/core/errors.mjs +63 -0
  807. package/dist/esm/node_modules/zod/v4/core/errors.mjs.map +1 -0
  808. package/dist/esm/node_modules/zod/v4/core/parse.mjs +110 -0
  809. package/dist/esm/node_modules/zod/v4/core/parse.mjs.map +1 -0
  810. package/dist/esm/node_modules/zod/v4/core/regexes.mjs +60 -0
  811. package/dist/esm/node_modules/zod/v4/core/regexes.mjs.map +1 -0
  812. package/dist/esm/node_modules/zod/v4/core/registries.mjs +53 -0
  813. package/dist/esm/node_modules/zod/v4/core/registries.mjs.map +1 -0
  814. package/dist/esm/node_modules/zod/v4/core/schemas.mjs +1069 -0
  815. package/dist/esm/node_modules/zod/v4/core/schemas.mjs.map +1 -0
  816. package/dist/esm/node_modules/zod/v4/core/util.mjs +302 -0
  817. package/dist/esm/node_modules/zod/v4/core/util.mjs.map +1 -0
  818. package/dist/esm/node_modules/zod/v4/core/versions.mjs +10 -0
  819. package/dist/esm/node_modules/zod/v4/core/versions.mjs.map +1 -0
  820. package/dist/esm/schemas/user.schema.mjs +17 -0
  821. package/dist/esm/schemas/user.schema.mjs.map +1 -1
  822. package/dist/esm/services/dictionary.service.mjs +8 -31
  823. package/dist/esm/services/dictionary.service.mjs.map +1 -1
  824. package/dist/esm/services/email.service.mjs +13 -0
  825. package/dist/esm/services/email.service.mjs.map +1 -1
  826. package/dist/esm/types/user.types.mjs.map +1 -1
  827. package/dist/esm/utils/auth/getAuth.mjs +61 -27
  828. package/dist/esm/utils/auth/getAuth.mjs.map +1 -1
  829. package/dist/esm/utils/mongoDB/connectDB.mjs.map +1 -1
  830. package/dist/types/MagicLinkEmail.d.ts +8 -0
  831. package/dist/types/MagicLinkEmail.d.ts.map +1 -0
  832. package/dist/types/controllers/ai.controller.d.ts.map +1 -1
  833. package/dist/types/controllers/dictionary.controller.d.ts +18 -5
  834. package/dist/types/controllers/dictionary.controller.d.ts.map +1 -1
  835. package/dist/types/controllers/projectAccessKey.controller.d.ts.map +1 -1
  836. package/dist/types/controllers/stripe.controller.d.ts.map +1 -1
  837. package/dist/types/emails/InviteUserEmail.d.ts +4 -4
  838. package/dist/types/emails/MagicLinkEmail.d.ts +31 -0
  839. package/dist/types/emails/MagicLinkEmail.d.ts.map +1 -0
  840. package/dist/types/emails/OAuthTokenCreatedEmail.d.ts +4 -4
  841. package/dist/types/emails/OAuthTokenCreatedEmail.d.ts.map +1 -1
  842. package/dist/types/emails/PasswordChangeConfirmation.d.ts +4 -4
  843. package/dist/types/emails/PasswordChangeConfirmation.d.ts.map +1 -1
  844. package/dist/types/emails/ResetUserPassword.d.ts +4 -4
  845. package/dist/types/emails/SubscriptionPaymentCancellation.d.ts +4 -4
  846. package/dist/types/emails/SubscriptionPaymentCancellation.d.ts.map +1 -1
  847. package/dist/types/emails/SubscriptionPaymentError.d.ts +4 -4
  848. package/dist/types/emails/SubscriptionPaymentError.d.ts.map +1 -1
  849. package/dist/types/emails/SubscriptionPaymentSuccess.d.ts +4 -4
  850. package/dist/types/emails/ValidateUserEmail.d.ts +4 -4
  851. package/dist/types/emails/Welcome.d.ts +4 -4
  852. package/dist/types/export.d.ts +1 -3
  853. package/dist/types/models/dictionary.model.d.ts +4 -4
  854. package/dist/types/models/dictionary.model.d.ts.map +1 -1
  855. package/dist/types/models/discussion.model.d.ts +2 -2
  856. package/dist/types/models/discussion.model.d.ts.map +1 -1
  857. package/dist/types/models/oAuth2.model.d.ts +3 -3
  858. package/dist/types/models/oAuth2.model.d.ts.map +1 -1
  859. package/dist/types/routes/ai.routes.d.ts.map +1 -1
  860. package/dist/types/routes/newsletter.routes.d.ts.map +1 -1
  861. package/dist/types/schemas/dictionary.schema.d.ts +6 -6
  862. package/dist/types/schemas/discussion.schema.d.ts +6 -6
  863. package/dist/types/schemas/discussion.schema.d.ts.map +1 -1
  864. package/dist/types/schemas/oAuth2.schema.d.ts +5 -5
  865. package/dist/types/schemas/oAuth2.schema.d.ts.map +1 -1
  866. package/dist/types/schemas/organization.schema.d.ts +6 -6
  867. package/dist/types/schemas/session.schema.d.ts +6 -6
  868. package/dist/types/schemas/tag.schema.d.ts +6 -6
  869. package/dist/types/schemas/user.schema.d.ts +6 -6
  870. package/dist/types/schemas/user.schema.d.ts.map +1 -1
  871. package/dist/types/services/dictionary.service.d.ts +1 -12
  872. package/dist/types/services/dictionary.service.d.ts.map +1 -1
  873. package/dist/types/services/email.service.d.ts +21 -10
  874. package/dist/types/services/email.service.d.ts.map +1 -1
  875. package/dist/types/types/dictionary.types.d.ts +1 -0
  876. package/dist/types/types/dictionary.types.d.ts.map +1 -1
  877. package/dist/types/types/user.types.d.ts +1 -0
  878. package/dist/types/types/user.types.d.ts.map +1 -1
  879. package/dist/types/utils/auth/getAuth.d.ts.map +1 -1
  880. package/dist/types/utils/filtersAndPagination/getDictionaryFiltersAndPagination.d.ts +2 -2
  881. package/dist/types/utils/filtersAndPagination/getDiscussionFiltersAndPagination.d.ts +2 -2
  882. package/dist/types/utils/filtersAndPagination/getOrganizationFiltersAndPagination.d.ts +2 -2
  883. package/dist/types/utils/filtersAndPagination/getProjectFiltersAndPagination.d.ts +2 -2
  884. package/dist/types/utils/filtersAndPagination/getTagFiltersAndPagination.d.ts +2 -2
  885. package/dist/types/utils/mongoDB/connectDB.d.ts +2 -2
  886. package/dist/types/utils/mongoDB/connectDB.d.ts.map +1 -1
  887. package/package.json +38 -33
  888. package/dist/assets/controllers/test.json +0 -4
  889. package/dist/cjs/routes/audit.routes.cjs +0 -35
  890. package/dist/cjs/routes/audit.routes.cjs.map +0 -1
  891. package/dist/cjs/schemas/audit.schema.cjs +0 -65
  892. package/dist/cjs/schemas/audit.schema.cjs.map +0 -1
  893. package/dist/cjs/services/audit.service.cjs +0 -49
  894. package/dist/cjs/services/audit.service.cjs.map +0 -1
  895. package/dist/cjs/types/audit.types.cjs +0 -0
  896. package/dist/esm/routes/audit.routes.mjs +0 -31
  897. package/dist/esm/routes/audit.routes.mjs.map +0 -1
  898. package/dist/esm/schemas/audit.schema.mjs +0 -63
  899. package/dist/esm/schemas/audit.schema.mjs.map +0 -1
  900. package/dist/esm/services/audit.service.mjs +0 -46
  901. package/dist/esm/services/audit.service.mjs.map +0 -1
  902. package/dist/esm/types/audit.types.mjs +0 -0
  903. package/dist/types/emails/index.d.ts.map +0 -1
  904. package/dist/types/export.d.ts.map +0 -1
  905. package/dist/types/index.d.ts.map +0 -1
  906. package/dist/types/routes/audit.routes.d.ts +0 -29
  907. package/dist/types/routes/audit.routes.d.ts.map +0 -1
  908. package/dist/types/schemas/audit.schema.d.ts +0 -19
  909. package/dist/types/schemas/audit.schema.d.ts.map +0 -1
  910. package/dist/types/services/audit.service.d.ts +0 -36
  911. package/dist/types/services/audit.service.d.ts.map +0 -1
  912. package/dist/types/types/audit.types.d.ts +0 -29
  913. package/dist/types/types/audit.types.d.ts.map +0 -1
  914. package/dist/types/utils/access.d.ts.map +0 -1
  915. package/dist/types/utils/errors/index.d.ts.map +0 -1
@@ -0,0 +1,2168 @@
1
+ import { __commonJS } from "../../../_virtual/rolldown_runtime.mjs";
2
+ import { require_forge } from "./forge.mjs";
3
+ import { require_util } from "./util.mjs";
4
+ import { require_aes } from "./aes.mjs";
5
+ import { require_oids } from "./oids.mjs";
6
+ import { require_asn1 } from "./asn1.mjs";
7
+ import { require_md } from "./md.mjs";
8
+ import { require_pem } from "./pem.mjs";
9
+ import { require_des } from "./des.mjs";
10
+ import { require_rsa } from "./rsa.mjs";
11
+ import { require_mgf } from "./mgf.mjs";
12
+ import { require_pss } from "./pss.mjs";
13
+
14
+ //#region ../../node_modules/node-forge/lib/x509.js
15
+ var require_x509 = /* @__PURE__ */ __commonJS({ "../../node_modules/node-forge/lib/x509.js": ((exports, module) => {
16
+ /**
17
+ * Javascript implementation of X.509 and related components (such as
18
+ * Certification Signing Requests) of a Public Key Infrastructure.
19
+ *
20
+ * @author Dave Longley
21
+ *
22
+ * Copyright (c) 2010-2014 Digital Bazaar, Inc.
23
+ *
24
+ * The ASN.1 representation of an X.509v3 certificate is as follows
25
+ * (see RFC 2459):
26
+ *
27
+ * Certificate ::= SEQUENCE {
28
+ * tbsCertificate TBSCertificate,
29
+ * signatureAlgorithm AlgorithmIdentifier,
30
+ * signatureValue BIT STRING
31
+ * }
32
+ *
33
+ * TBSCertificate ::= SEQUENCE {
34
+ * version [0] EXPLICIT Version DEFAULT v1,
35
+ * serialNumber CertificateSerialNumber,
36
+ * signature AlgorithmIdentifier,
37
+ * issuer Name,
38
+ * validity Validity,
39
+ * subject Name,
40
+ * subjectPublicKeyInfo SubjectPublicKeyInfo,
41
+ * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
42
+ * -- If present, version shall be v2 or v3
43
+ * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
44
+ * -- If present, version shall be v2 or v3
45
+ * extensions [3] EXPLICIT Extensions OPTIONAL
46
+ * -- If present, version shall be v3
47
+ * }
48
+ *
49
+ * Version ::= INTEGER { v1(0), v2(1), v3(2) }
50
+ *
51
+ * CertificateSerialNumber ::= INTEGER
52
+ *
53
+ * Name ::= CHOICE {
54
+ * // only one possible choice for now
55
+ * RDNSequence
56
+ * }
57
+ *
58
+ * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
59
+ *
60
+ * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
61
+ *
62
+ * AttributeTypeAndValue ::= SEQUENCE {
63
+ * type AttributeType,
64
+ * value AttributeValue
65
+ * }
66
+ * AttributeType ::= OBJECT IDENTIFIER
67
+ * AttributeValue ::= ANY DEFINED BY AttributeType
68
+ *
69
+ * Validity ::= SEQUENCE {
70
+ * notBefore Time,
71
+ * notAfter Time
72
+ * }
73
+ *
74
+ * Time ::= CHOICE {
75
+ * utcTime UTCTime,
76
+ * generalTime GeneralizedTime
77
+ * }
78
+ *
79
+ * UniqueIdentifier ::= BIT STRING
80
+ *
81
+ * SubjectPublicKeyInfo ::= SEQUENCE {
82
+ * algorithm AlgorithmIdentifier,
83
+ * subjectPublicKey BIT STRING
84
+ * }
85
+ *
86
+ * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
87
+ *
88
+ * Extension ::= SEQUENCE {
89
+ * extnID OBJECT IDENTIFIER,
90
+ * critical BOOLEAN DEFAULT FALSE,
91
+ * extnValue OCTET STRING
92
+ * }
93
+ *
94
+ * The only key algorithm currently supported for PKI is RSA.
95
+ *
96
+ * RSASSA-PSS signatures are described in RFC 3447 and RFC 4055.
97
+ *
98
+ * PKCS#10 v1.7 describes certificate signing requests:
99
+ *
100
+ * CertificationRequestInfo:
101
+ *
102
+ * CertificationRequestInfo ::= SEQUENCE {
103
+ * version INTEGER { v1(0) } (v1,...),
104
+ * subject Name,
105
+ * subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
106
+ * attributes [0] Attributes{{ CRIAttributes }}
107
+ * }
108
+ *
109
+ * Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}
110
+ *
111
+ * CRIAttributes ATTRIBUTE ::= {
112
+ * ... -- add any locally defined attributes here -- }
113
+ *
114
+ * Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
115
+ * type ATTRIBUTE.&id({IOSet}),
116
+ * values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type})
117
+ * }
118
+ *
119
+ * CertificationRequest ::= SEQUENCE {
120
+ * certificationRequestInfo CertificationRequestInfo,
121
+ * signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
122
+ * signature BIT STRING
123
+ * }
124
+ */
125
+ var forge = require_forge();
126
+ require_aes();
127
+ require_asn1();
128
+ require_des();
129
+ require_md();
130
+ require_mgf();
131
+ require_oids();
132
+ require_pem();
133
+ require_pss();
134
+ require_rsa();
135
+ require_util();
136
+ var asn1 = forge.asn1;
137
+ var pki = module.exports = forge.pki = forge.pki || {};
138
+ var oids = pki.oids;
139
+ var _shortNames = {};
140
+ _shortNames["CN"] = oids["commonName"];
141
+ _shortNames["commonName"] = "CN";
142
+ _shortNames["C"] = oids["countryName"];
143
+ _shortNames["countryName"] = "C";
144
+ _shortNames["L"] = oids["localityName"];
145
+ _shortNames["localityName"] = "L";
146
+ _shortNames["ST"] = oids["stateOrProvinceName"];
147
+ _shortNames["stateOrProvinceName"] = "ST";
148
+ _shortNames["O"] = oids["organizationName"];
149
+ _shortNames["organizationName"] = "O";
150
+ _shortNames["OU"] = oids["organizationalUnitName"];
151
+ _shortNames["organizationalUnitName"] = "OU";
152
+ _shortNames["E"] = oids["emailAddress"];
153
+ _shortNames["emailAddress"] = "E";
154
+ var publicKeyValidator = forge.pki.rsa.publicKeyValidator;
155
+ var x509CertificateValidator = {
156
+ name: "Certificate",
157
+ tagClass: asn1.Class.UNIVERSAL,
158
+ type: asn1.Type.SEQUENCE,
159
+ constructed: true,
160
+ value: [
161
+ {
162
+ name: "Certificate.TBSCertificate",
163
+ tagClass: asn1.Class.UNIVERSAL,
164
+ type: asn1.Type.SEQUENCE,
165
+ constructed: true,
166
+ captureAsn1: "tbsCertificate",
167
+ value: [
168
+ {
169
+ name: "Certificate.TBSCertificate.version",
170
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
171
+ type: 0,
172
+ constructed: true,
173
+ optional: true,
174
+ value: [{
175
+ name: "Certificate.TBSCertificate.version.integer",
176
+ tagClass: asn1.Class.UNIVERSAL,
177
+ type: asn1.Type.INTEGER,
178
+ constructed: false,
179
+ capture: "certVersion"
180
+ }]
181
+ },
182
+ {
183
+ name: "Certificate.TBSCertificate.serialNumber",
184
+ tagClass: asn1.Class.UNIVERSAL,
185
+ type: asn1.Type.INTEGER,
186
+ constructed: false,
187
+ capture: "certSerialNumber"
188
+ },
189
+ {
190
+ name: "Certificate.TBSCertificate.signature",
191
+ tagClass: asn1.Class.UNIVERSAL,
192
+ type: asn1.Type.SEQUENCE,
193
+ constructed: true,
194
+ value: [{
195
+ name: "Certificate.TBSCertificate.signature.algorithm",
196
+ tagClass: asn1.Class.UNIVERSAL,
197
+ type: asn1.Type.OID,
198
+ constructed: false,
199
+ capture: "certinfoSignatureOid"
200
+ }, {
201
+ name: "Certificate.TBSCertificate.signature.parameters",
202
+ tagClass: asn1.Class.UNIVERSAL,
203
+ optional: true,
204
+ captureAsn1: "certinfoSignatureParams"
205
+ }]
206
+ },
207
+ {
208
+ name: "Certificate.TBSCertificate.issuer",
209
+ tagClass: asn1.Class.UNIVERSAL,
210
+ type: asn1.Type.SEQUENCE,
211
+ constructed: true,
212
+ captureAsn1: "certIssuer"
213
+ },
214
+ {
215
+ name: "Certificate.TBSCertificate.validity",
216
+ tagClass: asn1.Class.UNIVERSAL,
217
+ type: asn1.Type.SEQUENCE,
218
+ constructed: true,
219
+ value: [
220
+ {
221
+ name: "Certificate.TBSCertificate.validity.notBefore (utc)",
222
+ tagClass: asn1.Class.UNIVERSAL,
223
+ type: asn1.Type.UTCTIME,
224
+ constructed: false,
225
+ optional: true,
226
+ capture: "certValidity1UTCTime"
227
+ },
228
+ {
229
+ name: "Certificate.TBSCertificate.validity.notBefore (generalized)",
230
+ tagClass: asn1.Class.UNIVERSAL,
231
+ type: asn1.Type.GENERALIZEDTIME,
232
+ constructed: false,
233
+ optional: true,
234
+ capture: "certValidity2GeneralizedTime"
235
+ },
236
+ {
237
+ name: "Certificate.TBSCertificate.validity.notAfter (utc)",
238
+ tagClass: asn1.Class.UNIVERSAL,
239
+ type: asn1.Type.UTCTIME,
240
+ constructed: false,
241
+ optional: true,
242
+ capture: "certValidity3UTCTime"
243
+ },
244
+ {
245
+ name: "Certificate.TBSCertificate.validity.notAfter (generalized)",
246
+ tagClass: asn1.Class.UNIVERSAL,
247
+ type: asn1.Type.GENERALIZEDTIME,
248
+ constructed: false,
249
+ optional: true,
250
+ capture: "certValidity4GeneralizedTime"
251
+ }
252
+ ]
253
+ },
254
+ {
255
+ name: "Certificate.TBSCertificate.subject",
256
+ tagClass: asn1.Class.UNIVERSAL,
257
+ type: asn1.Type.SEQUENCE,
258
+ constructed: true,
259
+ captureAsn1: "certSubject"
260
+ },
261
+ publicKeyValidator,
262
+ {
263
+ name: "Certificate.TBSCertificate.issuerUniqueID",
264
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
265
+ type: 1,
266
+ constructed: true,
267
+ optional: true,
268
+ value: [{
269
+ name: "Certificate.TBSCertificate.issuerUniqueID.id",
270
+ tagClass: asn1.Class.UNIVERSAL,
271
+ type: asn1.Type.BITSTRING,
272
+ constructed: false,
273
+ captureBitStringValue: "certIssuerUniqueId"
274
+ }]
275
+ },
276
+ {
277
+ name: "Certificate.TBSCertificate.subjectUniqueID",
278
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
279
+ type: 2,
280
+ constructed: true,
281
+ optional: true,
282
+ value: [{
283
+ name: "Certificate.TBSCertificate.subjectUniqueID.id",
284
+ tagClass: asn1.Class.UNIVERSAL,
285
+ type: asn1.Type.BITSTRING,
286
+ constructed: false,
287
+ captureBitStringValue: "certSubjectUniqueId"
288
+ }]
289
+ },
290
+ {
291
+ name: "Certificate.TBSCertificate.extensions",
292
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
293
+ type: 3,
294
+ constructed: true,
295
+ captureAsn1: "certExtensions",
296
+ optional: true
297
+ }
298
+ ]
299
+ },
300
+ {
301
+ name: "Certificate.signatureAlgorithm",
302
+ tagClass: asn1.Class.UNIVERSAL,
303
+ type: asn1.Type.SEQUENCE,
304
+ constructed: true,
305
+ value: [{
306
+ name: "Certificate.signatureAlgorithm.algorithm",
307
+ tagClass: asn1.Class.UNIVERSAL,
308
+ type: asn1.Type.OID,
309
+ constructed: false,
310
+ capture: "certSignatureOid"
311
+ }, {
312
+ name: "Certificate.TBSCertificate.signature.parameters",
313
+ tagClass: asn1.Class.UNIVERSAL,
314
+ optional: true,
315
+ captureAsn1: "certSignatureParams"
316
+ }]
317
+ },
318
+ {
319
+ name: "Certificate.signatureValue",
320
+ tagClass: asn1.Class.UNIVERSAL,
321
+ type: asn1.Type.BITSTRING,
322
+ constructed: false,
323
+ captureBitStringValue: "certSignature"
324
+ }
325
+ ]
326
+ };
327
+ var rsassaPssParameterValidator = {
328
+ name: "rsapss",
329
+ tagClass: asn1.Class.UNIVERSAL,
330
+ type: asn1.Type.SEQUENCE,
331
+ constructed: true,
332
+ value: [
333
+ {
334
+ name: "rsapss.hashAlgorithm",
335
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
336
+ type: 0,
337
+ constructed: true,
338
+ value: [{
339
+ name: "rsapss.hashAlgorithm.AlgorithmIdentifier",
340
+ tagClass: asn1.Class.UNIVERSAL,
341
+ type: asn1.Class.SEQUENCE,
342
+ constructed: true,
343
+ optional: true,
344
+ value: [{
345
+ name: "rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",
346
+ tagClass: asn1.Class.UNIVERSAL,
347
+ type: asn1.Type.OID,
348
+ constructed: false,
349
+ capture: "hashOid"
350
+ }]
351
+ }]
352
+ },
353
+ {
354
+ name: "rsapss.maskGenAlgorithm",
355
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
356
+ type: 1,
357
+ constructed: true,
358
+ value: [{
359
+ name: "rsapss.maskGenAlgorithm.AlgorithmIdentifier",
360
+ tagClass: asn1.Class.UNIVERSAL,
361
+ type: asn1.Class.SEQUENCE,
362
+ constructed: true,
363
+ optional: true,
364
+ value: [{
365
+ name: "rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",
366
+ tagClass: asn1.Class.UNIVERSAL,
367
+ type: asn1.Type.OID,
368
+ constructed: false,
369
+ capture: "maskGenOid"
370
+ }, {
371
+ name: "rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",
372
+ tagClass: asn1.Class.UNIVERSAL,
373
+ type: asn1.Type.SEQUENCE,
374
+ constructed: true,
375
+ value: [{
376
+ name: "rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",
377
+ tagClass: asn1.Class.UNIVERSAL,
378
+ type: asn1.Type.OID,
379
+ constructed: false,
380
+ capture: "maskGenHashOid"
381
+ }]
382
+ }]
383
+ }]
384
+ },
385
+ {
386
+ name: "rsapss.saltLength",
387
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
388
+ type: 2,
389
+ optional: true,
390
+ value: [{
391
+ name: "rsapss.saltLength.saltLength",
392
+ tagClass: asn1.Class.UNIVERSAL,
393
+ type: asn1.Class.INTEGER,
394
+ constructed: false,
395
+ capture: "saltLength"
396
+ }]
397
+ },
398
+ {
399
+ name: "rsapss.trailerField",
400
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
401
+ type: 3,
402
+ optional: true,
403
+ value: [{
404
+ name: "rsapss.trailer.trailer",
405
+ tagClass: asn1.Class.UNIVERSAL,
406
+ type: asn1.Class.INTEGER,
407
+ constructed: false,
408
+ capture: "trailer"
409
+ }]
410
+ }
411
+ ]
412
+ };
413
+ var certificationRequestInfoValidator = {
414
+ name: "CertificationRequestInfo",
415
+ tagClass: asn1.Class.UNIVERSAL,
416
+ type: asn1.Type.SEQUENCE,
417
+ constructed: true,
418
+ captureAsn1: "certificationRequestInfo",
419
+ value: [
420
+ {
421
+ name: "CertificationRequestInfo.integer",
422
+ tagClass: asn1.Class.UNIVERSAL,
423
+ type: asn1.Type.INTEGER,
424
+ constructed: false,
425
+ capture: "certificationRequestInfoVersion"
426
+ },
427
+ {
428
+ name: "CertificationRequestInfo.subject",
429
+ tagClass: asn1.Class.UNIVERSAL,
430
+ type: asn1.Type.SEQUENCE,
431
+ constructed: true,
432
+ captureAsn1: "certificationRequestInfoSubject"
433
+ },
434
+ publicKeyValidator,
435
+ {
436
+ name: "CertificationRequestInfo.attributes",
437
+ tagClass: asn1.Class.CONTEXT_SPECIFIC,
438
+ type: 0,
439
+ constructed: true,
440
+ optional: true,
441
+ capture: "certificationRequestInfoAttributes",
442
+ value: [{
443
+ name: "CertificationRequestInfo.attributes",
444
+ tagClass: asn1.Class.UNIVERSAL,
445
+ type: asn1.Type.SEQUENCE,
446
+ constructed: true,
447
+ value: [{
448
+ name: "CertificationRequestInfo.attributes.type",
449
+ tagClass: asn1.Class.UNIVERSAL,
450
+ type: asn1.Type.OID,
451
+ constructed: false
452
+ }, {
453
+ name: "CertificationRequestInfo.attributes.value",
454
+ tagClass: asn1.Class.UNIVERSAL,
455
+ type: asn1.Type.SET,
456
+ constructed: true
457
+ }]
458
+ }]
459
+ }
460
+ ]
461
+ };
462
+ var certificationRequestValidator = {
463
+ name: "CertificationRequest",
464
+ tagClass: asn1.Class.UNIVERSAL,
465
+ type: asn1.Type.SEQUENCE,
466
+ constructed: true,
467
+ captureAsn1: "csr",
468
+ value: [
469
+ certificationRequestInfoValidator,
470
+ {
471
+ name: "CertificationRequest.signatureAlgorithm",
472
+ tagClass: asn1.Class.UNIVERSAL,
473
+ type: asn1.Type.SEQUENCE,
474
+ constructed: true,
475
+ value: [{
476
+ name: "CertificationRequest.signatureAlgorithm.algorithm",
477
+ tagClass: asn1.Class.UNIVERSAL,
478
+ type: asn1.Type.OID,
479
+ constructed: false,
480
+ capture: "csrSignatureOid"
481
+ }, {
482
+ name: "CertificationRequest.signatureAlgorithm.parameters",
483
+ tagClass: asn1.Class.UNIVERSAL,
484
+ optional: true,
485
+ captureAsn1: "csrSignatureParams"
486
+ }]
487
+ },
488
+ {
489
+ name: "CertificationRequest.signature",
490
+ tagClass: asn1.Class.UNIVERSAL,
491
+ type: asn1.Type.BITSTRING,
492
+ constructed: false,
493
+ captureBitStringValue: "csrSignature"
494
+ }
495
+ ]
496
+ };
497
+ /**
498
+ * Converts an RDNSequence of ASN.1 DER-encoded RelativeDistinguishedName
499
+ * sets into an array with objects that have type and value properties.
500
+ *
501
+ * @param rdn the RDNSequence to convert.
502
+ * @param md a message digest to append type and value to if provided.
503
+ */
504
+ pki.RDNAttributesAsArray = function(rdn, md) {
505
+ var rval = [];
506
+ var set, attr, obj;
507
+ for (var si = 0; si < rdn.value.length; ++si) {
508
+ set = rdn.value[si];
509
+ for (var i = 0; i < set.value.length; ++i) {
510
+ obj = {};
511
+ attr = set.value[i];
512
+ obj.type = asn1.derToOid(attr.value[0].value);
513
+ obj.value = attr.value[1].value;
514
+ obj.valueTagClass = attr.value[1].type;
515
+ if (obj.type in oids) {
516
+ obj.name = oids[obj.type];
517
+ if (obj.name in _shortNames) obj.shortName = _shortNames[obj.name];
518
+ }
519
+ if (md) {
520
+ md.update(obj.type);
521
+ md.update(obj.value);
522
+ }
523
+ rval.push(obj);
524
+ }
525
+ }
526
+ return rval;
527
+ };
528
+ /**
529
+ * Converts ASN.1 CRIAttributes into an array with objects that have type and
530
+ * value properties.
531
+ *
532
+ * @param attributes the CRIAttributes to convert.
533
+ */
534
+ pki.CRIAttributesAsArray = function(attributes) {
535
+ var rval = [];
536
+ for (var si = 0; si < attributes.length; ++si) {
537
+ var seq = attributes[si];
538
+ var type = asn1.derToOid(seq.value[0].value);
539
+ var values = seq.value[1].value;
540
+ for (var vi = 0; vi < values.length; ++vi) {
541
+ var obj = {};
542
+ obj.type = type;
543
+ obj.value = values[vi].value;
544
+ obj.valueTagClass = values[vi].type;
545
+ if (obj.type in oids) {
546
+ obj.name = oids[obj.type];
547
+ if (obj.name in _shortNames) obj.shortName = _shortNames[obj.name];
548
+ }
549
+ if (obj.type === oids.extensionRequest) {
550
+ obj.extensions = [];
551
+ for (var ei = 0; ei < obj.value.length; ++ei) obj.extensions.push(pki.certificateExtensionFromAsn1(obj.value[ei]));
552
+ }
553
+ rval.push(obj);
554
+ }
555
+ }
556
+ return rval;
557
+ };
558
+ /**
559
+ * Gets an issuer or subject attribute from its name, type, or short name.
560
+ *
561
+ * @param obj the issuer or subject object.
562
+ * @param options a short name string or an object with:
563
+ * shortName the short name for the attribute.
564
+ * name the name for the attribute.
565
+ * type the type for the attribute.
566
+ *
567
+ * @return the attribute.
568
+ */
569
+ function _getAttribute(obj, options) {
570
+ if (typeof options === "string") options = { shortName: options };
571
+ var rval = null;
572
+ var attr;
573
+ for (var i = 0; rval === null && i < obj.attributes.length; ++i) {
574
+ attr = obj.attributes[i];
575
+ if (options.type && options.type === attr.type) rval = attr;
576
+ else if (options.name && options.name === attr.name) rval = attr;
577
+ else if (options.shortName && options.shortName === attr.shortName) rval = attr;
578
+ }
579
+ return rval;
580
+ }
581
+ /**
582
+ * Converts signature parameters from ASN.1 structure.
583
+ *
584
+ * Currently only RSASSA-PSS supported. The PKCS#1 v1.5 signature scheme had
585
+ * no parameters.
586
+ *
587
+ * RSASSA-PSS-params ::= SEQUENCE {
588
+ * hashAlgorithm [0] HashAlgorithm DEFAULT
589
+ * sha1Identifier,
590
+ * maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT
591
+ * mgf1SHA1Identifier,
592
+ * saltLength [2] INTEGER DEFAULT 20,
593
+ * trailerField [3] INTEGER DEFAULT 1
594
+ * }
595
+ *
596
+ * HashAlgorithm ::= AlgorithmIdentifier
597
+ *
598
+ * MaskGenAlgorithm ::= AlgorithmIdentifier
599
+ *
600
+ * AlgorithmIdentifer ::= SEQUENCE {
601
+ * algorithm OBJECT IDENTIFIER,
602
+ * parameters ANY DEFINED BY algorithm OPTIONAL
603
+ * }
604
+ *
605
+ * @param oid The OID specifying the signature algorithm
606
+ * @param obj The ASN.1 structure holding the parameters
607
+ * @param fillDefaults Whether to use return default values where omitted
608
+ * @return signature parameter object
609
+ */
610
+ var _readSignatureParameters = function(oid, obj, fillDefaults) {
611
+ var params = {};
612
+ if (oid !== oids["RSASSA-PSS"]) return params;
613
+ if (fillDefaults) params = {
614
+ hash: { algorithmOid: oids["sha1"] },
615
+ mgf: {
616
+ algorithmOid: oids["mgf1"],
617
+ hash: { algorithmOid: oids["sha1"] }
618
+ },
619
+ saltLength: 20
620
+ };
621
+ var capture = {};
622
+ var errors = [];
623
+ if (!asn1.validate(obj, rsassaPssParameterValidator, capture, errors)) {
624
+ var error = /* @__PURE__ */ new Error("Cannot read RSASSA-PSS parameter block.");
625
+ error.errors = errors;
626
+ throw error;
627
+ }
628
+ if (capture.hashOid !== void 0) {
629
+ params.hash = params.hash || {};
630
+ params.hash.algorithmOid = asn1.derToOid(capture.hashOid);
631
+ }
632
+ if (capture.maskGenOid !== void 0) {
633
+ params.mgf = params.mgf || {};
634
+ params.mgf.algorithmOid = asn1.derToOid(capture.maskGenOid);
635
+ params.mgf.hash = params.mgf.hash || {};
636
+ params.mgf.hash.algorithmOid = asn1.derToOid(capture.maskGenHashOid);
637
+ }
638
+ if (capture.saltLength !== void 0) params.saltLength = capture.saltLength.charCodeAt(0);
639
+ return params;
640
+ };
641
+ /**
642
+ * Create signature digest for OID.
643
+ *
644
+ * @param options
645
+ * signatureOid: the OID specifying the signature algorithm.
646
+ * type: a human readable type for error messages
647
+ * @return a created md instance. throws if unknown oid.
648
+ */
649
+ var _createSignatureDigest = function(options) {
650
+ switch (oids[options.signatureOid]) {
651
+ case "sha1WithRSAEncryption":
652
+ case "sha1WithRSASignature": return forge.md.sha1.create();
653
+ case "md5WithRSAEncryption": return forge.md.md5.create();
654
+ case "sha256WithRSAEncryption": return forge.md.sha256.create();
655
+ case "sha384WithRSAEncryption": return forge.md.sha384.create();
656
+ case "sha512WithRSAEncryption": return forge.md.sha512.create();
657
+ case "RSASSA-PSS": return forge.md.sha256.create();
658
+ default:
659
+ var error = /* @__PURE__ */ new Error("Could not compute " + options.type + " digest. Unknown signature OID.");
660
+ error.signatureOid = options.signatureOid;
661
+ throw error;
662
+ }
663
+ };
664
+ /**
665
+ * Verify signature on certificate or CSR.
666
+ *
667
+ * @param options:
668
+ * certificate the certificate or CSR to verify.
669
+ * md the signature digest.
670
+ * signature the signature
671
+ * @return a created md instance. throws if unknown oid.
672
+ */
673
+ var _verifySignature = function(options) {
674
+ var cert = options.certificate;
675
+ var scheme;
676
+ switch (cert.signatureOid) {
677
+ case oids.sha1WithRSAEncryption:
678
+ case oids.sha1WithRSASignature: break;
679
+ case oids["RSASSA-PSS"]:
680
+ var hash = oids[cert.signatureParameters.mgf.hash.algorithmOid], mgf;
681
+ if (hash === void 0 || forge.md[hash] === void 0) {
682
+ var error = /* @__PURE__ */ new Error("Unsupported MGF hash function.");
683
+ error.oid = cert.signatureParameters.mgf.hash.algorithmOid;
684
+ error.name = hash;
685
+ throw error;
686
+ }
687
+ mgf = oids[cert.signatureParameters.mgf.algorithmOid];
688
+ if (mgf === void 0 || forge.mgf[mgf] === void 0) {
689
+ var error = /* @__PURE__ */ new Error("Unsupported MGF function.");
690
+ error.oid = cert.signatureParameters.mgf.algorithmOid;
691
+ error.name = mgf;
692
+ throw error;
693
+ }
694
+ mgf = forge.mgf[mgf].create(forge.md[hash].create());
695
+ hash = oids[cert.signatureParameters.hash.algorithmOid];
696
+ if (hash === void 0 || forge.md[hash] === void 0) {
697
+ var error = /* @__PURE__ */ new Error("Unsupported RSASSA-PSS hash function.");
698
+ error.oid = cert.signatureParameters.hash.algorithmOid;
699
+ error.name = hash;
700
+ throw error;
701
+ }
702
+ scheme = forge.pss.create(forge.md[hash].create(), mgf, cert.signatureParameters.saltLength);
703
+ break;
704
+ }
705
+ return cert.publicKey.verify(options.md.digest().getBytes(), options.signature, scheme);
706
+ };
707
+ /**
708
+ * Converts an X.509 certificate from PEM format.
709
+ *
710
+ * Note: If the certificate is to be verified then compute hash should
711
+ * be set to true. This will scan the TBSCertificate part of the ASN.1
712
+ * object while it is converted so it doesn't need to be converted back
713
+ * to ASN.1-DER-encoding later.
714
+ *
715
+ * @param pem the PEM-formatted certificate.
716
+ * @param computeHash true to compute the hash for verification.
717
+ * @param strict true to be strict when checking ASN.1 value lengths, false to
718
+ * allow truncated values (default: true).
719
+ *
720
+ * @return the certificate.
721
+ */
722
+ pki.certificateFromPem = function(pem, computeHash, strict) {
723
+ var msg = forge.pem.decode(pem)[0];
724
+ if (msg.type !== "CERTIFICATE" && msg.type !== "X509 CERTIFICATE" && msg.type !== "TRUSTED CERTIFICATE") {
725
+ var error = /* @__PURE__ */ new Error("Could not convert certificate from PEM; PEM header type is not \"CERTIFICATE\", \"X509 CERTIFICATE\", or \"TRUSTED CERTIFICATE\".");
726
+ error.headerType = msg.type;
727
+ throw error;
728
+ }
729
+ if (msg.procType && msg.procType.type === "ENCRYPTED") throw new Error("Could not convert certificate from PEM; PEM is encrypted.");
730
+ var obj = asn1.fromDer(msg.body, strict);
731
+ return pki.certificateFromAsn1(obj, computeHash);
732
+ };
733
+ /**
734
+ * Converts an X.509 certificate to PEM format.
735
+ *
736
+ * @param cert the certificate.
737
+ * @param maxline the maximum characters per line, defaults to 64.
738
+ *
739
+ * @return the PEM-formatted certificate.
740
+ */
741
+ pki.certificateToPem = function(cert, maxline) {
742
+ var msg = {
743
+ type: "CERTIFICATE",
744
+ body: asn1.toDer(pki.certificateToAsn1(cert)).getBytes()
745
+ };
746
+ return forge.pem.encode(msg, { maxline });
747
+ };
748
+ /**
749
+ * Converts an RSA public key from PEM format.
750
+ *
751
+ * @param pem the PEM-formatted public key.
752
+ *
753
+ * @return the public key.
754
+ */
755
+ pki.publicKeyFromPem = function(pem) {
756
+ var msg = forge.pem.decode(pem)[0];
757
+ if (msg.type !== "PUBLIC KEY" && msg.type !== "RSA PUBLIC KEY") {
758
+ var error = /* @__PURE__ */ new Error("Could not convert public key from PEM; PEM header type is not \"PUBLIC KEY\" or \"RSA PUBLIC KEY\".");
759
+ error.headerType = msg.type;
760
+ throw error;
761
+ }
762
+ if (msg.procType && msg.procType.type === "ENCRYPTED") throw new Error("Could not convert public key from PEM; PEM is encrypted.");
763
+ var obj = asn1.fromDer(msg.body);
764
+ return pki.publicKeyFromAsn1(obj);
765
+ };
766
+ /**
767
+ * Converts an RSA public key to PEM format (using a SubjectPublicKeyInfo).
768
+ *
769
+ * @param key the public key.
770
+ * @param maxline the maximum characters per line, defaults to 64.
771
+ *
772
+ * @return the PEM-formatted public key.
773
+ */
774
+ pki.publicKeyToPem = function(key, maxline) {
775
+ var msg = {
776
+ type: "PUBLIC KEY",
777
+ body: asn1.toDer(pki.publicKeyToAsn1(key)).getBytes()
778
+ };
779
+ return forge.pem.encode(msg, { maxline });
780
+ };
781
+ /**
782
+ * Converts an RSA public key to PEM format (using an RSAPublicKey).
783
+ *
784
+ * @param key the public key.
785
+ * @param maxline the maximum characters per line, defaults to 64.
786
+ *
787
+ * @return the PEM-formatted public key.
788
+ */
789
+ pki.publicKeyToRSAPublicKeyPem = function(key, maxline) {
790
+ var msg = {
791
+ type: "RSA PUBLIC KEY",
792
+ body: asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes()
793
+ };
794
+ return forge.pem.encode(msg, { maxline });
795
+ };
796
+ /**
797
+ * Gets a fingerprint for the given public key.
798
+ *
799
+ * @param options the options to use.
800
+ * [md] the message digest object to use (defaults to forge.md.sha1).
801
+ * [type] the type of fingerprint, such as 'RSAPublicKey',
802
+ * 'SubjectPublicKeyInfo' (defaults to 'RSAPublicKey').
803
+ * [encoding] an alternative output encoding, such as 'hex'
804
+ * (defaults to none, outputs a byte buffer).
805
+ * [delimiter] the delimiter to use between bytes for 'hex' encoded
806
+ * output, eg: ':' (defaults to none).
807
+ *
808
+ * @return the fingerprint as a byte buffer or other encoding based on options.
809
+ */
810
+ pki.getPublicKeyFingerprint = function(key, options) {
811
+ options = options || {};
812
+ var md = options.md || forge.md.sha1.create();
813
+ var type = options.type || "RSAPublicKey";
814
+ var bytes;
815
+ switch (type) {
816
+ case "RSAPublicKey":
817
+ bytes = asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes();
818
+ break;
819
+ case "SubjectPublicKeyInfo":
820
+ bytes = asn1.toDer(pki.publicKeyToAsn1(key)).getBytes();
821
+ break;
822
+ default: throw new Error("Unknown fingerprint type \"" + options.type + "\".");
823
+ }
824
+ md.start();
825
+ md.update(bytes);
826
+ var digest = md.digest();
827
+ if (options.encoding === "hex") {
828
+ var hex = digest.toHex();
829
+ if (options.delimiter) return hex.match(/.{2}/g).join(options.delimiter);
830
+ return hex;
831
+ } else if (options.encoding === "binary") return digest.getBytes();
832
+ else if (options.encoding) throw new Error("Unknown encoding \"" + options.encoding + "\".");
833
+ return digest;
834
+ };
835
+ /**
836
+ * Converts a PKCS#10 certification request (CSR) from PEM format.
837
+ *
838
+ * Note: If the certification request is to be verified then compute hash
839
+ * should be set to true. This will scan the CertificationRequestInfo part of
840
+ * the ASN.1 object while it is converted so it doesn't need to be converted
841
+ * back to ASN.1-DER-encoding later.
842
+ *
843
+ * @param pem the PEM-formatted certificate.
844
+ * @param computeHash true to compute the hash for verification.
845
+ * @param strict true to be strict when checking ASN.1 value lengths, false to
846
+ * allow truncated values (default: true).
847
+ *
848
+ * @return the certification request (CSR).
849
+ */
850
+ pki.certificationRequestFromPem = function(pem, computeHash, strict) {
851
+ var msg = forge.pem.decode(pem)[0];
852
+ if (msg.type !== "CERTIFICATE REQUEST") {
853
+ var error = /* @__PURE__ */ new Error("Could not convert certification request from PEM; PEM header type is not \"CERTIFICATE REQUEST\".");
854
+ error.headerType = msg.type;
855
+ throw error;
856
+ }
857
+ if (msg.procType && msg.procType.type === "ENCRYPTED") throw new Error("Could not convert certification request from PEM; PEM is encrypted.");
858
+ var obj = asn1.fromDer(msg.body, strict);
859
+ return pki.certificationRequestFromAsn1(obj, computeHash);
860
+ };
861
+ /**
862
+ * Converts a PKCS#10 certification request (CSR) to PEM format.
863
+ *
864
+ * @param csr the certification request.
865
+ * @param maxline the maximum characters per line, defaults to 64.
866
+ *
867
+ * @return the PEM-formatted certification request.
868
+ */
869
+ pki.certificationRequestToPem = function(csr, maxline) {
870
+ var msg = {
871
+ type: "CERTIFICATE REQUEST",
872
+ body: asn1.toDer(pki.certificationRequestToAsn1(csr)).getBytes()
873
+ };
874
+ return forge.pem.encode(msg, { maxline });
875
+ };
876
+ /**
877
+ * Creates an empty X.509v3 RSA certificate.
878
+ *
879
+ * @return the certificate.
880
+ */
881
+ pki.createCertificate = function() {
882
+ var cert = {};
883
+ cert.version = 2;
884
+ cert.serialNumber = "00";
885
+ cert.signatureOid = null;
886
+ cert.signature = null;
887
+ cert.siginfo = {};
888
+ cert.siginfo.algorithmOid = null;
889
+ cert.validity = {};
890
+ cert.validity.notBefore = /* @__PURE__ */ new Date();
891
+ cert.validity.notAfter = /* @__PURE__ */ new Date();
892
+ cert.issuer = {};
893
+ cert.issuer.getField = function(sn) {
894
+ return _getAttribute(cert.issuer, sn);
895
+ };
896
+ cert.issuer.addField = function(attr) {
897
+ _fillMissingFields([attr]);
898
+ cert.issuer.attributes.push(attr);
899
+ };
900
+ cert.issuer.attributes = [];
901
+ cert.issuer.hash = null;
902
+ cert.subject = {};
903
+ cert.subject.getField = function(sn) {
904
+ return _getAttribute(cert.subject, sn);
905
+ };
906
+ cert.subject.addField = function(attr) {
907
+ _fillMissingFields([attr]);
908
+ cert.subject.attributes.push(attr);
909
+ };
910
+ cert.subject.attributes = [];
911
+ cert.subject.hash = null;
912
+ cert.extensions = [];
913
+ cert.publicKey = null;
914
+ cert.md = null;
915
+ /**
916
+ * Sets the subject of this certificate.
917
+ *
918
+ * @param attrs the array of subject attributes to use.
919
+ * @param uniqueId an optional a unique ID to use.
920
+ */
921
+ cert.setSubject = function(attrs, uniqueId) {
922
+ _fillMissingFields(attrs);
923
+ cert.subject.attributes = attrs;
924
+ delete cert.subject.uniqueId;
925
+ if (uniqueId) cert.subject.uniqueId = uniqueId;
926
+ cert.subject.hash = null;
927
+ };
928
+ /**
929
+ * Sets the issuer of this certificate.
930
+ *
931
+ * @param attrs the array of issuer attributes to use.
932
+ * @param uniqueId an optional a unique ID to use.
933
+ */
934
+ cert.setIssuer = function(attrs, uniqueId) {
935
+ _fillMissingFields(attrs);
936
+ cert.issuer.attributes = attrs;
937
+ delete cert.issuer.uniqueId;
938
+ if (uniqueId) cert.issuer.uniqueId = uniqueId;
939
+ cert.issuer.hash = null;
940
+ };
941
+ /**
942
+ * Sets the extensions of this certificate.
943
+ *
944
+ * @param exts the array of extensions to use.
945
+ */
946
+ cert.setExtensions = function(exts) {
947
+ for (var i = 0; i < exts.length; ++i) _fillMissingExtensionFields(exts[i], { cert });
948
+ cert.extensions = exts;
949
+ };
950
+ /**
951
+ * Gets an extension by its name or id.
952
+ *
953
+ * @param options the name to use or an object with:
954
+ * name the name to use.
955
+ * id the id to use.
956
+ *
957
+ * @return the extension or null if not found.
958
+ */
959
+ cert.getExtension = function(options) {
960
+ if (typeof options === "string") options = { name: options };
961
+ var rval = null;
962
+ var ext;
963
+ for (var i = 0; rval === null && i < cert.extensions.length; ++i) {
964
+ ext = cert.extensions[i];
965
+ if (options.id && ext.id === options.id) rval = ext;
966
+ else if (options.name && ext.name === options.name) rval = ext;
967
+ }
968
+ return rval;
969
+ };
970
+ /**
971
+ * Signs this certificate using the given private key.
972
+ *
973
+ * @param key the private key to sign with.
974
+ * @param md the message digest object to use (defaults to forge.md.sha1).
975
+ */
976
+ cert.sign = function(key, md) {
977
+ cert.md = md || forge.md.sha1.create();
978
+ var algorithmOid = oids[cert.md.algorithm + "WithRSAEncryption"];
979
+ if (!algorithmOid) {
980
+ var error = /* @__PURE__ */ new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");
981
+ error.algorithm = cert.md.algorithm;
982
+ throw error;
983
+ }
984
+ cert.signatureOid = cert.siginfo.algorithmOid = algorithmOid;
985
+ cert.tbsCertificate = pki.getTBSCertificate(cert);
986
+ var bytes = asn1.toDer(cert.tbsCertificate);
987
+ cert.md.update(bytes.getBytes());
988
+ cert.signature = key.sign(cert.md);
989
+ };
990
+ /**
991
+ * Attempts verify the signature on the passed certificate using this
992
+ * certificate's public key.
993
+ *
994
+ * @param child the certificate to verify.
995
+ *
996
+ * @return true if verified, false if not.
997
+ */
998
+ cert.verify = function(child) {
999
+ var rval = false;
1000
+ if (!cert.issued(child)) {
1001
+ var issuer = child.issuer;
1002
+ var subject = cert.subject;
1003
+ var error = /* @__PURE__ */ new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
1004
+ error.expectedIssuer = subject.attributes;
1005
+ error.actualIssuer = issuer.attributes;
1006
+ throw error;
1007
+ }
1008
+ var md = child.md;
1009
+ if (md === null) {
1010
+ md = _createSignatureDigest({
1011
+ signatureOid: child.signatureOid,
1012
+ type: "certificate"
1013
+ });
1014
+ var tbsCertificate = child.tbsCertificate || pki.getTBSCertificate(child);
1015
+ var bytes = asn1.toDer(tbsCertificate);
1016
+ md.update(bytes.getBytes());
1017
+ }
1018
+ if (md !== null) rval = _verifySignature({
1019
+ certificate: cert,
1020
+ md,
1021
+ signature: child.signature
1022
+ });
1023
+ return rval;
1024
+ };
1025
+ /**
1026
+ * Returns true if this certificate's issuer matches the passed
1027
+ * certificate's subject. Note that no signature check is performed.
1028
+ *
1029
+ * @param parent the certificate to check.
1030
+ *
1031
+ * @return true if this certificate's issuer matches the passed certificate's
1032
+ * subject.
1033
+ */
1034
+ cert.isIssuer = function(parent) {
1035
+ var rval = false;
1036
+ var i = cert.issuer;
1037
+ var s = parent.subject;
1038
+ if (i.hash && s.hash) rval = i.hash === s.hash;
1039
+ else if (i.attributes.length === s.attributes.length) {
1040
+ rval = true;
1041
+ var iattr, sattr;
1042
+ for (var n = 0; rval && n < i.attributes.length; ++n) {
1043
+ iattr = i.attributes[n];
1044
+ sattr = s.attributes[n];
1045
+ if (iattr.type !== sattr.type || iattr.value !== sattr.value) rval = false;
1046
+ }
1047
+ }
1048
+ return rval;
1049
+ };
1050
+ /**
1051
+ * Returns true if this certificate's subject matches the issuer of the
1052
+ * given certificate). Note that not signature check is performed.
1053
+ *
1054
+ * @param child the certificate to check.
1055
+ *
1056
+ * @return true if this certificate's subject matches the passed
1057
+ * certificate's issuer.
1058
+ */
1059
+ cert.issued = function(child) {
1060
+ return child.isIssuer(cert);
1061
+ };
1062
+ /**
1063
+ * Generates the subjectKeyIdentifier for this certificate as byte buffer.
1064
+ *
1065
+ * @return the subjectKeyIdentifier for this certificate as byte buffer.
1066
+ */
1067
+ cert.generateSubjectKeyIdentifier = function() {
1068
+ return pki.getPublicKeyFingerprint(cert.publicKey, { type: "RSAPublicKey" });
1069
+ };
1070
+ /**
1071
+ * Verifies the subjectKeyIdentifier extension value for this certificate
1072
+ * against its public key. If no extension is found, false will be
1073
+ * returned.
1074
+ *
1075
+ * @return true if verified, false if not.
1076
+ */
1077
+ cert.verifySubjectKeyIdentifier = function() {
1078
+ var oid = oids["subjectKeyIdentifier"];
1079
+ for (var i = 0; i < cert.extensions.length; ++i) {
1080
+ var ext = cert.extensions[i];
1081
+ if (ext.id === oid) {
1082
+ var ski = cert.generateSubjectKeyIdentifier().getBytes();
1083
+ return forge.util.hexToBytes(ext.subjectKeyIdentifier) === ski;
1084
+ }
1085
+ }
1086
+ return false;
1087
+ };
1088
+ return cert;
1089
+ };
1090
+ /**
1091
+ * Converts an X.509v3 RSA certificate from an ASN.1 object.
1092
+ *
1093
+ * Note: If the certificate is to be verified then compute hash should
1094
+ * be set to true. There is currently no implementation for converting
1095
+ * a certificate back to ASN.1 so the TBSCertificate part of the ASN.1
1096
+ * object needs to be scanned before the cert object is created.
1097
+ *
1098
+ * @param obj the asn1 representation of an X.509v3 RSA certificate.
1099
+ * @param computeHash true to compute the hash for verification.
1100
+ *
1101
+ * @return the certificate.
1102
+ */
1103
+ pki.certificateFromAsn1 = function(obj, computeHash) {
1104
+ var capture = {};
1105
+ var errors = [];
1106
+ if (!asn1.validate(obj, x509CertificateValidator, capture, errors)) {
1107
+ var error = /* @__PURE__ */ new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");
1108
+ error.errors = errors;
1109
+ throw error;
1110
+ }
1111
+ if (asn1.derToOid(capture.publicKeyOid) !== pki.oids.rsaEncryption) throw new Error("Cannot read public key. OID is not RSA.");
1112
+ var cert = pki.createCertificate();
1113
+ cert.version = capture.certVersion ? capture.certVersion.charCodeAt(0) : 0;
1114
+ cert.serialNumber = forge.util.createBuffer(capture.certSerialNumber).toHex();
1115
+ cert.signatureOid = forge.asn1.derToOid(capture.certSignatureOid);
1116
+ cert.signatureParameters = _readSignatureParameters(cert.signatureOid, capture.certSignatureParams, true);
1117
+ cert.siginfo.algorithmOid = forge.asn1.derToOid(capture.certinfoSignatureOid);
1118
+ cert.siginfo.parameters = _readSignatureParameters(cert.siginfo.algorithmOid, capture.certinfoSignatureParams, false);
1119
+ cert.signature = capture.certSignature;
1120
+ var validity = [];
1121
+ if (capture.certValidity1UTCTime !== void 0) validity.push(asn1.utcTimeToDate(capture.certValidity1UTCTime));
1122
+ if (capture.certValidity2GeneralizedTime !== void 0) validity.push(asn1.generalizedTimeToDate(capture.certValidity2GeneralizedTime));
1123
+ if (capture.certValidity3UTCTime !== void 0) validity.push(asn1.utcTimeToDate(capture.certValidity3UTCTime));
1124
+ if (capture.certValidity4GeneralizedTime !== void 0) validity.push(asn1.generalizedTimeToDate(capture.certValidity4GeneralizedTime));
1125
+ if (validity.length > 2) throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");
1126
+ if (validity.length < 2) throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
1127
+ cert.validity.notBefore = validity[0];
1128
+ cert.validity.notAfter = validity[1];
1129
+ cert.tbsCertificate = capture.tbsCertificate;
1130
+ if (computeHash) {
1131
+ cert.md = _createSignatureDigest({
1132
+ signatureOid: cert.signatureOid,
1133
+ type: "certificate"
1134
+ });
1135
+ var bytes = asn1.toDer(cert.tbsCertificate);
1136
+ cert.md.update(bytes.getBytes());
1137
+ }
1138
+ var imd = forge.md.sha1.create();
1139
+ var ibytes = asn1.toDer(capture.certIssuer);
1140
+ imd.update(ibytes.getBytes());
1141
+ cert.issuer.getField = function(sn) {
1142
+ return _getAttribute(cert.issuer, sn);
1143
+ };
1144
+ cert.issuer.addField = function(attr) {
1145
+ _fillMissingFields([attr]);
1146
+ cert.issuer.attributes.push(attr);
1147
+ };
1148
+ cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer);
1149
+ if (capture.certIssuerUniqueId) cert.issuer.uniqueId = capture.certIssuerUniqueId;
1150
+ cert.issuer.hash = imd.digest().toHex();
1151
+ var smd = forge.md.sha1.create();
1152
+ var sbytes = asn1.toDer(capture.certSubject);
1153
+ smd.update(sbytes.getBytes());
1154
+ cert.subject.getField = function(sn) {
1155
+ return _getAttribute(cert.subject, sn);
1156
+ };
1157
+ cert.subject.addField = function(attr) {
1158
+ _fillMissingFields([attr]);
1159
+ cert.subject.attributes.push(attr);
1160
+ };
1161
+ cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject);
1162
+ if (capture.certSubjectUniqueId) cert.subject.uniqueId = capture.certSubjectUniqueId;
1163
+ cert.subject.hash = smd.digest().toHex();
1164
+ if (capture.certExtensions) cert.extensions = pki.certificateExtensionsFromAsn1(capture.certExtensions);
1165
+ else cert.extensions = [];
1166
+ cert.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo);
1167
+ return cert;
1168
+ };
1169
+ /**
1170
+ * Converts an ASN.1 extensions object (with extension sequences as its
1171
+ * values) into an array of extension objects with types and values.
1172
+ *
1173
+ * Supported extensions:
1174
+ *
1175
+ * id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 }
1176
+ * KeyUsage ::= BIT STRING {
1177
+ * digitalSignature (0),
1178
+ * nonRepudiation (1),
1179
+ * keyEncipherment (2),
1180
+ * dataEncipherment (3),
1181
+ * keyAgreement (4),
1182
+ * keyCertSign (5),
1183
+ * cRLSign (6),
1184
+ * encipherOnly (7),
1185
+ * decipherOnly (8)
1186
+ * }
1187
+ *
1188
+ * id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 }
1189
+ * BasicConstraints ::= SEQUENCE {
1190
+ * cA BOOLEAN DEFAULT FALSE,
1191
+ * pathLenConstraint INTEGER (0..MAX) OPTIONAL
1192
+ * }
1193
+ *
1194
+ * subjectAltName EXTENSION ::= {
1195
+ * SYNTAX GeneralNames
1196
+ * IDENTIFIED BY id-ce-subjectAltName
1197
+ * }
1198
+ *
1199
+ * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
1200
+ *
1201
+ * GeneralName ::= CHOICE {
1202
+ * otherName [0] INSTANCE OF OTHER-NAME,
1203
+ * rfc822Name [1] IA5String,
1204
+ * dNSName [2] IA5String,
1205
+ * x400Address [3] ORAddress,
1206
+ * directoryName [4] Name,
1207
+ * ediPartyName [5] EDIPartyName,
1208
+ * uniformResourceIdentifier [6] IA5String,
1209
+ * IPAddress [7] OCTET STRING,
1210
+ * registeredID [8] OBJECT IDENTIFIER
1211
+ * }
1212
+ *
1213
+ * OTHER-NAME ::= TYPE-IDENTIFIER
1214
+ *
1215
+ * EDIPartyName ::= SEQUENCE {
1216
+ * nameAssigner [0] DirectoryString {ub-name} OPTIONAL,
1217
+ * partyName [1] DirectoryString {ub-name}
1218
+ * }
1219
+ *
1220
+ * @param exts the extensions ASN.1 with extension sequences to parse.
1221
+ *
1222
+ * @return the array.
1223
+ */
1224
+ pki.certificateExtensionsFromAsn1 = function(exts) {
1225
+ var rval = [];
1226
+ for (var i = 0; i < exts.value.length; ++i) {
1227
+ var extseq = exts.value[i];
1228
+ for (var ei = 0; ei < extseq.value.length; ++ei) rval.push(pki.certificateExtensionFromAsn1(extseq.value[ei]));
1229
+ }
1230
+ return rval;
1231
+ };
1232
+ /**
1233
+ * Parses a single certificate extension from ASN.1.
1234
+ *
1235
+ * @param ext the extension in ASN.1 format.
1236
+ *
1237
+ * @return the parsed extension as an object.
1238
+ */
1239
+ pki.certificateExtensionFromAsn1 = function(ext) {
1240
+ var e = {};
1241
+ e.id = asn1.derToOid(ext.value[0].value);
1242
+ e.critical = false;
1243
+ if (ext.value[1].type === asn1.Type.BOOLEAN) {
1244
+ e.critical = ext.value[1].value.charCodeAt(0) !== 0;
1245
+ e.value = ext.value[2].value;
1246
+ } else e.value = ext.value[1].value;
1247
+ if (e.id in oids) {
1248
+ e.name = oids[e.id];
1249
+ if (e.name === "keyUsage") {
1250
+ var ev = asn1.fromDer(e.value);
1251
+ var b2 = 0;
1252
+ var b3 = 0;
1253
+ if (ev.value.length > 1) {
1254
+ b2 = ev.value.charCodeAt(1);
1255
+ b3 = ev.value.length > 2 ? ev.value.charCodeAt(2) : 0;
1256
+ }
1257
+ e.digitalSignature = (b2 & 128) === 128;
1258
+ e.nonRepudiation = (b2 & 64) === 64;
1259
+ e.keyEncipherment = (b2 & 32) === 32;
1260
+ e.dataEncipherment = (b2 & 16) === 16;
1261
+ e.keyAgreement = (b2 & 8) === 8;
1262
+ e.keyCertSign = (b2 & 4) === 4;
1263
+ e.cRLSign = (b2 & 2) === 2;
1264
+ e.encipherOnly = (b2 & 1) === 1;
1265
+ e.decipherOnly = (b3 & 128) === 128;
1266
+ } else if (e.name === "basicConstraints") {
1267
+ var ev = asn1.fromDer(e.value);
1268
+ if (ev.value.length > 0 && ev.value[0].type === asn1.Type.BOOLEAN) e.cA = ev.value[0].value.charCodeAt(0) !== 0;
1269
+ else e.cA = false;
1270
+ var value = null;
1271
+ if (ev.value.length > 0 && ev.value[0].type === asn1.Type.INTEGER) value = ev.value[0].value;
1272
+ else if (ev.value.length > 1) value = ev.value[1].value;
1273
+ if (value !== null) e.pathLenConstraint = asn1.derToInteger(value);
1274
+ } else if (e.name === "extKeyUsage") {
1275
+ var ev = asn1.fromDer(e.value);
1276
+ for (var vi = 0; vi < ev.value.length; ++vi) {
1277
+ var oid = asn1.derToOid(ev.value[vi].value);
1278
+ if (oid in oids) e[oids[oid]] = true;
1279
+ else e[oid] = true;
1280
+ }
1281
+ } else if (e.name === "nsCertType") {
1282
+ var ev = asn1.fromDer(e.value);
1283
+ var b2 = 0;
1284
+ if (ev.value.length > 1) b2 = ev.value.charCodeAt(1);
1285
+ e.client = (b2 & 128) === 128;
1286
+ e.server = (b2 & 64) === 64;
1287
+ e.email = (b2 & 32) === 32;
1288
+ e.objsign = (b2 & 16) === 16;
1289
+ e.reserved = (b2 & 8) === 8;
1290
+ e.sslCA = (b2 & 4) === 4;
1291
+ e.emailCA = (b2 & 2) === 2;
1292
+ e.objCA = (b2 & 1) === 1;
1293
+ } else if (e.name === "subjectAltName" || e.name === "issuerAltName") {
1294
+ e.altNames = [];
1295
+ var gn;
1296
+ var ev = asn1.fromDer(e.value);
1297
+ for (var n = 0; n < ev.value.length; ++n) {
1298
+ gn = ev.value[n];
1299
+ var altName = {
1300
+ type: gn.type,
1301
+ value: gn.value
1302
+ };
1303
+ e.altNames.push(altName);
1304
+ switch (gn.type) {
1305
+ case 1:
1306
+ case 2:
1307
+ case 6: break;
1308
+ case 7:
1309
+ altName.ip = forge.util.bytesToIP(gn.value);
1310
+ break;
1311
+ case 8:
1312
+ altName.oid = asn1.derToOid(gn.value);
1313
+ break;
1314
+ default:
1315
+ }
1316
+ }
1317
+ } else if (e.name === "subjectKeyIdentifier") {
1318
+ var ev = asn1.fromDer(e.value);
1319
+ e.subjectKeyIdentifier = forge.util.bytesToHex(ev.value);
1320
+ }
1321
+ }
1322
+ return e;
1323
+ };
1324
+ /**
1325
+ * Converts a PKCS#10 certification request (CSR) from an ASN.1 object.
1326
+ *
1327
+ * Note: If the certification request is to be verified then compute hash
1328
+ * should be set to true. There is currently no implementation for converting
1329
+ * a certificate back to ASN.1 so the CertificationRequestInfo part of the
1330
+ * ASN.1 object needs to be scanned before the csr object is created.
1331
+ *
1332
+ * @param obj the asn1 representation of a PKCS#10 certification request (CSR).
1333
+ * @param computeHash true to compute the hash for verification.
1334
+ *
1335
+ * @return the certification request (CSR).
1336
+ */
1337
+ pki.certificationRequestFromAsn1 = function(obj, computeHash) {
1338
+ var capture = {};
1339
+ var errors = [];
1340
+ if (!asn1.validate(obj, certificationRequestValidator, capture, errors)) {
1341
+ var error = /* @__PURE__ */ new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");
1342
+ error.errors = errors;
1343
+ throw error;
1344
+ }
1345
+ if (asn1.derToOid(capture.publicKeyOid) !== pki.oids.rsaEncryption) throw new Error("Cannot read public key. OID is not RSA.");
1346
+ var csr = pki.createCertificationRequest();
1347
+ csr.version = capture.csrVersion ? capture.csrVersion.charCodeAt(0) : 0;
1348
+ csr.signatureOid = forge.asn1.derToOid(capture.csrSignatureOid);
1349
+ csr.signatureParameters = _readSignatureParameters(csr.signatureOid, capture.csrSignatureParams, true);
1350
+ csr.siginfo.algorithmOid = forge.asn1.derToOid(capture.csrSignatureOid);
1351
+ csr.siginfo.parameters = _readSignatureParameters(csr.siginfo.algorithmOid, capture.csrSignatureParams, false);
1352
+ csr.signature = capture.csrSignature;
1353
+ csr.certificationRequestInfo = capture.certificationRequestInfo;
1354
+ if (computeHash) {
1355
+ csr.md = _createSignatureDigest({
1356
+ signatureOid: csr.signatureOid,
1357
+ type: "certification request"
1358
+ });
1359
+ var bytes = asn1.toDer(csr.certificationRequestInfo);
1360
+ csr.md.update(bytes.getBytes());
1361
+ }
1362
+ var smd = forge.md.sha1.create();
1363
+ csr.subject.getField = function(sn) {
1364
+ return _getAttribute(csr.subject, sn);
1365
+ };
1366
+ csr.subject.addField = function(attr) {
1367
+ _fillMissingFields([attr]);
1368
+ csr.subject.attributes.push(attr);
1369
+ };
1370
+ csr.subject.attributes = pki.RDNAttributesAsArray(capture.certificationRequestInfoSubject, smd);
1371
+ csr.subject.hash = smd.digest().toHex();
1372
+ csr.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo);
1373
+ csr.getAttribute = function(sn) {
1374
+ return _getAttribute(csr, sn);
1375
+ };
1376
+ csr.addAttribute = function(attr) {
1377
+ _fillMissingFields([attr]);
1378
+ csr.attributes.push(attr);
1379
+ };
1380
+ csr.attributes = pki.CRIAttributesAsArray(capture.certificationRequestInfoAttributes || []);
1381
+ return csr;
1382
+ };
1383
+ /**
1384
+ * Creates an empty certification request (a CSR or certificate signing
1385
+ * request). Once created, its public key and attributes can be set and then
1386
+ * it can be signed.
1387
+ *
1388
+ * @return the empty certification request.
1389
+ */
1390
+ pki.createCertificationRequest = function() {
1391
+ var csr = {};
1392
+ csr.version = 0;
1393
+ csr.signatureOid = null;
1394
+ csr.signature = null;
1395
+ csr.siginfo = {};
1396
+ csr.siginfo.algorithmOid = null;
1397
+ csr.subject = {};
1398
+ csr.subject.getField = function(sn) {
1399
+ return _getAttribute(csr.subject, sn);
1400
+ };
1401
+ csr.subject.addField = function(attr) {
1402
+ _fillMissingFields([attr]);
1403
+ csr.subject.attributes.push(attr);
1404
+ };
1405
+ csr.subject.attributes = [];
1406
+ csr.subject.hash = null;
1407
+ csr.publicKey = null;
1408
+ csr.attributes = [];
1409
+ csr.getAttribute = function(sn) {
1410
+ return _getAttribute(csr, sn);
1411
+ };
1412
+ csr.addAttribute = function(attr) {
1413
+ _fillMissingFields([attr]);
1414
+ csr.attributes.push(attr);
1415
+ };
1416
+ csr.md = null;
1417
+ /**
1418
+ * Sets the subject of this certification request.
1419
+ *
1420
+ * @param attrs the array of subject attributes to use.
1421
+ */
1422
+ csr.setSubject = function(attrs) {
1423
+ _fillMissingFields(attrs);
1424
+ csr.subject.attributes = attrs;
1425
+ csr.subject.hash = null;
1426
+ };
1427
+ /**
1428
+ * Sets the attributes of this certification request.
1429
+ *
1430
+ * @param attrs the array of attributes to use.
1431
+ */
1432
+ csr.setAttributes = function(attrs) {
1433
+ _fillMissingFields(attrs);
1434
+ csr.attributes = attrs;
1435
+ };
1436
+ /**
1437
+ * Signs this certification request using the given private key.
1438
+ *
1439
+ * @param key the private key to sign with.
1440
+ * @param md the message digest object to use (defaults to forge.md.sha1).
1441
+ */
1442
+ csr.sign = function(key, md) {
1443
+ csr.md = md || forge.md.sha1.create();
1444
+ var algorithmOid = oids[csr.md.algorithm + "WithRSAEncryption"];
1445
+ if (!algorithmOid) {
1446
+ var error = /* @__PURE__ */ new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");
1447
+ error.algorithm = csr.md.algorithm;
1448
+ throw error;
1449
+ }
1450
+ csr.signatureOid = csr.siginfo.algorithmOid = algorithmOid;
1451
+ csr.certificationRequestInfo = pki.getCertificationRequestInfo(csr);
1452
+ var bytes = asn1.toDer(csr.certificationRequestInfo);
1453
+ csr.md.update(bytes.getBytes());
1454
+ csr.signature = key.sign(csr.md);
1455
+ };
1456
+ /**
1457
+ * Attempts verify the signature on the passed certification request using
1458
+ * its public key.
1459
+ *
1460
+ * A CSR that has been exported to a file in PEM format can be verified using
1461
+ * OpenSSL using this command:
1462
+ *
1463
+ * openssl req -in <the-csr-pem-file> -verify -noout -text
1464
+ *
1465
+ * @return true if verified, false if not.
1466
+ */
1467
+ csr.verify = function() {
1468
+ var rval = false;
1469
+ var md = csr.md;
1470
+ if (md === null) {
1471
+ md = _createSignatureDigest({
1472
+ signatureOid: csr.signatureOid,
1473
+ type: "certification request"
1474
+ });
1475
+ var cri = csr.certificationRequestInfo || pki.getCertificationRequestInfo(csr);
1476
+ var bytes = asn1.toDer(cri);
1477
+ md.update(bytes.getBytes());
1478
+ }
1479
+ if (md !== null) rval = _verifySignature({
1480
+ certificate: csr,
1481
+ md,
1482
+ signature: csr.signature
1483
+ });
1484
+ return rval;
1485
+ };
1486
+ return csr;
1487
+ };
1488
+ /**
1489
+ * Converts an X.509 subject or issuer to an ASN.1 RDNSequence.
1490
+ *
1491
+ * @param obj the subject or issuer (distinguished name).
1492
+ *
1493
+ * @return the ASN.1 RDNSequence.
1494
+ */
1495
+ function _dnToAsn1(obj) {
1496
+ var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1497
+ var attr, set;
1498
+ var attrs = obj.attributes;
1499
+ for (var i = 0; i < attrs.length; ++i) {
1500
+ attr = attrs[i];
1501
+ var value = attr.value;
1502
+ var valueTagClass = asn1.Type.PRINTABLESTRING;
1503
+ if ("valueTagClass" in attr) {
1504
+ valueTagClass = attr.valueTagClass;
1505
+ if (valueTagClass === asn1.Type.UTF8) value = forge.util.encodeUtf8(value);
1506
+ }
1507
+ set = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(attr.type).getBytes()), asn1.create(asn1.Class.UNIVERSAL, valueTagClass, false, value)])]);
1508
+ rval.value.push(set);
1509
+ }
1510
+ return rval;
1511
+ }
1512
+ /**
1513
+ * Fills in missing fields in attributes.
1514
+ *
1515
+ * @param attrs the attributes to fill missing fields in.
1516
+ */
1517
+ function _fillMissingFields(attrs) {
1518
+ var attr;
1519
+ for (var i = 0; i < attrs.length; ++i) {
1520
+ attr = attrs[i];
1521
+ if (typeof attr.name === "undefined") {
1522
+ if (attr.type && attr.type in pki.oids) attr.name = pki.oids[attr.type];
1523
+ else if (attr.shortName && attr.shortName in _shortNames) attr.name = pki.oids[_shortNames[attr.shortName]];
1524
+ }
1525
+ if (typeof attr.type === "undefined") if (attr.name && attr.name in pki.oids) attr.type = pki.oids[attr.name];
1526
+ else {
1527
+ var error = /* @__PURE__ */ new Error("Attribute type not specified.");
1528
+ error.attribute = attr;
1529
+ throw error;
1530
+ }
1531
+ if (typeof attr.shortName === "undefined") {
1532
+ if (attr.name && attr.name in _shortNames) attr.shortName = _shortNames[attr.name];
1533
+ }
1534
+ if (attr.type === oids.extensionRequest) {
1535
+ attr.valueConstructed = true;
1536
+ attr.valueTagClass = asn1.Type.SEQUENCE;
1537
+ if (!attr.value && attr.extensions) {
1538
+ attr.value = [];
1539
+ for (var ei = 0; ei < attr.extensions.length; ++ei) attr.value.push(pki.certificateExtensionToAsn1(_fillMissingExtensionFields(attr.extensions[ei])));
1540
+ }
1541
+ }
1542
+ if (typeof attr.value === "undefined") {
1543
+ var error = /* @__PURE__ */ new Error("Attribute value not specified.");
1544
+ error.attribute = attr;
1545
+ throw error;
1546
+ }
1547
+ }
1548
+ }
1549
+ /**
1550
+ * Fills in missing fields in certificate extensions.
1551
+ *
1552
+ * @param e the extension.
1553
+ * @param [options] the options to use.
1554
+ * [cert] the certificate the extensions are for.
1555
+ *
1556
+ * @return the extension.
1557
+ */
1558
+ function _fillMissingExtensionFields(e, options) {
1559
+ options = options || {};
1560
+ if (typeof e.name === "undefined") {
1561
+ if (e.id && e.id in pki.oids) e.name = pki.oids[e.id];
1562
+ }
1563
+ if (typeof e.id === "undefined") if (e.name && e.name in pki.oids) e.id = pki.oids[e.name];
1564
+ else {
1565
+ var error = /* @__PURE__ */ new Error("Extension ID not specified.");
1566
+ error.extension = e;
1567
+ throw error;
1568
+ }
1569
+ if (typeof e.value !== "undefined") return e;
1570
+ if (e.name === "keyUsage") {
1571
+ var unused = 0;
1572
+ var b2 = 0;
1573
+ var b3 = 0;
1574
+ if (e.digitalSignature) {
1575
+ b2 |= 128;
1576
+ unused = 7;
1577
+ }
1578
+ if (e.nonRepudiation) {
1579
+ b2 |= 64;
1580
+ unused = 6;
1581
+ }
1582
+ if (e.keyEncipherment) {
1583
+ b2 |= 32;
1584
+ unused = 5;
1585
+ }
1586
+ if (e.dataEncipherment) {
1587
+ b2 |= 16;
1588
+ unused = 4;
1589
+ }
1590
+ if (e.keyAgreement) {
1591
+ b2 |= 8;
1592
+ unused = 3;
1593
+ }
1594
+ if (e.keyCertSign) {
1595
+ b2 |= 4;
1596
+ unused = 2;
1597
+ }
1598
+ if (e.cRLSign) {
1599
+ b2 |= 2;
1600
+ unused = 1;
1601
+ }
1602
+ if (e.encipherOnly) {
1603
+ b2 |= 1;
1604
+ unused = 0;
1605
+ }
1606
+ if (e.decipherOnly) {
1607
+ b3 |= 128;
1608
+ unused = 7;
1609
+ }
1610
+ var value = String.fromCharCode(unused);
1611
+ if (b3 !== 0) value += String.fromCharCode(b2) + String.fromCharCode(b3);
1612
+ else if (b2 !== 0) value += String.fromCharCode(b2);
1613
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value);
1614
+ } else if (e.name === "basicConstraints") {
1615
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1616
+ if (e.cA) e.value.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, String.fromCharCode(255)));
1617
+ if ("pathLenConstraint" in e) e.value.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, asn1.integerToDer(e.pathLenConstraint).getBytes()));
1618
+ } else if (e.name === "extKeyUsage") {
1619
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1620
+ var seq = e.value.value;
1621
+ for (var key in e) {
1622
+ if (e[key] !== true) continue;
1623
+ if (key in oids) seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(oids[key]).getBytes()));
1624
+ else if (key.indexOf(".") !== -1) seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(key).getBytes()));
1625
+ }
1626
+ } else if (e.name === "nsCertType") {
1627
+ var unused = 0;
1628
+ var b2 = 0;
1629
+ if (e.client) {
1630
+ b2 |= 128;
1631
+ unused = 7;
1632
+ }
1633
+ if (e.server) {
1634
+ b2 |= 64;
1635
+ unused = 6;
1636
+ }
1637
+ if (e.email) {
1638
+ b2 |= 32;
1639
+ unused = 5;
1640
+ }
1641
+ if (e.objsign) {
1642
+ b2 |= 16;
1643
+ unused = 4;
1644
+ }
1645
+ if (e.reserved) {
1646
+ b2 |= 8;
1647
+ unused = 3;
1648
+ }
1649
+ if (e.sslCA) {
1650
+ b2 |= 4;
1651
+ unused = 2;
1652
+ }
1653
+ if (e.emailCA) {
1654
+ b2 |= 2;
1655
+ unused = 1;
1656
+ }
1657
+ if (e.objCA) {
1658
+ b2 |= 1;
1659
+ unused = 0;
1660
+ }
1661
+ var value = String.fromCharCode(unused);
1662
+ if (b2 !== 0) value += String.fromCharCode(b2);
1663
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value);
1664
+ } else if (e.name === "subjectAltName" || e.name === "issuerAltName") {
1665
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1666
+ var altName;
1667
+ for (var n = 0; n < e.altNames.length; ++n) {
1668
+ altName = e.altNames[n];
1669
+ var value = altName.value;
1670
+ if (altName.type === 7 && altName.ip) {
1671
+ value = forge.util.bytesFromIP(altName.ip);
1672
+ if (value === null) {
1673
+ var error = /* @__PURE__ */ new Error("Extension \"ip\" value is not a valid IPv4 or IPv6 address.");
1674
+ error.extension = e;
1675
+ throw error;
1676
+ }
1677
+ } else if (altName.type === 8) if (altName.oid) value = asn1.oidToDer(asn1.oidToDer(altName.oid));
1678
+ else value = asn1.oidToDer(value);
1679
+ e.value.value.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, altName.type, false, value));
1680
+ }
1681
+ } else if (e.name === "nsComment" && options.cert) {
1682
+ if (!/^[\x00-\x7F]*$/.test(e.comment) || e.comment.length < 1 || e.comment.length > 128) throw new Error("Invalid \"nsComment\" content.");
1683
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.IA5STRING, false, e.comment);
1684
+ } else if (e.name === "subjectKeyIdentifier" && options.cert) {
1685
+ var ski = options.cert.generateSubjectKeyIdentifier();
1686
+ e.subjectKeyIdentifier = ski.toHex();
1687
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, ski.getBytes());
1688
+ } else if (e.name === "authorityKeyIdentifier" && options.cert) {
1689
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1690
+ var seq = e.value.value;
1691
+ if (e.keyIdentifier) {
1692
+ var keyIdentifier = e.keyIdentifier === true ? options.cert.generateSubjectKeyIdentifier().getBytes() : e.keyIdentifier;
1693
+ seq.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, false, keyIdentifier));
1694
+ }
1695
+ if (e.authorityCertIssuer) {
1696
+ var authorityCertIssuer = [asn1.create(asn1.Class.CONTEXT_SPECIFIC, 4, true, [_dnToAsn1(e.authorityCertIssuer === true ? options.cert.issuer : e.authorityCertIssuer)])];
1697
+ seq.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, authorityCertIssuer));
1698
+ }
1699
+ if (e.serialNumber) {
1700
+ var serialNumber = forge.util.hexToBytes(e.serialNumber === true ? options.cert.serialNumber : e.serialNumber);
1701
+ seq.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, false, serialNumber));
1702
+ }
1703
+ } else if (e.name === "cRLDistributionPoints") {
1704
+ e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1705
+ var seq = e.value.value;
1706
+ var subSeq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1707
+ var fullNameGeneralNames = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []);
1708
+ var altName;
1709
+ for (var n = 0; n < e.altNames.length; ++n) {
1710
+ altName = e.altNames[n];
1711
+ var value = altName.value;
1712
+ if (altName.type === 7 && altName.ip) {
1713
+ value = forge.util.bytesFromIP(altName.ip);
1714
+ if (value === null) {
1715
+ var error = /* @__PURE__ */ new Error("Extension \"ip\" value is not a valid IPv4 or IPv6 address.");
1716
+ error.extension = e;
1717
+ throw error;
1718
+ }
1719
+ } else if (altName.type === 8) if (altName.oid) value = asn1.oidToDer(asn1.oidToDer(altName.oid));
1720
+ else value = asn1.oidToDer(value);
1721
+ fullNameGeneralNames.value.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, altName.type, false, value));
1722
+ }
1723
+ subSeq.value.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [fullNameGeneralNames]));
1724
+ seq.push(subSeq);
1725
+ }
1726
+ if (typeof e.value === "undefined") {
1727
+ var error = /* @__PURE__ */ new Error("Extension value not specified.");
1728
+ error.extension = e;
1729
+ throw error;
1730
+ }
1731
+ return e;
1732
+ }
1733
+ /**
1734
+ * Convert signature parameters object to ASN.1
1735
+ *
1736
+ * @param {String} oid Signature algorithm OID
1737
+ * @param params The signature parametrs object
1738
+ * @return ASN.1 object representing signature parameters
1739
+ */
1740
+ function _signatureParametersToAsn1(oid, params) {
1741
+ switch (oid) {
1742
+ case oids["RSASSA-PSS"]:
1743
+ var parts = [];
1744
+ if (params.hash.algorithmOid !== void 0) parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(params.hash.algorithmOid).getBytes()), asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, "")])]));
1745
+ if (params.mgf.algorithmOid !== void 0) parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(params.mgf.algorithmOid).getBytes()), asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(params.mgf.hash.algorithmOid).getBytes()), asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, "")])])]));
1746
+ if (params.saltLength !== void 0) parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, asn1.integerToDer(params.saltLength).getBytes())]));
1747
+ return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, parts);
1748
+ default: return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, "");
1749
+ }
1750
+ }
1751
+ /**
1752
+ * Converts a certification request's attributes to an ASN.1 set of
1753
+ * CRIAttributes.
1754
+ *
1755
+ * @param csr certification request.
1756
+ *
1757
+ * @return the ASN.1 set of CRIAttributes.
1758
+ */
1759
+ function _CRIAttributesToAsn1(csr) {
1760
+ var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []);
1761
+ if (csr.attributes.length === 0) return rval;
1762
+ var attrs = csr.attributes;
1763
+ for (var i = 0; i < attrs.length; ++i) {
1764
+ var attr = attrs[i];
1765
+ var value = attr.value;
1766
+ var valueTagClass = asn1.Type.UTF8;
1767
+ if ("valueTagClass" in attr) valueTagClass = attr.valueTagClass;
1768
+ if (valueTagClass === asn1.Type.UTF8) value = forge.util.encodeUtf8(value);
1769
+ var valueConstructed = false;
1770
+ if ("valueConstructed" in attr) valueConstructed = attr.valueConstructed;
1771
+ var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(attr.type).getBytes()), asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [asn1.create(asn1.Class.UNIVERSAL, valueTagClass, valueConstructed, value)])]);
1772
+ rval.value.push(seq);
1773
+ }
1774
+ return rval;
1775
+ }
1776
+ var jan_1_1950 = /* @__PURE__ */ new Date("1950-01-01T00:00:00Z");
1777
+ var jan_1_2050 = /* @__PURE__ */ new Date("2050-01-01T00:00:00Z");
1778
+ /**
1779
+ * Converts a Date object to ASN.1
1780
+ * Handles the different format before and after 1st January 2050
1781
+ *
1782
+ * @param date date object.
1783
+ *
1784
+ * @return the ASN.1 object representing the date.
1785
+ */
1786
+ function _dateToAsn1(date) {
1787
+ if (date >= jan_1_1950 && date < jan_1_2050) return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false, asn1.dateToUtcTime(date));
1788
+ else return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false, asn1.dateToGeneralizedTime(date));
1789
+ }
1790
+ /**
1791
+ * Gets the ASN.1 TBSCertificate part of an X.509v3 certificate.
1792
+ *
1793
+ * @param cert the certificate.
1794
+ *
1795
+ * @return the asn1 TBSCertificate.
1796
+ */
1797
+ pki.getTBSCertificate = function(cert) {
1798
+ var notBefore = _dateToAsn1(cert.validity.notBefore);
1799
+ var notAfter = _dateToAsn1(cert.validity.notAfter);
1800
+ var tbs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
1801
+ asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, asn1.integerToDer(cert.version).getBytes())]),
1802
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, forge.util.hexToBytes(cert.serialNumber)),
1803
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(cert.siginfo.algorithmOid).getBytes()), _signatureParametersToAsn1(cert.siginfo.algorithmOid, cert.siginfo.parameters)]),
1804
+ _dnToAsn1(cert.issuer),
1805
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [notBefore, notAfter]),
1806
+ _dnToAsn1(cert.subject),
1807
+ pki.publicKeyToAsn1(cert.publicKey)
1808
+ ]);
1809
+ if (cert.issuer.uniqueId) tbs.value.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, String.fromCharCode(0) + cert.issuer.uniqueId)]));
1810
+ if (cert.subject.uniqueId) tbs.value.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, String.fromCharCode(0) + cert.subject.uniqueId)]));
1811
+ if (cert.extensions.length > 0) tbs.value.push(pki.certificateExtensionsToAsn1(cert.extensions));
1812
+ return tbs;
1813
+ };
1814
+ /**
1815
+ * Gets the ASN.1 CertificationRequestInfo part of a
1816
+ * PKCS#10 CertificationRequest.
1817
+ *
1818
+ * @param csr the certification request.
1819
+ *
1820
+ * @return the asn1 CertificationRequestInfo.
1821
+ */
1822
+ pki.getCertificationRequestInfo = function(csr) {
1823
+ return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
1824
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, asn1.integerToDer(csr.version).getBytes()),
1825
+ _dnToAsn1(csr.subject),
1826
+ pki.publicKeyToAsn1(csr.publicKey),
1827
+ _CRIAttributesToAsn1(csr)
1828
+ ]);
1829
+ };
1830
+ /**
1831
+ * Converts a DistinguishedName (subject or issuer) to an ASN.1 object.
1832
+ *
1833
+ * @param dn the DistinguishedName.
1834
+ *
1835
+ * @return the asn1 representation of a DistinguishedName.
1836
+ */
1837
+ pki.distinguishedNameToAsn1 = function(dn) {
1838
+ return _dnToAsn1(dn);
1839
+ };
1840
+ /**
1841
+ * Converts an X.509v3 RSA certificate to an ASN.1 object.
1842
+ *
1843
+ * @param cert the certificate.
1844
+ *
1845
+ * @return the asn1 representation of an X.509v3 RSA certificate.
1846
+ */
1847
+ pki.certificateToAsn1 = function(cert) {
1848
+ var tbsCertificate = cert.tbsCertificate || pki.getTBSCertificate(cert);
1849
+ return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
1850
+ tbsCertificate,
1851
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(cert.signatureOid).getBytes()), _signatureParametersToAsn1(cert.signatureOid, cert.signatureParameters)]),
1852
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, String.fromCharCode(0) + cert.signature)
1853
+ ]);
1854
+ };
1855
+ /**
1856
+ * Converts X.509v3 certificate extensions to ASN.1.
1857
+ *
1858
+ * @param exts the extensions to convert.
1859
+ *
1860
+ * @return the extensions in ASN.1 format.
1861
+ */
1862
+ pki.certificateExtensionsToAsn1 = function(exts) {
1863
+ var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []);
1864
+ var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1865
+ rval.value.push(seq);
1866
+ for (var i = 0; i < exts.length; ++i) seq.value.push(pki.certificateExtensionToAsn1(exts[i]));
1867
+ return rval;
1868
+ };
1869
+ /**
1870
+ * Converts a single certificate extension to ASN.1.
1871
+ *
1872
+ * @param ext the extension to convert.
1873
+ *
1874
+ * @return the extension in ASN.1 format.
1875
+ */
1876
+ pki.certificateExtensionToAsn1 = function(ext) {
1877
+ var extseq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);
1878
+ extseq.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(ext.id).getBytes()));
1879
+ if (ext.critical) extseq.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, String.fromCharCode(255)));
1880
+ var value = ext.value;
1881
+ if (typeof ext.value !== "string") value = asn1.toDer(value).getBytes();
1882
+ extseq.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, value));
1883
+ return extseq;
1884
+ };
1885
+ /**
1886
+ * Converts a PKCS#10 certification request to an ASN.1 object.
1887
+ *
1888
+ * @param csr the certification request.
1889
+ *
1890
+ * @return the asn1 representation of a certification request.
1891
+ */
1892
+ pki.certificationRequestToAsn1 = function(csr) {
1893
+ var cri = csr.certificationRequestInfo || pki.getCertificationRequestInfo(csr);
1894
+ return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [
1895
+ cri,
1896
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, asn1.oidToDer(csr.signatureOid).getBytes()), _signatureParametersToAsn1(csr.signatureOid, csr.signatureParameters)]),
1897
+ asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, String.fromCharCode(0) + csr.signature)
1898
+ ]);
1899
+ };
1900
+ /**
1901
+ * Creates a CA store.
1902
+ *
1903
+ * @param certs an optional array of certificate objects or PEM-formatted
1904
+ * certificate strings to add to the CA store.
1905
+ *
1906
+ * @return the CA store.
1907
+ */
1908
+ pki.createCaStore = function(certs) {
1909
+ var caStore = { certs: {} };
1910
+ /**
1911
+ * Gets the certificate that issued the passed certificate or its
1912
+ * 'parent'.
1913
+ *
1914
+ * @param cert the certificate to get the parent for.
1915
+ *
1916
+ * @return the parent certificate or null if none was found.
1917
+ */
1918
+ caStore.getIssuer = function(cert$1) {
1919
+ return getBySubject(cert$1.issuer);
1920
+ };
1921
+ /**
1922
+ * Adds a trusted certificate to the store.
1923
+ *
1924
+ * @param cert the certificate to add as a trusted certificate (either a
1925
+ * pki.certificate object or a PEM-formatted certificate).
1926
+ */
1927
+ caStore.addCertificate = function(cert$1) {
1928
+ if (typeof cert$1 === "string") cert$1 = forge.pki.certificateFromPem(cert$1);
1929
+ ensureSubjectHasHash(cert$1.subject);
1930
+ if (!caStore.hasCertificate(cert$1)) if (cert$1.subject.hash in caStore.certs) {
1931
+ var tmp = caStore.certs[cert$1.subject.hash];
1932
+ if (!forge.util.isArray(tmp)) tmp = [tmp];
1933
+ tmp.push(cert$1);
1934
+ caStore.certs[cert$1.subject.hash] = tmp;
1935
+ } else caStore.certs[cert$1.subject.hash] = cert$1;
1936
+ };
1937
+ /**
1938
+ * Checks to see if the given certificate is in the store.
1939
+ *
1940
+ * @param cert the certificate to check (either a pki.certificate or a
1941
+ * PEM-formatted certificate).
1942
+ *
1943
+ * @return true if the certificate is in the store, false if not.
1944
+ */
1945
+ caStore.hasCertificate = function(cert$1) {
1946
+ if (typeof cert$1 === "string") cert$1 = forge.pki.certificateFromPem(cert$1);
1947
+ var match = getBySubject(cert$1.subject);
1948
+ if (!match) return false;
1949
+ if (!forge.util.isArray(match)) match = [match];
1950
+ var der1 = asn1.toDer(pki.certificateToAsn1(cert$1)).getBytes();
1951
+ for (var i$1 = 0; i$1 < match.length; ++i$1) if (der1 === asn1.toDer(pki.certificateToAsn1(match[i$1])).getBytes()) return true;
1952
+ return false;
1953
+ };
1954
+ /**
1955
+ * Lists all of the certificates kept in the store.
1956
+ *
1957
+ * @return an array of all of the pki.certificate objects in the store.
1958
+ */
1959
+ caStore.listAllCertificates = function() {
1960
+ var certList = [];
1961
+ for (var hash in caStore.certs) if (caStore.certs.hasOwnProperty(hash)) {
1962
+ var value = caStore.certs[hash];
1963
+ if (!forge.util.isArray(value)) certList.push(value);
1964
+ else for (var i$1 = 0; i$1 < value.length; ++i$1) certList.push(value[i$1]);
1965
+ }
1966
+ return certList;
1967
+ };
1968
+ /**
1969
+ * Removes a certificate from the store.
1970
+ *
1971
+ * @param cert the certificate to remove (either a pki.certificate or a
1972
+ * PEM-formatted certificate).
1973
+ *
1974
+ * @return the certificate that was removed or null if the certificate
1975
+ * wasn't in store.
1976
+ */
1977
+ caStore.removeCertificate = function(cert$1) {
1978
+ var result;
1979
+ if (typeof cert$1 === "string") cert$1 = forge.pki.certificateFromPem(cert$1);
1980
+ ensureSubjectHasHash(cert$1.subject);
1981
+ if (!caStore.hasCertificate(cert$1)) return null;
1982
+ var match = getBySubject(cert$1.subject);
1983
+ if (!forge.util.isArray(match)) {
1984
+ result = caStore.certs[cert$1.subject.hash];
1985
+ delete caStore.certs[cert$1.subject.hash];
1986
+ return result;
1987
+ }
1988
+ var der1 = asn1.toDer(pki.certificateToAsn1(cert$1)).getBytes();
1989
+ for (var i$1 = 0; i$1 < match.length; ++i$1) if (der1 === asn1.toDer(pki.certificateToAsn1(match[i$1])).getBytes()) {
1990
+ result = match[i$1];
1991
+ match.splice(i$1, 1);
1992
+ }
1993
+ if (match.length === 0) delete caStore.certs[cert$1.subject.hash];
1994
+ return result;
1995
+ };
1996
+ function getBySubject(subject) {
1997
+ ensureSubjectHasHash(subject);
1998
+ return caStore.certs[subject.hash] || null;
1999
+ }
2000
+ function ensureSubjectHasHash(subject) {
2001
+ if (!subject.hash) {
2002
+ var md = forge.md.sha1.create();
2003
+ subject.attributes = pki.RDNAttributesAsArray(_dnToAsn1(subject), md);
2004
+ subject.hash = md.digest().toHex();
2005
+ }
2006
+ }
2007
+ if (certs) for (var i = 0; i < certs.length; ++i) {
2008
+ var cert = certs[i];
2009
+ caStore.addCertificate(cert);
2010
+ }
2011
+ return caStore;
2012
+ };
2013
+ /**
2014
+ * Certificate verification errors, based on TLS.
2015
+ */
2016
+ pki.certificateError = {
2017
+ bad_certificate: "forge.pki.BadCertificate",
2018
+ unsupported_certificate: "forge.pki.UnsupportedCertificate",
2019
+ certificate_revoked: "forge.pki.CertificateRevoked",
2020
+ certificate_expired: "forge.pki.CertificateExpired",
2021
+ certificate_unknown: "forge.pki.CertificateUnknown",
2022
+ unknown_ca: "forge.pki.UnknownCertificateAuthority"
2023
+ };
2024
+ /**
2025
+ * Verifies a certificate chain against the given Certificate Authority store
2026
+ * with an optional custom verify callback.
2027
+ *
2028
+ * @param caStore a certificate store to verify against.
2029
+ * @param chain the certificate chain to verify, with the root or highest
2030
+ * authority at the end (an array of certificates).
2031
+ * @param options a callback to be called for every certificate in the chain or
2032
+ * an object with:
2033
+ * verify a callback to be called for every certificate in the
2034
+ * chain
2035
+ * validityCheckDate the date against which the certificate
2036
+ * validity period should be checked. Pass null to not check
2037
+ * the validity period. By default, the current date is used.
2038
+ *
2039
+ * The verify callback has the following signature:
2040
+ *
2041
+ * verified - Set to true if certificate was verified, otherwise the
2042
+ * pki.certificateError for why the certificate failed.
2043
+ * depth - The current index in the chain, where 0 is the end point's cert.
2044
+ * certs - The certificate chain, *NOTE* an empty chain indicates an anonymous
2045
+ * end point.
2046
+ *
2047
+ * The function returns true on success and on failure either the appropriate
2048
+ * pki.certificateError or an object with 'error' set to the appropriate
2049
+ * pki.certificateError and 'message' set to a custom error message.
2050
+ *
2051
+ * @return true if successful, error thrown if not.
2052
+ */
2053
+ pki.verifyCertificateChain = function(caStore, chain, options) {
2054
+ if (typeof options === "function") options = { verify: options };
2055
+ options = options || {};
2056
+ chain = chain.slice(0);
2057
+ var certs = chain.slice(0);
2058
+ var validityCheckDate = options.validityCheckDate;
2059
+ if (typeof validityCheckDate === "undefined") validityCheckDate = /* @__PURE__ */ new Date();
2060
+ var first = true;
2061
+ var error = null;
2062
+ var depth = 0;
2063
+ do {
2064
+ var cert = chain.shift();
2065
+ var parent = null;
2066
+ var selfSigned = false;
2067
+ if (validityCheckDate) {
2068
+ if (validityCheckDate < cert.validity.notBefore || validityCheckDate > cert.validity.notAfter) error = {
2069
+ message: "Certificate is not valid yet or has expired.",
2070
+ error: pki.certificateError.certificate_expired,
2071
+ notBefore: cert.validity.notBefore,
2072
+ notAfter: cert.validity.notAfter,
2073
+ now: validityCheckDate
2074
+ };
2075
+ }
2076
+ if (error === null) {
2077
+ parent = chain[0] || caStore.getIssuer(cert);
2078
+ if (parent === null) {
2079
+ if (cert.isIssuer(cert)) {
2080
+ selfSigned = true;
2081
+ parent = cert;
2082
+ }
2083
+ }
2084
+ if (parent) {
2085
+ var parents = parent;
2086
+ if (!forge.util.isArray(parents)) parents = [parents];
2087
+ var verified = false;
2088
+ while (!verified && parents.length > 0) {
2089
+ parent = parents.shift();
2090
+ try {
2091
+ verified = parent.verify(cert);
2092
+ } catch (ex) {}
2093
+ }
2094
+ if (!verified) error = {
2095
+ message: "Certificate signature is invalid.",
2096
+ error: pki.certificateError.bad_certificate
2097
+ };
2098
+ }
2099
+ if (error === null && (!parent || selfSigned) && !caStore.hasCertificate(cert)) error = {
2100
+ message: "Certificate is not trusted.",
2101
+ error: pki.certificateError.unknown_ca
2102
+ };
2103
+ }
2104
+ if (error === null && parent && !cert.isIssuer(parent)) error = {
2105
+ message: "Certificate issuer is invalid.",
2106
+ error: pki.certificateError.bad_certificate
2107
+ };
2108
+ if (error === null) {
2109
+ var se = {
2110
+ keyUsage: true,
2111
+ basicConstraints: true
2112
+ };
2113
+ for (var i = 0; error === null && i < cert.extensions.length; ++i) {
2114
+ var ext = cert.extensions[i];
2115
+ if (ext.critical && !(ext.name in se)) error = {
2116
+ message: "Certificate has an unsupported critical extension.",
2117
+ error: pki.certificateError.unsupported_certificate
2118
+ };
2119
+ }
2120
+ }
2121
+ if (error === null && (!first || chain.length === 0 && (!parent || selfSigned))) {
2122
+ var bcExt = cert.getExtension("basicConstraints");
2123
+ var keyUsageExt = cert.getExtension("keyUsage");
2124
+ if (keyUsageExt !== null) {
2125
+ if (!keyUsageExt.keyCertSign || bcExt === null) error = {
2126
+ message: "Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",
2127
+ error: pki.certificateError.bad_certificate
2128
+ };
2129
+ }
2130
+ if (error === null && bcExt !== null && !bcExt.cA) error = {
2131
+ message: "Certificate basicConstraints indicates the certificate is not a CA.",
2132
+ error: pki.certificateError.bad_certificate
2133
+ };
2134
+ if (error === null && keyUsageExt !== null && "pathLenConstraint" in bcExt) {
2135
+ if (depth - 1 > bcExt.pathLenConstraint) error = {
2136
+ message: "Certificate basicConstraints pathLenConstraint violated.",
2137
+ error: pki.certificateError.bad_certificate
2138
+ };
2139
+ }
2140
+ }
2141
+ var vfd = error === null ? true : error.error;
2142
+ var ret = options.verify ? options.verify(vfd, depth, certs) : vfd;
2143
+ if (ret === true) error = null;
2144
+ else {
2145
+ if (vfd === true) error = {
2146
+ message: "The application rejected the certificate.",
2147
+ error: pki.certificateError.bad_certificate
2148
+ };
2149
+ if (ret || ret === 0) {
2150
+ if (typeof ret === "object" && !forge.util.isArray(ret)) {
2151
+ if (ret.message) error.message = ret.message;
2152
+ if (ret.error) error.error = ret.error;
2153
+ } else if (typeof ret === "string") error.error = ret;
2154
+ }
2155
+ throw error;
2156
+ }
2157
+ first = false;
2158
+ ++depth;
2159
+ } while (chain.length > 0);
2160
+ return true;
2161
+ };
2162
+ }) });
2163
+
2164
+ //#endregion
2165
+ export default require_x509();
2166
+
2167
+ export { require_x509 };
2168
+ //# sourceMappingURL=x509.mjs.map