fsevents 1.0.5 → 1.0.6

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.

Potentially problematic release.


This version of fsevents might be problematic. Click here for more details.

Files changed (360) hide show
  1. package/Readme.md +12 -13
  2. package/node_modules/ansi/package.json +1 -2
  3. package/node_modules/are-we-there-yet/package.json +1 -2
  4. package/node_modules/asn1/.travis.yml +4 -0
  5. package/node_modules/asn1/lib/ber/reader.js +27 -33
  6. package/node_modules/asn1/lib/ber/writer.js +10 -11
  7. package/node_modules/asn1/package.json +21 -19
  8. package/node_modules/asn1/tst/ber/reader.test.js +36 -0
  9. package/node_modules/asn1/tst/ber/writer.test.js +74 -0
  10. package/node_modules/assert-plus/package.json +1 -0
  11. package/node_modules/{ctype → bl/node_modules/readable-stream/node_modules/core-util-is}/LICENSE +1 -6
  12. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +11 -11
  13. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json +17 -12
  14. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js +68 -0
  15. package/node_modules/boom/package.json +1 -1
  16. package/node_modules/commander/package.json +1 -1
  17. package/node_modules/core-util-is/LICENSE +19 -0
  18. package/node_modules/core-util-is/lib/util.js +11 -11
  19. package/node_modules/core-util-is/package.json +17 -12
  20. package/node_modules/core-util-is/test.js +68 -0
  21. package/node_modules/dashdash/README.md +508 -0
  22. package/node_modules/dashdash/lib/dashdash.js +813 -0
  23. package/node_modules/dashdash/package.json +87 -0
  24. package/node_modules/deep-extend/LICENSE +1 -1
  25. package/node_modules/deep-extend/README.md +89 -52
  26. package/node_modules/deep-extend/index.js +1 -90
  27. package/node_modules/deep-extend/lib/deep-extend.js +144 -0
  28. package/node_modules/deep-extend/package.json +47 -16
  29. package/node_modules/deep-extend/test/index.spec.js +168 -5
  30. package/node_modules/delegates/package.json +1 -2
  31. package/node_modules/ecc-jsbn/.npmignore +15 -0
  32. package/node_modules/ecc-jsbn/LICENSE +21 -0
  33. package/node_modules/ecc-jsbn/README.md +8 -0
  34. package/node_modules/ecc-jsbn/index.js +57 -0
  35. package/node_modules/ecc-jsbn/lib/LICENSE-jsbn +40 -0
  36. package/node_modules/ecc-jsbn/lib/ec.js +561 -0
  37. package/node_modules/ecc-jsbn/lib/sec.js +170 -0
  38. package/node_modules/ecc-jsbn/package.json +63 -0
  39. package/node_modules/ecc-jsbn/test.js +14 -0
  40. package/node_modules/extsprintf/.gitmodules +6 -0
  41. package/node_modules/{path-is-absolute/license → extsprintf/LICENSE} +2 -4
  42. package/node_modules/extsprintf/Makefile +23 -0
  43. package/node_modules/extsprintf/Makefile.deps +39 -0
  44. package/node_modules/extsprintf/Makefile.targ +285 -0
  45. package/node_modules/extsprintf/README.md +39 -0
  46. package/node_modules/extsprintf/examples/simple.js +2 -0
  47. package/node_modules/{ctype/tools/jsl.conf → extsprintf/jsl.node.conf} +71 -63
  48. package/node_modules/extsprintf/lib/extsprintf.js +166 -0
  49. package/node_modules/extsprintf/package.json +48 -0
  50. package/node_modules/fstream/package.json +1 -2
  51. package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/package.json +4 -22
  52. package/node_modules/{concat-map → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/package.json +3 -21
  53. package/node_modules/{brace-expansion → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion}/package.json +4 -23
  54. package/node_modules/fstream-ignore/node_modules/minimatch/package.json +4 -24
  55. package/node_modules/fstream-ignore/package.json +1 -2
  56. package/node_modules/gauge/package.json +1 -2
  57. package/node_modules/har-validator/package.json +15 -15
  58. package/node_modules/has-unicode/package.json +1 -2
  59. package/node_modules/hawk/dist/client.js +340 -0
  60. package/node_modules/hawk/lib/browser.js +14 -20
  61. package/node_modules/hawk/package.json +10 -10
  62. package/node_modules/hawk/test/browser.js +134 -101
  63. package/node_modules/hawk/test/index.js +61 -61
  64. package/node_modules/hawk/test/server.js +72 -84
  65. package/node_modules/hawk/test/uri.js +52 -63
  66. package/node_modules/http-signature/CHANGES.md +39 -0
  67. package/node_modules/http-signature/http_signing.md +16 -17
  68. package/node_modules/http-signature/lib/index.js +6 -4
  69. package/node_modules/http-signature/lib/parser.js +43 -29
  70. package/node_modules/http-signature/lib/signer.js +290 -74
  71. package/node_modules/http-signature/lib/utils.js +112 -0
  72. package/node_modules/http-signature/lib/verify.js +47 -15
  73. package/node_modules/http-signature/package.json +20 -14
  74. package/node_modules/is-my-json-valid/index.js +16 -14
  75. package/node_modules/is-my-json-valid/package.json +16 -12
  76. package/node_modules/is-typedarray/LICENSE.md +18 -0
  77. package/node_modules/is-typedarray/README.md +16 -0
  78. package/node_modules/is-typedarray/index.js +41 -0
  79. package/node_modules/is-typedarray/package.json +63 -0
  80. package/node_modules/is-typedarray/test.js +34 -0
  81. package/node_modules/jodid25519/.npmignore +11 -0
  82. package/node_modules/jodid25519/.travis.yml +7 -0
  83. package/node_modules/jodid25519/AUTHORS.md +3 -0
  84. package/node_modules/jodid25519/LICENSE +23 -0
  85. package/node_modules/jodid25519/README.md +51 -0
  86. package/node_modules/jodid25519/almond.0 +42 -0
  87. package/node_modules/jodid25519/almond.1 +13 -0
  88. package/node_modules/jodid25519/index.js +35 -0
  89. package/node_modules/jodid25519/jsdoc.json +19 -0
  90. package/node_modules/jodid25519/lib/core.js +481 -0
  91. package/node_modules/jodid25519/lib/curve255.js +221 -0
  92. package/node_modules/jodid25519/lib/dh.js +111 -0
  93. package/node_modules/jodid25519/lib/eddsa.js +573 -0
  94. package/node_modules/jodid25519/lib/utils.js +198 -0
  95. package/node_modules/jodid25519/package.json +77 -0
  96. package/node_modules/jsbn/.npmignore +2 -0
  97. package/node_modules/jsbn/LICENSE +40 -0
  98. package/node_modules/jsbn/README.md +175 -0
  99. package/node_modules/jsbn/example.html +12 -0
  100. package/node_modules/jsbn/example.js +3 -0
  101. package/node_modules/jsbn/index.js +1358 -0
  102. package/node_modules/jsbn/package.json +60 -0
  103. package/node_modules/json-schema/README.md +5 -0
  104. package/node_modules/json-schema/draft-00/hyper-schema +68 -0
  105. package/node_modules/json-schema/draft-00/json-ref +26 -0
  106. package/node_modules/json-schema/draft-00/links +33 -0
  107. package/node_modules/json-schema/draft-00/schema +155 -0
  108. package/node_modules/json-schema/draft-01/hyper-schema +68 -0
  109. package/node_modules/json-schema/draft-01/json-ref +26 -0
  110. package/node_modules/json-schema/draft-01/links +33 -0
  111. package/node_modules/json-schema/draft-01/schema +155 -0
  112. package/node_modules/json-schema/draft-02/hyper-schema +68 -0
  113. package/node_modules/json-schema/draft-02/json-ref +26 -0
  114. package/node_modules/json-schema/draft-02/links +35 -0
  115. package/node_modules/json-schema/draft-02/schema +166 -0
  116. package/node_modules/json-schema/draft-03/examples/address +20 -0
  117. package/node_modules/json-schema/draft-03/examples/calendar +53 -0
  118. package/node_modules/json-schema/draft-03/examples/card +105 -0
  119. package/node_modules/json-schema/draft-03/examples/geo +8 -0
  120. package/node_modules/json-schema/draft-03/examples/interfaces +23 -0
  121. package/node_modules/json-schema/draft-03/hyper-schema +60 -0
  122. package/node_modules/json-schema/draft-03/json-ref +26 -0
  123. package/node_modules/json-schema/draft-03/links +35 -0
  124. package/node_modules/json-schema/draft-03/schema +174 -0
  125. package/node_modules/json-schema/draft-04/hyper-schema +60 -0
  126. package/node_modules/json-schema/draft-04/links +41 -0
  127. package/node_modules/json-schema/draft-04/schema +189 -0
  128. package/node_modules/json-schema/draft-zyp-json-schema-03.xml +1120 -0
  129. package/node_modules/json-schema/draft-zyp-json-schema-04.xml +1072 -0
  130. package/node_modules/json-schema/lib/links.js +52 -0
  131. package/node_modules/json-schema/lib/validate.js +260 -0
  132. package/node_modules/json-schema/package.json +67 -0
  133. package/node_modules/json-schema/test/tests.js +95 -0
  134. package/node_modules/jsprim/CHANGES.md +30 -0
  135. package/node_modules/jsprim/LICENSE +19 -0
  136. package/node_modules/jsprim/README.md +228 -0
  137. package/node_modules/jsprim/lib/jsprim.js +478 -0
  138. package/node_modules/jsprim/package.json +54 -0
  139. package/node_modules/lodash._basetostring/package.json +1 -2
  140. package/node_modules/lodash._createpadding/package.json +1 -2
  141. package/node_modules/lodash.pad/package.json +1 -2
  142. package/node_modules/lodash.padleft/package.json +1 -2
  143. package/node_modules/lodash.padright/package.json +1 -2
  144. package/node_modules/lodash.repeat/package.json +1 -2
  145. package/node_modules/node-pre-gyp/CHANGELOG.md +8 -0
  146. package/node_modules/node-pre-gyp/README.md +570 -0
  147. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +4 -0
  148. package/node_modules/node-pre-gyp/node_modules/nopt/lib/nopt.js +2 -1
  149. package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/package.json +30 -37
  150. package/node_modules/node-pre-gyp/node_modules/nopt/package.json +37 -57
  151. package/node_modules/node-pre-gyp/node_modules/nopt/test/basic.js +22 -0
  152. package/node_modules/node-pre-gyp/package.json +17 -17
  153. package/node_modules/node-uuid/.npmignore +2 -0
  154. package/node_modules/node-uuid/README.md +12 -1
  155. package/node_modules/node-uuid/bower.json +1 -1
  156. package/node_modules/node-uuid/component.json +11 -4
  157. package/node_modules/node-uuid/package.json +25 -12
  158. package/node_modules/node-uuid/test/test.js +3 -0
  159. package/node_modules/node-uuid/uuid.js +70 -45
  160. package/node_modules/npmlog/.travis.yml +14 -0
  161. package/node_modules/npmlog/log.js +3 -0
  162. package/node_modules/npmlog/package.json +23 -20
  163. package/node_modules/npmlog/test/basic.js +8 -1
  164. package/node_modules/once/package.json +2 -3
  165. package/node_modules/pinkie/index.js +23 -7
  166. package/node_modules/pinkie/package.json +22 -15
  167. package/node_modules/pinkie/readme.md +17 -9
  168. package/node_modules/pinkie-promise/package.json +16 -14
  169. package/node_modules/pinkie-promise/readme.md +5 -3
  170. package/node_modules/rc/README.md +1 -1
  171. package/node_modules/rc/index.js +1 -1
  172. package/node_modules/rc/node_modules/minimist/package.json +1 -1
  173. package/node_modules/rc/package.json +12 -12
  174. package/node_modules/request/.eslintrc +1 -1
  175. package/node_modules/request/.travis.yml +4 -4
  176. package/node_modules/request/CHANGELOG.md +25 -0
  177. package/node_modules/request/README.md +12 -13
  178. package/node_modules/request/lib/har.js +84 -75
  179. package/node_modules/request/lib/redirect.js +2 -3
  180. package/node_modules/request/lib/tunnel.js +13 -18
  181. package/node_modules/request/package.json +17 -16
  182. package/node_modules/request/request.js +16 -59
  183. package/node_modules/rimraf/README.md +7 -2
  184. package/node_modules/{wrappy → rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy}/package.json +5 -25
  185. package/node_modules/{inflight → rimraf/node_modules/glob/node_modules/inflight}/package.json +5 -25
  186. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  187. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/README.md +42 -0
  188. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  189. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  190. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/package.json +58 -0
  191. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/test.js +25 -0
  192. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +3 -0
  193. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +122 -0
  194. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  195. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  196. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  197. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +3 -0
  198. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/LICENSE.md +21 -0
  199. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  200. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
  201. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  202. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
  203. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +79 -0
  204. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
  205. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +4 -0
  206. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  207. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  208. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  209. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  210. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +90 -0
  211. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  212. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +81 -0
  213. package/node_modules/rimraf/node_modules/{minimatch → glob/node_modules/minimatch}/package.json +3 -21
  214. package/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  215. package/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +58 -0
  216. package/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  217. package/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  218. package/node_modules/rimraf/node_modules/glob/node_modules/once/package.json +70 -0
  219. package/node_modules/{path-is-absolute → rimraf/node_modules/glob/node_modules/path-is-absolute}/package.json +4 -22
  220. package/node_modules/rimraf/node_modules/glob/package.json +2 -20
  221. package/node_modules/rimraf/package.json +10 -10
  222. package/node_modules/semver/README.md +25 -1
  223. package/node_modules/semver/package.json +10 -10
  224. package/node_modules/semver/range.bnf +16 -0
  225. package/node_modules/semver/semver.js +0 -12
  226. package/node_modules/sshpk/.npmignore +8 -0
  227. package/node_modules/sshpk/.travis.yml +11 -0
  228. package/node_modules/sshpk/LICENSE +18 -0
  229. package/node_modules/sshpk/README.md +436 -0
  230. package/node_modules/sshpk/bin/sshpk-conv +183 -0
  231. package/node_modules/sshpk/lib/algs.js +168 -0
  232. package/node_modules/sshpk/lib/dhe.js +312 -0
  233. package/node_modules/sshpk/lib/ed-compat.js +94 -0
  234. package/node_modules/sshpk/lib/errors.js +58 -0
  235. package/node_modules/sshpk/lib/fingerprint.js +140 -0
  236. package/node_modules/sshpk/lib/formats/auto.js +73 -0
  237. package/node_modules/sshpk/lib/formats/pem.js +152 -0
  238. package/node_modules/sshpk/lib/formats/pkcs1.js +320 -0
  239. package/node_modules/sshpk/lib/formats/pkcs8.js +510 -0
  240. package/node_modules/sshpk/lib/formats/rfc4253.js +145 -0
  241. package/node_modules/sshpk/lib/formats/ssh-private.js +138 -0
  242. package/node_modules/sshpk/lib/formats/ssh.js +114 -0
  243. package/node_modules/sshpk/lib/index.js +25 -0
  244. package/node_modules/sshpk/lib/key.js +260 -0
  245. package/node_modules/sshpk/lib/private-key.js +224 -0
  246. package/node_modules/sshpk/lib/signature.js +237 -0
  247. package/node_modules/sshpk/lib/ssh-buffer.js +123 -0
  248. package/node_modules/sshpk/lib/utils.js +207 -0
  249. package/node_modules/sshpk/node_modules/assert-plus/AUTHORS +6 -0
  250. package/node_modules/sshpk/node_modules/assert-plus/CHANGES.md +8 -0
  251. package/node_modules/sshpk/node_modules/assert-plus/README.md +155 -0
  252. package/node_modules/sshpk/node_modules/assert-plus/assert.js +206 -0
  253. package/node_modules/sshpk/node_modules/assert-plus/package.json +88 -0
  254. package/node_modules/sshpk/package.json +92 -0
  255. package/node_modules/strip-json-comments/cli.js +2 -2
  256. package/node_modules/strip-json-comments/package.json +13 -12
  257. package/node_modules/strip-json-comments/readme.md +11 -5
  258. package/node_modules/strip-json-comments/strip-json-comments.js +16 -7
  259. package/node_modules/tar/package.json +1 -2
  260. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/LICENSE +19 -0
  261. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +11 -11
  262. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/package.json +17 -12
  263. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/test.js +68 -0
  264. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/package.json +1 -1
  265. package/node_modules/tar-pack/node_modules/rimraf/package.json +1 -2
  266. package/node_modules/tar-pack/package.json +1 -2
  267. package/node_modules/tough-cookie/lib/cookie.js +1 -1
  268. package/node_modules/tough-cookie/package.json +7 -7
  269. package/node_modules/tweetnacl/.npmignore +4 -0
  270. package/node_modules/tweetnacl/CHANGELOG.md +128 -0
  271. package/node_modules/tweetnacl/README.md +463 -0
  272. package/node_modules/tweetnacl/nacl-fast.js +2418 -0
  273. package/node_modules/tweetnacl/nacl-fast.min.js +2 -0
  274. package/node_modules/tweetnacl/nacl.js +1205 -0
  275. package/node_modules/tweetnacl/nacl.min.js +1 -0
  276. package/node_modules/tweetnacl/package.json +101 -0
  277. package/node_modules/uid-number/package.json +2 -3
  278. package/node_modules/verror/.gitmodules +0 -0
  279. package/node_modules/verror/LICENSE +19 -0
  280. package/node_modules/verror/Makefile +35 -0
  281. package/node_modules/verror/Makefile.targ +285 -0
  282. package/node_modules/verror/README.md +120 -0
  283. package/node_modules/verror/examples/levels-verror.js +36 -0
  284. package/node_modules/verror/examples/levels-werror.js +34 -0
  285. package/node_modules/verror/examples/varargs.js +6 -0
  286. package/node_modules/verror/examples/verror.js +13 -0
  287. package/node_modules/verror/examples/werror.js +14 -0
  288. package/node_modules/verror/jsl.node.conf +139 -0
  289. package/node_modules/verror/lib/verror.js +157 -0
  290. package/node_modules/verror/package.json +51 -0
  291. package/node_modules/verror/tests/tst.inherit.js +100 -0
  292. package/node_modules/verror/tests/tst.verror.js +156 -0
  293. package/node_modules/verror/tests/tst.werror.js +179 -0
  294. package/package.json +3 -3
  295. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/util.js +0 -106
  296. package/node_modules/core-util-is/util.js +0 -106
  297. package/node_modules/ctype/.npmignore +0 -1
  298. package/node_modules/ctype/CHANGELOG +0 -78
  299. package/node_modules/ctype/README +0 -82
  300. package/node_modules/ctype/README.old +0 -298
  301. package/node_modules/ctype/ctf.js +0 -245
  302. package/node_modules/ctype/ctio.js +0 -1485
  303. package/node_modules/ctype/ctype.js +0 -944
  304. package/node_modules/ctype/man/man3ctype/ctio.3ctype +0 -241
  305. package/node_modules/ctype/package.json +0 -51
  306. package/node_modules/ctype/tools/jsstyle +0 -839
  307. package/node_modules/http-signature/lib/util.js +0 -306
  308. package/node_modules/inflight/node_modules/once/package.json +0 -86
  309. package/node_modules/inflight/node_modules/once/test/once.js +0 -23
  310. package/node_modules/rimraf/node_modules/glob/LICENSE +0 -15
  311. package/node_modules/rimraf/node_modules/minimatch/LICENSE +0 -15
  312. package/node_modules/rimraf/node_modules/once/LICENSE +0 -15
  313. package/node_modules/rimraf/node_modules/once/README.md +0 -51
  314. package/node_modules/rimraf/node_modules/once/once.js +0 -21
  315. package/node_modules/rimraf/node_modules/once/package.json +0 -84
  316. package/node_modules/rimraf/node_modules/once/test/once.js +0 -23
  317. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/util.js +0 -106
  318. package/node_modules/wrappy/LICENSE +0 -15
  319. /package/node_modules/{brace-expansion → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion}/.npmignore +0 -0
  320. /package/node_modules/{brace-expansion → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion}/README.md +0 -0
  321. /package/node_modules/{brace-expansion → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion}/example.js +0 -0
  322. /package/node_modules/{brace-expansion → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion}/index.js +0 -0
  323. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.npmignore +0 -0
  324. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
  325. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/LICENSE.md +0 -0
  326. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/Makefile +0 -0
  327. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/README.md +0 -0
  328. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/example.js +0 -0
  329. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/index.js +0 -0
  330. /package/node_modules/{balanced-match → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/test/balanced.js +0 -0
  331. /package/node_modules/{concat-map → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +0 -0
  332. /package/node_modules/{concat-map → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/LICENSE +0 -0
  333. /package/node_modules/{concat-map → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/README.markdown +0 -0
  334. /package/node_modules/{concat-map → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/example/map.js +0 -0
  335. /package/node_modules/{concat-map → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/index.js +0 -0
  336. /package/node_modules/{concat-map → fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/test/map.js +0 -0
  337. /package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/.npmignore +0 -0
  338. /package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/.travis.yml +0 -0
  339. /package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/CONTRIBUTING.md +0 -0
  340. /package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/LICENSE +0 -0
  341. /package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/README.md +0 -0
  342. /package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/abbrev.js +0 -0
  343. /package/node_modules/{abbrev → node-pre-gyp/node_modules/nopt/node_modules/abbrev}/test.js +0 -0
  344. /package/node_modules/{inflight → rimraf/node_modules/glob/node_modules/inflight}/.eslintrc +0 -0
  345. /package/node_modules/{inflight → rimraf/node_modules/glob/node_modules/inflight}/LICENSE +0 -0
  346. /package/node_modules/{inflight → rimraf/node_modules/glob/node_modules/inflight}/README.md +0 -0
  347. /package/node_modules/{inflight → rimraf/node_modules/glob/node_modules/inflight}/inflight.js +0 -0
  348. /package/node_modules/{fstream-ignore/node_modules/minimatch → rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy}/LICENSE +0 -0
  349. /package/node_modules/{wrappy → rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy}/README.md +0 -0
  350. /package/node_modules/{wrappy → rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy}/test/basic.js +0 -0
  351. /package/node_modules/{wrappy → rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy}/wrappy.js +0 -0
  352. /package/node_modules/{inflight → rimraf/node_modules/glob/node_modules/inflight}/test.js +0 -0
  353. /package/node_modules/rimraf/node_modules/{minimatch → glob/node_modules/minimatch}/README.md +0 -0
  354. /package/node_modules/rimraf/node_modules/{minimatch → glob/node_modules/minimatch}/minimatch.js +0 -0
  355. /package/node_modules/{inflight → rimraf/node_modules/glob}/node_modules/once/README.md +0 -0
  356. /package/node_modules/{inflight/node_modules/once → rimraf/node_modules/glob/node_modules/once/node_modules/wrappy}/LICENSE +0 -0
  357. /package/node_modules/{inflight → rimraf/node_modules/glob}/node_modules/once/once.js +0 -0
  358. /package/node_modules/{path-is-absolute → rimraf/node_modules/glob/node_modules/path-is-absolute}/index.js +0 -0
  359. /package/node_modules/{path-is-absolute → rimraf/node_modules/glob/node_modules/path-is-absolute}/readme.md +0 -0
  360. /package/node_modules/{deep-extend → verror}/.npmignore +0 -0
@@ -0,0 +1,436 @@
1
+ sshpk
2
+ =========
3
+
4
+ Parse, convert, fingerprint and use SSH keys (both public and private) in pure
5
+ node -- no `ssh-keygen` or other external dependencies.
6
+
7
+ Supports RSA, DSA, ECDSA (nistp-\*) and ED25519 key types, in PEM (PKCS#1,
8
+ PKCS#8) and OpenSSH formats.
9
+
10
+ This library has been extracted from
11
+ [`node-http-signature`](https://github.com/joyent/node-http-signature)
12
+ (work by [Mark Cavage](https://github.com/mcavage) and
13
+ [Dave Eddy](https://github.com/bahamas10)) and
14
+ [`node-ssh-fingerprint`](https://github.com/bahamas10/node-ssh-fingerprint)
15
+ (work by Dave Eddy), with additions (including ECDSA support) by
16
+ [Alex Wilson](https://github.com/arekinath).
17
+
18
+ Install
19
+ -------
20
+
21
+ ```
22
+ npm install sshpk
23
+ ```
24
+
25
+ Examples
26
+ --------
27
+
28
+ ```js
29
+ var sshpk = require('sshpk');
30
+
31
+ var fs = require('fs');
32
+
33
+ /* Read in an OpenSSH-format public key */
34
+ var keyPub = fs.readFileSync('id_rsa.pub');
35
+ var key = sshpk.parseKey(keyPub, 'ssh');
36
+
37
+ /* Get metadata about the key */
38
+ console.log('type => %s', key.type);
39
+ console.log('size => %d bits', key.size);
40
+ console.log('comment => %s', key.comment);
41
+
42
+ /* Compute key fingerprints, in new OpenSSH (>6.7) format, and old MD5 */
43
+ console.log('fingerprint => %s', key.fingerprint().toString());
44
+ console.log('old-style fingerprint => %s', key.fingerprint('md5').toString());
45
+ ```
46
+
47
+ Example output:
48
+
49
+ ```
50
+ type => rsa
51
+ size => 2048 bits
52
+ comment => foo@foo.com
53
+ fingerprint => SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w
54
+ old-style fingerprint => a0:c8:ad:6c:32:9a:32:fa:59:cc:a9:8c:0a:0d:6e:bd
55
+ ```
56
+
57
+ More examples: converting between formats:
58
+
59
+ ```js
60
+ /* Read in a PEM public key */
61
+ var keyPem = fs.readFileSync('id_rsa.pem');
62
+ var key = sshpk.parseKey(keyPem, 'pem');
63
+
64
+ /* Convert to PEM PKCS#8 public key format */
65
+ var pemBuf = key.toBuffer('pkcs8');
66
+
67
+ /* Convert to SSH public key format (and return as a string) */
68
+ var sshKey = key.toString('ssh');
69
+ ```
70
+
71
+ Signing and verifying:
72
+
73
+ ```js
74
+ /* Read in an OpenSSH/PEM *private* key */
75
+ var keyPriv = fs.readFileSync('id_ecdsa');
76
+ var key = sshpk.parsePrivateKey(keyPriv, 'pem');
77
+
78
+ var data = 'some data';
79
+
80
+ /* Sign some data with the key */
81
+ var s = key.createSign('sha1');
82
+ s.update(data);
83
+ var signature = s.sign();
84
+
85
+ /* Now load the public key (could also use just key.toPublic()) */
86
+ var keyPub = fs.readFileSync('id_ecdsa.pub');
87
+ key = sshpk.parseKey(keyPub, 'ssh');
88
+
89
+ /* Make a crypto.Verifier with this key */
90
+ var v = key.createVerify('sha1');
91
+ v.update(data);
92
+ var valid = v.verify(signature);
93
+ /* => true! */
94
+ ```
95
+
96
+ Matching fingerprints with keys:
97
+
98
+ ```js
99
+ var fp = sshpk.parseFingerprint('SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w');
100
+
101
+ var keys = [sshpk.parseKey(...), sshpk.parseKey(...), ...];
102
+
103
+ keys.forEach(function (key) {
104
+ if (fp.matches(key))
105
+ console.log('found it!');
106
+ });
107
+ ```
108
+
109
+ Usage
110
+ -----
111
+
112
+ ## Public keys
113
+
114
+ ### `parseKey(data[, format = 'auto'[, name]])`
115
+
116
+ Parses a key from a given data format and returns a new `Key` object.
117
+
118
+ Parameters
119
+
120
+ - `data` -- Either a Buffer or String, containing the key
121
+ - `format` -- String name of format to use, valid options are:
122
+ - `auto`: choose automatically from all below
123
+ - `pem`: supports both PKCS#1 and PKCS#8
124
+ - `ssh`: standard OpenSSH format,
125
+ - `pkcs1`, `pkcs8`: variants of `pem`
126
+ - `rfc4253`: raw OpenSSH wire format
127
+ - `openssh`: new post-OpenSSH 6.5 internal format, produced by
128
+ `ssh-keygen -o`
129
+ - `name` -- Optional name for the key being parsed (eg. the filename that
130
+ was opened). Used to generate Error messages
131
+
132
+ ### `Key.isKey(obj)`
133
+
134
+ Returns `true` if the given object is a valid `Key` object created by a version
135
+ of `sshpk` compatible with this one.
136
+
137
+ Parameters
138
+
139
+ - `obj` -- Object to identify
140
+
141
+ ### `Key#type`
142
+
143
+ String, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`.
144
+
145
+ ### `Key#size`
146
+
147
+ Integer, "size" of the key in bits. For RSA/DSA this is the size of the modulus;
148
+ for ECDSA this is the bit size of the curve in use.
149
+
150
+ ### `Key#comment`
151
+
152
+ Optional string, a key comment used by some formats (eg the `ssh` format).
153
+
154
+ ### `Key#curve`
155
+
156
+ Only present if `this.type === 'ecdsa'`, string containing the name of the
157
+ named curve used with this key. Possible values include `nistp256`, `nistp384`
158
+ and `nistp521`.
159
+
160
+ ### `Key#toBuffer([format = 'ssh'])`
161
+
162
+ Convert the key into a given data format and return the serialized key as
163
+ a Buffer.
164
+
165
+ Parameters
166
+
167
+ - `format` -- String name of format to use, for valid options see `parseKey()`
168
+
169
+ ### `Key#toString([format = 'ssh])`
170
+
171
+ Same as `this.toBuffer(format).toString()`.
172
+
173
+ ### `Key#fingerprint([algorithm = 'sha256'])`
174
+
175
+ Creates a new `Fingerprint` object representing this Key's fingerprint.
176
+
177
+ Parameters
178
+
179
+ - `algorithm` -- String name of hash algorithm to use, valid options are `md5`,
180
+ `sha1`, `sha256`, `sha384`, `sha512`
181
+
182
+ ### `Key#createVerify([hashAlgorithm])`
183
+
184
+ Creates a `crypto.Verifier` specialized to use this Key (and the correct public
185
+ key algorithm to match it). The returned Verifier has the same API as a regular
186
+ one, except that the `verify()` function takes only the target signature as an
187
+ argument.
188
+
189
+ Parameters
190
+
191
+ - `hashAlgorithm` -- optional String name of hash algorithm to use, any
192
+ supported by OpenSSL are valid, usually including
193
+ `sha1`, `sha256`.
194
+
195
+ `v.verify(signature[, format])` Parameters
196
+
197
+ - `signature` -- either a Signature object, or a Buffer or String
198
+ - `format` -- optional String, name of format to interpret given String with.
199
+ Not valid if `signature` is a Signature or Buffer.
200
+
201
+ ### `Key#createDiffieHellman()`
202
+ ### `Key#createDH()`
203
+
204
+ Creates a Diffie-Hellman key exchange object initialized with this key and all
205
+ necessary parameters. This has the same API as a `crypto.DiffieHellman`
206
+ instance, except that functions take `Key` and `PrivateKey` objects as
207
+ arguments, and return them where indicated for.
208
+
209
+ This is only valid for keys belonging to a cryptosystem that supports DHE
210
+ or a close analogue (i.e. `dsa`, `ecdsa` and `curve25519` keys). An attempt
211
+ to call this function on other keys will yield an `Error`.
212
+
213
+ ## Private keys
214
+
215
+ ### `parsePrivateKey(data[, format = 'auto'[, name]])`
216
+
217
+ Parses a private key from a given data format and returns a new
218
+ `PrivateKey` object.
219
+
220
+ Parameters
221
+
222
+ - `data` -- Either a Buffer or String, containing the key
223
+ - `format` -- String name of format to use, valid options are:
224
+ - `auto`: choose automatically from all below
225
+ - `pem`: supports both PKCS#1 and PKCS#8
226
+ - `ssh`, `openssh`: new post-OpenSSH 6.5 internal format, produced by
227
+ `ssh-keygen -o`
228
+ - `pkcs1`, `pkcs8`: variants of `pem`
229
+ - `rfc4253`: raw OpenSSH wire format
230
+ - `name` -- Optional name for the key being parsed (eg. the filename that
231
+ was opened). Used to generate Error messages
232
+
233
+ ### `PrivateKey.isPrivateKey(obj)`
234
+
235
+ Returns `true` if the given object is a valid `PrivateKey` object created by a
236
+ version of `sshpk` compatible with this one.
237
+
238
+ Parameters
239
+
240
+ - `obj` -- Object to identify
241
+
242
+ ### `PrivateKey#type`
243
+
244
+ String, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`.
245
+
246
+ ### `PrivateKey#size`
247
+
248
+ Integer, "size" of the key in bits. For RSA/DSA this is the size of the modulus;
249
+ for ECDSA this is the bit size of the curve in use.
250
+
251
+ ### `PrivateKey#curve`
252
+
253
+ Only present if `this.type === 'ecdsa'`, string containing the name of the
254
+ named curve used with this key. Possible values include `nistp256`, `nistp384`
255
+ and `nistp521`.
256
+
257
+ ### `PrivateKey#toBuffer([format = 'pkcs1'])`
258
+
259
+ Convert the key into a given data format and return the serialized key as
260
+ a Buffer.
261
+
262
+ Parameters
263
+
264
+ - `format` -- String name of format to use, valid options are listed under
265
+ `parsePrivateKey`. Note that ED25519 keys default to `openssh`
266
+ format instead (as they have no `pkcs1` representation).
267
+
268
+ ### `PrivateKey#toString([format = 'pkcs1'])`
269
+
270
+ Same as `this.toBuffer(format).toString()`.
271
+
272
+ ### `PrivateKey#toPublic()`
273
+
274
+ Extract just the public part of this private key, and return it as a `Key`
275
+ object.
276
+
277
+ ### `PrivateKey#fingerprint([algorithm = 'sha256'])`
278
+
279
+ Same as `this.toPublic().fingerprint()`.
280
+
281
+ ### `PrivateKey#createVerify([hashAlgorithm])`
282
+
283
+ Same as `this.toPublic().createVerify()`.
284
+
285
+ ### `PrivateKey#createSign([hashAlgorithm])`
286
+
287
+ Creates a `crypto.Sign` specialized to use this PrivateKey (and the correct
288
+ key algorithm to match it). The returned Signer has the same API as a regular
289
+ one, except that the `sign()` function takes no arguments, and returns a
290
+ `Signature` object.
291
+
292
+ Parameters
293
+
294
+ - `hashAlgorithm` -- optional String name of hash algorithm to use, any
295
+ supported by OpenSSL are valid, usually including
296
+ `sha1`, `sha256`.
297
+
298
+ `v.sign()` Parameters
299
+
300
+ - none
301
+
302
+ ### `PrivateKey#derive(newType)`
303
+
304
+ Derives a related key of type `newType` from this key. Currently this is
305
+ only supported to change between `ed25519` and `curve25519` keys which are
306
+ stored with the same private key (but usually distinct public keys in order
307
+ to avoid degenerate keys that lead to a weak Diffie-Hellman exchange).
308
+
309
+ Parameters
310
+
311
+ - `newType` -- String, type of key to derive, either `ed25519` or `curve25519`
312
+
313
+ ## Fingerprints
314
+
315
+ ### `parseFingerprint(fingerprint[, algorithms])`
316
+
317
+ Pre-parses a fingerprint, creating a `Fingerprint` object that can be used to
318
+ quickly locate a key by using the `Fingerprint#matches` function.
319
+
320
+ Parameters
321
+
322
+ - `fingerprint` -- String, the fingerprint value, in any supported format
323
+ - `algorithms` -- Optional list of strings, names of hash algorithms to limit
324
+ support to. If `fingerprint` uses a hash algorithm not on
325
+ this list, throws `InvalidAlgorithmError`.
326
+
327
+ ### `Fingerprint.isFingerprint(obj)`
328
+
329
+ Returns `true` if the given object is a valid `Fingerprint` object created by a
330
+ version of `sshpk` compatible with this one.
331
+
332
+ Parameters
333
+
334
+ - `obj` -- Object to identify
335
+
336
+ ### `Fingerprint#toString([format])`
337
+
338
+ Returns a fingerprint as a string, in the given format.
339
+
340
+ Parameters
341
+
342
+ - `format` -- Optional String, format to use, valid options are `hex` and
343
+ `base64`. If this `Fingerprint` uses the `md5` algorithm, the
344
+ default format is `hex`. Otherwise, the default is `base64`.
345
+
346
+ ### `Fingerprint#matches(key)`
347
+
348
+ Verifies whether or not this `Fingerprint` matches a given `Key`. This function
349
+ uses double-hashing to avoid leaking timing information. Returns a boolean.
350
+
351
+ Parameters
352
+
353
+ - `key` -- a `Key` object, the key to match this fingerprint against
354
+
355
+ ## Signatures
356
+
357
+ ### `parseSignature(signature, algorithm, format)`
358
+
359
+ Parses a signature in a given format, creating a `Signature` object. Useful
360
+ for converting between the SSH and ASN.1 (PKCS/OpenSSL) signature formats, and
361
+ also returned as output from `PrivateKey#createSign().sign()`.
362
+
363
+ A Signature object can also be passed to a verifier produced by
364
+ `Key#createVerify()` and it will automatically be converted internally into the
365
+ correct format for verification.
366
+
367
+ Parameters
368
+
369
+ - `signature` -- a Buffer (binary) or String (base64), data of the actual
370
+ signature in the given format
371
+ - `algorithm` -- a String, name of the algorithm to be used, possible values
372
+ are `rsa`, `dsa`, `ecdsa`
373
+ - `format` -- a String, either `asn1` or `ssh`
374
+
375
+ ### `Signature.isSignature(obj)`
376
+
377
+ Returns `true` if the given object is a valid `Signature` object created by a
378
+ version of `sshpk` compatible with this one.
379
+
380
+ Parameters
381
+
382
+ - `obj` -- Object to identify
383
+
384
+ ### `Signature#toBuffer([format = 'asn1'])`
385
+
386
+ Converts a Signature to the given format and returns it as a Buffer.
387
+
388
+ Parameters
389
+
390
+ - `format` -- a String, either `asn1` or `ssh`
391
+
392
+ ### `Signature#toString([format = 'asn1'])`
393
+
394
+ Same as `this.toBuffer(format).toString('base64')`.
395
+
396
+ Errors
397
+ ------
398
+
399
+ ### `InvalidAlgorithmError`
400
+
401
+ The specified algorithm is not valid, either because it is not supported, or
402
+ because it was not included on a list of allowed algorithms.
403
+
404
+ Thrown by `Fingerprint.parse`, `Key#fingerprint`.
405
+
406
+ Properties
407
+
408
+ - `algorithm` -- the algorithm that could not be validated
409
+
410
+ ### `FingerprintFormatError`
411
+
412
+ The fingerprint string given could not be parsed as a supported fingerprint
413
+ format, or the specified fingerprint format is invalid.
414
+
415
+ Thrown by `Fingerprint.parse`, `Fingerprint#toString`.
416
+
417
+ Properties
418
+
419
+ - `fingerprint` -- if caused by a fingerprint, the string value given
420
+ - `format` -- if caused by an invalid format specification, the string value given
421
+
422
+ ### `KeyParseError`
423
+
424
+ The key data given could not be parsed as a valid key.
425
+
426
+ Properties
427
+
428
+ - `keyName` -- `name` that was given to `Key#parse`
429
+ - `format` -- the `format` that was trying to parse the key
430
+ - `innerErr` -- the inner Error thrown by the format parser
431
+
432
+ Friends of sshpk
433
+ ----------------
434
+
435
+ * [`sshpk-agent`](https://github.com/arekinath/node-sshpk-agent) is a library
436
+ for speaking the `ssh-agent` protocol from node.js, which uses `sshpk`
@@ -0,0 +1,183 @@
1
+ #!/usr/bin/env node
2
+ // -*- mode: js -*-
3
+ // vim: set filetype=javascript :
4
+ // Copyright 2015 Joyent, Inc. All rights reserved.
5
+
6
+ var dashdash = require('dashdash');
7
+ var sshpk = require('../lib/index');
8
+ var fs = require('fs');
9
+ var path = require('path');
10
+
11
+ var options = [
12
+ {
13
+ names: ['outformat', 't'],
14
+ type: 'string',
15
+ help: 'Output format'
16
+ },
17
+ {
18
+ names: ['informat', 'T'],
19
+ type: 'string',
20
+ help: 'Input format'
21
+ },
22
+ {
23
+ names: ['file', 'f'],
24
+ type: 'string',
25
+ help: 'Input file name (default stdin)'
26
+ },
27
+ {
28
+ names: ['out', 'o'],
29
+ type: 'string',
30
+ help: 'Output file name (default stdout)'
31
+ },
32
+ {
33
+ names: ['private', 'p'],
34
+ type: 'bool',
35
+ help: 'Produce a private key as output'
36
+ },
37
+ {
38
+ names: ['derive', 'd'],
39
+ type: 'string',
40
+ help: 'Output a new key derived from this one, with given algo'
41
+ },
42
+ {
43
+ names: ['identify', 'i'],
44
+ type: 'bool',
45
+ help: 'Print key metadata instead of converting'
46
+ },
47
+ {
48
+ names: ['comment', 'c'],
49
+ type: 'string',
50
+ help: 'Set key comment, if output format supports'
51
+ },
52
+ {
53
+ names: ['help', 'h'],
54
+ type: 'bool',
55
+ help: 'Shows this help text'
56
+ }
57
+ ];
58
+
59
+ if (require.main === module) {
60
+ var parser = dashdash.createParser({
61
+ options: options
62
+ });
63
+
64
+ try {
65
+ var opts = parser.parse(process.argv);
66
+ } catch (e) {
67
+ console.error('sshpk-conv: error: %s', e.message);
68
+ process.exit(1);
69
+ }
70
+
71
+ if (opts.help || opts._args.length > 1) {
72
+ var help = parser.help({}).trimRight();
73
+ console.error('sshpk-conv: converts between SSH key formats\n');
74
+ console.error(help);
75
+ console.error('\navailable formats:');
76
+ console.error(' - pem, pkcs1 eg id_rsa');
77
+ console.error(' - ssh eg id_rsa.pub');
78
+ console.error(' - pkcs8 format you want for openssl');
79
+ console.error(' - openssh like output of ssh-keygen -o');
80
+ console.error(' - rfc4253 raw OpenSSH wire format');
81
+ process.exit(1);
82
+ }
83
+
84
+ /*
85
+ * Key derivation can only be done on private keys, so use of the -d
86
+ * option necessarily implies -p.
87
+ */
88
+ if (opts.derive)
89
+ opts.private = true;
90
+
91
+ var inFile = process.stdin;
92
+ var inFileName = 'stdin';
93
+
94
+ var inFilePath;
95
+ if (opts.file) {
96
+ inFilePath = opts.file;
97
+ } else if (opts._args.length === 1) {
98
+ inFilePath = opts._args[0];
99
+ }
100
+
101
+ if (inFilePath)
102
+ inFileName = path.basename(inFilePath);
103
+
104
+ try {
105
+ if (inFilePath) {
106
+ fs.accessSync(inFilePath, fs.R_OK);
107
+ inFile = fs.createReadStream(inFilePath);
108
+ }
109
+ } catch (e) {
110
+ console.error('sshpk-conv: error opening input file' +
111
+ ': ' + e.name + ': ' + e.message);
112
+ process.exit(1);
113
+ }
114
+
115
+ var outFile = process.stdout;
116
+
117
+ try {
118
+ if (opts.out && !opts.identify) {
119
+ fs.accessSync(path.dirname(opts.out), fs.W_OK);
120
+ outFile = fs.createWriteStream(opts.out);
121
+ }
122
+ } catch (e) {
123
+ console.error('sshpk-conv: error opening output file' +
124
+ ': ' + e.name + ': ' + e.message);
125
+ process.exit(1);
126
+ }
127
+
128
+ var bufs = [];
129
+ inFile.on('readable', function () {
130
+ var data;
131
+ while ((data = inFile.read()))
132
+ bufs.push(data);
133
+ });
134
+ inFile.on('end', function () {
135
+ var buf = Buffer.concat(bufs);
136
+ var fmt = 'auto';
137
+ if (opts.informat)
138
+ fmt = opts.informat;
139
+ var f = sshpk.parseKey;
140
+ if (opts.private)
141
+ f = sshpk.parsePrivateKey;
142
+ try {
143
+ var key = f(buf, fmt, inFileName);
144
+ } catch (e) {
145
+ console.error('sshpk-conv: ' +
146
+ e.name + ': ' + e.message);
147
+ process.exit(1);
148
+ }
149
+
150
+ if (opts.derive)
151
+ key = key.derive(opts.derive);
152
+
153
+ if (opts.comment)
154
+ key.comment = opts.comment;
155
+
156
+ if (!opts.identify) {
157
+ fmt = undefined;
158
+ if (opts.outformat)
159
+ fmt = opts.outformat;
160
+ outFile.write(key.toBuffer(fmt));
161
+ if (fmt === 'ssh' ||
162
+ (!opts.private && fmt === undefined))
163
+ outFile.write('\n');
164
+ outFile.once('drain', function () {
165
+ process.exit(0);
166
+ });
167
+ } else {
168
+ var kind = 'public';
169
+ if (PrivateKey.isPrivateKey(key))
170
+ kind = 'private';
171
+ console.log('%s: a %d bit %s %s key', inFileName,
172
+ key.size, key.type.toUpperCase(), kind);
173
+ if (key.type === 'ecdsa')
174
+ console.log('ECDSA curve: %s', key.curve);
175
+ if (key.comment)
176
+ console.log('Comment: %s', key.comment);
177
+ console.log('Fingerprint:');
178
+ console.log(' ' + key.fingerprint().toString());
179
+ console.log(' ' + key.fingerprint('md5').toString());
180
+ process.exit(0);
181
+ }
182
+ });
183
+ }