pi-codex-auto-review 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1057) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +10 -0
  3. package/README.md +77 -0
  4. package/dist/approvals.d.ts +72 -0
  5. package/dist/approvals.js +167 -0
  6. package/dist/approvals.js.map +1 -0
  7. package/dist/audit.d.ts +28 -0
  8. package/dist/audit.js +40 -0
  9. package/dist/audit.js.map +1 -0
  10. package/dist/cli.d.ts +2 -0
  11. package/dist/cli.js +70 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/context-files.d.ts +14 -0
  14. package/dist/context-files.js +113 -0
  15. package/dist/context-files.js.map +1 -0
  16. package/dist/contracts.d.ts +258 -0
  17. package/dist/contracts.js +102 -0
  18. package/dist/contracts.js.map +1 -0
  19. package/dist/index.d.ts +28 -0
  20. package/dist/index.js +106 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/native/darwin-arm64/artifact.json +5 -0
  23. package/dist/native/darwin-arm64/pi-guard-execpolicy +0 -0
  24. package/dist/native/linux-x64/artifact.json +5 -0
  25. package/dist/native/linux-x64/pi-guard-execpolicy +0 -0
  26. package/dist/policy/domains.d.ts +5 -0
  27. package/dist/policy/domains.js +18 -0
  28. package/dist/policy/domains.js.map +1 -0
  29. package/dist/policy/index.d.ts +56 -0
  30. package/dist/policy/index.js +304 -0
  31. package/dist/policy/index.js.map +1 -0
  32. package/dist/policy/paths.d.ts +5 -0
  33. package/dist/policy/paths.js +54 -0
  34. package/dist/policy/paths.js.map +1 -0
  35. package/dist/policy/rules.d.ts +36 -0
  36. package/dist/policy/rules.js +61 -0
  37. package/dist/policy/rules.js.map +1 -0
  38. package/dist/policy/shell.d.ts +14 -0
  39. package/dist/policy/shell.js +122 -0
  40. package/dist/policy/shell.js.map +1 -0
  41. package/dist/reports.d.ts +21 -0
  42. package/dist/reports.js +42 -0
  43. package/dist/reports.js.map +1 -0
  44. package/dist/review/context.d.ts +25 -0
  45. package/dist/review/context.js +108 -0
  46. package/dist/review/context.js.map +1 -0
  47. package/dist/review/investigation.d.ts +39 -0
  48. package/dist/review/investigation.js +36 -0
  49. package/dist/review/investigation.js.map +1 -0
  50. package/dist/review/lifecycle.d.ts +29 -0
  51. package/dist/review/lifecycle.js +71 -0
  52. package/dist/review/lifecycle.js.map +1 -0
  53. package/dist/review/policy.d.ts +4 -0
  54. package/dist/review/policy.js +15 -0
  55. package/dist/review/policy.js.map +1 -0
  56. package/dist/review/upstream-policy.d.ts +2 -0
  57. package/dist/review/upstream-policy.js +210 -0
  58. package/dist/review/upstream-policy.js.map +1 -0
  59. package/dist/reviewer.d.ts +45 -0
  60. package/dist/reviewer.js +148 -0
  61. package/dist/reviewer.js.map +1 -0
  62. package/dist/sandbox/broker.d.ts +1 -0
  63. package/dist/sandbox/broker.js +135 -0
  64. package/dist/sandbox/broker.js.map +1 -0
  65. package/dist/sandbox/config.d.ts +5 -0
  66. package/dist/sandbox/config.js +91 -0
  67. package/dist/sandbox/config.js.map +1 -0
  68. package/dist/sandbox/executor.d.ts +20 -0
  69. package/dist/sandbox/executor.js +144 -0
  70. package/dist/sandbox/executor.js.map +1 -0
  71. package/dist/sandbox/hard-links.d.ts +4 -0
  72. package/dist/sandbox/hard-links.js +145 -0
  73. package/dist/sandbox/hard-links.js.map +1 -0
  74. package/dist/sandbox/linux-read-paths.d.ts +7 -0
  75. package/dist/sandbox/linux-read-paths.js +47 -0
  76. package/dist/sandbox/linux-read-paths.js.map +1 -0
  77. package/dist/sandbox/paths.d.ts +3 -0
  78. package/dist/sandbox/paths.js +10 -0
  79. package/dist/sandbox/paths.js.map +1 -0
  80. package/dist/sandbox/runtime-write-paths.d.ts +2 -0
  81. package/dist/sandbox/runtime-write-paths.js +8 -0
  82. package/dist/sandbox/runtime-write-paths.js.map +1 -0
  83. package/dist/sandbox/seccomp.d.ts +5 -0
  84. package/dist/sandbox/seccomp.js +16 -0
  85. package/dist/sandbox/seccomp.js.map +1 -0
  86. package/dist/sandbox/worker.d.ts +1 -0
  87. package/dist/sandbox/worker.js +73 -0
  88. package/dist/sandbox/worker.js.map +1 -0
  89. package/dist/signals.d.ts +10 -0
  90. package/dist/signals.js +21 -0
  91. package/dist/signals.js.map +1 -0
  92. package/dist/startup.d.ts +22 -0
  93. package/dist/startup.js +100 -0
  94. package/dist/startup.js.map +1 -0
  95. package/dist/tools/controller.d.ts +63 -0
  96. package/dist/tools/controller.js +286 -0
  97. package/dist/tools/controller.js.map +1 -0
  98. package/dist/tools/external.d.ts +30 -0
  99. package/dist/tools/external.js +24 -0
  100. package/dist/tools/external.js.map +1 -0
  101. package/dist/tools/mcp.d.ts +17 -0
  102. package/dist/tools/mcp.js +186 -0
  103. package/dist/tools/mcp.js.map +1 -0
  104. package/docs/publishing.md +73 -0
  105. package/docs/security/dependencies.md +43 -0
  106. package/docs/testing/auto-review-protection.md +130 -0
  107. package/docs/usage.md +217 -0
  108. package/native/execpolicy/LICENSE +201 -0
  109. package/native/execpolicy/NOTICE +6 -0
  110. package/node_modules/@anthropic-ai/sandbox-runtime/LICENSE +201 -0
  111. package/node_modules/@anthropic-ai/sandbox-runtime/README.md +901 -0
  112. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.d.ts +3 -0
  113. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.d.ts.map +1 -0
  114. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.js +472 -0
  115. package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.js.map +1 -0
  116. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.d.ts +19 -0
  117. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.d.ts.map +1 -0
  118. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.js +17 -0
  119. package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.js.map +1 -0
  120. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.d.ts +52 -0
  121. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.d.ts.map +1 -0
  122. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.js +153 -0
  123. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.js.map +1 -0
  124. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.d.ts +164 -0
  125. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.d.ts.map +1 -0
  126. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.js +246 -0
  127. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.js.map +1 -0
  128. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.d.ts +58 -0
  129. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.d.ts.map +1 -0
  130. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.js +128 -0
  131. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.js.map +1 -0
  132. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.d.ts +124 -0
  133. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.d.ts.map +1 -0
  134. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.js +258 -0
  135. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.js.map +1 -0
  136. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.d.ts +87 -0
  137. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.d.ts.map +1 -0
  138. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.js +138 -0
  139. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.js.map +1 -0
  140. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.d.ts +67 -0
  141. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.d.ts.map +1 -0
  142. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.js +113 -0
  143. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.js.map +1 -0
  144. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.d.ts +70 -0
  145. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.d.ts.map +1 -0
  146. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.js +171 -0
  147. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.js.map +1 -0
  148. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.d.ts +120 -0
  149. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.d.ts.map +1 -0
  150. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.js +281 -0
  151. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.js.map +1 -0
  152. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.d.ts +108 -0
  153. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.d.ts.map +1 -0
  154. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.js +208 -0
  155. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.js.map +1 -0
  156. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.d.ts +82 -0
  157. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.d.ts.map +1 -0
  158. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.js +155 -0
  159. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.js.map +1 -0
  160. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.d.ts +44 -0
  161. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.d.ts.map +1 -0
  162. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.js +220 -0
  163. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.js.map +1 -0
  164. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.d.ts +150 -0
  165. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.d.ts.map +1 -0
  166. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.js +678 -0
  167. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.js.map +1 -0
  168. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.d.ts +32 -0
  169. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.d.ts.map +1 -0
  170. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.js +111 -0
  171. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.js.map +1 -0
  172. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.d.ts +305 -0
  173. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -0
  174. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.js +2605 -0
  175. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.js.map +1 -0
  176. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.d.ts +55 -0
  177. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.d.ts.map +1 -0
  178. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.js +152 -0
  179. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.js.map +1 -0
  180. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.d.ts +12 -0
  181. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.d.ts.map +1 -0
  182. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.js +43 -0
  183. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.js.map +1 -0
  184. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.d.ts +116 -0
  185. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -0
  186. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.js +1195 -0
  187. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.js.map +1 -0
  188. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.d.ts +200 -0
  189. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.d.ts.map +1 -0
  190. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.js +443 -0
  191. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.js.map +1 -0
  192. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.d.ts +28 -0
  193. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.d.ts.map +1 -0
  194. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.js +114 -0
  195. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.js.map +1 -0
  196. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.d.ts +59 -0
  197. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.d.ts.map +1 -0
  198. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.js +159 -0
  199. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.js.map +1 -0
  200. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.d.ts +147 -0
  201. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.d.ts.map +1 -0
  202. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.js +445 -0
  203. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.js.map +1 -0
  204. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.d.ts +17 -0
  205. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.d.ts.map +1 -0
  206. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.js +163 -0
  207. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.js.map +1 -0
  208. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.d.ts +83 -0
  209. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.d.ts.map +1 -0
  210. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.js +212 -0
  211. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.js.map +1 -0
  212. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.d.ts +76 -0
  213. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.d.ts.map +1 -0
  214. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.js +221 -0
  215. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.js.map +1 -0
  216. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.d.ts +1691 -0
  217. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.d.ts.map +1 -0
  218. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.js +1233 -0
  219. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.js.map +1 -0
  220. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.d.ts +97 -0
  221. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.d.ts.map +1 -0
  222. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.js +1937 -0
  223. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.js.map +1 -0
  224. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.d.ts +113 -0
  225. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.d.ts.map +1 -0
  226. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.js +3 -0
  227. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.js.map +1 -0
  228. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.d.ts +411 -0
  229. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.d.ts.map +1 -0
  230. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.js +1408 -0
  231. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.js.map +1 -0
  232. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.d.ts +37 -0
  233. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.d.ts.map +1 -0
  234. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.js +125 -0
  235. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.js.map +1 -0
  236. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.d.ts +57 -0
  237. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.d.ts.map +1 -0
  238. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.js +332 -0
  239. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.js.map +1 -0
  240. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.d.ts +100 -0
  241. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.d.ts.map +1 -0
  242. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.js +546 -0
  243. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.js.map +1 -0
  244. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.d.ts +923 -0
  245. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.d.ts.map +1 -0
  246. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.js +1419 -0
  247. package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.js.map +1 -0
  248. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.d.ts +31 -0
  249. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.d.ts.map +1 -0
  250. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.js +69 -0
  251. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.js.map +1 -0
  252. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.d.ts +7 -0
  253. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.d.ts.map +1 -0
  254. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.js +25 -0
  255. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.js.map +1 -0
  256. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.d.ts +15 -0
  257. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.d.ts.map +1 -0
  258. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.js +49 -0
  259. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.js.map +1 -0
  260. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.d.ts +17 -0
  261. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.d.ts.map +1 -0
  262. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.js +37 -0
  263. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.js.map +1 -0
  264. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.d.ts +27 -0
  265. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.d.ts.map +1 -0
  266. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.js +47 -0
  267. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.js.map +1 -0
  268. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.d.ts +9 -0
  269. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.d.ts.map +1 -0
  270. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.js +25 -0
  271. package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.js.map +1 -0
  272. package/node_modules/@anthropic-ai/sandbox-runtime/package.json +88 -0
  273. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/java-proxy-agent/build.ts +95 -0
  274. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/java-proxy-agent/srt-proxy-agent.jar +0 -0
  275. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/arm64/apply-seccomp +0 -0
  276. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/build.ts +69 -0
  277. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/x64/apply-seccomp +0 -0
  278. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/arm64/srt-win.exe +0 -0
  279. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/build.ts +28 -0
  280. package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/x64/srt-win.exe +0 -0
  281. package/node_modules/@pondwader/socks5-server/.github/workflows/ci.yml +27 -0
  282. package/node_modules/@pondwader/socks5-server/LICENSE +20 -0
  283. package/node_modules/@pondwader/socks5-server/README.md +151 -0
  284. package/node_modules/@pondwader/socks5-server/dist/index.d.mts +87 -0
  285. package/node_modules/@pondwader/socks5-server/dist/index.d.ts +87 -0
  286. package/node_modules/@pondwader/socks5-server/dist/index.js +346 -0
  287. package/node_modules/@pondwader/socks5-server/dist/index.mjs +307 -0
  288. package/node_modules/@pondwader/socks5-server/package.json +31 -0
  289. package/node_modules/commander/LICENSE +22 -0
  290. package/node_modules/commander/Readme.md +1157 -0
  291. package/node_modules/commander/esm.mjs +16 -0
  292. package/node_modules/commander/index.js +24 -0
  293. package/node_modules/commander/lib/argument.js +149 -0
  294. package/node_modules/commander/lib/command.js +2509 -0
  295. package/node_modules/commander/lib/error.js +39 -0
  296. package/node_modules/commander/lib/help.js +520 -0
  297. package/node_modules/commander/lib/option.js +330 -0
  298. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  299. package/node_modules/commander/package-support.json +16 -0
  300. package/node_modules/commander/package.json +84 -0
  301. package/node_modules/commander/typings/esm.d.mts +3 -0
  302. package/node_modules/commander/typings/index.d.ts +969 -0
  303. package/node_modules/node-forge/.editorconfig +17 -0
  304. package/node_modules/node-forge/.eslintrc.js +24 -0
  305. package/node_modules/node-forge/.github/workflows/main.yaml +96 -0
  306. package/node_modules/node-forge/.istanbul.yml +2 -0
  307. package/node_modules/node-forge/.npmignore +15 -0
  308. package/node_modules/node-forge/CHANGELOG.md +555 -0
  309. package/node_modules/node-forge/CONTRIBUTING.md +18 -0
  310. package/node_modules/node-forge/LICENSE +331 -0
  311. package/node_modules/node-forge/README.md +2071 -0
  312. package/node_modules/node-forge/RELEASE.md +19 -0
  313. package/node_modules/node-forge/SECURITY.md +5 -0
  314. package/node_modules/node-forge/examples/create-cert.js +110 -0
  315. package/node_modules/node-forge/examples/create-csr.js +66 -0
  316. package/node_modules/node-forge/examples/create-pkcs12.js +160 -0
  317. package/node_modules/node-forge/examples/imap.js +46 -0
  318. package/node_modules/node-forge/examples/sign-p7.js +115 -0
  319. package/node_modules/node-forge/examples/tls.js +189 -0
  320. package/node_modules/node-forge/flash/PooledSocket.as +18 -0
  321. package/node_modules/node-forge/flash/README.md +48 -0
  322. package/node_modules/node-forge/flash/SocketEvent.as +36 -0
  323. package/node_modules/node-forge/flash/SocketPool.as +754 -0
  324. package/node_modules/node-forge/flash/mod_fsp/README +135 -0
  325. package/node_modules/node-forge/flash/mod_fsp/mod_fsp.c +415 -0
  326. package/node_modules/node-forge/flash/package.json +28 -0
  327. package/node_modules/node-forge/flash/policyserver.js +65 -0
  328. package/node_modules/node-forge/flash/policyserver.py +112 -0
  329. package/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
  330. package/node_modules/node-forge/karma-sauce.conf.js +79 -0
  331. package/node_modules/node-forge/karma.conf.js +133 -0
  332. package/node_modules/node-forge/lib/aes.js +1091 -0
  333. package/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
  334. package/node_modules/node-forge/lib/asn1-validator.js +91 -0
  335. package/node_modules/node-forge/lib/asn1.js +1503 -0
  336. package/node_modules/node-forge/lib/baseN.js +186 -0
  337. package/node_modules/node-forge/lib/cipher.js +230 -0
  338. package/node_modules/node-forge/lib/cipherModes.js +999 -0
  339. package/node_modules/node-forge/lib/des.js +496 -0
  340. package/node_modules/node-forge/lib/ed25519.js +1091 -0
  341. package/node_modules/node-forge/lib/forge.js +13 -0
  342. package/node_modules/node-forge/lib/form.js +149 -0
  343. package/node_modules/node-forge/lib/hmac.js +146 -0
  344. package/node_modules/node-forge/lib/http.js +1346 -0
  345. package/node_modules/node-forge/lib/index.all.js +16 -0
  346. package/node_modules/node-forge/lib/index.js +33 -0
  347. package/node_modules/node-forge/lib/jsbn.js +1294 -0
  348. package/node_modules/node-forge/lib/kem.js +168 -0
  349. package/node_modules/node-forge/lib/log.js +319 -0
  350. package/node_modules/node-forge/lib/md.all.js +13 -0
  351. package/node_modules/node-forge/lib/md.js +11 -0
  352. package/node_modules/node-forge/lib/md5.js +289 -0
  353. package/node_modules/node-forge/lib/mgf.js +12 -0
  354. package/node_modules/node-forge/lib/mgf1.js +57 -0
  355. package/node_modules/node-forge/lib/oids.js +180 -0
  356. package/node_modules/node-forge/lib/pbe.js +1023 -0
  357. package/node_modules/node-forge/lib/pbkdf2.js +211 -0
  358. package/node_modules/node-forge/lib/pem.js +237 -0
  359. package/node_modules/node-forge/lib/pkcs1.js +276 -0
  360. package/node_modules/node-forge/lib/pkcs12.js +1078 -0
  361. package/node_modules/node-forge/lib/pkcs7.js +1260 -0
  362. package/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
  363. package/node_modules/node-forge/lib/pki.js +102 -0
  364. package/node_modules/node-forge/lib/prime.js +297 -0
  365. package/node_modules/node-forge/lib/prime.worker.js +168 -0
  366. package/node_modules/node-forge/lib/prng.js +419 -0
  367. package/node_modules/node-forge/lib/pss.js +241 -0
  368. package/node_modules/node-forge/lib/random.js +191 -0
  369. package/node_modules/node-forge/lib/rc2.js +410 -0
  370. package/node_modules/node-forge/lib/rsa.js +1973 -0
  371. package/node_modules/node-forge/lib/sha1.js +319 -0
  372. package/node_modules/node-forge/lib/sha256.js +327 -0
  373. package/node_modules/node-forge/lib/sha512.js +561 -0
  374. package/node_modules/node-forge/lib/socket.js +287 -0
  375. package/node_modules/node-forge/lib/ssh.js +236 -0
  376. package/node_modules/node-forge/lib/tls.js +4282 -0
  377. package/node_modules/node-forge/lib/tlssocket.js +249 -0
  378. package/node_modules/node-forge/lib/util.js +2652 -0
  379. package/node_modules/node-forge/lib/x509.js +3251 -0
  380. package/node_modules/node-forge/lib/xhr.js +738 -0
  381. package/node_modules/node-forge/package.json +123 -0
  382. package/node_modules/node-forge/tests/.eslintrc.js +5 -0
  383. package/node_modules/node-forge/tests/README.md +4 -0
  384. package/node_modules/node-forge/tests/benchmarks/aes-speed.js +62 -0
  385. package/node_modules/node-forge/tests/benchmarks/so-44303784.js +246 -0
  386. package/node_modules/node-forge/tests/flash/README.md +7 -0
  387. package/node_modules/node-forge/tests/flash/Test.as +96 -0
  388. package/node_modules/node-forge/tests/flash/build-flash.xml +7 -0
  389. package/node_modules/node-forge/tests/flash/index.html +28 -0
  390. package/node_modules/node-forge/tests/index.html +33 -0
  391. package/node_modules/node-forge/tests/issues/heartbleed.js +55 -0
  392. package/node_modules/node-forge/tests/issues/issue-428.html +95 -0
  393. package/node_modules/node-forge/tests/issues/issue-428.js +375 -0
  394. package/node_modules/node-forge/tests/karma/index.js +8 -0
  395. package/node_modules/node-forge/tests/karma/testWorker.js +65 -0
  396. package/node_modules/node-forge/tests/karma/web-worker-rsa.js +55 -0
  397. package/node_modules/node-forge/tests/legacy/common.html +65 -0
  398. package/node_modules/node-forge/tests/legacy/common.js +2199 -0
  399. package/node_modules/node-forge/tests/legacy/form.html +148 -0
  400. package/node_modules/node-forge/tests/legacy/form.js +40 -0
  401. package/node_modules/node-forge/tests/legacy/http.html +235 -0
  402. package/node_modules/node-forge/tests/legacy/index.html +70 -0
  403. package/node_modules/node-forge/tests/legacy/keygen.html +113 -0
  404. package/node_modules/node-forge/tests/legacy/login.css +26 -0
  405. package/node_modules/node-forge/tests/legacy/loginDemo.html +32 -0
  406. package/node_modules/node-forge/tests/legacy/loginDemo.js +149 -0
  407. package/node_modules/node-forge/tests/legacy/performance.html +533 -0
  408. package/node_modules/node-forge/tests/legacy/result.txt +1 -0
  409. package/node_modules/node-forge/tests/legacy/socketPool.html +302 -0
  410. package/node_modules/node-forge/tests/legacy/tasks.html +54 -0
  411. package/node_modules/node-forge/tests/legacy/tasks.js +378 -0
  412. package/node_modules/node-forge/tests/legacy/tls.html +389 -0
  413. package/node_modules/node-forge/tests/legacy/webid.html +89 -0
  414. package/node_modules/node-forge/tests/legacy/webid.js +313 -0
  415. package/node_modules/node-forge/tests/legacy/ws-webid.js +120 -0
  416. package/node_modules/node-forge/tests/legacy/xhr.html +67 -0
  417. package/node_modules/node-forge/tests/legacy/xhr.js +590 -0
  418. package/node_modules/node-forge/tests/pocs/ghsa-2328-f5f3-gj25.js +85 -0
  419. package/node_modules/node-forge/tests/pocs/ghsa-ppp5-5v6c-4jwp.js +166 -0
  420. package/node_modules/node-forge/tests/pocs/ghsa-q67f-28xg-22rw.js +103 -0
  421. package/node_modules/node-forge/tests/security/cve-2025-12816.js +75 -0
  422. package/node_modules/node-forge/tests/security/ghsa-554w-wpv2-vw27.js +81 -0
  423. package/node_modules/node-forge/tests/security/index.js +3 -0
  424. package/node_modules/node-forge/tests/server.crt +26 -0
  425. package/node_modules/node-forge/tests/server.js +87 -0
  426. package/node_modules/node-forge/tests/server.key +27 -0
  427. package/node_modules/node-forge/tests/support/task.js +718 -0
  428. package/node_modules/node-forge/tests/tests.css +61 -0
  429. package/node_modules/node-forge/tests/unit/aes.js +1498 -0
  430. package/node_modules/node-forge/tests/unit/asn1.js +1337 -0
  431. package/node_modules/node-forge/tests/unit/csr.js +129 -0
  432. package/node_modules/node-forge/tests/unit/des.js +231 -0
  433. package/node_modules/node-forge/tests/unit/ed25519.js +395 -0
  434. package/node_modules/node-forge/tests/unit/forge.js +2 -0
  435. package/node_modules/node-forge/tests/unit/hmac.js +64 -0
  436. package/node_modules/node-forge/tests/unit/index.html +20 -0
  437. package/node_modules/node-forge/tests/unit/index.js +27 -0
  438. package/node_modules/node-forge/tests/unit/jsbn.js +40 -0
  439. package/node_modules/node-forge/tests/unit/kem.js +167 -0
  440. package/node_modules/node-forge/tests/unit/md5.js +114 -0
  441. package/node_modules/node-forge/tests/unit/mgf1.js +16 -0
  442. package/node_modules/node-forge/tests/unit/pbkdf2.js +182 -0
  443. package/node_modules/node-forge/tests/unit/pem.js +159 -0
  444. package/node_modules/node-forge/tests/unit/pkcs1.js +1077 -0
  445. package/node_modules/node-forge/tests/unit/pkcs12.js +739 -0
  446. package/node_modules/node-forge/tests/unit/pkcs7.js +792 -0
  447. package/node_modules/node-forge/tests/unit/random.js +48 -0
  448. package/node_modules/node-forge/tests/unit/rc2.js +88 -0
  449. package/node_modules/node-forge/tests/unit/rsa.js +1278 -0
  450. package/node_modules/node-forge/tests/unit/sha1.js +72 -0
  451. package/node_modules/node-forge/tests/unit/sha256.js +79 -0
  452. package/node_modules/node-forge/tests/unit/sha512.js +200 -0
  453. package/node_modules/node-forge/tests/unit/ssh.js +175 -0
  454. package/node_modules/node-forge/tests/unit/tls.js +175 -0
  455. package/node_modules/node-forge/tests/unit/util.js +595 -0
  456. package/node_modules/node-forge/tests/unit/x509.js +1986 -0
  457. package/node_modules/node-forge/tests/websockets/server-webid.js +495 -0
  458. package/node_modules/node-forge/tests/websockets/server-ws.js +158 -0
  459. package/node_modules/node-forge/webpack-tests.config.js +26 -0
  460. package/node_modules/node-forge/webpack.config.js +130 -0
  461. package/node_modules/zod/LICENSE +21 -0
  462. package/node_modules/zod/README.md +208 -0
  463. package/node_modules/zod/index.cjs +33 -0
  464. package/node_modules/zod/index.d.cts +4 -0
  465. package/node_modules/zod/index.d.ts +4 -0
  466. package/node_modules/zod/index.js +4 -0
  467. package/node_modules/zod/package.json +118 -0
  468. package/node_modules/zod/src/index.ts +4 -0
  469. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  470. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  471. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  472. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  473. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  474. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  475. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  476. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  477. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  478. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  479. package/node_modules/zod/src/v3/errors.ts +13 -0
  480. package/node_modules/zod/src/v3/external.ts +6 -0
  481. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  482. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  483. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  484. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  485. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  486. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  487. package/node_modules/zod/src/v3/index.ts +4 -0
  488. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  489. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  490. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  491. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  492. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  493. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  494. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  495. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  496. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  497. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  498. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  499. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  500. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  501. package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
  502. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  503. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  504. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  505. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  506. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  507. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  508. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  509. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  510. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  511. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  512. package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
  513. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  514. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  515. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  516. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  517. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  518. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  519. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  520. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  521. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  522. package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
  523. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  524. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  525. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  526. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  527. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  528. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  529. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  530. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  531. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  532. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  533. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  534. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  535. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  536. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  537. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  538. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  539. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  540. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  541. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  542. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  543. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  544. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  545. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  546. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  547. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  548. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  549. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  550. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  551. package/node_modules/zod/src/v3/types.ts +5136 -0
  552. package/node_modules/zod/src/v4/classic/checks.ts +30 -0
  553. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  554. package/node_modules/zod/src/v4/classic/compat.ts +66 -0
  555. package/node_modules/zod/src/v4/classic/errors.ts +75 -0
  556. package/node_modules/zod/src/v4/classic/external.ts +50 -0
  557. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  558. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  559. package/node_modules/zod/src/v4/classic/parse.ts +33 -0
  560. package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
  561. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  562. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  563. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
  564. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  565. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  566. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  567. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  568. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
  569. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
  570. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  571. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  572. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
  573. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  574. package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
  575. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
  576. package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
  577. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  578. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
  579. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  580. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
  581. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  582. package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
  583. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
  584. package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
  585. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  586. package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
  587. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
  588. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
  589. package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
  590. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  591. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
  592. package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
  593. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  594. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  595. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
  596. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  597. package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
  598. package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
  599. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
  600. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
  601. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
  602. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
  603. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  604. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
  605. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  606. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  607. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  608. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  609. package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
  610. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
  611. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
  612. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
  613. package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
  614. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
  615. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
  616. package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
  617. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
  618. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
  619. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
  620. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
  621. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
  622. package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
  623. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  624. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  625. package/node_modules/zod/src/v4/core/api.ts +1594 -0
  626. package/node_modules/zod/src/v4/core/checks.ts +1283 -0
  627. package/node_modules/zod/src/v4/core/config.ts +15 -0
  628. package/node_modules/zod/src/v4/core/core.ts +134 -0
  629. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  630. package/node_modules/zod/src/v4/core/errors.ts +424 -0
  631. package/node_modules/zod/src/v4/core/function.ts +176 -0
  632. package/node_modules/zod/src/v4/core/index.ts +15 -0
  633. package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
  634. package/node_modules/zod/src/v4/core/parse.ts +94 -0
  635. package/node_modules/zod/src/v4/core/regexes.ts +135 -0
  636. package/node_modules/zod/src/v4/core/registries.ts +96 -0
  637. package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
  638. package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
  639. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  640. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  641. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  642. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  643. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  644. package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
  645. package/node_modules/zod/src/v4/core/util.ts +775 -0
  646. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  647. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  648. package/node_modules/zod/src/v4/index.ts +4 -0
  649. package/node_modules/zod/src/v4/locales/ar.ts +125 -0
  650. package/node_modules/zod/src/v4/locales/az.ts +121 -0
  651. package/node_modules/zod/src/v4/locales/be.ts +184 -0
  652. package/node_modules/zod/src/v4/locales/ca.ts +127 -0
  653. package/node_modules/zod/src/v4/locales/cs.ts +142 -0
  654. package/node_modules/zod/src/v4/locales/de.ts +124 -0
  655. package/node_modules/zod/src/v4/locales/en.ts +127 -0
  656. package/node_modules/zod/src/v4/locales/eo.ts +125 -0
  657. package/node_modules/zod/src/v4/locales/es.ts +125 -0
  658. package/node_modules/zod/src/v4/locales/fa.ts +134 -0
  659. package/node_modules/zod/src/v4/locales/fi.ts +131 -0
  660. package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
  661. package/node_modules/zod/src/v4/locales/fr.ts +124 -0
  662. package/node_modules/zod/src/v4/locales/he.ts +125 -0
  663. package/node_modules/zod/src/v4/locales/hu.ts +126 -0
  664. package/node_modules/zod/src/v4/locales/id.ts +125 -0
  665. package/node_modules/zod/src/v4/locales/index.ts +39 -0
  666. package/node_modules/zod/src/v4/locales/it.ts +125 -0
  667. package/node_modules/zod/src/v4/locales/ja.ts +122 -0
  668. package/node_modules/zod/src/v4/locales/kh.ts +126 -0
  669. package/node_modules/zod/src/v4/locales/ko.ts +131 -0
  670. package/node_modules/zod/src/v4/locales/mk.ts +127 -0
  671. package/node_modules/zod/src/v4/locales/ms.ts +124 -0
  672. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  673. package/node_modules/zod/src/v4/locales/no.ts +124 -0
  674. package/node_modules/zod/src/v4/locales/ota.ts +125 -0
  675. package/node_modules/zod/src/v4/locales/pl.ts +126 -0
  676. package/node_modules/zod/src/v4/locales/ps.ts +133 -0
  677. package/node_modules/zod/src/v4/locales/pt.ts +123 -0
  678. package/node_modules/zod/src/v4/locales/ru.ts +184 -0
  679. package/node_modules/zod/src/v4/locales/sl.ts +126 -0
  680. package/node_modules/zod/src/v4/locales/sv.ts +127 -0
  681. package/node_modules/zod/src/v4/locales/ta.ts +125 -0
  682. package/node_modules/zod/src/v4/locales/th.ts +126 -0
  683. package/node_modules/zod/src/v4/locales/tr.ts +121 -0
  684. package/node_modules/zod/src/v4/locales/ua.ts +126 -0
  685. package/node_modules/zod/src/v4/locales/ur.ts +126 -0
  686. package/node_modules/zod/src/v4/locales/vi.ts +125 -0
  687. package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
  688. package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
  689. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  690. package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
  691. package/node_modules/zod/src/v4/mini/external.ts +40 -0
  692. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  693. package/node_modules/zod/src/v4/mini/iso.ts +62 -0
  694. package/node_modules/zod/src/v4/mini/parse.ts +1 -0
  695. package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
  696. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  697. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
  698. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  699. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  700. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  701. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
  702. package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
  703. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  704. package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
  705. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  706. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  707. package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
  708. package/node_modules/zod/src/v4-mini/index.ts +1 -0
  709. package/node_modules/zod/v3/ZodError.cjs +138 -0
  710. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  711. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  712. package/node_modules/zod/v3/ZodError.js +133 -0
  713. package/node_modules/zod/v3/errors.cjs +17 -0
  714. package/node_modules/zod/v3/errors.d.cts +5 -0
  715. package/node_modules/zod/v3/errors.d.ts +5 -0
  716. package/node_modules/zod/v3/errors.js +9 -0
  717. package/node_modules/zod/v3/external.cjs +22 -0
  718. package/node_modules/zod/v3/external.d.cts +6 -0
  719. package/node_modules/zod/v3/external.d.ts +6 -0
  720. package/node_modules/zod/v3/external.js +6 -0
  721. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  722. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  723. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  724. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  725. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  726. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  727. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  728. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  729. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  730. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  731. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  732. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  733. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  734. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  735. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  736. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  737. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  738. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  739. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  740. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  741. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  742. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  743. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  744. package/node_modules/zod/v3/helpers/util.js +133 -0
  745. package/node_modules/zod/v3/index.cjs +33 -0
  746. package/node_modules/zod/v3/index.d.cts +4 -0
  747. package/node_modules/zod/v3/index.d.ts +4 -0
  748. package/node_modules/zod/v3/index.js +4 -0
  749. package/node_modules/zod/v3/locales/en.cjs +111 -0
  750. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  751. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  752. package/node_modules/zod/v3/locales/en.js +109 -0
  753. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  754. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  755. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  756. package/node_modules/zod/v3/standard-schema.js +1 -0
  757. package/node_modules/zod/v3/types.cjs +3775 -0
  758. package/node_modules/zod/v3/types.d.cts +1031 -0
  759. package/node_modules/zod/v3/types.d.ts +1031 -0
  760. package/node_modules/zod/v3/types.js +3693 -0
  761. package/node_modules/zod/v4/classic/checks.cjs +32 -0
  762. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  763. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  764. package/node_modules/zod/v4/classic/checks.js +1 -0
  765. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  766. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  767. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  768. package/node_modules/zod/v4/classic/coerce.js +17 -0
  769. package/node_modules/zod/v4/classic/compat.cjs +57 -0
  770. package/node_modules/zod/v4/classic/compat.d.cts +46 -0
  771. package/node_modules/zod/v4/classic/compat.d.ts +46 -0
  772. package/node_modules/zod/v4/classic/compat.js +27 -0
  773. package/node_modules/zod/v4/classic/errors.cjs +67 -0
  774. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  775. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  776. package/node_modules/zod/v4/classic/errors.js +41 -0
  777. package/node_modules/zod/v4/classic/external.cjs +70 -0
  778. package/node_modules/zod/v4/classic/external.d.cts +13 -0
  779. package/node_modules/zod/v4/classic/external.d.ts +13 -0
  780. package/node_modules/zod/v4/classic/external.js +18 -0
  781. package/node_modules/zod/v4/classic/index.cjs +33 -0
  782. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  783. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  784. package/node_modules/zod/v4/classic/index.js +4 -0
  785. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  786. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  787. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  788. package/node_modules/zod/v4/classic/iso.js +30 -0
  789. package/node_modules/zod/v4/classic/parse.cjs +32 -0
  790. package/node_modules/zod/v4/classic/parse.d.cts +23 -0
  791. package/node_modules/zod/v4/classic/parse.d.ts +23 -0
  792. package/node_modules/zod/v4/classic/parse.js +6 -0
  793. package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
  794. package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
  795. package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
  796. package/node_modules/zod/v4/classic/schemas.js +1006 -0
  797. package/node_modules/zod/v4/core/api.cjs +1039 -0
  798. package/node_modules/zod/v4/core/api.d.cts +284 -0
  799. package/node_modules/zod/v4/core/api.d.ts +284 -0
  800. package/node_modules/zod/v4/core/api.js +906 -0
  801. package/node_modules/zod/v4/core/checks.cjs +591 -0
  802. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  803. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  804. package/node_modules/zod/v4/core/checks.js +565 -0
  805. package/node_modules/zod/v4/core/core.cjs +67 -0
  806. package/node_modules/zod/v4/core/core.d.cts +49 -0
  807. package/node_modules/zod/v4/core/core.d.ts +49 -0
  808. package/node_modules/zod/v4/core/core.js +61 -0
  809. package/node_modules/zod/v4/core/doc.cjs +39 -0
  810. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  811. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  812. package/node_modules/zod/v4/core/doc.js +35 -0
  813. package/node_modules/zod/v4/core/errors.cjs +226 -0
  814. package/node_modules/zod/v4/core/errors.d.cts +208 -0
  815. package/node_modules/zod/v4/core/errors.d.ts +208 -0
  816. package/node_modules/zod/v4/core/errors.js +195 -0
  817. package/node_modules/zod/v4/core/function.cjs +102 -0
  818. package/node_modules/zod/v4/core/function.d.cts +52 -0
  819. package/node_modules/zod/v4/core/function.d.ts +52 -0
  820. package/node_modules/zod/v4/core/function.js +75 -0
  821. package/node_modules/zod/v4/core/index.cjs +44 -0
  822. package/node_modules/zod/v4/core/index.d.cts +15 -0
  823. package/node_modules/zod/v4/core/index.d.ts +15 -0
  824. package/node_modules/zod/v4/core/index.js +15 -0
  825. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  826. package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
  827. package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
  828. package/node_modules/zod/v4/core/json-schema.js +1 -0
  829. package/node_modules/zod/v4/core/parse.cjs +87 -0
  830. package/node_modules/zod/v4/core/parse.d.cts +25 -0
  831. package/node_modules/zod/v4/core/parse.d.ts +25 -0
  832. package/node_modules/zod/v4/core/parse.js +57 -0
  833. package/node_modules/zod/v4/core/regexes.cjs +103 -0
  834. package/node_modules/zod/v4/core/regexes.d.cts +62 -0
  835. package/node_modules/zod/v4/core/regexes.d.ts +62 -0
  836. package/node_modules/zod/v4/core/regexes.js +95 -0
  837. package/node_modules/zod/v4/core/registries.cjs +56 -0
  838. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  839. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  840. package/node_modules/zod/v4/core/registries.js +51 -0
  841. package/node_modules/zod/v4/core/schemas.cjs +1748 -0
  842. package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
  843. package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
  844. package/node_modules/zod/v4/core/schemas.js +1717 -0
  845. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  846. package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
  847. package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
  848. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  849. package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
  850. package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
  851. package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
  852. package/node_modules/zod/v4/core/to-json-schema.js +849 -0
  853. package/node_modules/zod/v4/core/util.cjs +539 -0
  854. package/node_modules/zod/v4/core/util.d.cts +183 -0
  855. package/node_modules/zod/v4/core/util.d.ts +183 -0
  856. package/node_modules/zod/v4/core/util.js +493 -0
  857. package/node_modules/zod/v4/core/versions.cjs +8 -0
  858. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  859. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  860. package/node_modules/zod/v4/core/versions.js +5 -0
  861. package/node_modules/zod/v4/index.cjs +22 -0
  862. package/node_modules/zod/v4/index.d.cts +3 -0
  863. package/node_modules/zod/v4/index.d.ts +3 -0
  864. package/node_modules/zod/v4/index.js +3 -0
  865. package/node_modules/zod/v4/locales/ar.cjs +142 -0
  866. package/node_modules/zod/v4/locales/ar.d.cts +4 -0
  867. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  868. package/node_modules/zod/v4/locales/ar.js +116 -0
  869. package/node_modules/zod/v4/locales/az.cjs +141 -0
  870. package/node_modules/zod/v4/locales/az.d.cts +4 -0
  871. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  872. package/node_modules/zod/v4/locales/az.js +115 -0
  873. package/node_modules/zod/v4/locales/be.cjs +190 -0
  874. package/node_modules/zod/v4/locales/be.d.cts +4 -0
  875. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  876. package/node_modules/zod/v4/locales/be.js +164 -0
  877. package/node_modules/zod/v4/locales/ca.cjs +144 -0
  878. package/node_modules/zod/v4/locales/ca.d.cts +4 -0
  879. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  880. package/node_modules/zod/v4/locales/ca.js +118 -0
  881. package/node_modules/zod/v4/locales/cs.cjs +161 -0
  882. package/node_modules/zod/v4/locales/cs.d.cts +4 -0
  883. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  884. package/node_modules/zod/v4/locales/cs.js +135 -0
  885. package/node_modules/zod/v4/locales/de.cjs +142 -0
  886. package/node_modules/zod/v4/locales/de.d.cts +4 -0
  887. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  888. package/node_modules/zod/v4/locales/de.js +116 -0
  889. package/node_modules/zod/v4/locales/en.cjs +145 -0
  890. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  891. package/node_modules/zod/v4/locales/en.d.ts +5 -0
  892. package/node_modules/zod/v4/locales/en.js +117 -0
  893. package/node_modules/zod/v4/locales/eo.cjs +144 -0
  894. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  895. package/node_modules/zod/v4/locales/eo.d.ts +5 -0
  896. package/node_modules/zod/v4/locales/eo.js +116 -0
  897. package/node_modules/zod/v4/locales/es.cjs +143 -0
  898. package/node_modules/zod/v4/locales/es.d.cts +4 -0
  899. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  900. package/node_modules/zod/v4/locales/es.js +117 -0
  901. package/node_modules/zod/v4/locales/fa.cjs +148 -0
  902. package/node_modules/zod/v4/locales/fa.d.cts +4 -0
  903. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  904. package/node_modules/zod/v4/locales/fa.js +122 -0
  905. package/node_modules/zod/v4/locales/fi.cjs +148 -0
  906. package/node_modules/zod/v4/locales/fi.d.cts +4 -0
  907. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  908. package/node_modules/zod/v4/locales/fi.js +122 -0
  909. package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
  910. package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
  911. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  912. package/node_modules/zod/v4/locales/fr-CA.js +117 -0
  913. package/node_modules/zod/v4/locales/fr.cjs +142 -0
  914. package/node_modules/zod/v4/locales/fr.d.cts +4 -0
  915. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  916. package/node_modules/zod/v4/locales/fr.js +116 -0
  917. package/node_modules/zod/v4/locales/he.cjs +143 -0
  918. package/node_modules/zod/v4/locales/he.d.cts +4 -0
  919. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  920. package/node_modules/zod/v4/locales/he.js +117 -0
  921. package/node_modules/zod/v4/locales/hu.cjs +143 -0
  922. package/node_modules/zod/v4/locales/hu.d.cts +4 -0
  923. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  924. package/node_modules/zod/v4/locales/hu.js +117 -0
  925. package/node_modules/zod/v4/locales/id.cjs +142 -0
  926. package/node_modules/zod/v4/locales/id.d.cts +4 -0
  927. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  928. package/node_modules/zod/v4/locales/id.js +116 -0
  929. package/node_modules/zod/v4/locales/index.cjs +84 -0
  930. package/node_modules/zod/v4/locales/index.d.cts +39 -0
  931. package/node_modules/zod/v4/locales/index.d.ts +39 -0
  932. package/node_modules/zod/v4/locales/index.js +39 -0
  933. package/node_modules/zod/v4/locales/it.cjs +143 -0
  934. package/node_modules/zod/v4/locales/it.d.cts +4 -0
  935. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  936. package/node_modules/zod/v4/locales/it.js +117 -0
  937. package/node_modules/zod/v4/locales/ja.cjs +141 -0
  938. package/node_modules/zod/v4/locales/ja.d.cts +4 -0
  939. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  940. package/node_modules/zod/v4/locales/ja.js +115 -0
  941. package/node_modules/zod/v4/locales/kh.cjs +143 -0
  942. package/node_modules/zod/v4/locales/kh.d.cts +4 -0
  943. package/node_modules/zod/v4/locales/kh.d.ts +4 -0
  944. package/node_modules/zod/v4/locales/kh.js +117 -0
  945. package/node_modules/zod/v4/locales/ko.cjs +147 -0
  946. package/node_modules/zod/v4/locales/ko.d.cts +4 -0
  947. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  948. package/node_modules/zod/v4/locales/ko.js +121 -0
  949. package/node_modules/zod/v4/locales/mk.cjs +144 -0
  950. package/node_modules/zod/v4/locales/mk.d.cts +4 -0
  951. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  952. package/node_modules/zod/v4/locales/mk.js +118 -0
  953. package/node_modules/zod/v4/locales/ms.cjs +142 -0
  954. package/node_modules/zod/v4/locales/ms.d.cts +4 -0
  955. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  956. package/node_modules/zod/v4/locales/ms.js +116 -0
  957. package/node_modules/zod/v4/locales/nl.cjs +143 -0
  958. package/node_modules/zod/v4/locales/nl.d.cts +4 -0
  959. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  960. package/node_modules/zod/v4/locales/nl.js +117 -0
  961. package/node_modules/zod/v4/locales/no.cjs +142 -0
  962. package/node_modules/zod/v4/locales/no.d.cts +4 -0
  963. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  964. package/node_modules/zod/v4/locales/no.js +116 -0
  965. package/node_modules/zod/v4/locales/ota.cjs +143 -0
  966. package/node_modules/zod/v4/locales/ota.d.cts +4 -0
  967. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  968. package/node_modules/zod/v4/locales/ota.js +117 -0
  969. package/node_modules/zod/v4/locales/pl.cjs +143 -0
  970. package/node_modules/zod/v4/locales/pl.d.cts +4 -0
  971. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  972. package/node_modules/zod/v4/locales/pl.js +117 -0
  973. package/node_modules/zod/v4/locales/ps.cjs +148 -0
  974. package/node_modules/zod/v4/locales/ps.d.cts +4 -0
  975. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  976. package/node_modules/zod/v4/locales/ps.js +122 -0
  977. package/node_modules/zod/v4/locales/pt.cjs +142 -0
  978. package/node_modules/zod/v4/locales/pt.d.cts +4 -0
  979. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  980. package/node_modules/zod/v4/locales/pt.js +116 -0
  981. package/node_modules/zod/v4/locales/ru.cjs +190 -0
  982. package/node_modules/zod/v4/locales/ru.d.cts +4 -0
  983. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  984. package/node_modules/zod/v4/locales/ru.js +164 -0
  985. package/node_modules/zod/v4/locales/sl.cjs +143 -0
  986. package/node_modules/zod/v4/locales/sl.d.cts +4 -0
  987. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  988. package/node_modules/zod/v4/locales/sl.js +117 -0
  989. package/node_modules/zod/v4/locales/sv.cjs +144 -0
  990. package/node_modules/zod/v4/locales/sv.d.cts +4 -0
  991. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  992. package/node_modules/zod/v4/locales/sv.js +118 -0
  993. package/node_modules/zod/v4/locales/ta.cjs +143 -0
  994. package/node_modules/zod/v4/locales/ta.d.cts +4 -0
  995. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  996. package/node_modules/zod/v4/locales/ta.js +117 -0
  997. package/node_modules/zod/v4/locales/th.cjs +143 -0
  998. package/node_modules/zod/v4/locales/th.d.cts +4 -0
  999. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  1000. package/node_modules/zod/v4/locales/th.js +117 -0
  1001. package/node_modules/zod/v4/locales/tr.cjs +143 -0
  1002. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  1003. package/node_modules/zod/v4/locales/tr.d.ts +5 -0
  1004. package/node_modules/zod/v4/locales/tr.js +115 -0
  1005. package/node_modules/zod/v4/locales/ua.cjs +143 -0
  1006. package/node_modules/zod/v4/locales/ua.d.cts +4 -0
  1007. package/node_modules/zod/v4/locales/ua.d.ts +4 -0
  1008. package/node_modules/zod/v4/locales/ua.js +117 -0
  1009. package/node_modules/zod/v4/locales/ur.cjs +143 -0
  1010. package/node_modules/zod/v4/locales/ur.d.cts +4 -0
  1011. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  1012. package/node_modules/zod/v4/locales/ur.js +117 -0
  1013. package/node_modules/zod/v4/locales/vi.cjs +142 -0
  1014. package/node_modules/zod/v4/locales/vi.d.cts +4 -0
  1015. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  1016. package/node_modules/zod/v4/locales/vi.js +116 -0
  1017. package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
  1018. package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
  1019. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  1020. package/node_modules/zod/v4/locales/zh-CN.js +116 -0
  1021. package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
  1022. package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
  1023. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  1024. package/node_modules/zod/v4/locales/zh-TW.js +117 -0
  1025. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  1026. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  1027. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  1028. package/node_modules/zod/v4/mini/checks.js +1 -0
  1029. package/node_modules/zod/v4/mini/coerce.cjs +47 -0
  1030. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  1031. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  1032. package/node_modules/zod/v4/mini/coerce.js +17 -0
  1033. package/node_modules/zod/v4/mini/external.cjs +62 -0
  1034. package/node_modules/zod/v4/mini/external.d.cts +11 -0
  1035. package/node_modules/zod/v4/mini/external.d.ts +11 -0
  1036. package/node_modules/zod/v4/mini/external.js +13 -0
  1037. package/node_modules/zod/v4/mini/index.cjs +32 -0
  1038. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  1039. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  1040. package/node_modules/zod/v4/mini/index.js +3 -0
  1041. package/node_modules/zod/v4/mini/iso.cjs +60 -0
  1042. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  1043. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  1044. package/node_modules/zod/v4/mini/iso.js +30 -0
  1045. package/node_modules/zod/v4/mini/parse.cjs +8 -0
  1046. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  1047. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  1048. package/node_modules/zod/v4/mini/parse.js +1 -0
  1049. package/node_modules/zod/v4/mini/schemas.cjs +839 -0
  1050. package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
  1051. package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
  1052. package/node_modules/zod/v4/mini/schemas.js +732 -0
  1053. package/node_modules/zod/v4-mini/index.cjs +17 -0
  1054. package/node_modules/zod/v4-mini/index.d.cts +1 -0
  1055. package/node_modules/zod/v4-mini/index.d.ts +1 -0
  1056. package/node_modules/zod/v4-mini/index.js +1 -0
  1057. package/package.json +97 -0
@@ -0,0 +1,2199 @@
1
+ /**
2
+ * Forge Common Tests
3
+ *
4
+ * @author Dave Longley
5
+ *
6
+ * Copyright (c) 2009-2012 Digital Bazaar, Inc. All rights reserved.
7
+ */
8
+ jQuery(function($)
9
+ {
10
+ // logging category
11
+ var cat = 'forge.tests.common';
12
+
13
+ // local alias
14
+ var forge = window.forge;
15
+
16
+ var tests = [];
17
+ var passed = 0;
18
+ var failed = 0;
19
+
20
+ var init = function()
21
+ {
22
+ passed = failed = 0;
23
+ $('.ready,.testing,.pass,.fail')
24
+ .removeClass('ready testing pass fail');
25
+ $('#status')
26
+ .text('Ready.')
27
+ .addClass('ready');
28
+ $('#total').text(tests.length);
29
+ $('#pass').text(passed);
30
+ $('#fail').text(failed);
31
+ $('.expect').empty();
32
+ $('.result').empty();
33
+ $('.time').empty();
34
+ $('.timePer').empty();
35
+ $('#start').attr('disabled', '');
36
+ };
37
+
38
+ var start = function()
39
+ {
40
+ $('#start').attr('disabled', 'true');
41
+ // meta! use tasks to run the task tests
42
+ forge_task.start({
43
+ type: 'test',
44
+ run: function(task) {
45
+ task.next('starting', function(task) {
46
+ forge.log.debug(cat, 'start');
47
+ $('#status')
48
+ .text('Testing...')
49
+ .addClass('testing')
50
+ .removeClass('idle');
51
+ });
52
+ $.each(tests, function(i, test) {
53
+ task.next('test', function(task) {
54
+ var title = $('li:first', test.container);
55
+ if($('#scroll:checked').length === 1)
56
+ {
57
+ $('html,body').animate({scrollTop: title.offset().top});
58
+ }
59
+ title.addClass('testing');
60
+ test.run(task, test);
61
+ });
62
+ task.next('test', function(task) {
63
+ $('li:first', test.container).removeClass('testing');
64
+ });
65
+ });
66
+ task.next('success', function(task) {
67
+ forge.log.debug(cat, 'done');
68
+ if(failed === 0) {
69
+ $('#status')
70
+ .text('PASS')
71
+ .addClass('pass')
72
+ .removeClass('testing');
73
+ } else {
74
+ // FIXME: should just be hitting failure() below
75
+ $('#status')
76
+ .text('FAIL')
77
+ .addClass('fail')
78
+ .removeClass('testing');
79
+ }
80
+ });
81
+ },
82
+ failure: function() {
83
+ $('#status')
84
+ .text('FAIL')
85
+ .addClass('fail')
86
+ .removeClass('testing');
87
+ }
88
+ });
89
+ };
90
+
91
+ $('#start').click(function() {
92
+ start();
93
+ });
94
+
95
+ $('#reset').click(function() {
96
+ init();
97
+ });
98
+
99
+ $('#keygen').click(function() {
100
+ var bits = $('#bits')[0].value;
101
+ var keys = forge.pki.rsa.generateKeyPair(bits);
102
+ forge.log.debug(cat, 'generating ' + bits + '-bit RSA key-pair...');
103
+ setTimeout(function()
104
+ {
105
+ forge.log.debug(cat, 'private key:', keys.privateKey);
106
+ forge.log.debug(cat, forge.pki.privateKeyToPem(keys.privateKey));
107
+ forge.log.debug(cat, 'public key:', keys.publicKey);
108
+ forge.log.debug(cat, forge.pki.publicKeyToPem(keys.publicKey));
109
+
110
+ forge.log.debug(cat, 'testing sign/verify...');
111
+ setTimeout(function()
112
+ {
113
+ // do sign/verify test
114
+ try
115
+ {
116
+ var md = forge.md.sha1.create();
117
+ md.update('foo');
118
+ var signature = keys.privateKey.sign(md);
119
+ keys.publicKey.verify(md.digest().getBytes(), signature);
120
+ forge.log.debug(cat, 'sign/verify success');
121
+ }
122
+ catch(ex)
123
+ {
124
+ forge.log.error(cat, 'sign/verify failure', ex);
125
+ }
126
+ }, 0);
127
+ }, 0);
128
+ });
129
+
130
+ $('#certgen').click(function() {
131
+ var bits = $('#bits')[0].value;
132
+ forge.log.debug(cat, 'generating ' + bits +
133
+ '-bit RSA key-pair and certificate...');
134
+ setTimeout(function()
135
+ {
136
+ try
137
+ {
138
+ var keys = forge.pki.rsa.generateKeyPair(bits);
139
+ var cert = forge.pki.createCertificate();
140
+ cert.serialNumber = '01';
141
+ cert.validity.notBefore = new Date();
142
+ cert.validity.notAfter = new Date();
143
+ cert.validity.notAfter.setFullYear(
144
+ cert.validity.notBefore.getFullYear() + 1);
145
+ var attrs = [{
146
+ name: 'commonName',
147
+ value: 'mycert'
148
+ }, {
149
+ name: 'countryName',
150
+ value: 'US'
151
+ }, {
152
+ shortName: 'ST',
153
+ value: 'Virginia'
154
+ }, {
155
+ name: 'localityName',
156
+ value: 'Blacksburg'
157
+ }, {
158
+ name: 'organizationName',
159
+ value: 'Test'
160
+ }, {
161
+ shortName: 'OU',
162
+ value: 'Test'
163
+ }];
164
+ cert.setSubject(attrs);
165
+ cert.setIssuer(attrs);
166
+ cert.setExtensions([{
167
+ name: 'basicConstraints',
168
+ cA: true
169
+ }, {
170
+ name: 'keyUsage',
171
+ keyCertSign: true
172
+ }, {
173
+ name: 'subjectAltName',
174
+ altNames: [{
175
+ type: 6, // URI
176
+ value: 'http://localhost/dataspace/person/myname#this'
177
+ }]
178
+ }]);
179
+ // FIXME: add subjectKeyIdentifier extension
180
+ // FIXME: add authorityKeyIdentifier extension
181
+ cert.publicKey = keys.publicKey;
182
+
183
+ // self-sign certificate
184
+ cert.sign(keys.privateKey);
185
+
186
+ forge.log.debug(cat, 'certificate:', cert);
187
+ //forge.log.debug(cat,
188
+ // forge.asn1.prettyPrint(forge.pki.certificateToAsn1(cert)));
189
+ forge.log.debug(cat, forge.pki.certificateToPem(cert));
190
+
191
+ // verify certificate
192
+ forge.log.debug(cat, 'verified', cert.verify(cert));
193
+ }
194
+ catch(ex)
195
+ {
196
+ forge.log.error(cat, ex, ex.message ? ex.message : '');
197
+ }
198
+ }, 0);
199
+ });
200
+
201
+ var addTest = function(name, run)
202
+ {
203
+ var container = $('<ul><li>Test ' + name + '</li><ul/></ul>');
204
+ var expect = $('<li>Expect: <span class="expect"/></li>');
205
+ var result = $('<li>Result: <span class="result"/></li>');
206
+ var time = $('<li>Time: <span class="time"/></li>');
207
+ var timePer = $('<li>Time Per Iteration: <span class="timePer"/></li>');
208
+ $('ul', container)
209
+ .append(expect)
210
+ .append(result)
211
+ .append(time)
212
+ .append(timePer);
213
+ $('#tests').append(container);
214
+ var test = {
215
+ container: container,
216
+ startTime: null,
217
+ run: function(task, test) {
218
+ test.startTime = new Date();
219
+ run(task, test);
220
+ },
221
+ expect: $('span', expect),
222
+ result: $('span', result),
223
+ check: function() {
224
+ var e = test.expect.text();
225
+ var r = test.result.text();
226
+ (e == r) ? test.pass() : test.fail();
227
+ },
228
+ pass: function(iterations) {
229
+ var dt = new Date() - test.startTime;
230
+ if(!iterations)
231
+ {
232
+ iterations = 1;
233
+ }
234
+ var dti = (dt / iterations);
235
+ passed += 1;
236
+ $('#pass').text(passed);
237
+ $('li:first', container).addClass('pass');
238
+ $('span.time', container).html(dt + 'ms');
239
+ $('span.timePer', container).html(dti + 'ms');
240
+ },
241
+ fail: function(iterations) {
242
+ var dt = new Date() - test.startTime;
243
+ if(!iterations)
244
+ {
245
+ iterations = 1;
246
+ }
247
+ var dti = (dt / iterations);
248
+ failed += 1;
249
+ $('#fail').text(failed);
250
+ $('li:first', container).addClass('fail');
251
+ $('span.time', container).html(dt + 'ms');
252
+ $('span.timePer', container).html(dti + 'ms');
253
+ }
254
+ };
255
+ tests.push(test);
256
+ };
257
+
258
+ addTest('buffer put bytes', function(task, test)
259
+ {
260
+ ba = forge.util.createBuffer();
261
+ ba.putByte(1);
262
+ ba.putByte(2);
263
+ ba.putByte(3);
264
+ ba.putByte(4);
265
+ ba.putInt32(4);
266
+ ba.putByte(1);
267
+ ba.putByte(2);
268
+ ba.putByte(3);
269
+ ba.putInt32(4294967295);
270
+ var hex = ba.toHex();
271
+ var bytes = [];
272
+ while(ba.length() > 0)
273
+ {
274
+ bytes.push(ba.getByte());
275
+ }
276
+ var expect = [1, 2, 3, 4, 0, 0, 0, 4, 1, 2, 3, 255, 255, 255, 255];
277
+ var exHex = '0102030400000004010203ffffffff';
278
+ test.expect.html(exHex);
279
+ test.result.html(hex);
280
+
281
+ test.check();
282
+ });
283
+
284
+ addTest('buffer from hex', function(task, test)
285
+ {
286
+ var exHex = '0102030400000004010203ffffffff';
287
+ test.expect.html(exHex);
288
+
289
+ var buf = forge.util.createBuffer();
290
+ buf.putBytes(forge.util.hexToBytes(exHex));
291
+ test.result.html(buf.toHex());
292
+
293
+ test.check();
294
+ });
295
+
296
+ addTest('base64 encode', function(task, test)
297
+ {
298
+ var s1 = '00010203050607080A0B0C0D0F1011121415161719';
299
+ var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5';
300
+ test.expect.html(s2);
301
+
302
+ var out = forge.util.encode64(s1);
303
+ test.result.html(out);
304
+
305
+ test.check();
306
+ });
307
+
308
+ addTest('base64 decode', function(task, test)
309
+ {
310
+ var s1 = '00010203050607080A0B0C0D0F1011121415161719';
311
+ var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5';
312
+ test.expect.html(s1);
313
+
314
+ var out = forge.util.decode64(s2);
315
+ test.result.html(out);
316
+
317
+ test.check();
318
+ });
319
+
320
+ addTest('md5 empty', function(task, test)
321
+ {
322
+ var expect = 'd41d8cd98f00b204e9800998ecf8427e';
323
+ test.expect.html(expect);
324
+ var md = forge.md.md5.create();
325
+ test.result.html(md.digest().toHex());
326
+ test.check();
327
+ });
328
+
329
+ addTest('md5 "abc"', function(task, test)
330
+ {
331
+ var expect = '900150983cd24fb0d6963f7d28e17f72';
332
+ test.expect.html(expect);
333
+ var md = forge.md.md5.create();
334
+ md.update('abc');
335
+ test.result.html(md.digest().toHex());
336
+ test.check();
337
+ });
338
+
339
+ addTest('md5 "The quick brown fox jumps over the lazy dog"',
340
+ function(task, test)
341
+ {
342
+ var expect = '9e107d9d372bb6826bd81d3542a419d6';
343
+ test.expect.html(expect);
344
+ var md = forge.md.md5.create();
345
+ md.start();
346
+ md.update('The quick brown fox jumps over the lazy dog');
347
+ test.result.html(md.digest().toHex());
348
+ test.check();
349
+ });
350
+
351
+ // c'è
352
+ addTest('md5 "c\'\u00e8"', function(task, test)
353
+ {
354
+ var expect = '8ef7c2941d78fe89f31e614437c9db59';
355
+ test.expect.html(expect);
356
+ var md = forge.md.md5.create();
357
+ md.update("c'\u00e8", 'utf8');
358
+ test.result.html(md.digest().toHex());
359
+ test.check();
360
+ });
361
+
362
+ addTest('md5 "THIS IS A MESSAGE"',
363
+ function(task, test)
364
+ {
365
+ var expect = '78eebfd9d42958e3f31244f116ab7bbe';
366
+ test.expect.html(expect);
367
+ var md = forge.md.md5.create();
368
+ md.start();
369
+ md.update('THIS IS ');
370
+ md.update('A MESSAGE');
371
+ // do twice to check continuing digest
372
+ test.result.html(md.digest().toHex());
373
+ test.result.html(md.digest().toHex());
374
+ test.check();
375
+ });
376
+
377
+ addTest('md5 long message',
378
+ function(task, test)
379
+ {
380
+ var input = forge.util.createBuffer();
381
+ input.putBytes(forge.util.hexToBytes(
382
+ '0100002903018d32e9c6dc423774c4c39a5a1b78f44cc2cab5f676d39' +
383
+ 'f703d29bfa27dfeb870000002002f0100'));
384
+ input.putBytes(forge.util.hexToBytes(
385
+ '0200004603014c2c1e835d39da71bc0857eb04c2b50fe90dbb2a8477f' +
386
+ 'e7364598d6f0575999c20a6c7248c5174da6d03ac711888f762fc4ed5' +
387
+ '4f7254b32273690de849c843073d002f00'));
388
+ input.putBytes(forge.util.hexToBytes(
389
+ '0b0003d20003cf0003cc308203c8308202b0a003020102020100300d0' +
390
+ '6092a864886f70d0101050500308186310b3009060355040613025553' +
391
+ '311d301b060355040a13144469676974616c2042617a6161722c20496' +
392
+ 'e632e31443042060355040b133b4269746d756e6b206c6f63616c686f' +
393
+ '73742d6f6e6c7920436572746966696361746573202d20417574686f7' +
394
+ '2697a6174696f6e207669612042545031123010060355040313096c6f' +
395
+ '63616c686f7374301e170d3130303231343137303931395a170d32303' +
396
+ '03231333137303931395a308186310b3009060355040613025553311d' +
397
+ '301b060355040a13144469676974616c2042617a6161722c20496e632' +
398
+ 'e31443042060355040b133b4269746d756e6b206c6f63616c686f7374' +
399
+ '2d6f6e6c7920436572746966696361746573202d20417574686f72697' +
400
+ 'a6174696f6e207669612042545031123010060355040313096c6f6361' +
401
+ '6c686f737430820122300d06092a864886f70d01010105000382010f0' +
402
+ '03082010a0282010100dc436f17d6909d8a9d6186ea218eb5c86b848b' +
403
+ 'ae02219bd56a71203daf07e81bc19e7e98134136bcb012881864bf03b' +
404
+ '3774652ad5eab85dba411a5114ffeac09babce75f31314345512cd87c' +
405
+ '91318b2e77433270a52185fc16f428c3ca412ad6e9484bc2fb87abb4e' +
406
+ '8fb71bf0f619e31a42340b35967f06c24a741a31c979c0bb8921a90a4' +
407
+ '7025fbeb8adca576979e70a56830c61170c9647c18c0794d68c0df38f' +
408
+ '3aac5fc3b530e016ea5659715339f3f3c209cdee9dbe794b5af92530c' +
409
+ '5754c1d874b78974bfad994e0dfc582275e79feb522f6e4bcc2b2945b' +
410
+ 'aedfb0dbdaebb605f9483ff0bea29ecd5f4d6f2769965d1b3e04f8422' +
411
+ '716042680011ff676f0203010001a33f303d300c0603551d130101ff0' +
412
+ '4023000300e0603551d0f0101ff0404030204f0301d0603551d250416' +
413
+ '301406082b0601050507030106082b06010505070302300d06092a864' +
414
+ '886f70d010105050003820101009c4562be3f2d8d8e388085a697f2f1' +
415
+ '06eaeff4992a43f198fe3dcf15c8229cf1043f061a38204f73d86f4fb' +
416
+ '6348048cc5279ed719873aa10e3773d92b629c2c3fcce04012c81ba3b' +
417
+ '4ec451e9644ec5191078402d845e05d02c7b4d974b4588276e5037aba' +
418
+ '7ef26a8bddeb21e10698c82f425e767dc401adf722fa73ab78cfa069b' +
419
+ 'd69052d7ca6a75cc9225550e315d71c5f8764362ea4dbc6ecb837a847' +
420
+ '1043c5a7f826a71af145a053090bd4bccca6a2c552841cdb1908a8352' +
421
+ 'f49283d2e641acdef667c7543af441a16f8294251e2ac376fa507b53a' +
422
+ 'e418dd038cd20cef1e7bfbf5ae03a7c88d93d843abaabbdc5f3431132' +
423
+ 'f3e559d2dd414c3eda38a210b8'));
424
+ input.putBytes(forge.util.hexToBytes('0e000000'));
425
+ input.putBytes(forge.util.hexToBytes(
426
+ '10000102010026a220b7be857402819b78d81080d01a682599bbd0090' +
427
+ '2985cc64edf8e520e4111eb0e1729a14ffa3498ca259cc9ad6fc78fa1' +
428
+ '30d968ebdb78dc0b950c0aa44355f13ba678419185d7e4608fe178ca6' +
429
+ 'b2cef33e4193778d1a70fe4d0dfcb110be4bbb4dbaa712177655728f9' +
430
+ '14ab4c0f6c4aef79a46b3d996c82b2ebe9ed1748eb5cace7dc44fb67e' +
431
+ '73f452a047f2ed199b3d50d5db960acf03244dc8efa4fc129faf8b65f' +
432
+ '9e52e62b5544722bd17d2358e817a777618a4265a3db277fc04851a82' +
433
+ 'a91fe6cdcb8127f156e0b4a5d1f54ce2742eb70c895f5f8b85f5febe6' +
434
+ '9bc73e891f9280826860a0c2ef94c7935e6215c3c4cd6b0e43e80cca3' +
435
+ '96d913d36be'));
436
+
437
+ var expect = 'd15a2da0e92c3da55dc573f885b6e653';
438
+ test.expect.html(expect);
439
+
440
+ var md = forge.md.md5.create();
441
+ md.start();
442
+ md.update(input.getBytes());
443
+ test.result.html(md.digest().toHex());
444
+
445
+ test.check();
446
+ });
447
+
448
+ addTest('sha-1 empty', function(task, test)
449
+ {
450
+ var expect = 'da39a3ee5e6b4b0d3255bfef95601890afd80709';
451
+ test.expect.html(expect);
452
+ var md = forge.md.sha1.create();
453
+ test.result.html(md.digest().toHex());
454
+ test.check();
455
+ });
456
+
457
+ addTest('sha-1 "abc"', function(task, test)
458
+ {
459
+ var expect = 'a9993e364706816aba3e25717850c26c9cd0d89d';
460
+ test.expect.html(expect);
461
+ var md = forge.md.sha1.create();
462
+ md.update('abc');
463
+ test.result.html(md.digest().toHex());
464
+ test.check();
465
+ });
466
+
467
+ addTest('sha-1 "The quick brown fox jumps over the lazy dog"',
468
+ function(task, test)
469
+ {
470
+ var expect = '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12';
471
+ test.expect.html(expect);
472
+ var md = forge.md.sha1.create();
473
+ md.start();
474
+ md.update('The quick brown fox jumps over the lazy dog');
475
+ test.result.html(md.digest().toHex());
476
+ test.check();
477
+ });
478
+
479
+ // c'è
480
+ addTest('sha-1 "c\'\u00e8"', function(task, test)
481
+ {
482
+ var expect = '98c9a3f804daa73b68a5660d032499a447350c0d';
483
+ test.expect.html(expect);
484
+ var md = forge.md.sha1.create();
485
+ md.update("c'\u00e8", 'utf8');
486
+ test.result.html(md.digest().toHex());
487
+ test.check();
488
+ });
489
+
490
+ addTest('sha-1 "THIS IS A MESSAGE"',
491
+ function(task, test)
492
+ {
493
+ var expect = '5f24f4d6499fd2d44df6c6e94be8b14a796c071d';
494
+ test.expect.html(expect);
495
+ var md = forge.md.sha1.create();
496
+ md.start();
497
+ md.update('THIS IS ');
498
+ md.update('A MESSAGE');
499
+ // do twice to check continuing digest
500
+ test.result.html(md.digest().toHex());
501
+ test.result.html(md.digest().toHex());
502
+ test.check();
503
+ });
504
+
505
+ // other browsers too slow for this test
506
+ if($.browser.webkit)
507
+ {
508
+ addTest('sha-1 long message',
509
+ function(task, test)
510
+ {
511
+ var expect = '34aa973cd4c4daa4f61eeb2bdbad27316534016f';
512
+ test.expect.html(expect);
513
+ var md = forge.md.sha1.create();
514
+ md.start();
515
+ md.update(forge.util.fillString('a', 1000000));
516
+ // do twice to check continuing digest
517
+ test.result.html(md.digest().toHex());
518
+ test.result.html(md.digest().toHex());
519
+ test.check();
520
+ });
521
+ }
522
+
523
+ addTest('sha-256 "abc"', function(task, test)
524
+ {
525
+ var expect =
526
+ 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad';
527
+ test.expect.html(expect);
528
+ var md = forge.md.sha256.create();
529
+ md.update('abc');
530
+ test.result.html(md.digest().toHex());
531
+ test.check();
532
+ });
533
+
534
+ // c'è
535
+ addTest('sha-256 "c\'\u00e8"', function(task, test)
536
+ {
537
+ var expect =
538
+ '1aa15c717afffd312acce2217ce1c2e5dabca53c92165999132ec9ca5decdaca';
539
+ test.expect.html(expect);
540
+ var md = forge.md.sha256.create();
541
+ md.update("c'\u00e8", 'utf8');
542
+ test.result.html(md.digest().toHex());
543
+ test.check();
544
+ });
545
+
546
+ addTest('sha-256 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"',
547
+ function(task, test)
548
+ {
549
+ var expect =
550
+ '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1';
551
+ test.expect.html(expect);
552
+ var md = forge.md.sha256.create();
553
+ md.start();
554
+ md.update('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq');
555
+ test.result.html(md.digest().toHex());
556
+ test.check();
557
+ });
558
+
559
+ // other browsers too slow for this test
560
+ if($.browser.webkit)
561
+ {
562
+ addTest('sha-256 long message',
563
+ function(task, test)
564
+ {
565
+ var expect =
566
+ 'cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0';
567
+ test.expect.html(expect);
568
+ var md = forge.md.sha256.create();
569
+ md.start();
570
+ md.update(forge.util.fillString('a', 1000000));
571
+ // do twice to check continuing digest
572
+ test.result.html(md.digest().toHex());
573
+ test.result.html(md.digest().toHex());
574
+ test.check();
575
+ });
576
+ }
577
+
578
+ addTest('hmac md5 "Hi There", 16-byte key', function(task, test)
579
+ {
580
+ var expect = '9294727a3638bb1c13f48ef8158bfc9d';
581
+ test.expect.html(expect);
582
+ var key = forge.util.hexToBytes(
583
+ '0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b');
584
+ var hmac = forge.hmac.create();
585
+ hmac.start('MD5', key);
586
+ hmac.update('Hi There');
587
+ test.result.html(hmac.digest().toHex());
588
+ test.check();
589
+ });
590
+
591
+ addTest('hmac md5 "what do ya want for nothing?", "Jefe" key',
592
+ function(task, test)
593
+ {
594
+ var expect = '750c783e6ab0b503eaa86e310a5db738';
595
+ test.expect.html(expect);
596
+ var hmac = forge.hmac.create();
597
+ hmac.start('MD5', 'Jefe');
598
+ hmac.update('what do ya want for nothing?');
599
+ test.result.html(hmac.digest().toHex());
600
+ test.check();
601
+ });
602
+
603
+ addTest('hmac md5 "Test Using Larger Than Block-Size Key - ' +
604
+ 'Hash Key First", 80-byte key', function(task, test)
605
+ {
606
+ var expect = '6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd';
607
+ test.expect.html(expect);
608
+ var key = forge.util.hexToBytes(
609
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
610
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
611
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
612
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
613
+ var hmac = forge.hmac.create();
614
+ hmac.start('MD5', key);
615
+ hmac.update('Test Using Larger Than Block-Size Key - Hash Key First');
616
+ test.result.html(hmac.digest().toHex());
617
+ test.check();
618
+ });
619
+
620
+ addTest('hmac sha-1 "Hi There", 20-byte key', function(task, test)
621
+ {
622
+ var expect = 'b617318655057264e28bc0b6fb378c8ef146be00';
623
+ test.expect.html(expect);
624
+ var key = forge.util.hexToBytes(
625
+ '0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b');
626
+ var hmac = forge.hmac.create();
627
+ hmac.start('SHA1', key);
628
+ hmac.update('Hi There');
629
+ test.result.html(hmac.digest().toHex());
630
+ test.check();
631
+ });
632
+
633
+ addTest('hmac sha-1 "what do ya want for nothing?", "Jefe" key',
634
+ function(task, test)
635
+ {
636
+ var expect = 'effcdf6ae5eb2fa2d27416d5f184df9c259a7c79';
637
+ test.expect.html(expect);
638
+ var hmac = forge.hmac.create();
639
+ hmac.start('SHA1', 'Jefe');
640
+ hmac.update('what do ya want for nothing?');
641
+ test.result.html(hmac.digest().toHex());
642
+ test.check();
643
+ });
644
+
645
+ addTest('hmac sha-1 "Test Using Larger Than Block-Size Key - ' +
646
+ 'Hash Key First", 80-byte key', function(task, test)
647
+ {
648
+ var expect = 'aa4ae5e15272d00e95705637ce8a3b55ed402112';
649
+ test.expect.html(expect);
650
+ var key = forge.util.hexToBytes(
651
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
652
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
653
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
654
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
655
+ var hmac = forge.hmac.create();
656
+ hmac.start('SHA1', key);
657
+ hmac.update('Test Using Larger Than Block-Size Key - Hash Key First');
658
+ test.result.html(hmac.digest().toHex());
659
+ test.check();
660
+ });
661
+
662
+ addTest('pbkdf2 hmac-sha-1 c=1', function(task, test)
663
+ {
664
+ var expect = '0c60c80f961f0e71f3a9b524af6012062fe037a6';
665
+ var dk = forge.pkcs5.pbkdf2('password', 'salt', 1, 20);
666
+ test.expect.html(expect);
667
+ test.result.html(forge.util.bytesToHex(dk));
668
+ test.check();
669
+ });
670
+
671
+ addTest('pbkdf2 hmac-sha-1 c=2', function(task, test)
672
+ {
673
+ var expect = 'ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957';
674
+ var dk = forge.pkcs5.pbkdf2('password', 'salt', 2, 20);
675
+ test.expect.html(expect);
676
+ test.result.html(forge.util.bytesToHex(dk));
677
+ test.check();
678
+ });
679
+
680
+ addTest('pbkdf2 hmac-sha-1 c=2', function(task, test)
681
+ {
682
+ var expect = 'ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957';
683
+ var dk = forge.pkcs5.pbkdf2('password', 'salt', 2, 20);
684
+ test.expect.html(expect);
685
+ test.result.html(forge.util.bytesToHex(dk));
686
+ test.check();
687
+ });
688
+
689
+ addTest('pbkdf2 hmac-sha-1 c=5 keylen=8', function(task, test)
690
+ {
691
+ var expect = 'd1daa78615f287e6';
692
+ var salt = forge.util.hexToBytes('1234567878563412');
693
+ var dk = forge.pkcs5.pbkdf2('password', salt, 5, 8);
694
+ test.expect.html(expect);
695
+ test.result.html(forge.util.bytesToHex(dk));
696
+ test.check();
697
+ });
698
+
699
+ // other browsers too slow for this test
700
+ if($.browser.webkit)
701
+ {
702
+ addTest('pbkdf2 hmac-sha-1 c=4096', function(task, test)
703
+ {
704
+ var expect = '4b007901b765489abead49d926f721d065a429c1';
705
+ var dk = forge.pkcs5.pbkdf2('password', 'salt', 4096, 20);
706
+ test.expect.html(expect);
707
+ test.result.html(forge.util.bytesToHex(dk));
708
+ test.check();
709
+ });
710
+ }
711
+
712
+ /* too slow for javascript
713
+ addTest('pbkdf2 hmac-sha-1 c=16777216', function(task, test)
714
+ {
715
+ var expect = 'eefe3d61cd4da4e4e9945b3d6ba2158c2634e984';
716
+ var dk = forge.pkcs5.pbkdf2('password', 'salt', 16777216, 20);
717
+ test.expect.html(expect);
718
+ test.result.html(forge.util.bytesToHex(dk));
719
+ test.check();
720
+ });*/
721
+
722
+ addTest('aes-128 encrypt', function(task, test)
723
+ {
724
+ var block = [];
725
+ block.push(0x00112233);
726
+ block.push(0x44556677);
727
+ block.push(0x8899aabb);
728
+ block.push(0xccddeeff);
729
+ var plain = block;
730
+
731
+ var key = [];
732
+ key.push(0x00010203);
733
+ key.push(0x04050607);
734
+ key.push(0x08090a0b);
735
+ key.push(0x0c0d0e0f);
736
+
737
+ var expect = [];
738
+ expect.push(0x69c4e0d8);
739
+ expect.push(0x6a7b0430);
740
+ expect.push(0xd8cdb780);
741
+ expect.push(0x70b4c55a);
742
+
743
+ test.expect.html('69c4e0d86a7b0430d8cdb78070b4c55a');
744
+
745
+ var output = [];
746
+ var w = forge.aes._expandKey(key, false);
747
+ forge.aes._updateBlock(w, block, output, false);
748
+
749
+ var out = forge.util.createBuffer();
750
+ out.putInt32(output[0]);
751
+ out.putInt32(output[1]);
752
+ out.putInt32(output[2]);
753
+ out.putInt32(output[3]);
754
+ test.result.html(out.toHex());
755
+
756
+ test.check();
757
+ });
758
+
759
+ addTest('aes-128 decrypt', function(task, test)
760
+ {
761
+ var block = [];
762
+ block.push(0x69c4e0d8);
763
+ block.push(0x6a7b0430);
764
+ block.push(0xd8cdb780);
765
+ block.push(0x70b4c55a);
766
+
767
+ var key = [];
768
+ key.push(0x00010203);
769
+ key.push(0x04050607);
770
+ key.push(0x08090a0b);
771
+ key.push(0x0c0d0e0f);
772
+
773
+ var expect = [];
774
+ expect.push(0x00112233);
775
+ expect.push(0x44556677);
776
+ expect.push(0x8899aabb);
777
+ expect.push(0xccddeeff);
778
+
779
+ test.expect.html('00112233445566778899aabbccddeeff');
780
+
781
+ var output = [];
782
+ w = forge.aes._expandKey(key, true);
783
+ forge.aes._updateBlock(w, block, output, true);
784
+
785
+ var out = forge.util.createBuffer();
786
+ out.putInt32(output[0]);
787
+ out.putInt32(output[1]);
788
+ out.putInt32(output[2]);
789
+ out.putInt32(output[3]);
790
+ test.result.html(out.toHex());
791
+
792
+ test.check();
793
+ });
794
+
795
+ addTest('aes-192 encrypt', function(task, test)
796
+ {
797
+ var block = [];
798
+ block.push(0x00112233);
799
+ block.push(0x44556677);
800
+ block.push(0x8899aabb);
801
+ block.push(0xccddeeff);
802
+ var plain = block;
803
+
804
+ var key = [];
805
+ key.push(0x00010203);
806
+ key.push(0x04050607);
807
+ key.push(0x08090a0b);
808
+ key.push(0x0c0d0e0f);
809
+ key.push(0x10111213);
810
+ key.push(0x14151617);
811
+
812
+ var expect = [];
813
+ expect.push(0xdda97ca4);
814
+ expect.push(0x864cdfe0);
815
+ expect.push(0x6eaf70a0);
816
+ expect.push(0xec0d7191);
817
+
818
+ test.expect.html('dda97ca4864cdfe06eaf70a0ec0d7191');
819
+
820
+ var output = [];
821
+ var w = forge.aes._expandKey(key, false);
822
+ forge.aes._updateBlock(w, block, output, false);
823
+
824
+ var out = forge.util.createBuffer();
825
+ out.putInt32(output[0]);
826
+ out.putInt32(output[1]);
827
+ out.putInt32(output[2]);
828
+ out.putInt32(output[3]);
829
+ test.result.html(out.toHex());
830
+
831
+ test.check();
832
+ });
833
+
834
+ addTest('aes-192 decrypt', function(task, test)
835
+ {
836
+ var block = [];
837
+ block.push(0xdda97ca4);
838
+ block.push(0x864cdfe0);
839
+ block.push(0x6eaf70a0);
840
+ block.push(0xec0d7191);
841
+
842
+ var key = [];
843
+ key.push(0x00010203);
844
+ key.push(0x04050607);
845
+ key.push(0x08090a0b);
846
+ key.push(0x0c0d0e0f);
847
+ key.push(0x10111213);
848
+ key.push(0x14151617);
849
+
850
+ var expect = [];
851
+ expect.push(0x00112233);
852
+ expect.push(0x44556677);
853
+ expect.push(0x8899aabb);
854
+ expect.push(0xccddeeff);
855
+
856
+ test.expect.html('00112233445566778899aabbccddeeff');
857
+
858
+ var output = [];
859
+ w = forge.aes._expandKey(key, true);
860
+ forge.aes._updateBlock(w, block, output, true);
861
+
862
+ var out = forge.util.createBuffer();
863
+ out.putInt32(output[0]);
864
+ out.putInt32(output[1]);
865
+ out.putInt32(output[2]);
866
+ out.putInt32(output[3]);
867
+ test.result.html(out.toHex());
868
+
869
+ test.check();
870
+ });
871
+
872
+ addTest('aes-256 encrypt', function(task, test)
873
+ {
874
+ var block = [];
875
+ block.push(0x00112233);
876
+ block.push(0x44556677);
877
+ block.push(0x8899aabb);
878
+ block.push(0xccddeeff);
879
+ var plain = block;
880
+
881
+ var key = [];
882
+ key.push(0x00010203);
883
+ key.push(0x04050607);
884
+ key.push(0x08090a0b);
885
+ key.push(0x0c0d0e0f);
886
+ key.push(0x10111213);
887
+ key.push(0x14151617);
888
+ key.push(0x18191a1b);
889
+ key.push(0x1c1d1e1f);
890
+
891
+ var expect = [];
892
+ expect.push(0x8ea2b7ca);
893
+ expect.push(0x516745bf);
894
+ expect.push(0xeafc4990);
895
+ expect.push(0x4b496089);
896
+
897
+ test.expect.html('8ea2b7ca516745bfeafc49904b496089');
898
+
899
+ var output = [];
900
+ var w = forge.aes._expandKey(key, false);
901
+ forge.aes._updateBlock(w, block, output, false);
902
+
903
+ var out = forge.util.createBuffer();
904
+ out.putInt32(output[0]);
905
+ out.putInt32(output[1]);
906
+ out.putInt32(output[2]);
907
+ out.putInt32(output[3]);
908
+ test.result.html(out.toHex());
909
+
910
+ test.check();
911
+ });
912
+
913
+ addTest('aes-256 decrypt', function(task, test)
914
+ {
915
+ var block = [];
916
+ block.push(0x8ea2b7ca);
917
+ block.push(0x516745bf);
918
+ block.push(0xeafc4990);
919
+ block.push(0x4b496089);
920
+
921
+ var key = [];
922
+ key.push(0x00010203);
923
+ key.push(0x04050607);
924
+ key.push(0x08090a0b);
925
+ key.push(0x0c0d0e0f);
926
+ key.push(0x10111213);
927
+ key.push(0x14151617);
928
+ key.push(0x18191a1b);
929
+ key.push(0x1c1d1e1f);
930
+
931
+ var expect = [];
932
+ expect.push(0x00112233);
933
+ expect.push(0x44556677);
934
+ expect.push(0x8899aabb);
935
+ expect.push(0xccddeeff);
936
+
937
+ test.expect.html('00112233445566778899aabbccddeeff');
938
+
939
+ var output = [];
940
+ w = forge.aes._expandKey(key, true);
941
+ forge.aes._updateBlock(w, block, output, true);
942
+
943
+ var out = forge.util.createBuffer();
944
+ out.putInt32(output[0]);
945
+ out.putInt32(output[1]);
946
+ out.putInt32(output[2]);
947
+ out.putInt32(output[3]);
948
+ test.result.html(out.toHex());
949
+
950
+ test.check();
951
+ });
952
+
953
+ (function()
954
+ {
955
+ var keys = [
956
+ '06a9214036b8a15b512e03d534120006',
957
+ 'c286696d887c9aa0611bbb3e2025a45a',
958
+ '6c3ea0477630ce21a2ce334aa746c2cd',
959
+ '56e47a38c5598974bc46903dba290349'
960
+ ];
961
+
962
+ var ivs = [
963
+ '3dafba429d9eb430b422da802c9fac41',
964
+ '562e17996d093d28ddb3ba695a2e6f58',
965
+ 'c782dc4c098c66cbd9cd27d825682c81',
966
+ '8ce82eefbea0da3c44699ed7db51b7d9'
967
+ ];
968
+
969
+ var inputs = [
970
+ 'Single block msg',
971
+ '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f',
972
+ 'This is a 48-byte message (exactly 3 AES blocks)',
973
+ 'a0a1a2a3a4a5a6a7a8a9aaabacadaeaf' +
974
+ 'b0b1b2b3b4b5b6b7b8b9babbbcbdbebf' +
975
+ 'c0c1c2c3c4c5c6c7c8c9cacbcccdcecf' +
976
+ 'd0d1d2d3d4d5d6d7d8d9dadbdcdddedf'
977
+ ];
978
+
979
+ var outputs = [
980
+ 'e353779c1079aeb82708942dbe77181a',
981
+ 'd296cd94c2cccf8a3a863028b5e1dc0a7586602d253cfff91b8266bea6d61ab1',
982
+ 'd0a02b3836451753d493665d33f0e886' +
983
+ '2dea54cdb293abc7506939276772f8d5' +
984
+ '021c19216bad525c8579695d83ba2684',
985
+ 'c30e32ffedc0774e6aff6af0869f71aa' +
986
+ '0f3af07a9a31a9c684db207eb0ef8e4e' +
987
+ '35907aa632c3ffdf868bb7b29d3d46ad' +
988
+ '83ce9f9a102ee99d49a53e87f4c3da55'
989
+ ];
990
+
991
+ for(var i = 0; i < keys.length; ++i)
992
+ {
993
+ (function(i)
994
+ {
995
+ var key = forge.util.hexToBytes(keys[i]);
996
+ var iv = forge.util.hexToBytes(ivs[i]);
997
+ var input = (i & 1) ? forge.util.hexToBytes(inputs[i]) : inputs[i];
998
+ var output = forge.util.hexToBytes(outputs[i]);
999
+
1000
+ addTest('aes-128 cbc encrypt', function(task, test)
1001
+ {
1002
+ // encrypt w/no padding
1003
+ test.expect.html(outputs[i]);
1004
+ var cipher = forge.aes.createEncryptionCipher(key);
1005
+ cipher.start(iv);
1006
+ cipher.update(forge.util.createBuffer(input));
1007
+ cipher.finish(function(){return true;});
1008
+ test.result.html(cipher.output.toHex());
1009
+ test.check();
1010
+ });
1011
+
1012
+ addTest('aes-128 cbc decrypt', function(task, test)
1013
+ {
1014
+ // decrypt w/no padding
1015
+ test.expect.html(inputs[i]);
1016
+ var cipher = forge.aes.createDecryptionCipher(key);
1017
+ cipher.start(iv);
1018
+ cipher.update(forge.util.createBuffer(output));
1019
+ cipher.finish(function(){return true;});
1020
+ var out = (i & 1) ?
1021
+ cipher.output.toHex() : cipher.output.bytes();
1022
+ test.result.html(out);
1023
+ test.check();
1024
+ });
1025
+ })(i);
1026
+ }
1027
+ })();
1028
+
1029
+ (function()
1030
+ {
1031
+ var keys = [
1032
+ '00000000000000000000000000000000',
1033
+ '2b7e151628aed2a6abf7158809cf4f3c',
1034
+ '2b7e151628aed2a6abf7158809cf4f3c',
1035
+ '2b7e151628aed2a6abf7158809cf4f3c',
1036
+ '2b7e151628aed2a6abf7158809cf4f3c',
1037
+ '00000000000000000000000000000000'
1038
+ ];
1039
+
1040
+ var ivs = [
1041
+ '80000000000000000000000000000000',
1042
+ '000102030405060708090a0b0c0d0e0f',
1043
+ '3B3FD92EB72DAD20333449F8E83CFB4A',
1044
+ 'C8A64537A0B3A93FCDE3CDAD9F1CE58B',
1045
+ '26751F67A3CBB140B1808CF187A4F4DF',
1046
+ '60f9ff04fac1a25657bf5b36b5efaf75'
1047
+ ];
1048
+
1049
+ var inputs = [
1050
+ '00000000000000000000000000000000',
1051
+ '6bc1bee22e409f96e93d7e117393172a',
1052
+ 'ae2d8a571e03ac9c9eb76fac45af8e51',
1053
+ '30c81c46a35ce411e5fbc1191a0a52ef',
1054
+ 'f69f2445df4f9b17ad2b417be66c3710',
1055
+ 'This is a 48-byte message (exactly 3 AES blocks)'
1056
+ ];
1057
+
1058
+ var outputs = [
1059
+ '3ad78e726c1ec02b7ebfe92b23d9ec34',
1060
+ '3b3fd92eb72dad20333449f8e83cfb4a',
1061
+ 'c8a64537a0b3a93fcde3cdad9f1ce58b',
1062
+ '26751f67a3cbb140b1808cf187a4f4df',
1063
+ 'c04b05357c5d1c0eeac4c66f9ff7f2e6',
1064
+ '52396a2ba1ba420c5e5b699a814944d8' +
1065
+ 'f4e7fbf984a038319fbc0b4ee45cfa6f' +
1066
+ '07b2564beab5b5e92dbd44cb345f49b4'
1067
+ ];
1068
+
1069
+ for(var i = 0; i < keys.length; ++i)
1070
+ {
1071
+ (function(i)
1072
+ {
1073
+ var key = forge.util.hexToBytes(keys[i]);
1074
+ var iv = forge.util.hexToBytes(ivs[i]);
1075
+ var input = (i !== 5) ?
1076
+ forge.util.hexToBytes(inputs[i]) : inputs[i];
1077
+ var output = forge.util.hexToBytes(outputs[i]);
1078
+
1079
+ addTest('aes-128 cfb encrypt', function(task, test)
1080
+ {
1081
+ // encrypt
1082
+ test.expect.html(outputs[i]);
1083
+ var cipher = forge.aes.createEncryptionCipher(key, 'CFB');
1084
+ cipher.start(iv);
1085
+ cipher.update(forge.util.createBuffer(input));
1086
+ cipher.finish();
1087
+ test.result.html(cipher.output.toHex());
1088
+ test.check();
1089
+ });
1090
+
1091
+ addTest('aes-128 cfb decrypt', function(task, test)
1092
+ {
1093
+ // decrypt
1094
+ test.expect.html(inputs[i]);
1095
+ var cipher = forge.aes.createDecryptionCipher(key, 'CFB');
1096
+ cipher.start(iv);
1097
+ cipher.update(forge.util.createBuffer(output));
1098
+ cipher.finish();
1099
+ var out = (i !== 5) ?
1100
+ cipher.output.toHex() : cipher.output.getBytes();
1101
+ test.result.html(out);
1102
+ test.check();
1103
+ });
1104
+ })(i);
1105
+ }
1106
+ })();
1107
+
1108
+ (function()
1109
+ {
1110
+ var keys = [
1111
+ '861009ec4d599fab1f40abc76e6f89880cff5833c79c548c99f9045f191cd90b'
1112
+ ];
1113
+
1114
+ var ivs = [
1115
+ 'd927ad81199aa7dcadfdb4e47b6dc694'
1116
+ ];
1117
+
1118
+ var inputs = [
1119
+ 'MY-DATA-AND-HERE-IS-MORE-DATA'
1120
+ ];
1121
+
1122
+ var outputs = [
1123
+ '80eb666a9fc9e263faf71e87ffc94451d7d8df7cfcf2606470351dd5ac'
1124
+ ];
1125
+
1126
+ for(var i = 0; i < keys.length; ++i)
1127
+ {
1128
+ (function(i)
1129
+ {
1130
+ var key = forge.util.hexToBytes(keys[i]);
1131
+ var iv = forge.util.hexToBytes(ivs[i]);
1132
+ var input = inputs[i];
1133
+ var output = forge.util.hexToBytes(outputs[i]);
1134
+
1135
+ addTest('aes-256 cfb encrypt', function(task, test)
1136
+ {
1137
+ // encrypt
1138
+ test.expect.html(outputs[i]);
1139
+ var cipher = forge.aes.createEncryptionCipher(key, 'CFB');
1140
+ cipher.start(iv);
1141
+ cipher.update(forge.util.createBuffer(input));
1142
+ cipher.finish();
1143
+ test.result.html(cipher.output.toHex());
1144
+ test.check();
1145
+ });
1146
+
1147
+ addTest('aes-256 cfb decrypt', function(task, test)
1148
+ {
1149
+ // decrypt
1150
+ test.expect.html(inputs[i]);
1151
+ var cipher = forge.aes.createDecryptionCipher(key, 'CFB');
1152
+ cipher.start(iv);
1153
+ cipher.update(forge.util.createBuffer(output));
1154
+ cipher.finish();
1155
+ var out = cipher.output.getBytes();
1156
+ test.result.html(out);
1157
+ test.check();
1158
+ });
1159
+ })(i);
1160
+ }
1161
+ })();
1162
+
1163
+ (function()
1164
+ {
1165
+ var keys = [
1166
+ '00000000000000000000000000000000',
1167
+ '00000000000000000000000000000000'
1168
+ ];
1169
+
1170
+ var ivs = [
1171
+ '80000000000000000000000000000000',
1172
+ 'c8ca0d6a35dbeac776e911ee16bea7d3'
1173
+ ];
1174
+
1175
+ var inputs = [
1176
+ '00000000000000000000000000000000',
1177
+ 'This is a 48-byte message (exactly 3 AES blocks)'
1178
+ ];
1179
+
1180
+ var outputs = [
1181
+ '3ad78e726c1ec02b7ebfe92b23d9ec34',
1182
+ '39c0190727a76b2a90963426f63689cf' +
1183
+ 'cdb8a2be8e20c5e877a81a724e3611f6' +
1184
+ '2ecc386f2e941b2441c838906002be19'
1185
+ ];
1186
+
1187
+ for(var i = 0; i < keys.length; ++i)
1188
+ {
1189
+ (function(i)
1190
+ {
1191
+ var key = forge.util.hexToBytes(keys[i]);
1192
+ var iv = forge.util.hexToBytes(ivs[i]);
1193
+ var input = (i !== 1) ?
1194
+ forge.util.hexToBytes(inputs[i]) : inputs[i];
1195
+ var output = forge.util.hexToBytes(outputs[i]);
1196
+
1197
+ addTest('aes-128 ofb encrypt', function(task, test)
1198
+ {
1199
+ // encrypt w/no padding
1200
+ test.expect.html(outputs[i]);
1201
+ var cipher = forge.aes.createEncryptionCipher(key, 'OFB');
1202
+ cipher.start(iv);
1203
+ cipher.update(forge.util.createBuffer(input));
1204
+ cipher.finish(function(){return true;});
1205
+ test.result.html(cipher.output.toHex());
1206
+ test.check();
1207
+ });
1208
+
1209
+ addTest('aes-128 ofb decrypt', function(task, test)
1210
+ {
1211
+ // decrypt w/no padding
1212
+ test.expect.html(inputs[i]);
1213
+ var cipher = forge.aes.createDecryptionCipher(key, 'OFB');
1214
+ cipher.start(iv);
1215
+ cipher.update(forge.util.createBuffer(output));
1216
+ cipher.finish(function(){return true;});
1217
+ var out = (i !== 1) ?
1218
+ cipher.output.toHex() : cipher.output.getBytes();
1219
+ test.result.html(out);
1220
+ test.check();
1221
+ });
1222
+ })(i);
1223
+ }
1224
+ })();
1225
+
1226
+ (function()
1227
+ {
1228
+ var keys = [
1229
+ '00000000000000000000000000000000',
1230
+ '2b7e151628aed2a6abf7158809cf4f3c'
1231
+ ];
1232
+
1233
+ var ivs = [
1234
+ '650cdb80ff9fc758342d2bd99ee2abcf',
1235
+ 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff'
1236
+ ];
1237
+
1238
+ var inputs = [
1239
+ 'This is a 48-byte message (exactly 3 AES blocks)',
1240
+ '6bc1bee22e409f96e93d7e117393172a'
1241
+ ];
1242
+
1243
+ var outputs = [
1244
+ '5ede11d00e9a76ec1d5e7e811ea3dd1c' +
1245
+ 'e09ee941210f825d35718d3282796f1c' +
1246
+ '07c3f1cb424f2b365766ab5229f5b5a4',
1247
+ '874d6191b620e3261bef6864990db6ce'
1248
+ ];
1249
+
1250
+ for(var i = 0; i < keys.length; ++i)
1251
+ {
1252
+ (function(i)
1253
+ {
1254
+ var key = forge.util.hexToBytes(keys[i]);
1255
+ var iv = forge.util.hexToBytes(ivs[i]);
1256
+ var input = (i !== 0) ?
1257
+ forge.util.hexToBytes(inputs[i]) : inputs[i];
1258
+ var output = forge.util.hexToBytes(outputs[i]);
1259
+
1260
+ addTest('aes-128 ctr encrypt', function(task, test)
1261
+ {
1262
+ // encrypt w/no padding
1263
+ test.expect.html(outputs[i]);
1264
+ var cipher = forge.aes.createEncryptionCipher(key, 'CTR');
1265
+ cipher.start(iv);
1266
+ cipher.update(forge.util.createBuffer(input));
1267
+ cipher.finish(function(){return true;});
1268
+ test.result.html(cipher.output.toHex());
1269
+ test.check();
1270
+ });
1271
+
1272
+ addTest('aes-128 ctr decrypt', function(task, test)
1273
+ {
1274
+ // decrypt w/no padding
1275
+ test.expect.html(inputs[i]);
1276
+ var cipher = forge.aes.createDecryptionCipher(key, 'CTR');
1277
+ cipher.start(iv);
1278
+ cipher.update(forge.util.createBuffer(output));
1279
+ cipher.finish(function(){return true;});
1280
+ var out = (i !== 0) ?
1281
+ cipher.output.toHex() : cipher.output.getBytes();
1282
+ test.result.html(out);
1283
+ test.check();
1284
+ });
1285
+ })(i);
1286
+ }
1287
+ })();
1288
+
1289
+ addTest('private key encryption', function(task, test)
1290
+ {
1291
+ var _privateKey =
1292
+ '-----BEGIN RSA PRIVATE KEY-----\r\n' +
1293
+ 'MIICXQIBAAKBgQDL0EugUiNGMWscLAVM0VoMdhDZEJOqdsUMpx9U0YZI7szokJqQ\r\n' +
1294
+ 'NIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMGTkP3VF29vXBo+dLq5e+8VyAy\r\n' +
1295
+ 'Q3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGtvnM+z0MYDdKo80efzwIDAQAB\r\n' +
1296
+ 'AoGAIzkGONi5G+JifmXlLJdplom486p3upf4Ce2/7mqfaG9MnkyPSairKD/JXvfh\r\n' +
1297
+ 'NNWkkN8DKKDKBcVVElPgORYT0qwrWc7ueLBMUCbRXb1ZyfEulimG0R3kjUh7NYau\r\n' +
1298
+ 'DaIkVgfykXGSQMZx8FoaT6L080zd+0emKDDYRrb+/kgJNJECQQDoUZoiC2K/DWNY\r\n' +
1299
+ 'h3/ppZ0ane2y4SBmJUHJVMPQ2CEgxsrJTxet668ckNCKaOP/3VFPoWC41f17DvKq\r\n' +
1300
+ 'noYINNntAkEA4JbZBZBVUrQFhHlrpXT4jzqtO2RlKZzEq8qmFZfEErxOT1WMyyCi\r\n' +
1301
+ 'lAQ5gUKardo1Kf0omC8Xq/uO9ZYdED55KwJBALs6cJ65UFaq4oLJiQPzLd7yokuE\r\n' +
1302
+ 'dcj8g71PLBTW6jPxIiMFNA89nz3FU9wIVp+xbMNhSoMMKqIPVPC+m0Rn260CQQDA\r\n' +
1303
+ 'I83fWK/mZWUjBM33a68KumRiH238v8XyQxj7+C8i6D8G2GXvkigFAehAkb7LZZd+\r\n' +
1304
+ 'KLuGFyPlWv3fVWHf99KpAkBQFKk3MRMl6IGJZUEFQe4l5whm8LkGU4acSqv9B3xt\r\n' +
1305
+ 'qROkCrsFrMPqjuuzEmyHoQZ64r2PLJg7FOuyhBnQUOt4\r\n' +
1306
+ '-----END RSA PRIVATE KEY-----';
1307
+ var pk = forge.pki.privateKeyFromPem(_privateKey);
1308
+ var pem1 = forge.pki.privateKeyToPem(pk);
1309
+ var pem2 = forge.pki.encryptRsaPrivateKey(
1310
+ pk, 'password', {'encAlg': 'aes128'});
1311
+ var privateKey = forge.pki.decryptRsaPrivateKey(pem2, 'password');
1312
+ var pem3 = forge.pki.privateKeyToPem(privateKey);
1313
+ if(pem1 === pem3)
1314
+ {
1315
+ test.pass();
1316
+ }
1317
+ else
1318
+ {
1319
+ test.fail();
1320
+ }
1321
+ });
1322
+
1323
+ addTest('random', function(task, test)
1324
+ {
1325
+ forge.random.getBytes(16);
1326
+ forge.random.getBytes(24);
1327
+ forge.random.getBytes(32);
1328
+
1329
+ var b = forge.random.getBytes(10);
1330
+ test.result.html(forge.util.bytesToHex(b));
1331
+ if(b.length === 10)
1332
+ {
1333
+ test.pass();
1334
+ }
1335
+ else
1336
+ {
1337
+ test.fail();
1338
+ }
1339
+ });
1340
+
1341
+ addTest('asn.1 oid => der', function(task, test)
1342
+ {
1343
+ test.expect.html('2a864886f70d');
1344
+ test.result.html(forge.asn1.oidToDer('1.2.840.113549').toHex());
1345
+ test.check();
1346
+ });
1347
+
1348
+ addTest('asn.1 der => oid', function(task, test)
1349
+ {
1350
+ var der = '2a864886f70d';
1351
+ test.expect.html('1.2.840.113549');
1352
+ test.result.html(forge.asn1.derToOid(forge.util.hexToBytes(der)));
1353
+ test.check();
1354
+ });
1355
+
1356
+ (function()
1357
+ {
1358
+ var _privateKey =
1359
+ '-----BEGIN RSA PRIVATE KEY-----\r\n' +
1360
+ 'MIICXQIBAAKBgQDL0EugUiNGMWscLAVM0VoMdhDZEJOqdsUMpx9U0YZI7szokJqQ\r\n' +
1361
+ 'NIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMGTkP3VF29vXBo+dLq5e+8VyAy\r\n' +
1362
+ 'Q3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGtvnM+z0MYDdKo80efzwIDAQAB\r\n' +
1363
+ 'AoGAIzkGONi5G+JifmXlLJdplom486p3upf4Ce2/7mqfaG9MnkyPSairKD/JXvfh\r\n' +
1364
+ 'NNWkkN8DKKDKBcVVElPgORYT0qwrWc7ueLBMUCbRXb1ZyfEulimG0R3kjUh7NYau\r\n' +
1365
+ 'DaIkVgfykXGSQMZx8FoaT6L080zd+0emKDDYRrb+/kgJNJECQQDoUZoiC2K/DWNY\r\n' +
1366
+ 'h3/ppZ0ane2y4SBmJUHJVMPQ2CEgxsrJTxet668ckNCKaOP/3VFPoWC41f17DvKq\r\n' +
1367
+ 'noYINNntAkEA4JbZBZBVUrQFhHlrpXT4jzqtO2RlKZzEq8qmFZfEErxOT1WMyyCi\r\n' +
1368
+ 'lAQ5gUKardo1Kf0omC8Xq/uO9ZYdED55KwJBALs6cJ65UFaq4oLJiQPzLd7yokuE\r\n' +
1369
+ 'dcj8g71PLBTW6jPxIiMFNA89nz3FU9wIVp+xbMNhSoMMKqIPVPC+m0Rn260CQQDA\r\n' +
1370
+ 'I83fWK/mZWUjBM33a68KumRiH238v8XyQxj7+C8i6D8G2GXvkigFAehAkb7LZZd+\r\n' +
1371
+ 'KLuGFyPlWv3fVWHf99KpAkBQFKk3MRMl6IGJZUEFQe4l5whm8LkGU4acSqv9B3xt\r\n' +
1372
+ 'qROkCrsFrMPqjuuzEmyHoQZ64r2PLJg7FOuyhBnQUOt4\r\n' +
1373
+ '-----END RSA PRIVATE KEY-----\r\n';
1374
+
1375
+ var _publicKey =
1376
+ '-----BEGIN PUBLIC KEY-----\r\n' +
1377
+ 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDL0EugUiNGMWscLAVM0VoMdhDZ\r\n' +
1378
+ 'EJOqdsUMpx9U0YZI7szokJqQNIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMG\r\n' +
1379
+ 'TkP3VF29vXBo+dLq5e+8VyAyQ3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGt\r\n' +
1380
+ 'vnM+z0MYDdKo80efzwIDAQAB\r\n' +
1381
+ '-----END PUBLIC KEY-----\r\n';
1382
+
1383
+ var _certificate =
1384
+ '-----BEGIN CERTIFICATE-----\r\n' +
1385
+ 'MIIDIjCCAougAwIBAgIJANE2aHSbwpaRMA0GCSqGSIb3DQEBBQUAMGoxCzAJBgNV\r\n' +
1386
+ 'BAYTAlVTMREwDwYDVQQIEwhWaXJnaW5pYTETMBEGA1UEBxMKQmxhY2tzYnVyZzEN\r\n' +
1387
+ 'MAsGA1UEChMEVGVzdDENMAsGA1UECxMEVGVzdDEVMBMGA1UEAxMMbXlzZXJ2ZXIu\r\n' +
1388
+ 'Y29tMB4XDTEwMDYxOTE3MzYyOFoXDTExMDYxOTE3MzYyOFowajELMAkGA1UEBhMC\r\n' +
1389
+ 'VVMxETAPBgNVBAgTCFZpcmdpbmlhMRMwEQYDVQQHEwpCbGFja3NidXJnMQ0wCwYD\r\n' +
1390
+ 'VQQKEwRUZXN0MQ0wCwYDVQQLEwRUZXN0MRUwEwYDVQQDEwxteXNlcnZlci5jb20w\r\n' +
1391
+ 'gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMvQS6BSI0YxaxwsBUzRWgx2ENkQ\r\n' +
1392
+ 'k6p2xQynH1TRhkjuzOiQmpA0jCiSJDoSic2dZIyUi/LjoCGeVFif57N5N5Tt4wZO\r\n' +
1393
+ 'Q/dUXb29cGj50url77xXIDJDcXMzXAji2ziFEAIXzDqarKBdDuL9IO7z+tepEa2+\r\n' +
1394
+ 'cz7PQxgN0qjzR5/PAgMBAAGjgc8wgcwwHQYDVR0OBBYEFPV1Y+DHXW6bA/r9sv1y\r\n' +
1395
+ 'NJ8jAwMAMIGcBgNVHSMEgZQwgZGAFPV1Y+DHXW6bA/r9sv1yNJ8jAwMAoW6kbDBq\r\n' +
1396
+ 'MQswCQYDVQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWExEzARBgNVBAcTCkJsYWNr\r\n' +
1397
+ 'c2J1cmcxDTALBgNVBAoTBFRlc3QxDTALBgNVBAsTBFRlc3QxFTATBgNVBAMTDG15\r\n' +
1398
+ 'c2VydmVyLmNvbYIJANE2aHSbwpaRMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF\r\n' +
1399
+ 'BQADgYEARdH2KOlJWTC1CS2y/PAvg4uiM31PXMC1hqSdJlnLM1MY4hRfuf9VyTeX\r\n' +
1400
+ 'Y6FdybcyDLSxKn9id+g9229ci9/s9PI+QmD5vXd8yZyScLc2JkYB4GC6+9D1+/+x\r\n' +
1401
+ 's2hzMxuK6kzZlP+0l9LGcraMQPGRydjCARZZm4Uegln9rh85XFQ=\r\n' +
1402
+ '-----END CERTIFICATE-----\r\n';
1403
+
1404
+ var _signature =
1405
+ '9200ece65cdaed36bcc20b94c65af852e4f88f0b4fe5b249d54665f815992ac4' +
1406
+ '3a1399e65d938c6a7f16dd39d971a53ca66523209dbbfbcb67afa579dbb0c220' +
1407
+ '672813d9e6f4818f29b9becbb29da2032c5e422da97e0c39bfb7a2e7d568615a' +
1408
+ '5073af0337ff215a8e1b2332d668691f4fb731440055420c24ac451dd3c913f4';
1409
+
1410
+ addTest('private key from pem/to pem', function(task, test)
1411
+ {
1412
+ try
1413
+ {
1414
+ // convert from pem
1415
+ var key = forge.pki.privateKeyFromPem(_privateKey);
1416
+ //forge.log.debug(cat, 'privateKey', key);
1417
+
1418
+ // convert back to pem
1419
+ var pem = forge.pki.privateKeyToPem(key);
1420
+ test.expect.html(_privateKey);
1421
+ test.result.html(pem);
1422
+ test.check();
1423
+ }
1424
+ catch(ex)
1425
+ {
1426
+ forge.log.error('test', ex);
1427
+ test.fail();
1428
+ }
1429
+ });
1430
+
1431
+ addTest('public key from pem/to pem', function(task, test)
1432
+ {
1433
+ try
1434
+ {
1435
+ // convert from pem
1436
+ var key = forge.pki.publicKeyFromPem(_publicKey);
1437
+ //forge.log.debug(cat, 'publicKey', key);
1438
+
1439
+ // convert back to pem
1440
+ var pem = forge.pki.publicKeyToPem(key);
1441
+ test.expect.html(_publicKey);
1442
+ test.result.html(pem);
1443
+ test.check();
1444
+ }
1445
+ catch(ex)
1446
+ {
1447
+ forge.log.error('test', ex);
1448
+ test.fail();
1449
+ }
1450
+ });
1451
+
1452
+ addTest('certificate key from pem/to pem', function(task, test)
1453
+ {
1454
+ try
1455
+ {
1456
+ var cert = forge.pki.certificateFromPem(_certificate);
1457
+ /*
1458
+ forge.log.debug(cat, 'cert', cert);
1459
+ forge.log.debug(cat, 'CN', cert.subject.getField('CN').value);
1460
+ forge.log.debug(cat, 'C',
1461
+ cert.subject.getField({shortName: 'C'}).value);
1462
+ forge.log.debug(cat, 'stateOrProvinceName',
1463
+ cert.subject.getField({name: 'stateOrProvinceName'}).value);
1464
+ forge.log.debug(cat, '2.5.4.7',
1465
+ cert.subject.getField({type: '2.5.4.7'}).value);
1466
+ */
1467
+ // convert back to pem
1468
+ var pem = forge.pki.certificateToPem(cert);
1469
+ test.expect.html(_certificate);
1470
+ test.result.html(pem);
1471
+ test.check();
1472
+ }
1473
+ catch(ex)
1474
+ {
1475
+ forge.log.error('test', ex);
1476
+ test.fail();
1477
+ }
1478
+ });
1479
+
1480
+ addTest('verify signature', function(task, test)
1481
+ {
1482
+ try
1483
+ {
1484
+ var key = forge.pki.publicKeyFromPem(_publicKey);
1485
+ var md = forge.md.sha1.create();
1486
+ md.update('0123456789abcdef');
1487
+ var signature = forge.util.hexToBytes(_signature);
1488
+ var success = key.verify(md.digest().getBytes(), signature);
1489
+ if(success)
1490
+ {
1491
+ test.pass();
1492
+ }
1493
+ else
1494
+ {
1495
+ test.fail();
1496
+ }
1497
+ }
1498
+ catch(ex)
1499
+ {
1500
+ forge.log.error('test', ex);
1501
+ test.fail();
1502
+ }
1503
+ });
1504
+
1505
+ addTest('sign and verify', function(task, test)
1506
+ {
1507
+ try
1508
+ {
1509
+ var privateKey = forge.pki.privateKeyFromPem(_privateKey);
1510
+ var publicKey = forge.pki.publicKeyFromPem(_publicKey);
1511
+
1512
+ // do sign
1513
+ var md = forge.md.sha1.create();
1514
+ md.update('0123456789abcdef');
1515
+ var st = +new Date();
1516
+ var signature = privateKey.sign(md);
1517
+ var et = +new Date();
1518
+ //forge.log.debug(cat, 'sign time', (et - st) + 'ms');
1519
+
1520
+ // do verify
1521
+ st = +new Date();
1522
+ var success = publicKey.verify(md.digest().getBytes(), signature);
1523
+ et = +new Date();
1524
+ //forge.log.debug(cat, 'verify time', (et - st) + 'ms');
1525
+ if(success)
1526
+ {
1527
+ test.pass();
1528
+ }
1529
+ else
1530
+ {
1531
+ test.fail();
1532
+ }
1533
+ }
1534
+ catch(ex)
1535
+ {
1536
+ forge.log.error('test', ex);
1537
+ test.fail();
1538
+ }
1539
+ });
1540
+
1541
+ addTest('certificate verify', function(task, test)
1542
+ {
1543
+ try
1544
+ {
1545
+ var cert = forge.pki.certificateFromPem(_certificate, true);
1546
+ //forge.log.debug(cat, 'cert', cert);
1547
+ var success = cert.verify(cert);
1548
+ if(success)
1549
+ {
1550
+ test.pass();
1551
+ }
1552
+ else
1553
+ {
1554
+ test.fail();
1555
+ }
1556
+ }
1557
+ catch(ex)
1558
+ {
1559
+ forge.log.error('test', ex);
1560
+ test.fail();
1561
+ }
1562
+ });
1563
+ })();
1564
+
1565
+ addTest('TLS prf', function(task, test)
1566
+ {
1567
+ // Note: This test vector is originally from:
1568
+ // http://www.imc.org/ietf-tls/mail-archive/msg01589.html
1569
+ // But that link is now dead.
1570
+ var secret = forge.util.createBuffer();
1571
+ for(var i = 0; i < 48; ++i)
1572
+ {
1573
+ secret.putByte(0xAB);
1574
+ }
1575
+ secret = secret.getBytes();
1576
+ var seed = forge.util.createBuffer();
1577
+ for(var i = 0; i < 64; ++i)
1578
+ {
1579
+ seed.putByte(0xCD);
1580
+ }
1581
+ seed = seed.getBytes();
1582
+
1583
+ var bytes = forge.tls.prf_tls1(secret, 'PRF Testvector', seed, 104);
1584
+ var expect =
1585
+ 'd3d4d1e349b5d515044666d51de32bab258cb521' +
1586
+ 'b6b053463e354832fd976754443bcf9a296519bc' +
1587
+ '289abcbc1187e4ebd31e602353776c408aafb74c' +
1588
+ 'bc85eff69255f9788faa184cbb957a9819d84a5d' +
1589
+ '7eb006eb459d3ae8de9810454b8b2d8f1afbc655' +
1590
+ 'a8c9a013';
1591
+ test.expect.html(expect);
1592
+ test.result.html(bytes.toHex());
1593
+ test.check();
1594
+ });
1595
+
1596
+ // function to create certificate
1597
+ var createCert = function(keys, cn, data)
1598
+ {
1599
+ var cert = forge.pki.createCertificate();
1600
+ cert.serialNumber = '01';
1601
+ cert.validity.notBefore = new Date();
1602
+ cert.validity.notAfter = new Date();
1603
+ cert.validity.notAfter.setFullYear(
1604
+ cert.validity.notBefore.getFullYear() + 1);
1605
+ var attrs = [{
1606
+ name: 'commonName',
1607
+ value: cn
1608
+ }, {
1609
+ name: 'countryName',
1610
+ value: 'US'
1611
+ }, {
1612
+ shortName: 'ST',
1613
+ value: 'Virginia'
1614
+ }, {
1615
+ name: 'localityName',
1616
+ value: 'Blacksburg'
1617
+ }, {
1618
+ name: 'organizationName',
1619
+ value: 'Test'
1620
+ }, {
1621
+ shortName: 'OU',
1622
+ value: 'Test'
1623
+ }];
1624
+ cert.setSubject(attrs);
1625
+ cert.setIssuer(attrs);
1626
+ cert.setExtensions([{
1627
+ name: 'basicConstraints',
1628
+ cA: true
1629
+ }, {
1630
+ name: 'keyUsage',
1631
+ keyCertSign: true,
1632
+ digitalSignature: true,
1633
+ nonRepudiation: true,
1634
+ keyEncipherment: true,
1635
+ dataEncipherment: true
1636
+ }, {
1637
+ name: 'subjectAltName',
1638
+ altNames: [{
1639
+ type: 6, // URI
1640
+ value: 'http://myuri.com/webid#me'
1641
+ }]
1642
+ }]);
1643
+ // FIXME: add subjectKeyIdentifier extension
1644
+ // FIXME: add authorityKeyIdentifier extension
1645
+ cert.publicKey = keys.publicKey;
1646
+
1647
+ // self-sign certificate
1648
+ cert.sign(keys.privateKey);
1649
+
1650
+ // save data
1651
+ data[cn] = {
1652
+ cert: forge.pki.certificateToPem(cert),
1653
+ privateKey: forge.pki.privateKeyToPem(keys.privateKey)
1654
+ };
1655
+ };
1656
+
1657
+ var generateCert = function(task, test, cn, data)
1658
+ {
1659
+ task.block();
1660
+
1661
+ // create key-generation state and function to step algorithm
1662
+ test.result.html(
1663
+ 'Generating 512-bit key-pair and certificate for \"' + cn + '\".');
1664
+ var state = forge.pki.rsa.createKeyPairGenerationState(512);
1665
+ var kgTime = +new Date();
1666
+ var step = function()
1667
+ {
1668
+ // step key-generation
1669
+ if(!forge.pki.rsa.stepKeyPairGenerationState(state, 1000))
1670
+ {
1671
+ test.result.html(test.result.html() + '.');
1672
+ setTimeout(step, 1);
1673
+ }
1674
+ // key-generation complete
1675
+ else
1676
+ {
1677
+ kgTime = +new Date() - kgTime;
1678
+ forge.log.debug(cat, 'Total key-gen time', kgTime + 'ms');
1679
+ try
1680
+ {
1681
+ createCert(state.keys, cn, data);
1682
+ test.result.html(
1683
+ test.result.html() + 'done. Time=' + kgTime + 'ms. ');
1684
+ task.unblock();
1685
+ }
1686
+ catch(ex)
1687
+ {
1688
+ forge.log.error(cat, ex, ex.message ? ex.message : '');
1689
+ test.result.html(ex.message);
1690
+ test.fail();
1691
+ task.fail();
1692
+ }
1693
+ }
1694
+ };
1695
+
1696
+ // run key-gen algorithm
1697
+ setTimeout(step, 0);
1698
+ };
1699
+
1700
+ var clientSessionCache1 = forge.tls.createSessionCache();
1701
+ var serverSessionCache1 = forge.tls.createSessionCache();
1702
+ addTest('TLS connection, w/o client-certificate', function(task, test)
1703
+ {
1704
+ var data = {};
1705
+
1706
+ task.next('generate server certifcate', function(task)
1707
+ {
1708
+ generateCert(task, test, 'server', data);
1709
+ });
1710
+
1711
+ task.next('starttls', function(task)
1712
+ {
1713
+ test.result.html(test.result.html() + 'Starting TLS...');
1714
+
1715
+ var end =
1716
+ {
1717
+ client: null,
1718
+ server: null
1719
+ };
1720
+ var success = false;
1721
+
1722
+ // create client
1723
+ end.client = forge.tls.createConnection(
1724
+ {
1725
+ server: false,
1726
+ caStore: [data.server.cert],
1727
+ sessionCache: clientSessionCache1,
1728
+ // optional cipher suites in order of preference
1729
+ cipherSuites: [
1730
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
1731
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
1732
+ virtualHost: 'server',
1733
+ verify: function(c, verified, depth, certs)
1734
+ {
1735
+ test.result.html(test.result.html() +
1736
+ 'Client verifying certificate w/CN: \"' +
1737
+ certs[0].subject.getField('CN').value +
1738
+ '\", verified: ' + verified + '...');
1739
+ if(verified !== true)
1740
+ {
1741
+ test.fail();
1742
+ task.fail();
1743
+ }
1744
+ return verified;
1745
+ },
1746
+ connected: function(c)
1747
+ {
1748
+ test.result.html(test.result.html() + 'Client connected...');
1749
+
1750
+ // send message to server
1751
+ setTimeout(function()
1752
+ {
1753
+ c.prepare('Hello Server');
1754
+ }, 1);
1755
+ },
1756
+ tlsDataReady: function(c)
1757
+ {
1758
+ // send TLS data to server
1759
+ end.server.process(c.tlsData.getBytes());
1760
+ },
1761
+ dataReady: function(c)
1762
+ {
1763
+ var response = c.data.getBytes();
1764
+ test.result.html(test.result.html() +
1765
+ 'Client received \"' + response + '\"');
1766
+ success = (response === 'Hello Client');
1767
+ c.close();
1768
+ },
1769
+ closed: function(c)
1770
+ {
1771
+ test.result.html(test.result.html() + 'Client disconnected.');
1772
+ test.result.html(success ? 'Success' : 'Failure');
1773
+ if(success)
1774
+ {
1775
+ test.expect.html('Success');
1776
+ task.unblock();
1777
+ test.pass();
1778
+ }
1779
+ else
1780
+ {
1781
+ console.log('closed fail');
1782
+ test.fail();
1783
+ task.fail();
1784
+ }
1785
+ },
1786
+ error: function(c, error)
1787
+ {
1788
+ test.result.html(test.result.html() + 'Error: ' + error.message);
1789
+ test.fail();
1790
+ task.fail();
1791
+ }
1792
+ });
1793
+
1794
+ // create server
1795
+ end.server = forge.tls.createConnection(
1796
+ {
1797
+ server: true,
1798
+ sessionCache: serverSessionCache1,
1799
+ // optional cipher suites in order of preference
1800
+ cipherSuites: [
1801
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
1802
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
1803
+ connected: function(c)
1804
+ {
1805
+ test.result.html(test.result.html() + 'Server connected...');
1806
+ },
1807
+ getCertificate: function(c, hint)
1808
+ {
1809
+ test.result.html(test.result.html() +
1810
+ 'Server getting certificate for \"' + hint[0] + '\"...');
1811
+ return data.server.cert;
1812
+ },
1813
+ getPrivateKey: function(c, cert)
1814
+ {
1815
+ return data.server.privateKey;
1816
+ },
1817
+ tlsDataReady: function(c)
1818
+ {
1819
+ // send TLS data to client
1820
+ end.client.process(c.tlsData.getBytes());
1821
+ },
1822
+ dataReady: function(c)
1823
+ {
1824
+ test.result.html(test.result.html() +
1825
+ 'Server received \"' + c.data.getBytes() + '\"');
1826
+
1827
+ // send response
1828
+ c.prepare('Hello Client');
1829
+ c.close();
1830
+ },
1831
+ closed: function(c)
1832
+ {
1833
+ test.result.html(test.result.html() + 'Server disconnected.');
1834
+ },
1835
+ error: function(c, error)
1836
+ {
1837
+ test.result.html(test.result.html() + 'Error: ' + error.message);
1838
+ test.fail();
1839
+ task.fail();
1840
+ }
1841
+ });
1842
+
1843
+ // start handshake
1844
+ task.block();
1845
+ end.client.handshake();
1846
+ });
1847
+ });
1848
+
1849
+ var clientSessionCache2 = forge.tls.createSessionCache();
1850
+ var serverSessionCache2 = forge.tls.createSessionCache();
1851
+ addTest('TLS connection, w/optional client-certificate', function(task, test)
1852
+ {
1853
+ var data = {};
1854
+
1855
+ task.next('generate server certifcate', function(task)
1856
+ {
1857
+ generateCert(task, test, 'server', data);
1858
+ });
1859
+
1860
+ // client-cert generated but not sent in this test
1861
+ task.next('generate client certifcate', function(task)
1862
+ {
1863
+ generateCert(task, test, 'client', data);
1864
+ });
1865
+
1866
+ task.next('starttls', function(task)
1867
+ {
1868
+ test.result.html(test.result.html() + 'Starting TLS...');
1869
+
1870
+ var end =
1871
+ {
1872
+ client: null,
1873
+ server: null
1874
+ };
1875
+ var success = false;
1876
+
1877
+ // create client
1878
+ end.client = forge.tls.createConnection(
1879
+ {
1880
+ server: false,
1881
+ caStore: [data.server.cert],
1882
+ sessionCache: clientSessionCache2,
1883
+ // supported cipher suites in order of preference
1884
+ cipherSuites: [
1885
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
1886
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
1887
+ virtualHost: 'server',
1888
+ verify: function(c, verified, depth, certs)
1889
+ {
1890
+ test.result.html(test.result.html() +
1891
+ 'Client verifying certificate w/CN: \"' +
1892
+ certs[0].subject.getField('CN').value +
1893
+ '\", verified: ' + verified + '...');
1894
+ if(verified !== true)
1895
+ {
1896
+ test.fail();
1897
+ task.fail();
1898
+ }
1899
+ return verified;
1900
+ },
1901
+ connected: function(c)
1902
+ {
1903
+ test.result.html(test.result.html() + 'Client connected...');
1904
+
1905
+ // send message to server
1906
+ setTimeout(function()
1907
+ {
1908
+ c.prepare('Hello Server');
1909
+ }, 1);
1910
+ },
1911
+ tlsDataReady: function(c)
1912
+ {
1913
+ // send TLS data to server
1914
+ end.server.process(c.tlsData.getBytes());
1915
+ },
1916
+ dataReady: function(c)
1917
+ {
1918
+ var response = c.data.getBytes();
1919
+ test.result.html(test.result.html() +
1920
+ 'Client received \"' + response + '\"');
1921
+ success = (response === 'Hello Client');
1922
+ c.close();
1923
+ },
1924
+ closed: function(c)
1925
+ {
1926
+ test.result.html(test.result.html() + 'Client disconnected.');
1927
+ test.result.html(success ? 'Success' : 'Failure');
1928
+ if(success)
1929
+ {
1930
+ test.expect.html('Success');
1931
+ task.unblock();
1932
+ test.pass();
1933
+ }
1934
+ else
1935
+ {
1936
+ console.log('closed fail');
1937
+ test.fail();
1938
+ task.fail();
1939
+ }
1940
+ },
1941
+ error: function(c, error)
1942
+ {
1943
+ test.result.html(test.result.html() + 'Error: ' + error.message);
1944
+ test.fail();
1945
+ task.fail();
1946
+ }
1947
+ });
1948
+
1949
+ // create server
1950
+ end.server = forge.tls.createConnection(
1951
+ {
1952
+ server: true,
1953
+ caStore: [data.client.cert],
1954
+ sessionCache: serverSessionCache2,
1955
+ // supported cipher suites in order of preference
1956
+ cipherSuites: [
1957
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
1958
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
1959
+ connected: function(c)
1960
+ {
1961
+ test.result.html(test.result.html() + 'Server connected...');
1962
+ },
1963
+ verifyClient: 'optional',
1964
+ verify: function(c, verified, depth, certs)
1965
+ {
1966
+ test.result.html(test.result.html() +
1967
+ 'Server verifying certificate w/CN: \"' +
1968
+ certs[0].subject.getField('CN').value +
1969
+ '\", verified: ' + verified + '...');
1970
+ if(verified !== true)
1971
+ {
1972
+ test.fail();
1973
+ task.fail();
1974
+ }
1975
+ return verified;
1976
+ },
1977
+ getCertificate: function(c, hint)
1978
+ {
1979
+ test.result.html(test.result.html() +
1980
+ 'Server getting certificate for \"' + hint[0] + '\"...');
1981
+ return data.server.cert;
1982
+ },
1983
+ getPrivateKey: function(c, cert)
1984
+ {
1985
+ return data.server.privateKey;
1986
+ },
1987
+ tlsDataReady: function(c)
1988
+ {
1989
+ // send TLS data to client
1990
+ end.client.process(c.tlsData.getBytes());
1991
+ },
1992
+ dataReady: function(c)
1993
+ {
1994
+ test.result.html(test.result.html() +
1995
+ 'Server received \"' + c.data.getBytes() + '\"');
1996
+
1997
+ // send response
1998
+ c.prepare('Hello Client');
1999
+ c.close();
2000
+ },
2001
+ closed: function(c)
2002
+ {
2003
+ test.result.html(test.result.html() + 'Server disconnected.');
2004
+ },
2005
+ error: function(c, error)
2006
+ {
2007
+ test.result.html(test.result.html() + 'Error: ' + error.message);
2008
+ test.fail();
2009
+ task.fail();
2010
+ }
2011
+ });
2012
+
2013
+ // start handshake
2014
+ task.block();
2015
+ end.client.handshake();
2016
+ });
2017
+ });
2018
+
2019
+ var clientSessionCache3 = forge.tls.createSessionCache();
2020
+ var serverSessionCache3 = forge.tls.createSessionCache();
2021
+ addTest('TLS connection, w/client-certificate', function(task, test)
2022
+ {
2023
+ var data = {};
2024
+
2025
+ task.next('generate server certifcate', function(task)
2026
+ {
2027
+ generateCert(task, test, 'server', data);
2028
+ });
2029
+
2030
+ task.next('generate client certifcate', function(task)
2031
+ {
2032
+ generateCert(task, test, 'client', data);
2033
+ });
2034
+
2035
+ task.next('starttls', function(task)
2036
+ {
2037
+ test.result.html(test.result.html() + 'Starting TLS...');
2038
+
2039
+ var end =
2040
+ {
2041
+ client: null,
2042
+ server: null
2043
+ };
2044
+ var success = false;
2045
+
2046
+ // create client
2047
+ end.client = forge.tls.createConnection(
2048
+ {
2049
+ server: false,
2050
+ caStore: [data.server.cert],
2051
+ sessionCache: clientSessionCache3,
2052
+ // supported cipher suites in order of preference
2053
+ cipherSuites: [
2054
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
2055
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
2056
+ virtualHost: 'server',
2057
+ verify: function(c, verified, depth, certs)
2058
+ {
2059
+ test.result.html(test.result.html() +
2060
+ 'Client verifying certificate w/CN: \"' +
2061
+ certs[0].subject.getField('CN').value +
2062
+ '\", verified: ' + verified + '...');
2063
+ if(verified !== true)
2064
+ {
2065
+ test.fail();
2066
+ task.fail();
2067
+ }
2068
+ return verified;
2069
+ },
2070
+ connected: function(c)
2071
+ {
2072
+ test.result.html(test.result.html() + 'Client connected...');
2073
+
2074
+ // send message to server
2075
+ setTimeout(function()
2076
+ {
2077
+ c.prepare('Hello Server');
2078
+ }, 1);
2079
+ },
2080
+ getCertificate: function(c, hint)
2081
+ {
2082
+ test.result.html(test.result.html() +
2083
+ 'Client getting certificate ...');
2084
+ return data.client.cert;
2085
+ },
2086
+ getPrivateKey: function(c, cert)
2087
+ {
2088
+ return data.client.privateKey;
2089
+ },
2090
+ tlsDataReady: function(c)
2091
+ {
2092
+ // send TLS data to server
2093
+ end.server.process(c.tlsData.getBytes());
2094
+ },
2095
+ dataReady: function(c)
2096
+ {
2097
+ var response = c.data.getBytes();
2098
+ test.result.html(test.result.html() +
2099
+ 'Client received \"' + response + '\"');
2100
+ success = (response === 'Hello Client');
2101
+ c.close();
2102
+ },
2103
+ closed: function(c)
2104
+ {
2105
+ test.result.html(test.result.html() + 'Client disconnected.');
2106
+ test.result.html(success ? 'Success' : 'Failure');
2107
+ if(success)
2108
+ {
2109
+ test.expect.html('Success');
2110
+ task.unblock();
2111
+ test.pass();
2112
+ }
2113
+ else
2114
+ {
2115
+ console.log('closed fail');
2116
+ test.fail();
2117
+ task.fail();
2118
+ }
2119
+ },
2120
+ error: function(c, error)
2121
+ {
2122
+ test.result.html(test.result.html() + 'Error: ' + error.message);
2123
+ test.fail();
2124
+ task.fail();
2125
+ }
2126
+ });
2127
+
2128
+ // create server
2129
+ end.server = forge.tls.createConnection(
2130
+ {
2131
+ server: true,
2132
+ caStore: [data.client.cert],
2133
+ sessionCache: serverSessionCache3,
2134
+ // supported cipher suites in order of preference
2135
+ cipherSuites: [
2136
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
2137
+ forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
2138
+ connected: function(c)
2139
+ {
2140
+ test.result.html(test.result.html() + 'Server connected...');
2141
+ },
2142
+ verifyClient: true, // use 'optional' to request but not require
2143
+ verify: function(c, verified, depth, certs)
2144
+ {
2145
+ test.result.html(test.result.html() +
2146
+ 'Server verifying certificate w/CN: \"' +
2147
+ certs[0].subject.getField('CN').value +
2148
+ '\", verified: ' + verified + '...');
2149
+ if(verified !== true)
2150
+ {
2151
+ test.fail();
2152
+ task.fail();
2153
+ }
2154
+ return verified;
2155
+ },
2156
+ getCertificate: function(c, hint)
2157
+ {
2158
+ test.result.html(test.result.html() +
2159
+ 'Server getting certificate for \"' + hint[0] + '\"...');
2160
+ return data.server.cert;
2161
+ },
2162
+ getPrivateKey: function(c, cert)
2163
+ {
2164
+ return data.server.privateKey;
2165
+ },
2166
+ tlsDataReady: function(c)
2167
+ {
2168
+ // send TLS data to client
2169
+ end.client.process(c.tlsData.getBytes());
2170
+ },
2171
+ dataReady: function(c)
2172
+ {
2173
+ test.result.html(test.result.html() +
2174
+ 'Server received \"' + c.data.getBytes() + '\"');
2175
+
2176
+ // send response
2177
+ c.prepare('Hello Client');
2178
+ c.close();
2179
+ },
2180
+ closed: function(c)
2181
+ {
2182
+ test.result.html(test.result.html() + 'Server disconnected.');
2183
+ },
2184
+ error: function(c, error)
2185
+ {
2186
+ test.result.html(test.result.html() + 'Error: ' + error.message);
2187
+ test.fail();
2188
+ task.fail();
2189
+ }
2190
+ });
2191
+
2192
+ // start handshake
2193
+ task.block();
2194
+ end.client.handshake();
2195
+ });
2196
+ });
2197
+
2198
+ init();
2199
+ });