fsevents 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (322) hide show
  1. package/node_modules/ansi/History.md +7 -0
  2. package/node_modules/ansi/LICENSE +24 -0
  3. package/node_modules/ansi/lib/ansi.js +2 -2
  4. package/node_modules/ansi/package.json +15 -10
  5. package/node_modules/ansi-regex/package.json +1 -0
  6. package/node_modules/ansi-styles/package.json +1 -0
  7. package/node_modules/are-we-there-yet/.npmignore +2 -0
  8. package/node_modules/are-we-there-yet/index.js +20 -18
  9. package/node_modules/are-we-there-yet/package.json +15 -13
  10. package/node_modules/asn1/package.json +3 -1
  11. package/node_modules/assert-plus/README.md +50 -21
  12. package/node_modules/assert-plus/assert.js +168 -207
  13. package/node_modules/assert-plus/package.json +55 -15
  14. package/node_modules/async/README.md +86 -4
  15. package/node_modules/async/dist/async.js +4 -3
  16. package/node_modules/async/dist/async.min.js +1 -1
  17. package/node_modules/async/lib/async.js +4 -3
  18. package/node_modules/async/package.json +10 -10
  19. package/node_modules/aws-sign2/package.json +1 -0
  20. package/node_modules/aws4/.npmignore +3 -0
  21. package/node_modules/aws4/.tern-port +1 -0
  22. package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match → aws4}/.travis.yml +2 -0
  23. package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/LICENSE.md → aws4/LICENSE} +1 -3
  24. package/node_modules/aws4/README.md +510 -0
  25. package/node_modules/aws4/aws4.js +313 -0
  26. package/node_modules/aws4/example.js +372 -0
  27. package/node_modules/aws4/node_modules/lru-cache/.npmignore +1 -0
  28. package/node_modules/aws4/node_modules/lru-cache/.travis.yml +8 -0
  29. package/node_modules/aws4/node_modules/lru-cache/CONTRIBUTORS +14 -0
  30. package/node_modules/aws4/node_modules/lru-cache/README.md +137 -0
  31. package/node_modules/aws4/node_modules/lru-cache/lib/lru-cache.js +334 -0
  32. package/node_modules/aws4/node_modules/lru-cache/package.json +66 -0
  33. package/node_modules/aws4/node_modules/lru-cache/test/basic.js +396 -0
  34. package/node_modules/aws4/node_modules/lru-cache/test/foreach.js +120 -0
  35. package/node_modules/aws4/node_modules/lru-cache/test/memory-leak.js +51 -0
  36. package/node_modules/aws4/node_modules/lru-cache/test/serialize.js +216 -0
  37. package/node_modules/aws4/package.json +113 -0
  38. package/node_modules/bl/.travis.yml +5 -6
  39. package/node_modules/bl/bl.js +5 -0
  40. package/node_modules/bl/package.json +16 -13
  41. package/node_modules/bl/test/test.js +554 -6
  42. package/node_modules/block-stream/package.json +1 -0
  43. package/node_modules/boom/package.json +1 -0
  44. package/node_modules/caseless/package.json +1 -0
  45. package/node_modules/chalk/package.json +1 -0
  46. package/node_modules/combined-stream/package.json +1 -0
  47. package/node_modules/commander/package.json +1 -0
  48. package/node_modules/core-util-is/package.json +2 -2
  49. package/node_modules/cryptiles/package.json +1 -0
  50. package/node_modules/dashdash/README.md +70 -7
  51. package/node_modules/dashdash/etc/dashdash.bash_completion.in +388 -0
  52. package/node_modules/dashdash/lib/dashdash.js +202 -2
  53. package/node_modules/dashdash/package.json +12 -9
  54. package/node_modules/debug/.jshintrc +3 -0
  55. package/node_modules/debug/.npmignore +6 -0
  56. package/node_modules/debug/History.md +195 -0
  57. package/node_modules/debug/Makefile +36 -0
  58. package/node_modules/debug/Readme.md +86 -13
  59. package/node_modules/debug/bower.json +28 -0
  60. package/node_modules/debug/browser.js +168 -0
  61. package/node_modules/debug/component.json +19 -0
  62. package/node_modules/debug/debug.js +132 -72
  63. package/node_modules/debug/node.js +209 -0
  64. package/node_modules/debug/package.json +32 -22
  65. package/node_modules/deep-extend/README.md +51 -50
  66. package/node_modules/deep-extend/package.json +14 -16
  67. package/node_modules/delayed-stream/package.json +1 -0
  68. package/node_modules/delegates/History.md +6 -0
  69. package/node_modules/delegates/License +20 -0
  70. package/node_modules/delegates/package.json +17 -13
  71. package/node_modules/ecc-jsbn/package.json +3 -1
  72. package/node_modules/escape-string-regexp/package.json +2 -2
  73. package/node_modules/extend/package.json +1 -0
  74. package/node_modules/extsprintf/package.json +4 -2
  75. package/node_modules/forever-agent/package.json +1 -0
  76. package/node_modules/form-data/package.json +1 -0
  77. package/node_modules/fstream/package.json +1 -0
  78. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +1 -0
  79. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +1 -0
  80. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +1 -0
  81. package/node_modules/fstream-ignore/node_modules/minimatch/package.json +1 -0
  82. package/node_modules/fstream-ignore/package.json +3 -1
  83. package/node_modules/gauge/package.json +14 -12
  84. package/node_modules/gauge/progress-bar.js +4 -5
  85. package/node_modules/gauge/test/progress-bar.js +1 -1
  86. package/node_modules/generate-function/package.json +1 -0
  87. package/node_modules/generate-object-property/package.json +1 -0
  88. package/node_modules/graceful-fs/README.md +17 -0
  89. package/node_modules/graceful-fs/graceful-fs.js +2 -0
  90. package/node_modules/graceful-fs/package.json +16 -11
  91. package/node_modules/graceful-readlink/package.json +1 -0
  92. package/node_modules/har-validator/README.md +45 -122
  93. package/node_modules/har-validator/package.json +16 -16
  94. package/node_modules/has-ansi/package.json +1 -0
  95. package/node_modules/has-unicode/README.md +6 -3
  96. package/node_modules/has-unicode/index.js +7 -3
  97. package/node_modules/has-unicode/package.json +15 -13
  98. package/node_modules/has-unicode/test/index.js +1 -1
  99. package/node_modules/hawk/README.md +634 -634
  100. package/node_modules/hawk/bower.json +24 -24
  101. package/node_modules/hawk/component.json +18 -18
  102. package/node_modules/hawk/dist/client.js +343 -340
  103. package/node_modules/hawk/example/usage.js +78 -78
  104. package/node_modules/hawk/lib/browser.js +637 -637
  105. package/node_modules/hawk/lib/client.js +369 -369
  106. package/node_modules/hawk/lib/crypto.js +126 -126
  107. package/node_modules/hawk/lib/index.js +15 -15
  108. package/node_modules/hawk/lib/server.js +548 -540
  109. package/node_modules/hawk/lib/utils.js +184 -164
  110. package/node_modules/hawk/package.json +9 -8
  111. package/node_modules/hawk/test/browser.js +1492 -1492
  112. package/node_modules/hawk/test/client.js +440 -440
  113. package/node_modules/hawk/test/crypto.js +70 -70
  114. package/node_modules/hawk/test/index.js +378 -378
  115. package/node_modules/hawk/test/readme.js +95 -95
  116. package/node_modules/hawk/test/server.js +1329 -1302
  117. package/node_modules/hawk/test/uri.js +838 -838
  118. package/node_modules/hawk/test/utils.js +149 -121
  119. package/node_modules/hoek/package.json +1 -0
  120. package/node_modules/http-signature/CHANGES.md +7 -0
  121. package/node_modules/http-signature/http_signing.md +71 -3
  122. package/node_modules/http-signature/lib/signer.js +5 -0
  123. package/node_modules/http-signature/package.json +13 -11
  124. package/node_modules/ini/package.json +3 -1
  125. package/node_modules/is-my-json-valid/formats.js +1 -1
  126. package/node_modules/is-my-json-valid/package.json +11 -10
  127. package/node_modules/is-property/package.json +1 -0
  128. package/node_modules/is-typedarray/package.json +3 -1
  129. package/node_modules/isarray/package.json +2 -2
  130. package/node_modules/isstream/package.json +1 -0
  131. package/node_modules/jodid25519/package.json +3 -1
  132. package/node_modules/jsbn/package.json +3 -1
  133. package/node_modules/json-schema/package.json +2 -1
  134. package/node_modules/json-stringify-safe/package.json +1 -0
  135. package/node_modules/jsonpointer/package.json +1 -0
  136. package/node_modules/jsprim/package.json +3 -1
  137. package/node_modules/lodash._basetostring/package.json +4 -4
  138. package/node_modules/lodash._createpadding/package.json +3 -2
  139. package/node_modules/lodash._root/LICENSE +22 -0
  140. package/node_modules/lodash._root/README.md +18 -0
  141. package/node_modules/lodash._root/index.js +53 -0
  142. package/node_modules/lodash._root/package.json +77 -0
  143. package/node_modules/lodash.pad/LICENSE +2 -2
  144. package/node_modules/lodash.pad/README.md +4 -6
  145. package/node_modules/lodash.pad/index.js +347 -15
  146. package/node_modules/lodash.pad/package.json +20 -34
  147. package/node_modules/lodash.padleft/package.json +3 -1
  148. package/node_modules/lodash.padright/package.json +3 -1
  149. package/node_modules/lodash.repeat/LICENSE +2 -2
  150. package/node_modules/lodash.repeat/README.md +4 -6
  151. package/node_modules/lodash.repeat/index.js +262 -11
  152. package/node_modules/lodash.repeat/package.json +21 -34
  153. package/node_modules/mime-db/package.json +2 -2
  154. package/node_modules/mime-types/package.json +2 -2
  155. package/node_modules/ms/.npmignore +5 -0
  156. package/node_modules/{deep-extend → ms}/LICENSE +2 -2
  157. package/node_modules/ms/README.md +35 -0
  158. package/node_modules/ms/index.js +125 -0
  159. package/node_modules/ms/package.json +56 -0
  160. package/node_modules/node-pre-gyp/CHANGELOG.md +8 -0
  161. package/node_modules/node-pre-gyp/LICENSE +27 -0
  162. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +36 -0
  163. package/node_modules/node-pre-gyp/package.json +23 -22
  164. package/node_modules/node-uuid/package.json +1 -0
  165. package/node_modules/npmlog/package.json +18 -16
  166. package/node_modules/oauth-sign/index.js +2 -0
  167. package/node_modules/oauth-sign/package.json +10 -9
  168. package/node_modules/once/README.md +18 -0
  169. package/node_modules/once/once.js +8 -6
  170. package/node_modules/once/package.json +20 -12
  171. package/node_modules/pinkie/index.js +3 -3
  172. package/node_modules/pinkie/package.json +10 -9
  173. package/node_modules/pinkie/readme.md +1 -1
  174. package/node_modules/pinkie-promise/package.json +1 -0
  175. package/node_modules/process-nextick-args/package.json +2 -2
  176. package/node_modules/qs/.eslintrc +17 -0
  177. package/node_modules/qs/.travis.yml +66 -5
  178. package/node_modules/qs/CHANGELOG.md +86 -75
  179. package/node_modules/qs/README.md +85 -81
  180. package/node_modules/qs/bower.json +1 -1
  181. package/node_modules/qs/component.json +1 -1
  182. package/node_modules/qs/dist/qs.js +108 -177
  183. package/node_modules/qs/lib/index.js +1 -7
  184. package/node_modules/qs/lib/parse.js +26 -49
  185. package/node_modules/qs/lib/stringify.js +22 -46
  186. package/node_modules/qs/lib/utils.js +45 -73
  187. package/node_modules/qs/package.json +51 -28
  188. package/node_modules/qs/test/index.js +5 -0
  189. package/node_modules/qs/test/parse.js +236 -321
  190. package/node_modules/qs/test/stringify.js +139 -197
  191. package/node_modules/qs/test/utils.js +6 -25
  192. package/node_modules/rc/node_modules/minimist/package.json +1 -0
  193. package/node_modules/rc/package.json +1 -0
  194. package/node_modules/readable-stream/package.json +1 -0
  195. package/node_modules/request/CHANGELOG.md +16 -1
  196. package/node_modules/request/README.md +1 -1
  197. package/node_modules/request/lib/har.js +3 -2
  198. package/node_modules/request/lib/multipart.js +3 -0
  199. package/node_modules/request/lib/tunnel.js +0 -2
  200. package/node_modules/request/package.json +20 -17
  201. package/node_modules/request/request.js +50 -26
  202. package/node_modules/rimraf/README.md +1 -1
  203. package/node_modules/rimraf/node_modules/glob/README.md +2 -2
  204. package/node_modules/rimraf/node_modules/glob/glob.js +14 -1
  205. package/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +1 -0
  206. package/node_modules/rimraf/node_modules/glob/node_modules/inflight/package.json +1 -0
  207. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/package.json +2 -1
  208. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +1 -0
  209. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +1 -0
  210. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +1 -0
  211. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/package.json +1 -0
  212. package/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +1 -0
  213. package/node_modules/rimraf/node_modules/glob/node_modules/once/package.json +1 -0
  214. package/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/package.json +1 -0
  215. package/node_modules/rimraf/node_modules/glob/package.json +11 -11
  216. package/node_modules/rimraf/package.json +13 -12
  217. package/node_modules/semver/package.json +3 -1
  218. package/node_modules/sntp/package.json +1 -0
  219. package/node_modules/sshpk/.npmignore +1 -0
  220. package/node_modules/sshpk/bin/sshpk-sign +176 -0
  221. package/node_modules/sshpk/bin/sshpk-verify +166 -0
  222. package/node_modules/sshpk/lib/ed-compat.js +2 -0
  223. package/node_modules/sshpk/lib/key.js +6 -0
  224. package/node_modules/sshpk/man/man1/sshpk-conv.1 +135 -0
  225. package/node_modules/sshpk/man/man1/sshpk-sign.1 +81 -0
  226. package/node_modules/sshpk/man/man1/sshpk-verify.1 +68 -0
  227. package/node_modules/sshpk/package.json +18 -9
  228. package/node_modules/string_decoder/package.json +2 -2
  229. package/node_modules/stringstream/package.json +1 -0
  230. package/node_modules/strip-ansi/package.json +1 -0
  231. package/node_modules/strip-json-comments/package.json +1 -0
  232. package/node_modules/supports-color/package.json +1 -0
  233. package/node_modules/tar/package.json +1 -0
  234. package/node_modules/tar-pack/README.md +2 -2
  235. package/node_modules/tar-pack/package.json +25 -26
  236. package/node_modules/tough-cookie/package.json +1 -0
  237. package/node_modules/tunnel-agent/package.json +1 -0
  238. package/node_modules/tweetnacl/README.md +1 -1
  239. package/node_modules/tweetnacl/package.json +13 -11
  240. package/node_modules/uid-number/package.json +14 -13
  241. package/node_modules/uid-number/uid-number.js +9 -4
  242. package/node_modules/util-deprecate/package.json +2 -2
  243. package/node_modules/verror/package.json +1 -0
  244. package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy → wrappy}/package.json +3 -2
  245. package/node_modules/xtend/package.json +1 -0
  246. package/package.json +2 -2
  247. package/node_modules/are-we-there-yet/README.md~ +0 -183
  248. package/node_modules/bl/test/basic-test.js +0 -541
  249. package/node_modules/bl/test/sauce.js +0 -38
  250. package/node_modules/debug/index.js +0 -5
  251. package/node_modules/debug/lib/debug.js +0 -147
  252. package/node_modules/deep-extend/test/index.spec.js +0 -220
  253. package/node_modules/deep-extend/test/mocha.opts +0 -1
  254. package/node_modules/gauge/README.md~ +0 -161
  255. package/node_modules/has-unicode/README.md~ +0 -4
  256. package/node_modules/once/LICENSE +0 -27
  257. package/node_modules/once/test/once.js +0 -18
  258. package/node_modules/sshpk/node_modules/assert-plus/README.md +0 -155
  259. package/node_modules/sshpk/node_modules/assert-plus/assert.js +0 -206
  260. package/node_modules/sshpk/node_modules/assert-plus/package.json +0 -88
  261. package/node_modules/tar-pack/node_modules/rimraf/README.md +0 -43
  262. package/node_modules/tar-pack/node_modules/rimraf/bin.js +0 -40
  263. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/README.md +0 -359
  264. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/common.js +0 -226
  265. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/glob.js +0 -752
  266. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/.eslintrc +0 -17
  267. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/README.md +0 -37
  268. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/inflight.js +0 -44
  269. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +0 -58
  270. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/package.json +0 -67
  271. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/test.js +0 -97
  272. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inherits/LICENSE +0 -16
  273. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inherits/README.md +0 -42
  274. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inherits/inherits.js +0 -1
  275. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inherits/inherits_browser.js +0 -23
  276. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inherits/package.json +0 -58
  277. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inherits/test.js +0 -25
  278. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/README.md +0 -216
  279. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/minimatch.js +0 -912
  280. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +0 -3
  281. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +0 -122
  282. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +0 -8
  283. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +0 -191
  284. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +0 -2
  285. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +0 -6
  286. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +0 -89
  287. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +0 -5
  288. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +0 -50
  289. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +0 -79
  290. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +0 -84
  291. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +0 -4
  292. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +0 -18
  293. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +0 -62
  294. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +0 -6
  295. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +0 -13
  296. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +0 -90
  297. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +0 -39
  298. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +0 -81
  299. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/package.json +0 -66
  300. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/README.md +0 -51
  301. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +0 -15
  302. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +0 -36
  303. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +0 -51
  304. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +0 -33
  305. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/once.js +0 -21
  306. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/package.json +0 -70
  307. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/index.js +0 -20
  308. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/package.json +0 -78
  309. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/readme.md +0 -51
  310. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/package.json +0 -79
  311. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/sync.js +0 -460
  312. package/node_modules/tar-pack/node_modules/rimraf/package.json +0 -69
  313. package/node_modules/tar-pack/node_modules/rimraf/rimraf.js +0 -333
  314. package/node_modules/uid-number/LICENCE +0 -25
  315. /package/node_modules/{sshpk/node_modules/assert-plus → assert-plus}/AUTHORS +0 -0
  316. /package/node_modules/{sshpk/node_modules/assert-plus → assert-plus}/CHANGES.md +0 -0
  317. /package/node_modules/{tar-pack/node_modules/rimraf → aws4/node_modules/lru-cache}/LICENSE +0 -0
  318. /package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight → uid-number}/LICENSE +0 -0
  319. /package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy → wrappy}/LICENSE +0 -0
  320. /package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy → wrappy}/README.md +0 -0
  321. /package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy → wrappy}/test/basic.js +0 -0
  322. /package/node_modules/{tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy → wrappy}/wrappy.js +0 -0
@@ -1,540 +1,548 @@
1
- // Load modules
2
-
3
- var Boom = require('boom');
4
- var Hoek = require('hoek');
5
- var Cryptiles = require('cryptiles');
6
- var Crypto = require('./crypto');
7
- var Utils = require('./utils');
8
-
9
-
10
- // Declare internals
11
-
12
- var internals = {};
13
-
14
-
15
- // Hawk authentication
16
-
17
- /*
18
- req: node's HTTP request object or an object as follows:
19
-
20
- var request = {
21
- method: 'GET',
22
- url: '/resource/4?a=1&b=2',
23
- host: 'example.com',
24
- port: 8080,
25
- authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="'
26
- };
27
-
28
- credentialsFunc: required function to lookup the set of Hawk credentials based on the provided credentials id.
29
- The credentials include the MAC key, MAC algorithm, and other attributes (such as username)
30
- needed by the application. This function is the equivalent of verifying the username and
31
- password in Basic authentication.
32
-
33
- var credentialsFunc = function (id, callback) {
34
-
35
- // Lookup credentials in database
36
- db.lookup(id, function (err, item) {
37
-
38
- if (err || !item) {
39
- return callback(err);
40
- }
41
-
42
- var credentials = {
43
- // Required
44
- key: item.key,
45
- algorithm: item.algorithm,
46
- // Application specific
47
- user: item.user
48
- };
49
-
50
- return callback(null, credentials);
51
- });
52
- };
53
-
54
- options: {
55
-
56
- hostHeaderName: optional header field name, used to override the default 'Host' header when used
57
- behind a cache of a proxy. Apache2 changes the value of the 'Host' header while preserving
58
- the original (which is what the module must verify) in the 'x-forwarded-host' header field.
59
- Only used when passed a node Http.ServerRequest object.
60
-
61
- nonceFunc: optional nonce validation function. The function signature is function(key, nonce, ts, callback)
62
- where 'callback' must be called using the signature function(err).
63
-
64
- timestampSkewSec: optional number of seconds of permitted clock skew for incoming timestamps. Defaults to 60 seconds.
65
- Provides a +/- skew which means actual allowed window is double the number of seconds.
66
-
67
- localtimeOffsetMsec: optional local clock time offset express in a number of milliseconds (positive or negative).
68
- Defaults to 0.
69
-
70
- payload: optional payload for validation. The client calculates the hash value and includes it via the 'hash'
71
- header attribute. The server always ensures the value provided has been included in the request
72
- MAC. When this option is provided, it validates the hash value itself. Validation is done by calculating
73
- a hash value over the entire payload (assuming it has already be normalized to the same format and
74
- encoding used by the client to calculate the hash on request). If the payload is not available at the time
75
- of authentication, the authenticatePayload() method can be used by passing it the credentials and
76
- attributes.hash returned in the authenticate callback.
77
-
78
- host: optional host name override. Only used when passed a node request object.
79
- port: optional port override. Only used when passed a node request object.
80
- }
81
-
82
- callback: function (err, credentials, artifacts) { }
83
- */
84
-
85
- exports.authenticate = function (req, credentialsFunc, options, callback) {
86
-
87
- callback = Hoek.nextTick(callback);
88
-
89
- // Default options
90
-
91
- options.nonceFunc = options.nonceFunc || internals.nonceFunc;
92
- options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
93
-
94
- // Application time
95
-
96
- var now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing
97
-
98
- // Convert node Http request object to a request configuration object
99
-
100
- var request = Utils.parseRequest(req, options);
101
- if (request instanceof Error) {
102
- return callback(Boom.badRequest(request.message));
103
- }
104
-
105
- // Parse HTTP Authorization header
106
-
107
- var attributes = Utils.parseAuthorizationHeader(request.authorization);
108
- if (attributes instanceof Error) {
109
- return callback(attributes);
110
- }
111
-
112
- // Construct artifacts container
113
-
114
- var artifacts = {
115
- method: request.method,
116
- host: request.host,
117
- port: request.port,
118
- resource: request.url,
119
- ts: attributes.ts,
120
- nonce: attributes.nonce,
121
- hash: attributes.hash,
122
- ext: attributes.ext,
123
- app: attributes.app,
124
- dlg: attributes.dlg,
125
- mac: attributes.mac,
126
- id: attributes.id
127
- };
128
-
129
- // Verify required header attributes
130
-
131
- if (!attributes.id ||
132
- !attributes.ts ||
133
- !attributes.nonce ||
134
- !attributes.mac) {
135
-
136
- return callback(Boom.badRequest('Missing attributes'), null, artifacts);
137
- }
138
-
139
- // Fetch Hawk credentials
140
-
141
- credentialsFunc(attributes.id, function (err, credentials) {
142
-
143
- if (err) {
144
- return callback(err, credentials || null, artifacts);
145
- }
146
-
147
- if (!credentials) {
148
- return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, artifacts);
149
- }
150
-
151
- if (!credentials.key ||
152
- !credentials.algorithm) {
153
-
154
- return callback(Boom.internal('Invalid credentials'), credentials, artifacts);
155
- }
156
-
157
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
158
- return callback(Boom.internal('Unknown algorithm'), credentials, artifacts);
159
- }
160
-
161
- // Calculate MAC
162
-
163
- var mac = Crypto.calculateMac('header', credentials, artifacts);
164
- if (!Cryptiles.fixedTimeComparison(mac, attributes.mac)) {
165
- return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, artifacts);
166
- }
167
-
168
- // Check payload hash
169
-
170
- if (options.payload ||
171
- options.payload === '') {
172
-
173
- if (!attributes.hash) {
174
- return callback(Boom.unauthorized('Missing required payload hash', 'Hawk'), credentials, artifacts);
175
- }
176
-
177
- var hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, request.contentType);
178
- if (!Cryptiles.fixedTimeComparison(hash, attributes.hash)) {
179
- return callback(Boom.unauthorized('Bad payload hash', 'Hawk'), credentials, artifacts);
180
- }
181
- }
182
-
183
- // Check nonce
184
-
185
- options.nonceFunc(credentials.key, attributes.nonce, attributes.ts, function (err) {
186
-
187
- if (err) {
188
- return callback(Boom.unauthorized('Invalid nonce', 'Hawk'), credentials, artifacts);
189
- }
190
-
191
- // Check timestamp staleness
192
-
193
- if (Math.abs((attributes.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
194
- var tsm = Crypto.timestampMessage(credentials, options.localtimeOffsetMsec);
195
- return callback(Boom.unauthorized('Stale timestamp', 'Hawk', tsm), credentials, artifacts);
196
- }
197
-
198
- // Successful authentication
199
-
200
- return callback(null, credentials, artifacts);
201
- });
202
- });
203
- };
204
-
205
-
206
- // Authenticate payload hash - used when payload cannot be provided during authenticate()
207
-
208
- /*
209
- payload: raw request payload
210
- credentials: from authenticate callback
211
- artifacts: from authenticate callback
212
- contentType: req.headers['content-type']
213
- */
214
-
215
- exports.authenticatePayload = function (payload, credentials, artifacts, contentType) {
216
-
217
- var calculatedHash = Crypto.calculatePayloadHash(payload, credentials.algorithm, contentType);
218
- return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash);
219
- };
220
-
221
-
222
- // Authenticate payload hash - used when payload cannot be provided during authenticate()
223
-
224
- /*
225
- calculatedHash: the payload hash calculated using Crypto.calculatePayloadHash()
226
- artifacts: from authenticate callback
227
- */
228
-
229
- exports.authenticatePayloadHash = function (calculatedHash, artifacts) {
230
-
231
- return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash);
232
- };
233
-
234
-
235
- // Generate a Server-Authorization header for a given response
236
-
237
- /*
238
- credentials: {}, // Object received from authenticate()
239
- artifacts: {} // Object received from authenticate(); 'mac', 'hash', and 'ext' - ignored
240
- options: {
241
- ext: 'application-specific', // Application specific data sent via the ext attribute
242
- payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
243
- contentType: 'application/json', // Payload content-type (ignored if hash provided)
244
- hash: 'U4MKKSmiVxk37JCCrAVIjV=' // Pre-calculated payload hash
245
- }
246
- */
247
-
248
- exports.header = function (credentials, artifacts, options) {
249
-
250
- // Prepare inputs
251
-
252
- options = options || {};
253
-
254
- if (!artifacts ||
255
- typeof artifacts !== 'object' ||
256
- typeof options !== 'object') {
257
-
258
- return '';
259
- }
260
-
261
- artifacts = Hoek.clone(artifacts);
262
- delete artifacts.mac;
263
- artifacts.hash = options.hash;
264
- artifacts.ext = options.ext;
265
-
266
- // Validate credentials
267
-
268
- if (!credentials ||
269
- !credentials.key ||
270
- !credentials.algorithm) {
271
-
272
- // Invalid credential object
273
- return '';
274
- }
275
-
276
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
277
- return '';
278
- }
279
-
280
- // Calculate payload hash
281
-
282
- if (!artifacts.hash &&
283
- (options.payload || options.payload === '')) {
284
-
285
- artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
286
- }
287
-
288
- var mac = Crypto.calculateMac('response', credentials, artifacts);
289
-
290
- // Construct header
291
-
292
- var header = 'Hawk mac="' + mac + '"' +
293
- (artifacts.hash ? ', hash="' + artifacts.hash + '"' : '');
294
-
295
- if (artifacts.ext !== null &&
296
- artifacts.ext !== undefined &&
297
- artifacts.ext !== '') { // Other falsey values allowed
298
-
299
- header += ', ext="' + Hoek.escapeHeaderAttribute(artifacts.ext) + '"';
300
- }
301
-
302
- return header;
303
- };
304
-
305
-
306
- /*
307
- * Arguments and options are the same as authenticate() with the exception that the only supported options are:
308
- * 'hostHeaderName', 'localtimeOffsetMsec', 'host', 'port'
309
- */
310
-
311
- exports.authenticateBewit = function (req, credentialsFunc, options, callback) {
312
-
313
- callback = Hoek.nextTick(callback);
314
-
315
- // Application time
316
-
317
- var now = Utils.now(options.localtimeOffsetMsec);
318
-
319
- // Convert node Http request object to a request configuration object
320
-
321
- var request = Utils.parseRequest(req, options);
322
- if (request instanceof Error) {
323
- return callback(Boom.badRequest(request.message));
324
- }
325
-
326
- // Extract bewit
327
-
328
- // 1 2 3 4
329
- var resource = request.url.match(/^(\/.*)([\?&])bewit\=([^&$]*)(?:&(.+))?$/);
330
- if (!resource) {
331
- return callback(Boom.unauthorized(null, 'Hawk'));
332
- }
333
-
334
- // Bewit not empty
335
-
336
- if (!resource[3]) {
337
- return callback(Boom.unauthorized('Empty bewit', 'Hawk'));
338
- }
339
-
340
- // Verify method is GET
341
-
342
- if (request.method !== 'GET' &&
343
- request.method !== 'HEAD') {
344
-
345
- return callback(Boom.unauthorized('Invalid method', 'Hawk'));
346
- }
347
-
348
- // No other authentication
349
-
350
- if (request.authorization) {
351
- return callback(Boom.badRequest('Multiple authentications'));
352
- }
353
-
354
- // Parse bewit
355
-
356
- var bewitString = Hoek.base64urlDecode(resource[3]);
357
- if (bewitString instanceof Error) {
358
- return callback(Boom.badRequest('Invalid bewit encoding'));
359
- }
360
-
361
- // Bewit format: id\exp\mac\ext ('\' is used because it is a reserved header attribute character)
362
-
363
- var bewitParts = bewitString.split('\\');
364
- if (bewitParts.length !== 4) {
365
- return callback(Boom.badRequest('Invalid bewit structure'));
366
- }
367
-
368
- var bewit = {
369
- id: bewitParts[0],
370
- exp: parseInt(bewitParts[1], 10),
371
- mac: bewitParts[2],
372
- ext: bewitParts[3] || ''
373
- };
374
-
375
- if (!bewit.id ||
376
- !bewit.exp ||
377
- !bewit.mac) {
378
-
379
- return callback(Boom.badRequest('Missing bewit attributes'));
380
- }
381
-
382
- // Construct URL without bewit
383
-
384
- var url = resource[1];
385
- if (resource[4]) {
386
- url += resource[2] + resource[4];
387
- }
388
-
389
- // Check expiration
390
-
391
- if (bewit.exp * 1000 <= now) {
392
- return callback(Boom.unauthorized('Access expired', 'Hawk'), null, bewit);
393
- }
394
-
395
- // Fetch Hawk credentials
396
-
397
- credentialsFunc(bewit.id, function (err, credentials) {
398
-
399
- if (err) {
400
- return callback(err, credentials || null, bewit.ext);
401
- }
402
-
403
- if (!credentials) {
404
- return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, bewit);
405
- }
406
-
407
- if (!credentials.key ||
408
- !credentials.algorithm) {
409
-
410
- return callback(Boom.internal('Invalid credentials'), credentials, bewit);
411
- }
412
-
413
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
414
- return callback(Boom.internal('Unknown algorithm'), credentials, bewit);
415
- }
416
-
417
- // Calculate MAC
418
-
419
- var mac = Crypto.calculateMac('bewit', credentials, {
420
- ts: bewit.exp,
421
- nonce: '',
422
- method: 'GET',
423
- resource: url,
424
- host: request.host,
425
- port: request.port,
426
- ext: bewit.ext
427
- });
428
-
429
- if (!Cryptiles.fixedTimeComparison(mac, bewit.mac)) {
430
- return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, bewit);
431
- }
432
-
433
- // Successful authentication
434
-
435
- return callback(null, credentials, bewit);
436
- });
437
- };
438
-
439
-
440
- /*
441
- * options are the same as authenticate() with the exception that the only supported options are:
442
- * 'nonceFunc', 'timestampSkewSec', 'localtimeOffsetMsec'
443
- */
444
-
445
- exports.authenticateMessage = function (host, port, message, authorization, credentialsFunc, options, callback) {
446
-
447
- callback = Hoek.nextTick(callback);
448
-
449
- // Default options
450
-
451
- options.nonceFunc = options.nonceFunc || internals.nonceFunc;
452
- options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
453
-
454
- // Application time
455
-
456
- var now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing
457
-
458
- // Validate authorization
459
-
460
- if (!authorization.id ||
461
- !authorization.ts ||
462
- !authorization.nonce ||
463
- !authorization.hash ||
464
- !authorization.mac) {
465
-
466
- return callback(Boom.badRequest('Invalid authorization'));
467
- }
468
-
469
- // Fetch Hawk credentials
470
-
471
- credentialsFunc(authorization.id, function (err, credentials) {
472
-
473
- if (err) {
474
- return callback(err, credentials || null);
475
- }
476
-
477
- if (!credentials) {
478
- return callback(Boom.unauthorized('Unknown credentials', 'Hawk'));
479
- }
480
-
481
- if (!credentials.key ||
482
- !credentials.algorithm) {
483
-
484
- return callback(Boom.internal('Invalid credentials'), credentials);
485
- }
486
-
487
- if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
488
- return callback(Boom.internal('Unknown algorithm'), credentials);
489
- }
490
-
491
- // Construct artifacts container
492
-
493
- var artifacts = {
494
- ts: authorization.ts,
495
- nonce: authorization.nonce,
496
- host: host,
497
- port: port,
498
- hash: authorization.hash
499
- };
500
-
501
- // Calculate MAC
502
-
503
- var mac = Crypto.calculateMac('message', credentials, artifacts);
504
- if (!Cryptiles.fixedTimeComparison(mac, authorization.mac)) {
505
- return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials);
506
- }
507
-
508
- // Check payload hash
509
-
510
- var hash = Crypto.calculatePayloadHash(message, credentials.algorithm);
511
- if (!Cryptiles.fixedTimeComparison(hash, authorization.hash)) {
512
- return callback(Boom.unauthorized('Bad message hash', 'Hawk'), credentials);
513
- }
514
-
515
- // Check nonce
516
-
517
- options.nonceFunc(credentials.key, authorization.nonce, authorization.ts, function (err) {
518
-
519
- if (err) {
520
- return callback(Boom.unauthorized('Invalid nonce', 'Hawk'), credentials);
521
- }
522
-
523
- // Check timestamp staleness
524
-
525
- if (Math.abs((authorization.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
526
- return callback(Boom.unauthorized('Stale timestamp'), credentials);
527
- }
528
-
529
- // Successful authentication
530
-
531
- return callback(null, credentials);
532
- });
533
- });
534
- };
535
-
536
-
537
- internals.nonceFunc = function (key, nonce, ts, nonceCallback) {
538
-
539
- return nonceCallback(); // No validation
540
- };
1
+ // Load modules
2
+
3
+ var Boom = require('boom');
4
+ var Hoek = require('hoek');
5
+ var Cryptiles = require('cryptiles');
6
+ var Crypto = require('./crypto');
7
+ var Utils = require('./utils');
8
+
9
+
10
+ // Declare internals
11
+
12
+ var internals = {};
13
+
14
+
15
+ // Hawk authentication
16
+
17
+ /*
18
+ req: node's HTTP request object or an object as follows:
19
+
20
+ var request = {
21
+ method: 'GET',
22
+ url: '/resource/4?a=1&b=2',
23
+ host: 'example.com',
24
+ port: 8080,
25
+ authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="'
26
+ };
27
+
28
+ credentialsFunc: required function to lookup the set of Hawk credentials based on the provided credentials id.
29
+ The credentials include the MAC key, MAC algorithm, and other attributes (such as username)
30
+ needed by the application. This function is the equivalent of verifying the username and
31
+ password in Basic authentication.
32
+
33
+ var credentialsFunc = function (id, callback) {
34
+
35
+ // Lookup credentials in database
36
+ db.lookup(id, function (err, item) {
37
+
38
+ if (err || !item) {
39
+ return callback(err);
40
+ }
41
+
42
+ var credentials = {
43
+ // Required
44
+ key: item.key,
45
+ algorithm: item.algorithm,
46
+ // Application specific
47
+ user: item.user
48
+ };
49
+
50
+ return callback(null, credentials);
51
+ });
52
+ };
53
+
54
+ options: {
55
+
56
+ hostHeaderName: optional header field name, used to override the default 'Host' header when used
57
+ behind a cache of a proxy. Apache2 changes the value of the 'Host' header while preserving
58
+ the original (which is what the module must verify) in the 'x-forwarded-host' header field.
59
+ Only used when passed a node Http.ServerRequest object.
60
+
61
+ nonceFunc: optional nonce validation function. The function signature is function(key, nonce, ts, callback)
62
+ where 'callback' must be called using the signature function(err).
63
+
64
+ timestampSkewSec: optional number of seconds of permitted clock skew for incoming timestamps. Defaults to 60 seconds.
65
+ Provides a +/- skew which means actual allowed window is double the number of seconds.
66
+
67
+ localtimeOffsetMsec: optional local clock time offset express in a number of milliseconds (positive or negative).
68
+ Defaults to 0.
69
+
70
+ payload: optional payload for validation. The client calculates the hash value and includes it via the 'hash'
71
+ header attribute. The server always ensures the value provided has been included in the request
72
+ MAC. When this option is provided, it validates the hash value itself. Validation is done by calculating
73
+ a hash value over the entire payload (assuming it has already be normalized to the same format and
74
+ encoding used by the client to calculate the hash on request). If the payload is not available at the time
75
+ of authentication, the authenticatePayload() method can be used by passing it the credentials and
76
+ attributes.hash returned in the authenticate callback.
77
+
78
+ host: optional host name override. Only used when passed a node request object.
79
+ port: optional port override. Only used when passed a node request object.
80
+ }
81
+
82
+ callback: function (err, credentials, artifacts) { }
83
+ */
84
+
85
+ exports.authenticate = function (req, credentialsFunc, options, callback) {
86
+
87
+ callback = Hoek.nextTick(callback);
88
+
89
+ // Default options
90
+
91
+ options.nonceFunc = options.nonceFunc || internals.nonceFunc;
92
+ options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
93
+
94
+ // Application time
95
+
96
+ var now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing
97
+
98
+ // Convert node Http request object to a request configuration object
99
+
100
+ var request = Utils.parseRequest(req, options);
101
+ if (request instanceof Error) {
102
+ return callback(Boom.badRequest(request.message));
103
+ }
104
+
105
+ // Parse HTTP Authorization header
106
+
107
+ var attributes = Utils.parseAuthorizationHeader(request.authorization);
108
+ if (attributes instanceof Error) {
109
+ return callback(attributes);
110
+ }
111
+
112
+ // Construct artifacts container
113
+
114
+ var artifacts = {
115
+ method: request.method,
116
+ host: request.host,
117
+ port: request.port,
118
+ resource: request.url,
119
+ ts: attributes.ts,
120
+ nonce: attributes.nonce,
121
+ hash: attributes.hash,
122
+ ext: attributes.ext,
123
+ app: attributes.app,
124
+ dlg: attributes.dlg,
125
+ mac: attributes.mac,
126
+ id: attributes.id
127
+ };
128
+
129
+ // Verify required header attributes
130
+
131
+ if (!attributes.id ||
132
+ !attributes.ts ||
133
+ !attributes.nonce ||
134
+ !attributes.mac) {
135
+
136
+ return callback(Boom.badRequest('Missing attributes'), null, artifacts);
137
+ }
138
+
139
+ // Fetch Hawk credentials
140
+
141
+ credentialsFunc(attributes.id, function (err, credentials) {
142
+
143
+ if (err) {
144
+ return callback(err, credentials || null, artifacts);
145
+ }
146
+
147
+ if (!credentials) {
148
+ return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, artifacts);
149
+ }
150
+
151
+ if (!credentials.key ||
152
+ !credentials.algorithm) {
153
+
154
+ return callback(Boom.internal('Invalid credentials'), credentials, artifacts);
155
+ }
156
+
157
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
158
+ return callback(Boom.internal('Unknown algorithm'), credentials, artifacts);
159
+ }
160
+
161
+ // Calculate MAC
162
+
163
+ var mac = Crypto.calculateMac('header', credentials, artifacts);
164
+ if (!Cryptiles.fixedTimeComparison(mac, attributes.mac)) {
165
+ return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, artifacts);
166
+ }
167
+
168
+ // Check payload hash
169
+
170
+ if (options.payload ||
171
+ options.payload === '') {
172
+
173
+ if (!attributes.hash) {
174
+ return callback(Boom.unauthorized('Missing required payload hash', 'Hawk'), credentials, artifacts);
175
+ }
176
+
177
+ var hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, request.contentType);
178
+ if (!Cryptiles.fixedTimeComparison(hash, attributes.hash)) {
179
+ return callback(Boom.unauthorized('Bad payload hash', 'Hawk'), credentials, artifacts);
180
+ }
181
+ }
182
+
183
+ // Check nonce
184
+
185
+ options.nonceFunc(credentials.key, attributes.nonce, attributes.ts, function (err) {
186
+
187
+ if (err) {
188
+ return callback(Boom.unauthorized('Invalid nonce', 'Hawk'), credentials, artifacts);
189
+ }
190
+
191
+ // Check timestamp staleness
192
+
193
+ if (Math.abs((attributes.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
194
+ var tsm = Crypto.timestampMessage(credentials, options.localtimeOffsetMsec);
195
+ return callback(Boom.unauthorized('Stale timestamp', 'Hawk', tsm), credentials, artifacts);
196
+ }
197
+
198
+ // Successful authentication
199
+
200
+ return callback(null, credentials, artifacts);
201
+ });
202
+ });
203
+ };
204
+
205
+
206
+ // Authenticate payload hash - used when payload cannot be provided during authenticate()
207
+
208
+ /*
209
+ payload: raw request payload
210
+ credentials: from authenticate callback
211
+ artifacts: from authenticate callback
212
+ contentType: req.headers['content-type']
213
+ */
214
+
215
+ exports.authenticatePayload = function (payload, credentials, artifacts, contentType) {
216
+
217
+ var calculatedHash = Crypto.calculatePayloadHash(payload, credentials.algorithm, contentType);
218
+ return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash);
219
+ };
220
+
221
+
222
+ // Authenticate payload hash - used when payload cannot be provided during authenticate()
223
+
224
+ /*
225
+ calculatedHash: the payload hash calculated using Crypto.calculatePayloadHash()
226
+ artifacts: from authenticate callback
227
+ */
228
+
229
+ exports.authenticatePayloadHash = function (calculatedHash, artifacts) {
230
+
231
+ return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash);
232
+ };
233
+
234
+
235
+ // Generate a Server-Authorization header for a given response
236
+
237
+ /*
238
+ credentials: {}, // Object received from authenticate()
239
+ artifacts: {} // Object received from authenticate(); 'mac', 'hash', and 'ext' - ignored
240
+ options: {
241
+ ext: 'application-specific', // Application specific data sent via the ext attribute
242
+ payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
243
+ contentType: 'application/json', // Payload content-type (ignored if hash provided)
244
+ hash: 'U4MKKSmiVxk37JCCrAVIjV=' // Pre-calculated payload hash
245
+ }
246
+ */
247
+
248
+ exports.header = function (credentials, artifacts, options) {
249
+
250
+ // Prepare inputs
251
+
252
+ options = options || {};
253
+
254
+ if (!artifacts ||
255
+ typeof artifacts !== 'object' ||
256
+ typeof options !== 'object') {
257
+
258
+ return '';
259
+ }
260
+
261
+ artifacts = Hoek.clone(artifacts);
262
+ delete artifacts.mac;
263
+ artifacts.hash = options.hash;
264
+ artifacts.ext = options.ext;
265
+
266
+ // Validate credentials
267
+
268
+ if (!credentials ||
269
+ !credentials.key ||
270
+ !credentials.algorithm) {
271
+
272
+ // Invalid credential object
273
+ return '';
274
+ }
275
+
276
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
277
+ return '';
278
+ }
279
+
280
+ // Calculate payload hash
281
+
282
+ if (!artifacts.hash &&
283
+ (options.payload || options.payload === '')) {
284
+
285
+ artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
286
+ }
287
+
288
+ var mac = Crypto.calculateMac('response', credentials, artifacts);
289
+
290
+ // Construct header
291
+
292
+ var header = 'Hawk mac="' + mac + '"' +
293
+ (artifacts.hash ? ', hash="' + artifacts.hash + '"' : '');
294
+
295
+ if (artifacts.ext !== null &&
296
+ artifacts.ext !== undefined &&
297
+ artifacts.ext !== '') { // Other falsey values allowed
298
+
299
+ header += ', ext="' + Hoek.escapeHeaderAttribute(artifacts.ext) + '"';
300
+ }
301
+
302
+ return header;
303
+ };
304
+
305
+
306
+ /*
307
+ * Arguments and options are the same as authenticate() with the exception that the only supported options are:
308
+ * 'hostHeaderName', 'localtimeOffsetMsec', 'host', 'port'
309
+ */
310
+
311
+
312
+ // 1 2 3 4
313
+ internals.bewitRegex = /^(\/.*)([\?&])bewit\=([^&$]*)(?:&(.+))?$/;
314
+
315
+
316
+ exports.authenticateBewit = function (req, credentialsFunc, options, callback) {
317
+
318
+ callback = Hoek.nextTick(callback);
319
+
320
+ // Application time
321
+
322
+ var now = Utils.now(options.localtimeOffsetMsec);
323
+
324
+ // Convert node Http request object to a request configuration object
325
+
326
+ var request = Utils.parseRequest(req, options);
327
+ if (request instanceof Error) {
328
+ return callback(Boom.badRequest(request.message));
329
+ }
330
+
331
+ // Extract bewit
332
+
333
+ if (request.url.length > Utils.limits.maxMatchLength) {
334
+ return callback(Boom.badRequest('Resource path exceeds max length'));
335
+ }
336
+
337
+ var resource = request.url.match(internals.bewitRegex);
338
+ if (!resource) {
339
+ return callback(Boom.unauthorized(null, 'Hawk'));
340
+ }
341
+
342
+ // Bewit not empty
343
+
344
+ if (!resource[3]) {
345
+ return callback(Boom.unauthorized('Empty bewit', 'Hawk'));
346
+ }
347
+
348
+ // Verify method is GET
349
+
350
+ if (request.method !== 'GET' &&
351
+ request.method !== 'HEAD') {
352
+
353
+ return callback(Boom.unauthorized('Invalid method', 'Hawk'));
354
+ }
355
+
356
+ // No other authentication
357
+
358
+ if (request.authorization) {
359
+ return callback(Boom.badRequest('Multiple authentications'));
360
+ }
361
+
362
+ // Parse bewit
363
+
364
+ var bewitString = Hoek.base64urlDecode(resource[3]);
365
+ if (bewitString instanceof Error) {
366
+ return callback(Boom.badRequest('Invalid bewit encoding'));
367
+ }
368
+
369
+ // Bewit format: id\exp\mac\ext ('\' is used because it is a reserved header attribute character)
370
+
371
+ var bewitParts = bewitString.split('\\');
372
+ if (bewitParts.length !== 4) {
373
+ return callback(Boom.badRequest('Invalid bewit structure'));
374
+ }
375
+
376
+ var bewit = {
377
+ id: bewitParts[0],
378
+ exp: parseInt(bewitParts[1], 10),
379
+ mac: bewitParts[2],
380
+ ext: bewitParts[3] || ''
381
+ };
382
+
383
+ if (!bewit.id ||
384
+ !bewit.exp ||
385
+ !bewit.mac) {
386
+
387
+ return callback(Boom.badRequest('Missing bewit attributes'));
388
+ }
389
+
390
+ // Construct URL without bewit
391
+
392
+ var url = resource[1];
393
+ if (resource[4]) {
394
+ url += resource[2] + resource[4];
395
+ }
396
+
397
+ // Check expiration
398
+
399
+ if (bewit.exp * 1000 <= now) {
400
+ return callback(Boom.unauthorized('Access expired', 'Hawk'), null, bewit);
401
+ }
402
+
403
+ // Fetch Hawk credentials
404
+
405
+ credentialsFunc(bewit.id, function (err, credentials) {
406
+
407
+ if (err) {
408
+ return callback(err, credentials || null, bewit.ext);
409
+ }
410
+
411
+ if (!credentials) {
412
+ return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, bewit);
413
+ }
414
+
415
+ if (!credentials.key ||
416
+ !credentials.algorithm) {
417
+
418
+ return callback(Boom.internal('Invalid credentials'), credentials, bewit);
419
+ }
420
+
421
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
422
+ return callback(Boom.internal('Unknown algorithm'), credentials, bewit);
423
+ }
424
+
425
+ // Calculate MAC
426
+
427
+ var mac = Crypto.calculateMac('bewit', credentials, {
428
+ ts: bewit.exp,
429
+ nonce: '',
430
+ method: 'GET',
431
+ resource: url,
432
+ host: request.host,
433
+ port: request.port,
434
+ ext: bewit.ext
435
+ });
436
+
437
+ if (!Cryptiles.fixedTimeComparison(mac, bewit.mac)) {
438
+ return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, bewit);
439
+ }
440
+
441
+ // Successful authentication
442
+
443
+ return callback(null, credentials, bewit);
444
+ });
445
+ };
446
+
447
+
448
+ /*
449
+ * options are the same as authenticate() with the exception that the only supported options are:
450
+ * 'nonceFunc', 'timestampSkewSec', 'localtimeOffsetMsec'
451
+ */
452
+
453
+ exports.authenticateMessage = function (host, port, message, authorization, credentialsFunc, options, callback) {
454
+
455
+ callback = Hoek.nextTick(callback);
456
+
457
+ // Default options
458
+
459
+ options.nonceFunc = options.nonceFunc || internals.nonceFunc;
460
+ options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds
461
+
462
+ // Application time
463
+
464
+ var now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing
465
+
466
+ // Validate authorization
467
+
468
+ if (!authorization.id ||
469
+ !authorization.ts ||
470
+ !authorization.nonce ||
471
+ !authorization.hash ||
472
+ !authorization.mac) {
473
+
474
+ return callback(Boom.badRequest('Invalid authorization'));
475
+ }
476
+
477
+ // Fetch Hawk credentials
478
+
479
+ credentialsFunc(authorization.id, function (err, credentials) {
480
+
481
+ if (err) {
482
+ return callback(err, credentials || null);
483
+ }
484
+
485
+ if (!credentials) {
486
+ return callback(Boom.unauthorized('Unknown credentials', 'Hawk'));
487
+ }
488
+
489
+ if (!credentials.key ||
490
+ !credentials.algorithm) {
491
+
492
+ return callback(Boom.internal('Invalid credentials'), credentials);
493
+ }
494
+
495
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
496
+ return callback(Boom.internal('Unknown algorithm'), credentials);
497
+ }
498
+
499
+ // Construct artifacts container
500
+
501
+ var artifacts = {
502
+ ts: authorization.ts,
503
+ nonce: authorization.nonce,
504
+ host: host,
505
+ port: port,
506
+ hash: authorization.hash
507
+ };
508
+
509
+ // Calculate MAC
510
+
511
+ var mac = Crypto.calculateMac('message', credentials, artifacts);
512
+ if (!Cryptiles.fixedTimeComparison(mac, authorization.mac)) {
513
+ return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials);
514
+ }
515
+
516
+ // Check payload hash
517
+
518
+ var hash = Crypto.calculatePayloadHash(message, credentials.algorithm);
519
+ if (!Cryptiles.fixedTimeComparison(hash, authorization.hash)) {
520
+ return callback(Boom.unauthorized('Bad message hash', 'Hawk'), credentials);
521
+ }
522
+
523
+ // Check nonce
524
+
525
+ options.nonceFunc(credentials.key, authorization.nonce, authorization.ts, function (err) {
526
+
527
+ if (err) {
528
+ return callback(Boom.unauthorized('Invalid nonce', 'Hawk'), credentials);
529
+ }
530
+
531
+ // Check timestamp staleness
532
+
533
+ if (Math.abs((authorization.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
534
+ return callback(Boom.unauthorized('Stale timestamp'), credentials);
535
+ }
536
+
537
+ // Successful authentication
538
+
539
+ return callback(null, credentials);
540
+ });
541
+ });
542
+ };
543
+
544
+
545
+ internals.nonceFunc = function (key, nonce, ts, nonceCallback) {
546
+
547
+ return nonceCallback(); // No validation
548
+ };