Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-12-11 06:17:40 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-12-11 07:00:04 +0300
commit95e99faadcdc85a16210dd79c0e7d83add1b9f3e (patch)
treeb06e9f4f7b14832399afe326e378efe84e1f1cbf /node_modules/request
parentb49199ac96dfb1afe5719286621a318576dd69ae (diff)
request@2.67.0
Dependency upgrades, improved tests, and fixes to tunneling. Credit: @simov Reviewed-By: @othiym23
Diffstat (limited to 'node_modules/request')
-rw-r--r--node_modules/request/.travis.yml8
-rw-r--r--node_modules/request/CHANGELOG.md25
-rw-r--r--node_modules/request/README.md25
-rw-r--r--node_modules/request/lib/har.js159
-rw-r--r--node_modules/request/lib/redirect.js5
-rw-r--r--node_modules/request/lib/tunnel.js31
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore5
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml39
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml1
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/README.md36
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown1651
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md60
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js1
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js82
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js27
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js959
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js197
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js520
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md3
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch604
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js107
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json37
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/util.js106
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md54
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js209
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json19
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js3
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json38
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js13
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json28
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md18
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js24
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore2
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE20
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md7
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js221
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json34
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md16
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE24
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md53
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js67
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js6
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json54
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/package.json46
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js1
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js12
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js1
-rw-r--r--node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js1
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md9
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/README.md1791
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/dist/async.js1260
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js2
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/lib/async.js86
-rw-r--r--node_modules/request/node_modules/form-data/node_modules/async/package.json135
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/index.js30
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/immutable.js4
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/mutable.js4
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/package.json129
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js20
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/package.json102
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/index.js30
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/package.json99
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/readme.md26
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json98
-rw-r--r--node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/readme.md8
-rw-r--r--node_modules/request/node_modules/har-validator/package.json148
-rw-r--r--node_modules/request/node_modules/hawk/dist/client.js340
-rwxr-xr-xnode_modules/request/node_modules/hawk/lib/browser.js34
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/README.md95
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/lib/index.js8
-rw-r--r--node_modules/request/node_modules/hawk/node_modules/boom/package.json96
-rwxr-xr-xnode_modules/request/node_modules/hawk/node_modules/boom/test/index.js40
-rw-r--r--node_modules/request/node_modules/hawk/package.json111
-rwxr-xr-xnode_modules/request/node_modules/hawk/test/browser.js235
-rwxr-xr-xnode_modules/request/node_modules/hawk/test/index.js122
-rwxr-xr-xnode_modules/request/node_modules/hawk/test/server.js156
-rwxr-xr-xnode_modules/request/node_modules/hawk/test/uri.js115
-rw-r--r--node_modules/request/node_modules/http-signature/CHANGES.md39
-rw-r--r--node_modules/request/node_modules/http-signature/http_signing.md33
-rw-r--r--node_modules/request/node_modules/http-signature/lib/index.js10
-rw-r--r--node_modules/request/node_modules/http-signature/lib/parser.js72
-rw-r--r--node_modules/request/node_modules/http-signature/lib/signer.js364
-rw-r--r--node_modules/request/node_modules/http-signature/lib/util.js306
-rw-r--r--node_modules/request/node_modules/http-signature/lib/utils.js112
-rw-r--r--node_modules/request/node_modules/http-signature/lib/verify.js62
l---------node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-conv1
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/asn1/package.json45
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore1
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG78
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/README82
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/README.old298
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js245
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js1485
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js944
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype241
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/ctype/package.json42
-rwxr-xr-xnode_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle839
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/CHANGES.md30
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/LICENSE (renamed from node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE)21
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/README.md228
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/lib/jsprim.js478
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/.gitmodules6
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/LICENSE19
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile23
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.deps39
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.targ285
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/README.md39
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/examples/simple.js2
-rw-r--r--[-rwxr-xr-x]node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/jsl.node.conf (renamed from node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf)134
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/lib/extsprintf.js166
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/package.json66
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/README.md5
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/hyper-schema68
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/json-ref26
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/links33
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/schema155
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/hyper-schema68
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/json-ref26
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/links33
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/schema155
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/hyper-schema68
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/json-ref26
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/links35
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/schema166
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/address20
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/calendar53
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/card105
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/geo8
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/interfaces23
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/hyper-schema60
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/json-ref26
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/links35
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/schema174
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/hyper-schema60
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/links41
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/schema189
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-03.xml1120
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-04.xml1072
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js52
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js260
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/package.json86
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/test/tests.js95
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.gitmodules0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.npmignore1
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/LICENSE19
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile35
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile.targ285
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/README.md120
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js36
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-werror.js34
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/varargs.js6
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/verror.js13
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/werror.js14
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/jsl.node.conf139
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/lib/verror.js157
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/package.json70
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.inherit.js100
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.verror.js156
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.werror.js179
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/jsprim/package.json73
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/.npmignore8
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/.travis.yml11
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/LICENSE (renamed from node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE)2
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/README.md436
-rwxr-xr-xnode_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv183
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/algs.js168
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/dhe.js311
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ed-compat.js94
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/errors.js58
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/fingerprint.js140
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/auto.js73
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pem.js152
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs1.js320
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs8.js510
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/rfc4253.js145
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh-private.js138
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh.js114
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/index.js25
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/key.js260
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/private-key.js224
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/signature.js237
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js123
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js207
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.npmignore (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore)0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.travis.yml4
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/LICENSE (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE)0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/README.md (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/README.md)0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/errors.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js)0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/index.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js)0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/reader.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js)60
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/types.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js)0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/writer.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js)21
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/index.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js)0
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/package.json90
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/reader.test.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js)36
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/writer.test.js (renamed from node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js)74
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/AUTHORS6
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/CHANGES.md8
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/README.md155
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/assert.js206
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/package.json107
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/README.md508
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/lib/dashdash.js813
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/README.md126
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/assert.js245
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/package.json71
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/package.json106
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/.npmignore15
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/LICENSE (renamed from node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/license.md)8
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/README.md8
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/index.js57
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/LICENSE-jsbn40
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/ec.js561
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/sec.js170
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/package.json82
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/test.js14
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.npmignore11
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.travis.yml (renamed from node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/.travis.yml)6
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/AUTHORS.md3
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/LICENSE23
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/README.md51
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.042
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.113
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/index.js35
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/jsdoc.json19
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/core.js481
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/curve255.js221
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/dh.js111
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/eddsa.js573
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/utils.js198
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/package.json96
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/.npmignore2
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/LICENSE40
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/README.md175
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.html12
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js3
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js1358
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json79
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore4
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md128
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md463
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js2418
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js2
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js1205
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js1
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json120
-rw-r--r--node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json111
-rw-r--r--node_modules/request/node_modules/http-signature/package.json109
-rw-r--r--node_modules/request/node_modules/is-typedarray/LICENSE.md18
-rw-r--r--node_modules/request/node_modules/is-typedarray/README.md16
-rw-r--r--node_modules/request/node_modules/is-typedarray/index.js41
-rw-r--r--node_modules/request/node_modules/is-typedarray/package.json82
-rw-r--r--node_modules/request/node_modules/is-typedarray/test.js34
-rw-r--r--node_modules/request/node_modules/mime-types/HISTORY.md6
-rw-r--r--node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md13
-rw-r--r--node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json30
-rw-r--r--node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json110
-rw-r--r--node_modules/request/node_modules/mime-types/package.json102
-rw-r--r--node_modules/request/node_modules/node-uuid/.npmignore2
-rw-r--r--node_modules/request/node_modules/node-uuid/README.md13
-rw-r--r--node_modules/request/node_modules/node-uuid/bower.json2
-rw-r--r--node_modules/request/node_modules/node-uuid/component.json15
-rw-r--r--node_modules/request/node_modules/node-uuid/package.json112
-rw-r--r--node_modules/request/node_modules/node-uuid/test/test.js3
-rw-r--r--node_modules/request/node_modules/node-uuid/uuid.js115
-rw-r--r--node_modules/request/node_modules/stringstream/LICENSE.txt24
-rw-r--r--node_modules/request/node_modules/stringstream/package.json83
-rw-r--r--node_modules/request/node_modules/tough-cookie/lib/cookie.js2
-rw-r--r--node_modules/request/node_modules/tough-cookie/package.json122
-rw-r--r--node_modules/request/node_modules/tunnel-agent/index.js2
-rw-r--r--node_modules/request/node_modules/tunnel-agent/package.json89
-rw-r--r--node_modules/request/package.json152
-rw-r--r--node_modules/request/request.js75
273 files changed, 29032 insertions, 11481 deletions
diff --git a/node_modules/request/.travis.yml b/node_modules/request/.travis.yml
index d793e7f54..c24c59b5d 100644
--- a/node_modules/request/.travis.yml
+++ b/node_modules/request/.travis.yml
@@ -1,9 +1,9 @@
language: node_js
node_js:
- - "4.0"
- - "io.js"
- - "0.12"
- - "0.10"
+ - node
+ - io.js
+ - 0.12
+ - 0.10
sudo: false
after_script: "npm run test-cov && cat ./coverage/lcov.info | codecov && cat ./coverage/lcov.info | coveralls"
diff --git a/node_modules/request/CHANGELOG.md b/node_modules/request/CHANGELOG.md
index a43c6726a..7dc85ea14 100644
--- a/node_modules/request/CHANGELOG.md
+++ b/node_modules/request/CHANGELOG.md
@@ -1,5 +1,30 @@
## Change Log
+### v2.67.0 (2015/11/19)
+- [#1913](https://github.com/request/request/pull/1913) Update http-signature to version 1.1.0 🚀 (@greenkeeperio-bot)
+
+### v2.66.0 (2015/11/18)
+- [#1906](https://github.com/request/request/pull/1906) Update README URLs based on HTTP redirects (@ReadmeCritic)
+- [#1905](https://github.com/request/request/pull/1905) Convert typed arrays into regular buffers (@simov)
+- [#1902](https://github.com/request/request/pull/1902) node-uuid@1.4.7 breaks build 🚨 (@greenkeeperio-bot)
+- [#1894](https://github.com/request/request/pull/1894) Fix tunneling after redirection from https (Original: #1881) (@simov, @falms)
+- [#1893](https://github.com/request/request/pull/1893) Update eslint to version 1.9.0 🚀 (@greenkeeperio-bot)
+- [#1852](https://github.com/request/request/pull/1852) Update eslint to version 1.7.3 🚀 (@simov, @greenkeeperio-bot, @paulomcnally, @michelsalib, @arbaaz, @vladimirich, @LoicMahieu, @JoshWillik, @jzaefferer, @ryanwholey, @djchie, @thisconnect, @mgenereu, @acroca, @Sebmaster, @Bloutiouf)
+- [#1876](https://github.com/request/request/pull/1876) Implement loose matching for har mime types (@simov)
+- [#1875](https://github.com/request/request/pull/1875) Update bluebird to version 3.0.2 🚀 (@simov, @greenkeeperio-bot)
+- [#1871](https://github.com/request/request/pull/1871) Update browserify to version 12.0.1 🚀 (@greenkeeperio-bot)
+- [#1866](https://github.com/request/request/pull/1866) Add missing quotes on x-token property in README (@miguelmota)
+- [#1874](https://github.com/request/request/pull/1874) Fix typo in README.md (@gswalden)
+- [#1860](https://github.com/request/request/pull/1860) Improve referer header tests and docs (@simov)
+- [#1861](https://github.com/request/request/pull/1861) Remove redundant call to Stream constructor (@watson)
+- [#1857](https://github.com/request/request/pull/1857) Fix Referer header to point to the original host name (@simov)
+- [#1850](https://github.com/request/request/pull/1850) Update karma-coverage to version 0.5.3 🚀 (@greenkeeperio-bot)
+- [#1847](https://github.com/request/request/pull/1847) Use node's latest version when building (@simov)
+- [#1836](https://github.com/request/request/pull/1836) Tunnel: fix wrong property name (@Bloutiouf)
+- [#1820](https://github.com/request/request/pull/1820) Set href as request.js uses it (@mgenereu)
+- [#1840](https://github.com/request/request/pull/1840) Update http-signature to version 1.0.2 🚀 (@greenkeeperio-bot)
+- [#1845](https://github.com/request/request/pull/1845) Update istanbul to version 0.4.0 🚀 (@greenkeeperio-bot)
+
### v2.65.0 (2015/10/11)
- [#1833](https://github.com/request/request/pull/1833) Update aws-sign2 to version 0.6.0 🚀 (@greenkeeperio-bot)
- [#1811](https://github.com/request/request/pull/1811) Enable loose cookie parsing in tough-cookie (@Sebmaster)
diff --git a/node_modules/request/README.md b/node_modules/request/README.md
index c18b022ab..77e30df58 100644
--- a/node_modules/request/README.md
+++ b/node_modules/request/README.md
@@ -161,7 +161,7 @@ request.post({url:'http://service.com/upload', form: {key:'value'}}, function(er
#### multipart/form-data (Multipart Form Uploads)
-For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). For the most cases, you can pass your upload form data via the `formData` option.
+For `multipart/form-data` we use the [form-data](https://github.com/form-data/form-data) library by [@felixge](https://github.com/felixge). For the most cases, you can pass your upload form data via the `formData` option.
```js
@@ -179,7 +179,7 @@ var formData = {
],
// Pass optional meta-data with an 'options' object with style: {value: DATA, options: OPTIONS}
// Use case: for some types of streams, you'll need to provide "file"-related information manually.
- // See the `form-data` README for more information about options: https://github.com/felixge/node-form-data
+ // See the `form-data` README for more information about options: https://github.com/form-data/form-data
custom_file: {
value: fs.createReadStream('/dev/urandom'),
options: {
@@ -206,7 +206,7 @@ form.append('my_field', 'my_value');
form.append('my_buffer', new Buffer([1, 2, 3]));
form.append('custom_file', fs.createReadStream(__dirname + '/unicycle.jpg'), {filename: 'unicycle.jpg'});
```
-See the [form-data README](https://github.com/felixge/node-form-data) for more information & examples.
+See the [form-data README](https://github.com/form-data/form-data) for more information & examples.
#### multipart/related
@@ -472,7 +472,7 @@ HTTP/1.1 200 OK
At this point, the connection is left open, and the client is
communicating directly with the `endpoint-server.com` machine.
-See [the wikipedia page on HTTP Tunneling](http://en.wikipedia.org/wiki/HTTP_tunnel)
+See [the wikipedia page on HTTP Tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel)
for more information.
By default, when proxying `http` traffic, request will simply make a
@@ -566,7 +566,7 @@ Here's some examples of valid `no_proxy` values:
## UNIX Domain Sockets
-`request` supports making requests to [UNIX Domain Sockets](http://en.wikipedia.org/wiki/Unix_domain_socket). To make one, use the following URL scheme:
+`request` supports making requests to [UNIX Domain Sockets](https://en.wikipedia.org/wiki/Unix_domain_socket). To make one, use the following URL scheme:
```js
/* Pattern */ 'http://unix:SOCKET:PATH'
@@ -746,7 +746,7 @@ The first argument can be either a `url` or an `options` object. The only requir
In non-chunked requests, data items with body streams are not allowed.
- `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request.
- `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request.
-- `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.
+- `json` - sets `body` to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.
- `jsonReviver` - a [reviver function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) that will be passed to `JSON.parse()` when parsing a JSON response body.
---
@@ -762,7 +762,7 @@ The first argument can be either a `url` or an `options` object. The only requir
- `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise.
- `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`)
- `maxRedirects` - the maximum number of redirects to follow (default: `10`)
-- `removeRefererHeader` - removes the referer header when a redirect happens (default: `false`).
+- `removeRefererHeader` - removes the referer header when a redirect happens (default: `false`). **Note:** if true, referer header set in the initial request is preserved during redirect chain.
---
@@ -799,8 +799,7 @@ default in Linux can be anywhere from 20-120 seconds][linux-timeout]).
- `tunnel` - controls the behavior of
[HTTP `CONNECT` tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling)
as follows:
- - `undefined` (default) - `true` if the destination is `https` or a previous
- request in the redirect chain used a tunneling proxy, `false` otherwise
+ - `undefined` (default) - `true` if the destination is `https`, `false` otherwise
- `true` - always tunnel to the destination by making a `CONNECT` request to
the proxy
- `false` - request the destination as a `GET` request.
@@ -845,7 +844,7 @@ For example:
```js
//requests using baseRequest() will set the 'x-token' header
var baseRequest = request.defaults({
- headers: {x-token: 'my-token'}
+ headers: {'x-token': 'my-token'}
})
//requests using specialRequest() will include the 'x-token' header set in
@@ -933,7 +932,7 @@ There are at least three ways to debug the operation of `request`:
2. Set `require('request').debug = true` at any time (this does the same thing
as #1).
-3. Use the [request-debug module](https://github.com/nylen/request-debug) to
+3. Use the [request-debug module](https://github.com/request/request-debug) to
view request and response headers and bodies.
[back to top](#table-of-contents)
@@ -1076,9 +1075,9 @@ request('http://www.google.com', function() {
```
The cookie store must be a
-[`tough-cookie`](https://github.com/goinstant/tough-cookie)
+[`tough-cookie`](https://github.com/SalesforceEng/tough-cookie)
store and it must support synchronous operations; see the
-[`CookieStore` API docs](https://github.com/goinstant/tough-cookie/#cookiestore-api)
+[`CookieStore` API docs](https://github.com/SalesforceEng/tough-cookie#cookiestore-api)
for details.
To inspect your cookie jar after a request:
diff --git a/node_modules/request/lib/har.js b/node_modules/request/lib/har.js
index 83453a327..ceb1cd107 100644
--- a/node_modules/request/lib/har.js
+++ b/node_modules/request/lib/har.js
@@ -60,43 +60,53 @@ Har.prototype.prep = function (data) {
}
// prep body
- switch (data.postData.mimeType) {
- case 'multipart/mixed':
- case 'multipart/related':
- case 'multipart/form-data':
- case 'multipart/alternative':
- // reset values
- data.postData.mimeType = 'multipart/form-data'
- break
-
- case 'application/x-www-form-urlencoded':
- if (!data.postData.params) {
- data.postData.text = ''
- } else {
- data.postData.paramsObj = data.postData.params.reduce(this.reducer, {})
-
- // always overwrite
- data.postData.text = qs.stringify(data.postData.paramsObj)
- }
- break
-
- case 'text/json':
- case 'text/x-json':
- case 'application/json':
- case 'application/x-json':
- data.postData.mimeType = 'application/json'
-
- if (data.postData.text) {
- try {
- data.postData.jsonObj = JSON.parse(data.postData.text)
- } catch (e) {
- this.request.debug(e)
-
- // force back to text/plain
- data.postData.mimeType = 'text/plain'
- }
+ function some (arr) {
+ return arr.some(function (type) {
+ return data.postData.mimeType.indexOf(type) === 0
+ })
+ }
+
+ if (some([
+ 'multipart/mixed',
+ 'multipart/related',
+ 'multipart/form-data',
+ 'multipart/alternative'])) {
+
+ // reset values
+ data.postData.mimeType = 'multipart/form-data'
+ }
+
+ else if (some([
+ 'application/x-www-form-urlencoded'])) {
+
+ if (!data.postData.params) {
+ data.postData.text = ''
+ } else {
+ data.postData.paramsObj = data.postData.params.reduce(this.reducer, {})
+
+ // always overwrite
+ data.postData.text = qs.stringify(data.postData.paramsObj)
+ }
+ }
+
+ else if (some([
+ 'text/json',
+ 'text/x-json',
+ 'application/json',
+ 'application/x-json'])) {
+
+ data.postData.mimeType = 'application/json'
+
+ if (data.postData.text) {
+ try {
+ data.postData.jsonObj = JSON.parse(data.postData.text)
+ } catch (e) {
+ this.request.debug(e)
+
+ // force back to text/plain
+ data.postData.mimeType = 'text/plain'
}
- break
+ }
}
return data
@@ -152,51 +162,50 @@ Har.prototype.options = function (options) {
options.headers = req.headersObj
}
- switch (req.postData.mimeType) {
- case 'application/x-www-form-urlencoded':
- options.form = req.postData.paramsObj
- break
-
- case 'application/json':
- if (req.postData.jsonObj) {
- options.body = req.postData.jsonObj
- options.json = true
- }
- break
-
- case 'multipart/form-data':
- options.formData = {}
+ function test (type) {
+ return req.postData.mimeType.indexOf(type) === 0
+ }
+ if (test('application/x-www-form-urlencoded')) {
+ options.form = req.postData.paramsObj
+ }
+ else if (test('application/json')) {
+ if (req.postData.jsonObj) {
+ options.body = req.postData.jsonObj
+ options.json = true
+ }
+ }
+ else if (test('multipart/form-data')) {
+ options.formData = {}
- req.postData.params.forEach(function (param) {
- var attachment = {}
+ req.postData.params.forEach(function (param) {
+ var attachment = {}
- if (!param.fileName && !param.fileName && !param.contentType) {
- options.formData[param.name] = param.value
- return
- }
+ if (!param.fileName && !param.fileName && !param.contentType) {
+ options.formData[param.name] = param.value
+ return
+ }
- // attempt to read from disk!
- if (param.fileName && !param.value) {
- attachment.value = fs.createReadStream(param.fileName)
- } else if (param.value) {
- attachment.value = param.value
- }
+ // attempt to read from disk!
+ if (param.fileName && !param.value) {
+ attachment.value = fs.createReadStream(param.fileName)
+ } else if (param.value) {
+ attachment.value = param.value
+ }
- if (param.fileName) {
- attachment.options = {
- filename: param.fileName,
- contentType: param.contentType ? param.contentType : null
- }
+ if (param.fileName) {
+ attachment.options = {
+ filename: param.fileName,
+ contentType: param.contentType ? param.contentType : null
}
-
- options.formData[param.name] = attachment
- })
- break
-
- default:
- if (req.postData.text) {
- options.body = req.postData.text
}
+
+ options.formData[param.name] = attachment
+ })
+ }
+ else {
+ if (req.postData.text) {
+ options.body = req.postData.text
+ }
}
return options
diff --git a/node_modules/request/lib/redirect.js b/node_modules/request/lib/redirect.js
index b2d0f613a..040dfe0e0 100644
--- a/node_modules/request/lib/redirect.js
+++ b/node_modules/request/lib/redirect.js
@@ -105,7 +105,7 @@ Redirect.prototype.onResponse = function (response) {
// handle the case where we change protocol from https to http or vice versa
if (request.uri.protocol !== uriPrev.protocol) {
- request._updateProtocol()
+ delete request.agent
}
self.redirects.push(
@@ -120,7 +120,6 @@ Redirect.prototype.onResponse = function (response) {
// request.method = 'GET' // Force all redirects to use GET || commented out fixes #215
delete request.src
delete request.req
- delete request.agent
delete request._started
if (response.statusCode !== 401 && response.statusCode !== 307) {
// Remove parameters from the previous response, unless this is the second request
@@ -141,7 +140,7 @@ Redirect.prototype.onResponse = function (response) {
}
if (!self.removeRefererHeader) {
- request.setHeader('referer', request.uri.href)
+ request.setHeader('referer', uriPrev.href)
}
request.emit('redirect')
diff --git a/node_modules/request/lib/tunnel.js b/node_modules/request/lib/tunnel.js
index cf28016e2..918aec69a 100644
--- a/node_modules/request/lib/tunnel.js
+++ b/node_modules/request/lib/tunnel.js
@@ -34,7 +34,7 @@ var defaultProxyHeaderExclusiveList = [
]
function constructProxyHost(uriObject) {
- var port = uriObject.portA
+ var port = uriObject.port
, protocol = uriObject.protocol
, proxyHost = uriObject.hostname + ':'
@@ -109,22 +109,19 @@ function Tunnel (request) {
this.request = request
this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
this.proxyHeaderExclusiveList = []
-}
-
-Tunnel.prototype.isEnabled = function (options) {
- var request = this.request
- // Tunnel HTTPS by default, or if a previous request in the redirect chain
- // was tunneled. Allow the user to override this setting.
-
- // If self.tunnel is already set (because this is a redirect), use the
- // existing value.
if (typeof request.tunnel !== 'undefined') {
- return request.tunnel
+ this.tunnelOverride = request.tunnel
}
+}
+
+Tunnel.prototype.isEnabled = function () {
+ var self = this
+ , request = self.request
+ // Tunnel HTTPS by default. Allow the user to override this setting.
- // If options.tunnel is set (the user specified a value), use it.
- if (typeof options.tunnel !== 'undefined') {
- return options.tunnel
+ // If self.tunnelOverride is set (the user specified a value), use it.
+ if (typeof self.tunnelOverride !== 'undefined') {
+ return self.tunnelOverride
}
// If the destination is HTTPS, tunnel.
@@ -132,10 +129,8 @@ Tunnel.prototype.isEnabled = function (options) {
return true
}
- // Otherwise, leave tunnel unset, because if a later request in the redirect
- // chain is HTTPS then that request (and any subsequent ones) should be
- // tunneled.
- return undefined
+ // Otherwise, do not use tunnel.
+ return false
}
Tunnel.prototype.setup = function (options) {
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore b/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore
deleted file mode 100644
index 38344f87a..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore
+++ /dev/null
@@ -1,5 +0,0 @@
-build/
-test/
-examples/
-fs.js
-zlib.js \ No newline at end of file
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml b/node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml
deleted file mode 100644
index a2870dfb1..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-sudo: false
-language: node_js
-before_install:
- - npm install -g npm
-notifications:
- email: false
-matrix:
- include:
- - node_js: '0.8'
- env: TASK=test
- - node_js: '0.10'
- env: TASK=test
- - node_js: '0.11'
- env: TASK=test
- - node_js: '0.12'
- env: TASK=test
- - node_js: 'iojs'
- env: TASK=test
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=opera BROWSER_VERSION="11..latest"
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=ie BROWSER_VERSION="9..latest"
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=chrome BROWSER_VERSION="39..beta"
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=firefox BROWSER_VERSION="34..beta"
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=ipad BROWSER_VERSION="6.0..latest"
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=iphone BROWSER_VERSION="6.0..latest"
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest"
- - node_js: 'iojs'
- env: TASK=browser BROWSER_NAME=android BROWSER_VERSION="4.0..latest"
-script: "npm run $TASK"
-env:
- global:
- - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc=
- - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI=
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml b/node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml
deleted file mode 100644
index 96d9cfbd3..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml
+++ /dev/null
@@ -1 +0,0 @@
-ui: tape
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md
deleted file mode 100644
index f9fb52059..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# readable-stream
-
-***Node-core streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
-
-
-[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
-[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)
-
-
-[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)
-
-```bash
-npm install --save readable-stream
-```
-
-***Node-core streams for userland***
-
-This package is a mirror of the Streams2 and Streams3 implementations in
-Node-core, including [documentation](doc/stream.markdown).
-
-If you want to guarantee a stable streams base, regardless of what version of
-Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
-
-As of version 2.0.0 **readable-stream** uses semantic versioning.
-
-# Streams WG Team Members
-
-* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;
- - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
-* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;
- - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
-* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;
- - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
-* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;
-* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;
-* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown b/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown
deleted file mode 100644
index e34dac429..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown
+++ /dev/null
@@ -1,1651 +0,0 @@
-# Stream
-
- Stability: 2 - Stable
-
-A stream is an abstract interface implemented by various objects in
-io.js. For example a [request to an HTTP
-server](https://iojs.org/dist/v2.3.0/doc/api/http.html#http_http_incomingmessage) is a stream, as is
-[stdout][]. Streams are readable, writable, or both. All streams are
-instances of [EventEmitter][]
-
-You can load the Stream base classes by doing `require('stream')`.
-There are base classes provided for [Readable][] streams, [Writable][]
-streams, [Duplex][] streams, and [Transform][] streams.
-
-This document is split up into 3 sections. The first explains the
-parts of the API that you need to be aware of to use streams in your
-programs. If you never implement a streaming API yourself, you can
-stop there.
-
-The second section explains the parts of the API that you need to use
-if you implement your own custom streams yourself. The API is
-designed to make this easy for you to do.
-
-The third section goes into more depth about how streams work,
-including some of the internal mechanisms and functions that you
-should probably not modify unless you definitely know what you are
-doing.
-
-
-## API for Stream Consumers
-
-<!--type=misc-->
-
-Streams can be either [Readable][], [Writable][], or both ([Duplex][]).
-
-All streams are EventEmitters, but they also have other custom methods
-and properties depending on whether they are Readable, Writable, or
-Duplex.
-
-If a stream is both Readable and Writable, then it implements all of
-the methods and events below. So, a [Duplex][] or [Transform][] stream is
-fully described by this API, though their implementation may be
-somewhat different.
-
-It is not necessary to implement Stream interfaces in order to consume
-streams in your programs. If you **are** implementing streaming
-interfaces in your own program, please also refer to
-[API for Stream Implementors][] below.
-
-Almost all io.js programs, no matter how simple, use Streams in some
-way. Here is an example of using Streams in an io.js program:
-
-```javascript
-var http = require('http');
-
-var server = http.createServer(function (req, res) {
- // req is an http.IncomingMessage, which is a Readable Stream
- // res is an http.ServerResponse, which is a Writable Stream
-
- var body = '';
- // we want to get the data as utf8 strings
- // If you don't set an encoding, then you'll get Buffer objects
- req.setEncoding('utf8');
-
- // Readable streams emit 'data' events once a listener is added
- req.on('data', function (chunk) {
- body += chunk;
- });
-
- // the end event tells you that you have entire body
- req.on('end', function () {
- try {
- var data = JSON.parse(body);
- } catch (er) {
- // uh oh! bad json!
- res.statusCode = 400;
- return res.end('error: ' + er.message);
- }
-
- // write back something interesting to the user:
- res.write(typeof data);
- res.end();
- });
-});
-
-server.listen(1337);
-
-// $ curl localhost:1337 -d '{}'
-// object
-// $ curl localhost:1337 -d '"foo"'
-// string
-// $ curl localhost:1337 -d 'not json'
-// error: Unexpected token o
-```
-
-### Class: stream.Readable
-
-<!--type=class-->
-
-The Readable stream interface is the abstraction for a *source* of
-data that you are reading from. In other words, data comes *out* of a
-Readable stream.
-
-A Readable stream will not start emitting data until you indicate that
-you are ready to receive it.
-
-Readable streams have two "modes": a **flowing mode** and a **paused
-mode**. When in flowing mode, data is read from the underlying system
-and provided to your program as fast as possible. In paused mode, you
-must explicitly call `stream.read()` to get chunks of data out.
-Streams start out in paused mode.
-
-**Note**: If no data event handlers are attached, and there are no
-[`pipe()`][] destinations, and the stream is switched into flowing
-mode, then data will be lost.
-
-You can switch to flowing mode by doing any of the following:
-
-* Adding a [`'data'` event][] handler to listen for data.
-* Calling the [`resume()`][] method to explicitly open the flow.
-* Calling the [`pipe()`][] method to send the data to a [Writable][].
-
-You can switch back to paused mode by doing either of the following:
-
-* If there are no pipe destinations, by calling the [`pause()`][]
- method.
-* If there are pipe destinations, by removing any [`'data'` event][]
- handlers, and removing all pipe destinations by calling the
- [`unpipe()`][] method.
-
-Note that, for backwards compatibility reasons, removing `'data'`
-event handlers will **not** automatically pause the stream. Also, if
-there are piped destinations, then calling `pause()` will not
-guarantee that the stream will *remain* paused once those
-destinations drain and ask for more data.
-
-Examples of readable streams include:
-
-* [http responses, on the client](https://iojs.org/dist/v2.3.0/doc/api/http.html#http_http_incomingmessage)
-* [http requests, on the server](https://iojs.org/dist/v2.3.0/doc/api/http.html#http_http_incomingmessage)
-* [fs read streams](https://iojs.org/dist/v2.3.0/doc/api/fs.html#fs_class_fs_readstream)
-* [zlib streams][]
-* [crypto streams][]
-* [tcp sockets][]
-* [child process stdout and stderr][]
-* [process.stdin][]
-
-#### Event: 'readable'
-
-When a chunk of data can be read from the stream, it will emit a
-`'readable'` event.
-
-In some cases, listening for a `'readable'` event will cause some data
-to be read into the internal buffer from the underlying system, if it
-hadn't already.
-
-```javascript
-var readable = getReadableStreamSomehow();
-readable.on('readable', function() {
- // there is some data to read now
-});
-```
-
-Once the internal buffer is drained, a `readable` event will fire
-again when more data is available.
-
-#### Event: 'data'
-
-* `chunk` {Buffer | String} The chunk of data.
-
-Attaching a `data` event listener to a stream that has not been
-explicitly paused will switch the stream into flowing mode. Data will
-then be passed as soon as it is available.
-
-If you just want to get all the data out of the stream as fast as
-possible, this is the best way to do so.
-
-```javascript
-var readable = getReadableStreamSomehow();
-readable.on('data', function(chunk) {
- console.log('got %d bytes of data', chunk.length);
-});
-```
-
-#### Event: 'end'
-
-This event fires when there will be no more data to read.
-
-Note that the `end` event **will not fire** unless the data is
-completely consumed. This can be done by switching into flowing mode,
-or by calling `read()` repeatedly until you get to the end.
-
-```javascript
-var readable = getReadableStreamSomehow();
-readable.on('data', function(chunk) {
- console.log('got %d bytes of data', chunk.length);
-});
-readable.on('end', function() {
- console.log('there will be no more data.');
-});
-```
-
-#### Event: 'close'
-
-Emitted when the underlying resource (for example, the backing file
-descriptor) has been closed. Not all streams will emit this.
-
-#### Event: 'error'
-
-* {Error Object}
-
-Emitted if there was an error receiving data.
-
-#### readable.read([size])
-
-* `size` {Number} Optional argument to specify how much data to read.
-* Return {String | Buffer | null}
-
-The `read()` method pulls some data out of the internal buffer and
-returns it. If there is no data available, then it will return
-`null`.
-
-If you pass in a `size` argument, then it will return that many
-bytes. If `size` bytes are not available, then it will return `null`.
-
-If you do not specify a `size` argument, then it will return all the
-data in the internal buffer.
-
-This method should only be called in paused mode. In flowing mode,
-this method is called automatically until the internal buffer is
-drained.
-
-```javascript
-var readable = getReadableStreamSomehow();
-readable.on('readable', function() {
- var chunk;
- while (null !== (chunk = readable.read())) {
- console.log('got %d bytes of data', chunk.length);
- }
-});
-```
-
-If this method returns a data chunk, then it will also trigger the
-emission of a [`'data'` event][].
-
-#### readable.setEncoding(encoding)
-
-* `encoding` {String} The encoding to use.
-* Return: `this`
-
-Call this function to cause the stream to return strings of the
-specified encoding instead of Buffer objects. For example, if you do
-`readable.setEncoding('utf8')`, then the output data will be
-interpreted as UTF-8 data, and returned as strings. If you do
-`readable.setEncoding('hex')`, then the data will be encoded in
-hexadecimal string format.
-
-This properly handles multi-byte characters that would otherwise be
-potentially mangled if you simply pulled the Buffers directly and
-called `buf.toString(encoding)` on them. If you want to read the data
-as strings, always use this method.
-
-```javascript
-var readable = getReadableStreamSomehow();
-readable.setEncoding('utf8');
-readable.on('data', function(chunk) {
- assert.equal(typeof chunk, 'string');
- console.log('got %d characters of string data', chunk.length);
-});
-```
-
-#### readable.resume()
-
-* Return: `this`
-
-This method will cause the readable stream to resume emitting `data`
-events.
-
-This method will switch the stream into flowing mode. If you do *not*
-want to consume the data from a stream, but you *do* want to get to
-its `end` event, you can call [`readable.resume()`][] to open the flow of
-data.
-
-```javascript
-var readable = getReadableStreamSomehow();
-readable.resume();
-readable.on('end', function() {
- console.log('got to the end, but did not read anything');
-});
-```
-
-#### readable.pause()
-
-* Return: `this`
-
-This method will cause a stream in flowing mode to stop emitting
-`data` events, switching out of flowing mode. Any data that becomes
-available will remain in the internal buffer.
-
-```javascript
-var readable = getReadableStreamSomehow();
-readable.on('data', function(chunk) {
- console.log('got %d bytes of data', chunk.length);
- readable.pause();
- console.log('there will be no more data for 1 second');
- setTimeout(function() {
- console.log('now data will start flowing again');
- readable.resume();
- }, 1000);
-});
-```
-
-#### readable.isPaused()
-
-* Return: `Boolean`
-
-This method returns whether or not the `readable` has been **explicitly**
-paused by client code (using `readable.pause()` without a corresponding
-`readable.resume()`).
-
-```javascript
-var readable = new stream.Readable
-
-readable.isPaused() // === false
-readable.pause()
-readable.isPaused() // === true
-readable.resume()
-readable.isPaused() // === false
-```
-
-#### readable.pipe(destination[, options])
-
-* `destination` {[Writable][] Stream} The destination for writing data
-* `options` {Object} Pipe options
- * `end` {Boolean} End the writer when the reader ends. Default = `true`
-
-This method pulls all the data out of a readable stream, and writes it
-to the supplied destination, automatically managing the flow so that
-the destination is not overwhelmed by a fast readable stream.
-
-Multiple destinations can be piped to safely.
-
-```javascript
-var readable = getReadableStreamSomehow();
-var writable = fs.createWriteStream('file.txt');
-// All the data from readable goes into 'file.txt'
-readable.pipe(writable);
-```
-
-This function returns the destination stream, so you can set up pipe
-chains like so:
-
-```javascript
-var r = fs.createReadStream('file.txt');
-var z = zlib.createGzip();
-var w = fs.createWriteStream('file.txt.gz');
-r.pipe(z).pipe(w);
-```
-
-For example, emulating the Unix `cat` command:
-
-```javascript
-process.stdin.pipe(process.stdout);
-```
-
-By default [`end()`][] is called on the destination when the source stream
-emits `end`, so that `destination` is no longer writable. Pass `{ end:
-false }` as `options` to keep the destination stream open.
-
-This keeps `writer` open so that "Goodbye" can be written at the
-end.
-
-```javascript
-reader.pipe(writer, { end: false });
-reader.on('end', function() {
- writer.end('Goodbye\n');
-});
-```
-
-Note that `process.stderr` and `process.stdout` are never closed until
-the process exits, regardless of the specified options.
-
-#### readable.unpipe([destination])
-
-* `destination` {[Writable][] Stream} Optional specific stream to unpipe
-
-This method will remove the hooks set up for a previous `pipe()` call.
-
-If the destination is not specified, then all pipes are removed.
-
-If the destination is specified, but no pipe is set up for it, then
-this is a no-op.
-
-```javascript
-var readable = getReadableStreamSomehow();
-var writable = fs.createWriteStream('file.txt');
-// All the data from readable goes into 'file.txt',
-// but only for the first second
-readable.pipe(writable);
-setTimeout(function() {
- console.log('stop writing to file.txt');
- readable.unpipe(writable);
- console.log('manually close the file stream');
- writable.end();
-}, 1000);
-```
-
-#### readable.unshift(chunk)
-
-* `chunk` {Buffer | String} Chunk of data to unshift onto the read queue
-
-This is useful in certain cases where a stream is being consumed by a
-parser, which needs to "un-consume" some data that it has
-optimistically pulled out of the source, so that the stream can be
-passed on to some other party.
-
-If you find that you must often call `stream.unshift(chunk)` in your
-programs, consider implementing a [Transform][] stream instead. (See API
-for Stream Implementors, below.)
-
-```javascript
-// Pull off a header delimited by \n\n
-// use unshift() if we get too much
-// Call the callback with (error, header, stream)
-var StringDecoder = require('string_decoder').StringDecoder;
-function parseHeader(stream, callback) {
- stream.on('error', callback);
- stream.on('readable', onReadable);
- var decoder = new StringDecoder('utf8');
- var header = '';
- function onReadable() {
- var chunk;
- while (null !== (chunk = stream.read())) {
- var str = decoder.write(chunk);
- if (str.match(/\n\n/)) {
- // found the header boundary
- var split = str.split(/\n\n/);
- header += split.shift();
- var remaining = split.join('\n\n');
- var buf = new Buffer(remaining, 'utf8');
- if (buf.length)
- stream.unshift(buf);
- stream.removeListener('error', callback);
- stream.removeListener('readable', onReadable);
- // now the body of the message can be read from the stream.
- callback(null, header, stream);
- } else {
- // still reading the header.
- header += str;
- }
- }
- }
-}
-```
-
-#### readable.wrap(stream)
-
-* `stream` {Stream} An "old style" readable stream
-
-Versions of Node.js prior to v0.10 had streams that did not implement the
-entire Streams API as it is today. (See "Compatibility" below for
-more information.)
-
-If you are using an older io.js library that emits `'data'` events and
-has a [`pause()`][] method that is advisory only, then you can use the
-`wrap()` method to create a [Readable][] stream that uses the old stream
-as its data source.
-
-You will very rarely ever need to call this function, but it exists
-as a convenience for interacting with old io.js programs and libraries.
-
-For example:
-
-```javascript
-var OldReader = require('./old-api-module.js').OldReader;
-var oreader = new OldReader;
-var Readable = require('stream').Readable;
-var myReader = new Readable().wrap(oreader);
-
-myReader.on('readable', function() {
- myReader.read(); // etc.
-});
-```
-
-
-### Class: stream.Writable
-
-<!--type=class-->
-
-The Writable stream interface is an abstraction for a *destination*
-that you are writing data *to*.
-
-Examples of writable streams include:
-
-* [http requests, on the client](https://iojs.org/dist/v2.3.0/doc/api/http.html#http_class_http_clientrequest)
-* [http responses, on the server](https://iojs.org/dist/v2.3.0/doc/api/http.html#http_class_http_serverresponse)
-* [fs write streams](https://iojs.org/dist/v2.3.0/doc/api/fs.html#fs_class_fs_writestream)
-* [zlib streams][]
-* [crypto streams][]
-* [tcp sockets][]
-* [child process stdin](https://iojs.org/dist/v2.3.0/doc/api/child_process.html#child_process_child_stdin)
-* [process.stdout][], [process.stderr][]
-
-#### writable.write(chunk[, encoding][, callback])
-
-* `chunk` {String | Buffer} The data to write
-* `encoding` {String} The encoding, if `chunk` is a String
-* `callback` {Function} Callback for when this chunk of data is flushed
-* Returns: {Boolean} True if the data was handled completely.
-
-This method writes some data to the underlying system, and calls the
-supplied callback once the data has been fully handled.
-
-The return value indicates if you should continue writing right now.
-If the data had to be buffered internally, then it will return
-`false`. Otherwise, it will return `true`.
-
-This return value is strictly advisory. You MAY continue to write,
-even if it returns `false`. However, writes will be buffered in
-memory, so it is best not to do this excessively. Instead, wait for
-the `drain` event before writing more data.
-
-#### Event: 'drain'
-
-If a [`writable.write(chunk)`][] call returns false, then the `drain`
-event will indicate when it is appropriate to begin writing more data
-to the stream.
-
-```javascript
-// Write the data to the supplied writable stream 1MM times.
-// Be attentive to back-pressure.
-function writeOneMillionTimes(writer, data, encoding, callback) {
- var i = 1000000;
- write();
- function write() {
- var ok = true;
- do {
- i -= 1;
- if (i === 0) {
- // last time!
- writer.write(data, encoding, callback);
- } else {
- // see if we should continue, or wait
- // don't pass the callback, because we're not done yet.
- ok = writer.write(data, encoding);
- }
- } while (i > 0 && ok);
- if (i > 0) {
- // had to stop early!
- // write some more once it drains
- writer.once('drain', write);
- }
- }
-}
-```
-
-#### writable.cork()
-
-Forces buffering of all writes.
-
-Buffered data will be flushed either at `.uncork()` or at `.end()` call.
-
-#### writable.uncork()
-
-Flush all data, buffered since `.cork()` call.
-
-#### writable.setDefaultEncoding(encoding)
-
-* `encoding` {String} The new default encoding
-
-Sets the default encoding for a writable stream.
-
-#### writable.end([chunk][, encoding][, callback])
-
-* `chunk` {String | Buffer} Optional data to write
-* `encoding` {String} The encoding, if `chunk` is a String
-* `callback` {Function} Optional callback for when the stream is finished
-
-Call this method when no more data will be written to the stream. If
-supplied, the callback is attached as a listener on the `finish` event.
-
-Calling [`write()`][] after calling [`end()`][] will raise an error.
-
-```javascript
-// write 'hello, ' and then end with 'world!'
-var file = fs.createWriteStream('example.txt');
-file.write('hello, ');
-file.end('world!');
-// writing more now is not allowed!
-```
-
-#### Event: 'finish'
-
-When the [`end()`][] method has been called, and all data has been flushed
-to the underlying system, this event is emitted.
-
-```javascript
-var writer = getWritableStreamSomehow();
-for (var i = 0; i < 100; i ++) {
- writer.write('hello, #' + i + '!\n');
-}
-writer.end('this is the end\n');
-writer.on('finish', function() {
- console.error('all writes are now complete.');
-});
-```
-
-#### Event: 'pipe'
-
-* `src` {[Readable][] Stream} source stream that is piping to this writable
-
-This is emitted whenever the `pipe()` method is called on a readable
-stream, adding this writable to its set of destinations.
-
-```javascript
-var writer = getWritableStreamSomehow();
-var reader = getReadableStreamSomehow();
-writer.on('pipe', function(src) {
- console.error('something is piping into the writer');
- assert.equal(src, reader);
-});
-reader.pipe(writer);
-```
-
-#### Event: 'unpipe'
-
-* `src` {[Readable][] Stream} The source stream that [unpiped][] this writable
-
-This is emitted whenever the [`unpipe()`][] method is called on a
-readable stream, removing this writable from its set of destinations.
-
-```javascript
-var writer = getWritableStreamSomehow();
-var reader = getReadableStreamSomehow();
-writer.on('unpipe', function(src) {
- console.error('something has stopped piping into the writer');
- assert.equal(src, reader);
-});
-reader.pipe(writer);
-reader.unpipe(writer);
-```
-
-#### Event: 'error'
-
-* {Error object}
-
-Emitted if there was an error when writing or piping data.
-
-### Class: stream.Duplex
-
-Duplex streams are streams that implement both the [Readable][] and
-[Writable][] interfaces. See above for usage.
-
-Examples of Duplex streams include:
-
-* [tcp sockets][]
-* [zlib streams][]
-* [crypto streams][]
-
-
-### Class: stream.Transform
-
-Transform streams are [Duplex][] streams where the output is in some way
-computed from the input. They implement both the [Readable][] and
-[Writable][] interfaces. See above for usage.
-
-Examples of Transform streams include:
-
-* [zlib streams][]
-* [crypto streams][]
-
-
-## API for Stream Implementors
-
-<!--type=misc-->
-
-To implement any sort of stream, the pattern is the same:
-
-1. Extend the appropriate parent class in your own subclass. (The
- [`util.inherits`][] method is particularly helpful for this.)
-2. Call the appropriate parent class constructor in your constructor,
- to be sure that the internal mechanisms are set up properly.
-2. Implement one or more specific methods, as detailed below.
-
-The class to extend and the method(s) to implement depend on the sort
-of stream class you are writing:
-
-<table>
- <thead>
- <tr>
- <th>
- <p>Use-case</p>
- </th>
- <th>
- <p>Class</p>
- </th>
- <th>
- <p>Method(s) to implement</p>
- </th>
- </tr>
- </thead>
- <tr>
- <td>
- <p>Reading only</p>
- </td>
- <td>
- <p>[Readable](#stream_class_stream_readable_1)</p>
- </td>
- <td>
- <p><code>[_read][]</code></p>
- </td>
- </tr>
- <tr>
- <td>
- <p>Writing only</p>
- </td>
- <td>
- <p>[Writable](#stream_class_stream_writable_1)</p>
- </td>
- <td>
- <p><code>[_write][]</code>, <code>_writev</code></p>
- </td>
- </tr>
- <tr>
- <td>
- <p>Reading and writing</p>
- </td>
- <td>
- <p>[Duplex](#stream_class_stream_duplex_1)</p>
- </td>
- <td>
- <p><code>[_read][]</code>, <code>[_write][]</code>, <code>_writev</code></p>
- </td>
- </tr>
- <tr>
- <td>
- <p>Operate on written data, then read the result</p>
- </td>
- <td>
- <p>[Transform](#stream_class_stream_transform_1)</p>
- </td>
- <td>
- <p><code>_transform</code>, <code>_flush</code></p>
- </td>
- </tr>
-</table>
-
-In your implementation code, it is very important to never call the
-methods described in [API for Stream Consumers][] above. Otherwise, you
-can potentially cause adverse side effects in programs that consume
-your streaming interfaces.
-
-### Class: stream.Readable
-
-<!--type=class-->
-
-`stream.Readable` is an abstract class designed to be extended with an
-underlying implementation of the [`_read(size)`][] method.
-
-Please see above under [API for Stream Consumers][] for how to consume
-streams in your programs. What follows is an explanation of how to
-implement Readable streams in your programs.
-
-#### Example: A Counting Stream
-
-<!--type=example-->
-
-This is a basic example of a Readable stream. It emits the numerals
-from 1 to 1,000,000 in ascending order, and then ends.
-
-```javascript
-var Readable = require('stream').Readable;
-var util = require('util');
-util.inherits(Counter, Readable);
-
-function Counter(opt) {
- Readable.call(this, opt);
- this._max = 1000000;
- this._index = 1;
-}
-
-Counter.prototype._read = function() {
- var i = this._index++;
- if (i > this._max)
- this.push(null);
- else {
- var str = '' + i;
- var buf = new Buffer(str, 'ascii');
- this.push(buf);
- }
-};
-```
-
-#### Example: SimpleProtocol v1 (Sub-optimal)
-
-This is similar to the `parseHeader` function described above, but
-implemented as a custom stream. Also, note that this implementation
-does not convert the incoming data to a string.
-
-However, this would be better implemented as a [Transform][] stream. See
-below for a better implementation.
-
-```javascript
-// A parser for a simple data protocol.
-// The "header" is a JSON object, followed by 2 \n characters, and
-// then a message body.
-//
-// NOTE: This can be done more simply as a Transform stream!
-// Using Readable directly for this is sub-optimal. See the
-// alternative example below under the Transform section.
-
-var Readable = require('stream').Readable;
-var util = require('util');
-
-util.inherits(SimpleProtocol, Readable);
-
-function SimpleProtocol(source, options) {
- if (!(this instanceof SimpleProtocol))
- return new SimpleProtocol(source, options);
-
- Readable.call(this, options);
- this._inBody = false;
- this._sawFirstCr = false;
-
- // source is a readable stream, such as a socket or file
- this._source = source;
-
- var self = this;
- source.on('end', function() {
- self.push(null);
- });
-
- // give it a kick whenever the source is readable
- // read(0) will not consume any bytes
- source.on('readable', function() {
- self.read(0);
- });
-
- this._rawHeader = [];
- this.header = null;
-}
-
-SimpleProtocol.prototype._read = function(n) {
- if (!this._inBody) {
- var chunk = this._source.read();
-
- // if the source doesn't have data, we don't have data yet.
- if (chunk === null)
- return this.push('');
-
- // check if the chunk has a \n\n
- var split = -1;
- for (var i = 0; i < chunk.length; i++) {
- if (chunk[i] === 10) { // '\n'
- if (this._sawFirstCr) {
- split = i;
- break;
- } else {
- this._sawFirstCr = true;
- }
- } else {
- this._sawFirstCr = false;
- }
- }
-
- if (split === -1) {
- // still waiting for the \n\n
- // stash the chunk, and try again.
- this._rawHeader.push(chunk);
- this.push('');
- } else {
- this._inBody = true;
- var h = chunk.slice(0, split);
- this._rawHeader.push(h);
- var header = Buffer.concat(this._rawHeader).toString();
- try {
- this.header = JSON.parse(header);
- } catch (er) {
- this.emit('error', new Error('invalid simple protocol data'));
- return;
- }
- // now, because we got some extra data, unshift the rest
- // back into the read queue so that our consumer will see it.
- var b = chunk.slice(split);
- this.unshift(b);
-
- // and let them know that we are done parsing the header.
- this.emit('header', this.header);
- }
- } else {
- // from there on, just provide the data to our consumer.
- // careful not to push(null), since that would indicate EOF.
- var chunk = this._source.read();
- if (chunk) this.push(chunk);
- }
-};
-
-// Usage:
-// var parser = new SimpleProtocol(source);
-// Now parser is a readable stream that will emit 'header'
-// with the parsed header data.
-```
-
-
-#### new stream.Readable([options])
-
-* `options` {Object}
- * `highWaterMark` {Number} The maximum number of bytes to store in
- the internal buffer before ceasing to read from the underlying
- resource. Default=16kb, or 16 for `objectMode` streams
- * `encoding` {String} If specified, then buffers will be decoded to
- strings using the specified encoding. Default=null
- * `objectMode` {Boolean} Whether this stream should behave
- as a stream of objects. Meaning that stream.read(n) returns
- a single value instead of a Buffer of size n. Default=false
-
-In classes that extend the Readable class, make sure to call the
-Readable constructor so that the buffering settings can be properly
-initialized.
-
-#### readable.\_read(size)
-
-* `size` {Number} Number of bytes to read asynchronously
-
-Note: **Implement this function, but do NOT call it directly.**
-
-This function should NOT be called directly. It should be implemented
-by child classes, and only called by the internal Readable class
-methods.
-
-All Readable stream implementations must provide a `_read` method to
-fetch data from the underlying resource.
-
-This method is prefixed with an underscore because it is internal to
-the class that defines it, and should not be called directly by user
-programs. However, you **are** expected to override this method in
-your own extension classes.
-
-When data is available, put it into the read queue by calling
-`readable.push(chunk)`. If `push` returns false, then you should stop
-reading. When `_read` is called again, you should start pushing more
-data.
-
-The `size` argument is advisory. Implementations where a "read" is a
-single call that returns data can use this to know how much data to
-fetch. Implementations where that is not relevant, such as TCP or
-TLS, may ignore this argument, and simply provide data whenever it
-becomes available. There is no need, for example to "wait" until
-`size` bytes are available before calling [`stream.push(chunk)`][].
-
-#### readable.push(chunk[, encoding])
-
-* `chunk` {Buffer | null | String} Chunk of data to push into the read queue
-* `encoding` {String} Encoding of String chunks. Must be a valid
- Buffer encoding, such as `'utf8'` or `'ascii'`
-* return {Boolean} Whether or not more pushes should be performed
-
-Note: **This function should be called by Readable implementors, NOT
-by consumers of Readable streams.**
-
-The `_read()` function will not be called again until at least one
-`push(chunk)` call is made.
-
-The `Readable` class works by putting data into a read queue to be
-pulled out later by calling the `read()` method when the `'readable'`
-event fires.
-
-The `push()` method will explicitly insert some data into the read
-queue. If it is called with `null` then it will signal the end of the
-data (EOF).
-
-This API is designed to be as flexible as possible. For example,
-you may be wrapping a lower-level source which has some sort of
-pause/resume mechanism, and a data callback. In those cases, you
-could wrap the low-level source object by doing something like this:
-
-```javascript
-// source is an object with readStop() and readStart() methods,
-// and an `ondata` member that gets called when it has data, and
-// an `onend` member that gets called when the data is over.
-
-util.inherits(SourceWrapper, Readable);
-
-function SourceWrapper(options) {
- Readable.call(this, options);
-
- this._source = getLowlevelSourceObject();
- var self = this;
-
- // Every time there's data, we push it into the internal buffer.
- this._source.ondata = function(chunk) {
- // if push() returns false, then we need to stop reading from source
- if (!self.push(chunk))
- self._source.readStop();
- };
-
- // When the source ends, we push the EOF-signaling `null` chunk
- this._source.onend = function() {
- self.push(null);
- };
-}
-
-// _read will be called when the stream wants to pull more data in
-// the advisory size argument is ignored in this case.
-SourceWrapper.prototype._read = function(size) {
- this._source.readStart();
-};
-```
-
-
-### Class: stream.Writable
-
-<!--type=class-->
-
-`stream.Writable` is an abstract class designed to be extended with an
-underlying implementation of the [`_write(chunk, encoding, callback)`][] method.
-
-Please see above under [API for Stream Consumers][] for how to consume
-writable streams in your programs. What follows is an explanation of
-how to implement Writable streams in your programs.
-
-#### new stream.Writable([options])
-
-* `options` {Object}
- * `highWaterMark` {Number} Buffer level when [`write()`][] starts
- returning false. Default=16kb, or 16 for `objectMode` streams
- * `decodeStrings` {Boolean} Whether or not to decode strings into
- Buffers before passing them to [`_write()`][]. Default=true
- * `objectMode` {Boolean} Whether or not the `write(anyObj)` is
- a valid operation. If set you can write arbitrary data instead
- of only `Buffer` / `String` data. Default=false
-
-In classes that extend the Writable class, make sure to call the
-constructor so that the buffering settings can be properly
-initialized.
-
-#### writable.\_write(chunk, encoding, callback)
-
-* `chunk` {Buffer | String} The chunk to be written. Will **always**
- be a buffer unless the `decodeStrings` option was set to `false`.
-* `encoding` {String} If the chunk is a string, then this is the
- encoding type. If chunk is a buffer, then this is the special
- value - 'buffer', ignore it in this case.
-* `callback` {Function} Call this function (optionally with an error
- argument) when you are done processing the supplied chunk.
-
-All Writable stream implementations must provide a [`_write()`][]
-method to send data to the underlying resource.
-
-Note: **This function MUST NOT be called directly.** It should be
-implemented by child classes, and called by the internal Writable
-class methods only.
-
-Call the callback using the standard `callback(error)` pattern to
-signal that the write completed successfully or with an error.
-
-If the `decodeStrings` flag is set in the constructor options, then
-`chunk` may be a string rather than a Buffer, and `encoding` will
-indicate the sort of string that it is. This is to support
-implementations that have an optimized handling for certain string
-data encodings. If you do not explicitly set the `decodeStrings`
-option to `false`, then you can safely ignore the `encoding` argument,
-and assume that `chunk` will always be a Buffer.
-
-This method is prefixed with an underscore because it is internal to
-the class that defines it, and should not be called directly by user
-programs. However, you **are** expected to override this method in
-your own extension classes.
-
-#### writable.\_writev(chunks, callback)
-
-* `chunks` {Array} The chunks to be written. Each chunk has following
- format: `{ chunk: ..., encoding: ... }`.
-* `callback` {Function} Call this function (optionally with an error
- argument) when you are done processing the supplied chunks.
-
-Note: **This function MUST NOT be called directly.** It may be
-implemented by child classes, and called by the internal Writable
-class methods only.
-
-This function is completely optional to implement. In most cases it is
-unnecessary. If implemented, it will be called with all the chunks
-that are buffered in the write queue.
-
-
-### Class: stream.Duplex
-
-<!--type=class-->
-
-A "duplex" stream is one that is both Readable and Writable, such as a
-TCP socket connection.
-
-Note that `stream.Duplex` is an abstract class designed to be extended
-with an underlying implementation of the `_read(size)` and
-[`_write(chunk, encoding, callback)`][] methods as you would with a
-Readable or Writable stream class.
-
-Since JavaScript doesn't have multiple prototypal inheritance, this
-class prototypally inherits from Readable, and then parasitically from
-Writable. It is thus up to the user to implement both the lowlevel
-`_read(n)` method as well as the lowlevel
-[`_write(chunk, encoding, callback)`][] method on extension duplex classes.
-
-#### new stream.Duplex(options)
-
-* `options` {Object} Passed to both Writable and Readable
- constructors. Also has the following fields:
- * `allowHalfOpen` {Boolean} Default=true. If set to `false`, then
- the stream will automatically end the readable side when the
- writable side ends and vice versa.
- * `readableObjectMode` {Boolean} Default=false. Sets `objectMode`
- for readable side of the stream. Has no effect if `objectMode`
- is `true`.
- * `writableObjectMode` {Boolean} Default=false. Sets `objectMode`
- for writable side of the stream. Has no effect if `objectMode`
- is `true`.
-
-In classes that extend the Duplex class, make sure to call the
-constructor so that the buffering settings can be properly
-initialized.
-
-
-### Class: stream.Transform
-
-A "transform" stream is a duplex stream where the output is causally
-connected in some way to the input, such as a [zlib][] stream or a
-[crypto][] stream.
-
-There is no requirement that the output be the same size as the input,
-the same number of chunks, or arrive at the same time. For example, a
-Hash stream will only ever have a single chunk of output which is
-provided when the input is ended. A zlib stream will produce output
-that is either much smaller or much larger than its input.
-
-Rather than implement the [`_read()`][] and [`_write()`][] methods, Transform
-classes must implement the `_transform()` method, and may optionally
-also implement the `_flush()` method. (See below.)
-
-#### new stream.Transform([options])
-
-* `options` {Object} Passed to both Writable and Readable
- constructors.
-
-In classes that extend the Transform class, make sure to call the
-constructor so that the buffering settings can be properly
-initialized.
-
-#### transform.\_transform(chunk, encoding, callback)
-
-* `chunk` {Buffer | String} The chunk to be transformed. Will **always**
- be a buffer unless the `decodeStrings` option was set to `false`.
-* `encoding` {String} If the chunk is a string, then this is the
- encoding type. If chunk is a buffer, then this is the special
- value - 'buffer', ignore it in this case.
-* `callback` {Function} Call this function (optionally with an error
- argument and data) when you are done processing the supplied chunk.
-
-Note: **This function MUST NOT be called directly.** It should be
-implemented by child classes, and called by the internal Transform
-class methods only.
-
-All Transform stream implementations must provide a `_transform`
-method to accept input and produce output.
-
-`_transform` should do whatever has to be done in this specific
-Transform class, to handle the bytes being written, and pass them off
-to the readable portion of the interface. Do asynchronous I/O,
-process things, and so on.
-
-Call `transform.push(outputChunk)` 0 or more times to generate output
-from this input chunk, depending on how much data you want to output
-as a result of this chunk.
-
-Call the callback function only when the current chunk is completely
-consumed. Note that there may or may not be output as a result of any
-particular input chunk. If you supply output as the second argument to the
-callback, it will be passed to push method, in other words the following are
-equivalent:
-
-```javascript
-transform.prototype._transform = function (data, encoding, callback) {
- this.push(data);
- callback();
-}
-
-transform.prototype._transform = function (data, encoding, callback) {
- callback(null, data);
-}
-```
-
-This method is prefixed with an underscore because it is internal to
-the class that defines it, and should not be called directly by user
-programs. However, you **are** expected to override this method in
-your own extension classes.
-
-#### transform.\_flush(callback)
-
-* `callback` {Function} Call this function (optionally with an error
- argument) when you are done flushing any remaining data.
-
-Note: **This function MUST NOT be called directly.** It MAY be implemented
-by child classes, and if so, will be called by the internal Transform
-class methods only.
-
-In some cases, your transform operation may need to emit a bit more
-data at the end of the stream. For example, a `Zlib` compression
-stream will store up some internal state so that it can optimally
-compress the output. At the end, however, it needs to do the best it
-can with what is left, so that the data will be complete.
-
-In those cases, you can implement a `_flush` method, which will be
-called at the very end, after all the written data is consumed, but
-before emitting `end` to signal the end of the readable side. Just
-like with `_transform`, call `transform.push(chunk)` zero or more
-times, as appropriate, and call `callback` when the flush operation is
-complete.
-
-This method is prefixed with an underscore because it is internal to
-the class that defines it, and should not be called directly by user
-programs. However, you **are** expected to override this method in
-your own extension classes.
-
-#### Events: 'finish' and 'end'
-
-The [`finish`][] and [`end`][] events are from the parent Writable
-and Readable classes respectively. The `finish` event is fired after
-`.end()` is called and all chunks have been processed by `_transform`,
-`end` is fired after all data has been output which is after the callback
-in `_flush` has been called.
-
-#### Example: `SimpleProtocol` parser v2
-
-The example above of a simple protocol parser can be implemented
-simply by using the higher level [Transform][] stream class, similar to
-the `parseHeader` and `SimpleProtocol v1` examples above.
-
-In this example, rather than providing the input as an argument, it
-would be piped into the parser, which is a more idiomatic io.js stream
-approach.
-
-```javascript
-var util = require('util');
-var Transform = require('stream').Transform;
-util.inherits(SimpleProtocol, Transform);
-
-function SimpleProtocol(options) {
- if (!(this instanceof SimpleProtocol))
- return new SimpleProtocol(options);
-
- Transform.call(this, options);
- this._inBody = false;
- this._sawFirstCr = false;
- this._rawHeader = [];
- this.header = null;
-}
-
-SimpleProtocol.prototype._transform = function(chunk, encoding, done) {
- if (!this._inBody) {
- // check if the chunk has a \n\n
- var split = -1;
- for (var i = 0; i < chunk.length; i++) {
- if (chunk[i] === 10) { // '\n'
- if (this._sawFirstCr) {
- split = i;
- break;
- } else {
- this._sawFirstCr = true;
- }
- } else {
- this._sawFirstCr = false;
- }
- }
-
- if (split === -1) {
- // still waiting for the \n\n
- // stash the chunk, and try again.
- this._rawHeader.push(chunk);
- } else {
- this._inBody = true;
- var h = chunk.slice(0, split);
- this._rawHeader.push(h);
- var header = Buffer.concat(this._rawHeader).toString();
- try {
- this.header = JSON.parse(header);
- } catch (er) {
- this.emit('error', new Error('invalid simple protocol data'));
- return;
- }
- // and let them know that we are done parsing the header.
- this.emit('header', this.header);
-
- // now, because we got some extra data, emit this first.
- this.push(chunk.slice(split));
- }
- } else {
- // from there on, just provide the data to our consumer as-is.
- this.push(chunk);
- }
- done();
-};
-
-// Usage:
-// var parser = new SimpleProtocol();
-// source.pipe(parser)
-// Now parser is a readable stream that will emit 'header'
-// with the parsed header data.
-```
-
-
-### Class: stream.PassThrough
-
-This is a trivial implementation of a [Transform][] stream that simply
-passes the input bytes across to the output. Its purpose is mainly
-for examples and testing, but there are occasionally use cases where
-it can come in handy as a building block for novel sorts of streams.
-
-
-## Simplified Constructor API
-
-<!--type=misc-->
-
-In simple cases there is now the added benefit of being able to construct a stream without inheritance.
-
-This can be done by passing the appropriate methods as constructor options:
-
-Examples:
-
-### Readable
-```javascript
-var readable = new stream.Readable({
- read: function(n) {
- // sets this._read under the hood
- }
-});
-```
-
-### Writable
-```javascript
-var writable = new stream.Writable({
- write: function(chunk, encoding, next) {
- // sets this._write under the hood
- }
-});
-
-// or
-
-var writable = new stream.Writable({
- writev: function(chunks, next) {
- // sets this._writev under the hood
- }
-});
-```
-
-### Duplex
-```javascript
-var duplex = new stream.Duplex({
- read: function(n) {
- // sets this._read under the hood
- },
- write: function(chunk, encoding, next) {
- // sets this._write under the hood
- }
-});
-
-// or
-
-var duplex = new stream.Duplex({
- read: function(n) {
- // sets this._read under the hood
- },
- writev: function(chunks, next) {
- // sets this._writev under the hood
- }
-});
-```
-
-### Transform
-```javascript
-var transform = new stream.Transform({
- transform: function(chunk, encoding, next) {
- // sets this._transform under the hood
- },
- flush: function(done) {
- // sets this._flush under the hood
- }
-});
-```
-
-## Streams: Under the Hood
-
-<!--type=misc-->
-
-### Buffering
-
-<!--type=misc-->
-
-Both Writable and Readable streams will buffer data on an internal
-object called `_writableState.buffer` or `_readableState.buffer`,
-respectively.
-
-The amount of data that will potentially be buffered depends on the
-`highWaterMark` option which is passed into the constructor.
-
-Buffering in Readable streams happens when the implementation calls
-[`stream.push(chunk)`][]. If the consumer of the Stream does not call
-`stream.read()`, then the data will sit in the internal queue until it
-is consumed.
-
-Buffering in Writable streams happens when the user calls
-[`stream.write(chunk)`][] repeatedly, even when `write()` returns `false`.
-
-The purpose of streams, especially with the `pipe()` method, is to
-limit the buffering of data to acceptable levels, so that sources and
-destinations of varying speed will not overwhelm the available memory.
-
-### `stream.read(0)`
-
-There are some cases where you want to trigger a refresh of the
-underlying readable stream mechanisms, without actually consuming any
-data. In that case, you can call `stream.read(0)`, which will always
-return null.
-
-If the internal read buffer is below the `highWaterMark`, and the
-stream is not currently reading, then calling `read(0)` will trigger
-a low-level `_read` call.
-
-There is almost never a need to do this. However, you will see some
-cases in io.js's internals where this is done, particularly in the
-Readable stream class internals.
-
-### `stream.push('')`
-
-Pushing a zero-byte string or Buffer (when not in [Object mode][]) has an
-interesting side effect. Because it *is* a call to
-[`stream.push()`][], it will end the `reading` process. However, it
-does *not* add any data to the readable buffer, so there's nothing for
-a user to consume.
-
-Very rarely, there are cases where you have no data to provide now,
-but the consumer of your stream (or, perhaps, another bit of your own
-code) will know when to check again, by calling `stream.read(0)`. In
-those cases, you *may* call `stream.push('')`.
-
-So far, the only use case for this functionality is in the
-[tls.CryptoStream][] class, which is deprecated in io.js v1.0. If you
-find that you have to use `stream.push('')`, please consider another
-approach, because it almost certainly indicates that something is
-horribly wrong.
-
-### Compatibility with Older Node.js Versions
-
-<!--type=misc-->
-
-In versions of Node.js prior to v0.10, the Readable stream interface was
-simpler, but also less powerful and less useful.
-
-* Rather than waiting for you to call the `read()` method, `'data'`
- events would start emitting immediately. If you needed to do some
- I/O to decide how to handle data, then you had to store the chunks
- in some kind of buffer so that they would not be lost.
-* The [`pause()`][] method was advisory, rather than guaranteed. This
- meant that you still had to be prepared to receive `'data'` events
- even when the stream was in a paused state.
-
-In io.js v1.0 and Node.js v0.10, the Readable class described below was added.
-For backwards compatibility with older Node.js programs, Readable streams
-switch into "flowing mode" when a `'data'` event handler is added, or
-when the [`resume()`][] method is called. The effect is that, even if
-you are not using the new `read()` method and `'readable'` event, you
-no longer have to worry about losing `'data'` chunks.
-
-Most programs will continue to function normally. However, this
-introduces an edge case in the following conditions:
-
-* No [`'data'` event][] handler is added.
-* The [`resume()`][] method is never called.
-* The stream is not piped to any writable destination.
-
-For example, consider the following code:
-
-```javascript
-// WARNING! BROKEN!
-net.createServer(function(socket) {
-
- // we add an 'end' method, but never consume the data
- socket.on('end', function() {
- // It will never get here.
- socket.end('I got your message (but didnt read it)\n');
- });
-
-}).listen(1337);
-```
-
-In versions of Node.js prior to v0.10, the incoming message data would be
-simply discarded. However, in io.js v1.0 and Node.js v0.10 and beyond,
-the socket will remain paused forever.
-
-The workaround in this situation is to call the `resume()` method to
-start the flow of data:
-
-```javascript
-// Workaround
-net.createServer(function(socket) {
-
- socket.on('end', function() {
- socket.end('I got your message (but didnt read it)\n');
- });
-
- // start the flow of data, discarding it.
- socket.resume();
-
-}).listen(1337);
-```
-
-In addition to new Readable streams switching into flowing mode,
-pre-v0.10 style streams can be wrapped in a Readable class using the
-`wrap()` method.
-
-
-### Object Mode
-
-<!--type=misc-->
-
-Normally, Streams operate on Strings and Buffers exclusively.
-
-Streams that are in **object mode** can emit generic JavaScript values
-other than Buffers and Strings.
-
-A Readable stream in object mode will always return a single item from
-a call to `stream.read(size)`, regardless of what the size argument
-is.
-
-A Writable stream in object mode will always ignore the `encoding`
-argument to `stream.write(data, encoding)`.
-
-The special value `null` still retains its special value for object
-mode streams. That is, for object mode readable streams, `null` as a
-return value from `stream.read()` indicates that there is no more
-data, and [`stream.push(null)`][] will signal the end of stream data
-(`EOF`).
-
-No streams in io.js core are object mode streams. This pattern is only
-used by userland streaming libraries.
-
-You should set `objectMode` in your stream child class constructor on
-the options object. Setting `objectMode` mid-stream is not safe.
-
-For Duplex streams `objectMode` can be set exclusively for readable or
-writable side with `readableObjectMode` and `writableObjectMode`
-respectively. These options can be used to implement parsers and
-serializers with Transform streams.
-
-```javascript
-var util = require('util');
-var StringDecoder = require('string_decoder').StringDecoder;
-var Transform = require('stream').Transform;
-util.inherits(JSONParseStream, Transform);
-
-// Gets \n-delimited JSON string data, and emits the parsed objects
-function JSONParseStream() {
- if (!(this instanceof JSONParseStream))
- return new JSONParseStream();
-
- Transform.call(this, { readableObjectMode : true });
-
- this._buffer = '';
- this._decoder = new StringDecoder('utf8');
-}
-
-JSONParseStream.prototype._transform = function(chunk, encoding, cb) {
- this._buffer += this._decoder.write(chunk);
- // split on newlines
- var lines = this._buffer.split(/\r?\n/);
- // keep the last partial line buffered
- this._buffer = lines.pop();
- for (var l = 0; l < lines.length; l++) {
- var line = lines[l];
- try {
- var obj = JSON.parse(line);
- } catch (er) {
- this.emit('error', er);
- return;
- }
- // push the parsed object out to the readable consumer
- this.push(obj);
- }
- cb();
-};
-
-JSONParseStream.prototype._flush = function(cb) {
- // Just handle any leftover
- var rem = this._buffer.trim();
- if (rem) {
- try {
- var obj = JSON.parse(rem);
- } catch (er) {
- this.emit('error', er);
- return;
- }
- // push the parsed object out to the readable consumer
- this.push(obj);
- }
- cb();
-};
-```
-
-
-[EventEmitter]: https://iojs.org/dist/v2.3.0/doc/api/events.html#events_class_events_eventemitter
-[Object mode]: #stream_object_mode
-[`stream.push(chunk)`]: #stream_readable_push_chunk_encoding
-[`stream.push(null)`]: #stream_readable_push_chunk_encoding
-[`stream.push()`]: #stream_readable_push_chunk_encoding
-[`unpipe()`]: #stream_readable_unpipe_destination
-[unpiped]: #stream_readable_unpipe_destination
-[tcp sockets]: https://iojs.org/dist/v2.3.0/doc/api/net.html#net_class_net_socket
-[zlib streams]: zlib.html
-[zlib]: zlib.html
-[crypto streams]: crypto.html
-[crypto]: crypto.html
-[tls.CryptoStream]: https://iojs.org/dist/v2.3.0/doc/api/tls.html#tls_class_cryptostream
-[process.stdin]: https://iojs.org/dist/v2.3.0/doc/api/process.html#process_process_stdin
-[stdout]: https://iojs.org/dist/v2.3.0/doc/api/process.html#process_process_stdout
-[process.stdout]: https://iojs.org/dist/v2.3.0/doc/api/process.html#process_process_stdout
-[process.stderr]: https://iojs.org/dist/v2.3.0/doc/api/process.html#process_process_stderr
-[child process stdout and stderr]: https://iojs.org/dist/v2.3.0/doc/api/child_process.html#child_process_child_stdout
-[API for Stream Consumers]: #stream_api_for_stream_consumers
-[API for Stream Implementors]: #stream_api_for_stream_implementors
-[Readable]: #stream_class_stream_readable
-[Writable]: #stream_class_stream_writable
-[Duplex]: #stream_class_stream_duplex
-[Transform]: #stream_class_stream_transform
-[`end`]: #stream_event_end
-[`finish`]: #stream_event_finish
-[`_read(size)`]: #stream_readable_read_size_1
-[`_read()`]: #stream_readable_read_size_1
-[_read]: #stream_readable_read_size_1
-[`writable.write(chunk)`]: #stream_writable_write_chunk_encoding_callback
-[`write(chunk, encoding, callback)`]: #stream_writable_write_chunk_encoding_callback
-[`write()`]: #stream_writable_write_chunk_encoding_callback
-[`stream.write(chunk)`]: #stream_writable_write_chunk_encoding_callback
-[`_write(chunk, encoding, callback)`]: #stream_writable_write_chunk_encoding_callback_1
-[`_write()`]: #stream_writable_write_chunk_encoding_callback_1
-[_write]: #stream_writable_write_chunk_encoding_callback_1
-[`util.inherits`]: https://iojs.org/dist/v2.3.0/doc/api/util.html#util_util_inherits_constructor_superconstructor
-[`end()`]: #stream_writable_end_chunk_encoding_callback
-[`'data'` event]: #stream_event_data
-[`resume()`]: #stream_readable_resume
-[`readable.resume()`]: #stream_readable_resume
-[`pause()`]: #stream_readable_pause
-[`unpipe()`]: #stream_readable_unpipe_destination
-[`pipe()`]: #stream_readable_pipe_destination_options
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
deleted file mode 100644
index 83275f192..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# streams WG Meeting 2015-01-30
-
-## Links
-
-* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg
-* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106
-* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/
-
-## Agenda
-
-Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting.
-
-* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105)
-* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101)
-* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102)
-* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99)
-
-## Minutes
-
-### adopt a charter
-
-* group: +1's all around
-
-### What versioning scheme should be adopted?
-* group: +1’s 3.0.0
-* domenic+group: pulling in patches from other sources where appropriate
-* mikeal: version independently, suggesting versions for io.js
-* mikeal+domenic: work with TC to notify in advance of changes
-simpler stream creation
-
-### streamline creation of streams
-* sam: streamline creation of streams
-* domenic: nice simple solution posted
- but, we lose the opportunity to change the model
- may not be backwards incompatible (double check keys)
-
- **action item:** domenic will check
-
-### remove implicit flowing of streams on(‘data’)
-* add isFlowing / isPaused
-* mikeal: worrying that we’re documenting polyfill methods – confuses users
-* domenic: more reflective API is probably good, with warning labels for users
-* new section for mad scientists (reflective stream access)
-* calvin: name the “third state”
-* mikeal: maybe borrow the name from whatwg?
-* domenic: we’re missing the “third state”
-* consensus: kind of difficult to name the third state
-* mikeal: figure out differences in states / compat
-* mathias: always flow on data – eliminates third state
- * explore what it breaks
-
-**action items:**
-* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream)
-* ask rod/build for infrastructure
-* **chris**: explore the “flow on data” approach
-* add isPaused/isFlowing
-* add new docs section
-* move isPaused to that section
-
-
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js
deleted file mode 100644
index ca807af87..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_duplex.js")
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js
deleted file mode 100644
index 69558af03..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js
+++ /dev/null
@@ -1,82 +0,0 @@
-// a duplex stream is just a stream that is both readable and writable.
-// Since JS doesn't have multiple prototypal inheritance, this class
-// prototypally inherits from Readable, and then parasitically from
-// Writable.
-
-'use strict';
-
-/*<replacement>*/
-var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) keys.push(key);
- return keys;
-}
-/*</replacement>*/
-
-
-module.exports = Duplex;
-
-/*<replacement>*/
-var processNextTick = require('process-nextick-args');
-/*</replacement>*/
-
-
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-var Readable = require('./_stream_readable');
-var Writable = require('./_stream_writable');
-
-util.inherits(Duplex, Readable);
-
-var keys = objectKeys(Writable.prototype);
-for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method])
- Duplex.prototype[method] = Writable.prototype[method];
-}
-
-function Duplex(options) {
- if (!(this instanceof Duplex))
- return new Duplex(options);
-
- Readable.call(this, options);
- Writable.call(this, options);
-
- if (options && options.readable === false)
- this.readable = false;
-
- if (options && options.writable === false)
- this.writable = false;
-
- this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false)
- this.allowHalfOpen = false;
-
- this.once('end', onend);
-}
-
-// the no-half-open enforcer
-function onend() {
- // if we allow half-open state, or if the writable side ended,
- // then we're ok.
- if (this.allowHalfOpen || this._writableState.ended)
- return;
-
- // no more data can be written.
- // But allow more writes to happen in this tick.
- processNextTick(onEndNT, this);
-}
-
-function onEndNT(self) {
- self.end();
-}
-
-function forEach (xs, f) {
- for (var i = 0, l = xs.length; i < l; i++) {
- f(xs[i], i);
- }
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js
deleted file mode 100644
index bddfdd015..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// a passthrough stream.
-// basically just the most minimal sort of Transform stream.
-// Every written chunk gets output as-is.
-
-'use strict';
-
-module.exports = PassThrough;
-
-var Transform = require('./_stream_transform');
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-util.inherits(PassThrough, Transform);
-
-function PassThrough(options) {
- if (!(this instanceof PassThrough))
- return new PassThrough(options);
-
- Transform.call(this, options);
-}
-
-PassThrough.prototype._transform = function(chunk, encoding, cb) {
- cb(null, chunk);
-};
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js
deleted file mode 100644
index eef3d825d..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js
+++ /dev/null
@@ -1,959 +0,0 @@
-'use strict';
-
-module.exports = Readable;
-
-/*<replacement>*/
-var processNextTick = require('process-nextick-args');
-/*</replacement>*/
-
-
-/*<replacement>*/
-var isArray = require('isarray');
-/*</replacement>*/
-
-
-/*<replacement>*/
-var Buffer = require('buffer').Buffer;
-/*</replacement>*/
-
-Readable.ReadableState = ReadableState;
-
-var EE = require('events').EventEmitter;
-
-/*<replacement>*/
-if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
- return emitter.listeners(type).length;
-};
-/*</replacement>*/
-
-
-
-/*<replacement>*/
-var Stream;
-(function (){try{
- Stream = require('st' + 'ream');
-}catch(_){}finally{
- if (!Stream)
- Stream = require('events').EventEmitter;
-}}())
-/*</replacement>*/
-
-var Buffer = require('buffer').Buffer;
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-
-
-/*<replacement>*/
-var debug = require('util');
-if (debug && debug.debuglog) {
- debug = debug.debuglog('stream');
-} else {
- debug = function () {};
-}
-/*</replacement>*/
-
-var StringDecoder;
-
-util.inherits(Readable, Stream);
-
-function ReadableState(options, stream) {
- var Duplex = require('./_stream_duplex');
-
- options = options || {};
-
- // object stream flag. Used to make read(n) ignore n and to
- // make all the buffer merging and length checks go away
- this.objectMode = !!options.objectMode;
-
- if (stream instanceof Duplex)
- this.objectMode = this.objectMode || !!options.readableObjectMode;
-
- // the point at which it stops calling _read() to fill the buffer
- // Note: 0 is a valid value, means "don't call _read preemptively ever"
- var hwm = options.highWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
-
- // cast to ints.
- this.highWaterMark = ~~this.highWaterMark;
-
- this.buffer = [];
- this.length = 0;
- this.pipes = null;
- this.pipesCount = 0;
- this.flowing = null;
- this.ended = false;
- this.endEmitted = false;
- this.reading = false;
-
- // a flag to be able to tell if the onwrite cb is called immediately,
- // or on a later tick. We set this to true at first, because any
- // actions that shouldn't happen until "later" should generally also
- // not happen before the first write call.
- this.sync = true;
-
- // whenever we return null, then we set a flag to say
- // that we're awaiting a 'readable' event emission.
- this.needReadable = false;
- this.emittedReadable = false;
- this.readableListening = false;
-
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
-
- // when piping, we only care about 'readable' events that happen
- // after read()ing all the bytes and not getting any pushback.
- this.ranOut = false;
-
- // the number of writers that are awaiting a drain event in .pipe()s
- this.awaitDrain = 0;
-
- // if true, a maybeReadMore has been scheduled
- this.readingMore = false;
-
- this.decoder = null;
- this.encoding = null;
- if (options.encoding) {
- if (!StringDecoder)
- StringDecoder = require('string_decoder/').StringDecoder;
- this.decoder = new StringDecoder(options.encoding);
- this.encoding = options.encoding;
- }
-}
-
-function Readable(options) {
- var Duplex = require('./_stream_duplex');
-
- if (!(this instanceof Readable))
- return new Readable(options);
-
- this._readableState = new ReadableState(options, this);
-
- // legacy
- this.readable = true;
-
- if (options && typeof options.read === 'function')
- this._read = options.read;
-
- Stream.call(this);
-}
-
-// Manually shove something into the read() buffer.
-// This returns true if the highWaterMark has not been hit yet,
-// similar to how Writable.write() returns true if you should
-// write() some more.
-Readable.prototype.push = function(chunk, encoding) {
- var state = this._readableState;
-
- if (!state.objectMode && typeof chunk === 'string') {
- encoding = encoding || state.defaultEncoding;
- if (encoding !== state.encoding) {
- chunk = new Buffer(chunk, encoding);
- encoding = '';
- }
- }
-
- return readableAddChunk(this, state, chunk, encoding, false);
-};
-
-// Unshift should *always* be something directly out of read()
-Readable.prototype.unshift = function(chunk) {
- var state = this._readableState;
- return readableAddChunk(this, state, chunk, '', true);
-};
-
-Readable.prototype.isPaused = function() {
- return this._readableState.flowing === false;
-};
-
-function readableAddChunk(stream, state, chunk, encoding, addToFront) {
- var er = chunkInvalid(state, chunk);
- if (er) {
- stream.emit('error', er);
- } else if (chunk === null) {
- state.reading = false;
- onEofChunk(stream, state);
- } else if (state.objectMode || chunk && chunk.length > 0) {
- if (state.ended && !addToFront) {
- var e = new Error('stream.push() after EOF');
- stream.emit('error', e);
- } else if (state.endEmitted && addToFront) {
- var e = new Error('stream.unshift() after end event');
- stream.emit('error', e);
- } else {
- if (state.decoder && !addToFront && !encoding)
- chunk = state.decoder.write(chunk);
-
- if (!addToFront)
- state.reading = false;
-
- // if we want the data now, just emit it.
- if (state.flowing && state.length === 0 && !state.sync) {
- stream.emit('data', chunk);
- stream.read(0);
- } else {
- // update the buffer info.
- state.length += state.objectMode ? 1 : chunk.length;
- if (addToFront)
- state.buffer.unshift(chunk);
- else
- state.buffer.push(chunk);
-
- if (state.needReadable)
- emitReadable(stream);
- }
-
- maybeReadMore(stream, state);
- }
- } else if (!addToFront) {
- state.reading = false;
- }
-
- return needMoreData(state);
-}
-
-
-
-// if it's past the high water mark, we can push in some more.
-// Also, if we have no data yet, we can stand some
-// more bytes. This is to work around cases where hwm=0,
-// such as the repl. Also, if the push() triggered a
-// readable event, and the user called read(largeNumber) such that
-// needReadable was set, then we ought to push more, so that another
-// 'readable' event will be triggered.
-function needMoreData(state) {
- return !state.ended &&
- (state.needReadable ||
- state.length < state.highWaterMark ||
- state.length === 0);
-}
-
-// backwards compatibility.
-Readable.prototype.setEncoding = function(enc) {
- if (!StringDecoder)
- StringDecoder = require('string_decoder/').StringDecoder;
- this._readableState.decoder = new StringDecoder(enc);
- this._readableState.encoding = enc;
- return this;
-};
-
-// Don't raise the hwm > 128MB
-var MAX_HWM = 0x800000;
-function roundUpToNextPowerOf2(n) {
- if (n >= MAX_HWM) {
- n = MAX_HWM;
- } else {
- // Get the next highest power of 2
- n--;
- for (var p = 1; p < 32; p <<= 1) n |= n >> p;
- n++;
- }
- return n;
-}
-
-function howMuchToRead(n, state) {
- if (state.length === 0 && state.ended)
- return 0;
-
- if (state.objectMode)
- return n === 0 ? 0 : 1;
-
- if (n === null || isNaN(n)) {
- // only flow one buffer at a time
- if (state.flowing && state.buffer.length)
- return state.buffer[0].length;
- else
- return state.length;
- }
-
- if (n <= 0)
- return 0;
-
- // If we're asking for more than the target buffer level,
- // then raise the water mark. Bump up to the next highest
- // power of 2, to prevent increasing it excessively in tiny
- // amounts.
- if (n > state.highWaterMark)
- state.highWaterMark = roundUpToNextPowerOf2(n);
-
- // don't have that much. return null, unless we've ended.
- if (n > state.length) {
- if (!state.ended) {
- state.needReadable = true;
- return 0;
- } else {
- return state.length;
- }
- }
-
- return n;
-}
-
-// you can override either this method, or the async _read(n) below.
-Readable.prototype.read = function(n) {
- debug('read', n);
- var state = this._readableState;
- var nOrig = n;
-
- if (typeof n !== 'number' || n > 0)
- state.emittedReadable = false;
-
- // if we're doing read(0) to trigger a readable event, but we
- // already have a bunch of data in the buffer, then just trigger
- // the 'readable' event and move on.
- if (n === 0 &&
- state.needReadable &&
- (state.length >= state.highWaterMark || state.ended)) {
- debug('read: emitReadable', state.length, state.ended);
- if (state.length === 0 && state.ended)
- endReadable(this);
- else
- emitReadable(this);
- return null;
- }
-
- n = howMuchToRead(n, state);
-
- // if we've ended, and we're now clear, then finish it up.
- if (n === 0 && state.ended) {
- if (state.length === 0)
- endReadable(this);
- return null;
- }
-
- // All the actual chunk generation logic needs to be
- // *below* the call to _read. The reason is that in certain
- // synthetic stream cases, such as passthrough streams, _read
- // may be a completely synchronous operation which may change
- // the state of the read buffer, providing enough data when
- // before there was *not* enough.
- //
- // So, the steps are:
- // 1. Figure out what the state of things will be after we do
- // a read from the buffer.
- //
- // 2. If that resulting state will trigger a _read, then call _read.
- // Note that this may be asynchronous, or synchronous. Yes, it is
- // deeply ugly to write APIs this way, but that still doesn't mean
- // that the Readable class should behave improperly, as streams are
- // designed to be sync/async agnostic.
- // Take note if the _read call is sync or async (ie, if the read call
- // has returned yet), so that we know whether or not it's safe to emit
- // 'readable' etc.
- //
- // 3. Actually pull the requested chunks out of the buffer and return.
-
- // if we need a readable event, then we need to do some reading.
- var doRead = state.needReadable;
- debug('need readable', doRead);
-
- // if we currently have less than the highWaterMark, then also read some
- if (state.length === 0 || state.length - n < state.highWaterMark) {
- doRead = true;
- debug('length less than watermark', doRead);
- }
-
- // however, if we've ended, then there's no point, and if we're already
- // reading, then it's unnecessary.
- if (state.ended || state.reading) {
- doRead = false;
- debug('reading or ended', doRead);
- }
-
- if (doRead) {
- debug('do read');
- state.reading = true;
- state.sync = true;
- // if the length is currently zero, then we *need* a readable event.
- if (state.length === 0)
- state.needReadable = true;
- // call internal read method
- this._read(state.highWaterMark);
- state.sync = false;
- }
-
- // If _read pushed data synchronously, then `reading` will be false,
- // and we need to re-evaluate how much data we can return to the user.
- if (doRead && !state.reading)
- n = howMuchToRead(nOrig, state);
-
- var ret;
- if (n > 0)
- ret = fromList(n, state);
- else
- ret = null;
-
- if (ret === null) {
- state.needReadable = true;
- n = 0;
- }
-
- state.length -= n;
-
- // If we have nothing in the buffer, then we want to know
- // as soon as we *do* get something into the buffer.
- if (state.length === 0 && !state.ended)
- state.needReadable = true;
-
- // If we tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended && state.length === 0)
- endReadable(this);
-
- if (ret !== null)
- this.emit('data', ret);
-
- return ret;
-};
-
-function chunkInvalid(state, chunk) {
- var er = null;
- if (!(Buffer.isBuffer(chunk)) &&
- typeof chunk !== 'string' &&
- chunk !== null &&
- chunk !== undefined &&
- !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- return er;
-}
-
-
-function onEofChunk(stream, state) {
- if (state.ended) return;
- if (state.decoder) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) {
- state.buffer.push(chunk);
- state.length += state.objectMode ? 1 : chunk.length;
- }
- }
- state.ended = true;
-
- // emit 'readable' now to make sure it gets picked up.
- emitReadable(stream);
-}
-
-// Don't emit readable right away in sync mode, because this can trigger
-// another read() call => stack overflow. This way, it might trigger
-// a nextTick recursion warning, but that's not so bad.
-function emitReadable(stream) {
- var state = stream._readableState;
- state.needReadable = false;
- if (!state.emittedReadable) {
- debug('emitReadable', state.flowing);
- state.emittedReadable = true;
- if (state.sync)
- processNextTick(emitReadable_, stream);
- else
- emitReadable_(stream);
- }
-}
-
-function emitReadable_(stream) {
- debug('emit readable');
- stream.emit('readable');
- flow(stream);
-}
-
-
-// at this point, the user has presumably seen the 'readable' event,
-// and called read() to consume some data. that may have triggered
-// in turn another _read(n) call, in which case reading = true if
-// it's in progress.
-// However, if we're not ended, or reading, and the length < hwm,
-// then go ahead and try to read some more preemptively.
-function maybeReadMore(stream, state) {
- if (!state.readingMore) {
- state.readingMore = true;
- processNextTick(maybeReadMore_, stream, state);
- }
-}
-
-function maybeReadMore_(stream, state) {
- var len = state.length;
- while (!state.reading && !state.flowing && !state.ended &&
- state.length < state.highWaterMark) {
- debug('maybeReadMore read 0');
- stream.read(0);
- if (len === state.length)
- // didn't get any data, stop spinning.
- break;
- else
- len = state.length;
- }
- state.readingMore = false;
-}
-
-// abstract method. to be overridden in specific implementation classes.
-// call cb(er, data) where data is <= n in length.
-// for virtual (non-string, non-buffer) streams, "length" is somewhat
-// arbitrary, and perhaps not very meaningful.
-Readable.prototype._read = function(n) {
- this.emit('error', new Error('not implemented'));
-};
-
-Readable.prototype.pipe = function(dest, pipeOpts) {
- var src = this;
- var state = this._readableState;
-
- switch (state.pipesCount) {
- case 0:
- state.pipes = dest;
- break;
- case 1:
- state.pipes = [state.pipes, dest];
- break;
- default:
- state.pipes.push(dest);
- break;
- }
- state.pipesCount += 1;
- debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
-
- var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
- dest !== process.stdout &&
- dest !== process.stderr;
-
- var endFn = doEnd ? onend : cleanup;
- if (state.endEmitted)
- processNextTick(endFn);
- else
- src.once('end', endFn);
-
- dest.on('unpipe', onunpipe);
- function onunpipe(readable) {
- debug('onunpipe');
- if (readable === src) {
- cleanup();
- }
- }
-
- function onend() {
- debug('onend');
- dest.end();
- }
-
- // when the dest drains, it reduces the awaitDrain counter
- // on the source. This would be more elegant with a .once()
- // handler in flow(), but adding and removing repeatedly is
- // too slow.
- var ondrain = pipeOnDrain(src);
- dest.on('drain', ondrain);
-
- function cleanup() {
- debug('cleanup');
- // cleanup event handlers once the pipe is broken
- dest.removeListener('close', onclose);
- dest.removeListener('finish', onfinish);
- dest.removeListener('drain', ondrain);
- dest.removeListener('error', onerror);
- dest.removeListener('unpipe', onunpipe);
- src.removeListener('end', onend);
- src.removeListener('end', cleanup);
- src.removeListener('data', ondata);
-
- // if the reader is waiting for a drain event from this
- // specific writer, then it would cause it to never start
- // flowing again.
- // So, if this is awaiting a drain, then we just call it now.
- // If we don't know, then assume that we are waiting for one.
- if (state.awaitDrain &&
- (!dest._writableState || dest._writableState.needDrain))
- ondrain();
- }
-
- src.on('data', ondata);
- function ondata(chunk) {
- debug('ondata');
- var ret = dest.write(chunk);
- if (false === ret) {
- debug('false write response, pause',
- src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
- src.pause();
- }
- }
-
- // if the dest has an error, then stop piping into it.
- // however, don't suppress the throwing behavior for this.
- function onerror(er) {
- debug('onerror', er);
- unpipe();
- dest.removeListener('error', onerror);
- if (EE.listenerCount(dest, 'error') === 0)
- dest.emit('error', er);
- }
- // This is a brutally ugly hack to make sure that our error handler
- // is attached before any userland ones. NEVER DO THIS.
- if (!dest._events || !dest._events.error)
- dest.on('error', onerror);
- else if (isArray(dest._events.error))
- dest._events.error.unshift(onerror);
- else
- dest._events.error = [onerror, dest._events.error];
-
-
-
- // Both close and finish should trigger unpipe, but only once.
- function onclose() {
- dest.removeListener('finish', onfinish);
- unpipe();
- }
- dest.once('close', onclose);
- function onfinish() {
- debug('onfinish');
- dest.removeListener('close', onclose);
- unpipe();
- }
- dest.once('finish', onfinish);
-
- function unpipe() {
- debug('unpipe');
- src.unpipe(dest);
- }
-
- // tell the dest that it's being piped to
- dest.emit('pipe', src);
-
- // start the flow if it hasn't been started already.
- if (!state.flowing) {
- debug('pipe resume');
- src.resume();
- }
-
- return dest;
-};
-
-function pipeOnDrain(src) {
- return function() {
- var state = src._readableState;
- debug('pipeOnDrain', state.awaitDrain);
- if (state.awaitDrain)
- state.awaitDrain--;
- if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
- state.flowing = true;
- flow(src);
- }
- };
-}
-
-
-Readable.prototype.unpipe = function(dest) {
- var state = this._readableState;
-
- // if we're not piping anywhere, then do nothing.
- if (state.pipesCount === 0)
- return this;
-
- // just one destination. most common case.
- if (state.pipesCount === 1) {
- // passed in one, but it's not the right one.
- if (dest && dest !== state.pipes)
- return this;
-
- if (!dest)
- dest = state.pipes;
-
- // got a match.
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- if (dest)
- dest.emit('unpipe', this);
- return this;
- }
-
- // slow case. multiple pipe destinations.
-
- if (!dest) {
- // remove all.
- var dests = state.pipes;
- var len = state.pipesCount;
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
-
- for (var i = 0; i < len; i++)
- dests[i].emit('unpipe', this);
- return this;
- }
-
- // try to find the right one.
- var i = indexOf(state.pipes, dest);
- if (i === -1)
- return this;
-
- state.pipes.splice(i, 1);
- state.pipesCount -= 1;
- if (state.pipesCount === 1)
- state.pipes = state.pipes[0];
-
- dest.emit('unpipe', this);
-
- return this;
-};
-
-// set up data events if they are asked for
-// Ensure readable listeners eventually get something
-Readable.prototype.on = function(ev, fn) {
- var res = Stream.prototype.on.call(this, ev, fn);
-
- // If listening to data, and it has not explicitly been paused,
- // then call resume to start the flow of data on the next tick.
- if (ev === 'data' && false !== this._readableState.flowing) {
- this.resume();
- }
-
- if (ev === 'readable' && this.readable) {
- var state = this._readableState;
- if (!state.readableListening) {
- state.readableListening = true;
- state.emittedReadable = false;
- state.needReadable = true;
- if (!state.reading) {
- processNextTick(nReadingNextTick, this);
- } else if (state.length) {
- emitReadable(this, state);
- }
- }
- }
-
- return res;
-};
-Readable.prototype.addListener = Readable.prototype.on;
-
-function nReadingNextTick(self) {
- debug('readable nexttick read 0');
- self.read(0);
-}
-
-// pause() and resume() are remnants of the legacy readable stream API
-// If the user uses them, then switch into old mode.
-Readable.prototype.resume = function() {
- var state = this._readableState;
- if (!state.flowing) {
- debug('resume');
- state.flowing = true;
- resume(this, state);
- }
- return this;
-};
-
-function resume(stream, state) {
- if (!state.resumeScheduled) {
- state.resumeScheduled = true;
- processNextTick(resume_, stream, state);
- }
-}
-
-function resume_(stream, state) {
- if (!state.reading) {
- debug('resume read 0');
- stream.read(0);
- }
-
- state.resumeScheduled = false;
- stream.emit('resume');
- flow(stream);
- if (state.flowing && !state.reading)
- stream.read(0);
-}
-
-Readable.prototype.pause = function() {
- debug('call pause flowing=%j', this._readableState.flowing);
- if (false !== this._readableState.flowing) {
- debug('pause');
- this._readableState.flowing = false;
- this.emit('pause');
- }
- return this;
-};
-
-function flow(stream) {
- var state = stream._readableState;
- debug('flow', state.flowing);
- if (state.flowing) {
- do {
- var chunk = stream.read();
- } while (null !== chunk && state.flowing);
- }
-}
-
-// wrap an old-style stream as the async data source.
-// This is *not* part of the readable stream interface.
-// It is an ugly unfortunate mess of history.
-Readable.prototype.wrap = function(stream) {
- var state = this._readableState;
- var paused = false;
-
- var self = this;
- stream.on('end', function() {
- debug('wrapped end');
- if (state.decoder && !state.ended) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length)
- self.push(chunk);
- }
-
- self.push(null);
- });
-
- stream.on('data', function(chunk) {
- debug('wrapped data');
- if (state.decoder)
- chunk = state.decoder.write(chunk);
-
- // don't skip over falsy values in objectMode
- if (state.objectMode && (chunk === null || chunk === undefined))
- return;
- else if (!state.objectMode && (!chunk || !chunk.length))
- return;
-
- var ret = self.push(chunk);
- if (!ret) {
- paused = true;
- stream.pause();
- }
- });
-
- // proxy all the other methods.
- // important when wrapping filters and duplexes.
- for (var i in stream) {
- if (this[i] === undefined && typeof stream[i] === 'function') {
- this[i] = function(method) { return function() {
- return stream[method].apply(stream, arguments);
- }; }(i);
- }
- }
-
- // proxy certain important events.
- var events = ['error', 'close', 'destroy', 'pause', 'resume'];
- forEach(events, function(ev) {
- stream.on(ev, self.emit.bind(self, ev));
- });
-
- // when we try to consume some more bytes, simply unpause the
- // underlying stream.
- self._read = function(n) {
- debug('wrapped _read', n);
- if (paused) {
- paused = false;
- stream.resume();
- }
- };
-
- return self;
-};
-
-
-
-// exposed for testing purposes only.
-Readable._fromList = fromList;
-
-// Pluck off n bytes from an array of buffers.
-// Length is the combined lengths of all the buffers in the list.
-function fromList(n, state) {
- var list = state.buffer;
- var length = state.length;
- var stringMode = !!state.decoder;
- var objectMode = !!state.objectMode;
- var ret;
-
- // nothing in the list, definitely empty.
- if (list.length === 0)
- return null;
-
- if (length === 0)
- ret = null;
- else if (objectMode)
- ret = list.shift();
- else if (!n || n >= length) {
- // read it all, truncate the array.
- if (stringMode)
- ret = list.join('');
- else
- ret = Buffer.concat(list, length);
- list.length = 0;
- } else {
- // read just some of it.
- if (n < list[0].length) {
- // just take a part of the first list item.
- // slice is the same for buffers and strings.
- var buf = list[0];
- ret = buf.slice(0, n);
- list[0] = buf.slice(n);
- } else if (n === list[0].length) {
- // first list is a perfect match
- ret = list.shift();
- } else {
- // complex case.
- // we have enough to cover it, but it spans past the first buffer.
- if (stringMode)
- ret = '';
- else
- ret = new Buffer(n);
-
- var c = 0;
- for (var i = 0, l = list.length; i < l && c < n; i++) {
- var buf = list[0];
- var cpy = Math.min(n - c, buf.length);
-
- if (stringMode)
- ret += buf.slice(0, cpy);
- else
- buf.copy(ret, c, 0, cpy);
-
- if (cpy < buf.length)
- list[0] = buf.slice(cpy);
- else
- list.shift();
-
- c += cpy;
- }
- }
- }
-
- return ret;
-}
-
-function endReadable(stream) {
- var state = stream._readableState;
-
- // If we get here before consuming all the bytes, then that is a
- // bug in node. Should never happen.
- if (state.length > 0)
- throw new Error('endReadable called on non-empty stream');
-
- if (!state.endEmitted) {
- state.ended = true;
- processNextTick(endReadableNT, state, stream);
- }
-}
-
-function endReadableNT(state, stream) {
- // Check that we didn't get one last unshift.
- if (!state.endEmitted && state.length === 0) {
- state.endEmitted = true;
- stream.readable = false;
- stream.emit('end');
- }
-}
-
-function forEach (xs, f) {
- for (var i = 0, l = xs.length; i < l; i++) {
- f(xs[i], i);
- }
-}
-
-function indexOf (xs, x) {
- for (var i = 0, l = xs.length; i < l; i++) {
- if (xs[i] === x) return i;
- }
- return -1;
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js
deleted file mode 100644
index 3675d18d9..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js
+++ /dev/null
@@ -1,197 +0,0 @@
-// a transform stream is a readable/writable stream where you do
-// something with the data. Sometimes it's called a "filter",
-// but that's not a great name for it, since that implies a thing where
-// some bits pass through, and others are simply ignored. (That would
-// be a valid example of a transform, of course.)
-//
-// While the output is causally related to the input, it's not a
-// necessarily symmetric or synchronous transformation. For example,
-// a zlib stream might take multiple plain-text writes(), and then
-// emit a single compressed chunk some time in the future.
-//
-// Here's how this works:
-//
-// The Transform stream has all the aspects of the readable and writable
-// stream classes. When you write(chunk), that calls _write(chunk,cb)
-// internally, and returns false if there's a lot of pending writes
-// buffered up. When you call read(), that calls _read(n) until
-// there's enough pending readable data buffered up.
-//
-// In a transform stream, the written data is placed in a buffer. When
-// _read(n) is called, it transforms the queued up data, calling the
-// buffered _write cb's as it consumes chunks. If consuming a single
-// written chunk would result in multiple output chunks, then the first
-// outputted bit calls the readcb, and subsequent chunks just go into
-// the read buffer, and will cause it to emit 'readable' if necessary.
-//
-// This way, back-pressure is actually determined by the reading side,
-// since _read has to be called to start processing a new chunk. However,
-// a pathological inflate type of transform can cause excessive buffering
-// here. For example, imagine a stream where every byte of input is
-// interpreted as an integer from 0-255, and then results in that many
-// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
-// 1kb of data being output. In this case, you could write a very small
-// amount of input, and end up with a very large amount of output. In
-// such a pathological inflating mechanism, there'd be no way to tell
-// the system to stop doing the transform. A single 4MB write could
-// cause the system to run out of memory.
-//
-// However, even in such a pathological case, only a single written chunk
-// would be consumed, and then the rest would wait (un-transformed) until
-// the results of the previous transformed chunk were consumed.
-
-'use strict';
-
-module.exports = Transform;
-
-var Duplex = require('./_stream_duplex');
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-util.inherits(Transform, Duplex);
-
-
-function TransformState(stream) {
- this.afterTransform = function(er, data) {
- return afterTransform(stream, er, data);
- };
-
- this.needTransform = false;
- this.transforming = false;
- this.writecb = null;
- this.writechunk = null;
-}
-
-function afterTransform(stream, er, data) {
- var ts = stream._transformState;
- ts.transforming = false;
-
- var cb = ts.writecb;
-
- if (!cb)
- return stream.emit('error', new Error('no writecb in Transform class'));
-
- ts.writechunk = null;
- ts.writecb = null;
-
- if (data !== null && data !== undefined)
- stream.push(data);
-
- if (cb)
- cb(er);
-
- var rs = stream._readableState;
- rs.reading = false;
- if (rs.needReadable || rs.length < rs.highWaterMark) {
- stream._read(rs.highWaterMark);
- }
-}
-
-
-function Transform(options) {
- if (!(this instanceof Transform))
- return new Transform(options);
-
- Duplex.call(this, options);
-
- this._transformState = new TransformState(this);
-
- // when the writable side finishes, then flush out anything remaining.
- var stream = this;
-
- // start out asking for a readable event once data is transformed.
- this._readableState.needReadable = true;
-
- // we have implemented the _read method, and done the other things
- // that Readable wants before the first _read call, so unset the
- // sync guard flag.
- this._readableState.sync = false;
-
- if (options) {
- if (typeof options.transform === 'function')
- this._transform = options.transform;
-
- if (typeof options.flush === 'function')
- this._flush = options.flush;
- }
-
- this.once('prefinish', function() {
- if (typeof this._flush === 'function')
- this._flush(function(er) {
- done(stream, er);
- });
- else
- done(stream);
- });
-}
-
-Transform.prototype.push = function(chunk, encoding) {
- this._transformState.needTransform = false;
- return Duplex.prototype.push.call(this, chunk, encoding);
-};
-
-// This is the part where you do stuff!
-// override this function in implementation classes.
-// 'chunk' is an input chunk.
-//
-// Call `push(newChunk)` to pass along transformed output
-// to the readable side. You may call 'push' zero or more times.
-//
-// Call `cb(err)` when you are done with this chunk. If you pass
-// an error, then that'll put the hurt on the whole operation. If you
-// never call cb(), then you'll never get another chunk.
-Transform.prototype._transform = function(chunk, encoding, cb) {
- throw new Error('not implemented');
-};
-
-Transform.prototype._write = function(chunk, encoding, cb) {
- var ts = this._transformState;
- ts.writecb = cb;
- ts.writechunk = chunk;
- ts.writeencoding = encoding;
- if (!ts.transforming) {
- var rs = this._readableState;
- if (ts.needTransform ||
- rs.needReadable ||
- rs.length < rs.highWaterMark)
- this._read(rs.highWaterMark);
- }
-};
-
-// Doesn't matter what the args are here.
-// _transform does all the work.
-// That we got here means that the readable side wants more data.
-Transform.prototype._read = function(n) {
- var ts = this._transformState;
-
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
- ts.transforming = true;
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
- } else {
- // mark that we need a transform, so that any data that comes in
- // will get processed, now that we've asked for it.
- ts.needTransform = true;
- }
-};
-
-
-function done(stream, er) {
- if (er)
- return stream.emit('error', er);
-
- // if there's nothing in the write buffer, then that means
- // that nothing more will ever be provided
- var ws = stream._writableState;
- var ts = stream._transformState;
-
- if (ws.length)
- throw new Error('calling transform done when ws.length != 0');
-
- if (ts.transforming)
- throw new Error('calling transform done when still transforming');
-
- return stream.push(null);
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js
deleted file mode 100644
index b23295201..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js
+++ /dev/null
@@ -1,520 +0,0 @@
-// A bit simpler than readable streams.
-// Implement an async ._write(chunk, cb), and it'll handle all
-// the drain event emission and buffering.
-
-'use strict';
-
-module.exports = Writable;
-
-/*<replacement>*/
-var processNextTick = require('process-nextick-args');
-/*</replacement>*/
-
-
-/*<replacement>*/
-var Buffer = require('buffer').Buffer;
-/*</replacement>*/
-
-Writable.WritableState = WritableState;
-
-
-/*<replacement>*/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/*</replacement>*/
-
-
-
-/*<replacement>*/
-var Stream;
-(function (){try{
- Stream = require('st' + 'ream');
-}catch(_){}finally{
- if (!Stream)
- Stream = require('events').EventEmitter;
-}}())
-/*</replacement>*/
-
-var Buffer = require('buffer').Buffer;
-
-util.inherits(Writable, Stream);
-
-function nop() {}
-
-function WriteReq(chunk, encoding, cb) {
- this.chunk = chunk;
- this.encoding = encoding;
- this.callback = cb;
- this.next = null;
-}
-
-function WritableState(options, stream) {
- var Duplex = require('./_stream_duplex');
-
- options = options || {};
-
- // object stream flag to indicate whether or not this stream
- // contains buffers or objects.
- this.objectMode = !!options.objectMode;
-
- if (stream instanceof Duplex)
- this.objectMode = this.objectMode || !!options.writableObjectMode;
-
- // the point at which write() starts returning false
- // Note: 0 is a valid value, means that we always return false if
- // the entire buffer is not flushed immediately on write()
- var hwm = options.highWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
-
- // cast to ints.
- this.highWaterMark = ~~this.highWaterMark;
-
- this.needDrain = false;
- // at the start of calling end()
- this.ending = false;
- // when end() has been called, and returned
- this.ended = false;
- // when 'finish' is emitted
- this.finished = false;
-
- // should we decode strings into buffers before passing to _write?
- // this is here so that some node-core streams can optimize string
- // handling at a lower level.
- var noDecode = options.decodeStrings === false;
- this.decodeStrings = !noDecode;
-
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
-
- // not an actual buffer we keep track of, but a measurement
- // of how much we're waiting to get pushed to some underlying
- // socket or file.
- this.length = 0;
-
- // a flag to see when we're in the middle of a write.
- this.writing = false;
-
- // when true all writes will be buffered until .uncork() call
- this.corked = 0;
-
- // a flag to be able to tell if the onwrite cb is called immediately,
- // or on a later tick. We set this to true at first, because any
- // actions that shouldn't happen until "later" should generally also
- // not happen before the first write call.
- this.sync = true;
-
- // a flag to know if we're processing previously buffered items, which
- // may call the _write() callback in the same tick, so that we don't
- // end up in an overlapped onwrite situation.
- this.bufferProcessing = false;
-
- // the callback that's passed to _write(chunk,cb)
- this.onwrite = function(er) {
- onwrite(stream, er);
- };
-
- // the callback that the user supplies to write(chunk,encoding,cb)
- this.writecb = null;
-
- // the amount that is being written when _write is called.
- this.writelen = 0;
-
- this.bufferedRequest = null;
- this.lastBufferedRequest = null;
-
- // number of pending user-supplied write callbacks
- // this must be 0 before 'finish' can be emitted
- this.pendingcb = 0;
-
- // emit prefinish if the only thing we're waiting for is _write cbs
- // This is relevant for synchronous Transform streams
- this.prefinished = false;
-
- // True if the error was already emitted and should not be thrown again
- this.errorEmitted = false;
-}
-
-WritableState.prototype.getBuffer = function writableStateGetBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
- }
- return out;
-};
-
-(function (){try {
-Object.defineProperty(WritableState.prototype, 'buffer', {
- get: require('util-deprecate')(function() {
- return this.getBuffer();
- }, '_writableState.buffer is deprecated. Use ' +
- '_writableState.getBuffer() instead.')
-});
-}catch(_){}}());
-
-
-function Writable(options) {
- var Duplex = require('./_stream_duplex');
-
- // Writable ctor is applied to Duplexes, though they're not
- // instanceof Writable, they're instanceof Readable.
- if (!(this instanceof Writable) && !(this instanceof Duplex))
- return new Writable(options);
-
- this._writableState = new WritableState(options, this);
-
- // legacy.
- this.writable = true;
-
- if (options) {
- if (typeof options.write === 'function')
- this._write = options.write;
-
- if (typeof options.writev === 'function')
- this._writev = options.writev;
- }
-
- Stream.call(this);
-}
-
-// Otherwise people can pipe Writable streams, which is just wrong.
-Writable.prototype.pipe = function() {
- this.emit('error', new Error('Cannot pipe. Not readable.'));
-};
-
-
-function writeAfterEnd(stream, cb) {
- var er = new Error('write after end');
- // TODO: defer error events consistently everywhere, not just the cb
- stream.emit('error', er);
- processNextTick(cb, er);
-}
-
-// If we get something that is not a buffer, string, null, or undefined,
-// and we're not in objectMode, then that's an error.
-// Otherwise stream chunks are all considered to be of length=1, and the
-// watermarks determine how many objects to keep in the buffer, rather than
-// how many bytes or characters.
-function validChunk(stream, state, chunk, cb) {
- var valid = true;
-
- if (!(Buffer.isBuffer(chunk)) &&
- typeof chunk !== 'string' &&
- chunk !== null &&
- chunk !== undefined &&
- !state.objectMode) {
- var er = new TypeError('Invalid non-string/buffer chunk');
- stream.emit('error', er);
- processNextTick(cb, er);
- valid = false;
- }
- return valid;
-}
-
-Writable.prototype.write = function(chunk, encoding, cb) {
- var state = this._writableState;
- var ret = false;
-
- if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (Buffer.isBuffer(chunk))
- encoding = 'buffer';
- else if (!encoding)
- encoding = state.defaultEncoding;
-
- if (typeof cb !== 'function')
- cb = nop;
-
- if (state.ended)
- writeAfterEnd(this, cb);
- else if (validChunk(this, state, chunk, cb)) {
- state.pendingcb++;
- ret = writeOrBuffer(this, state, chunk, encoding, cb);
- }
-
- return ret;
-};
-
-Writable.prototype.cork = function() {
- var state = this._writableState;
-
- state.corked++;
-};
-
-Writable.prototype.uncork = function() {
- var state = this._writableState;
-
- if (state.corked) {
- state.corked--;
-
- if (!state.writing &&
- !state.corked &&
- !state.finished &&
- !state.bufferProcessing &&
- state.bufferedRequest)
- clearBuffer(this, state);
- }
-};
-
-Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- // node::ParseEncoding() requires lower case.
- if (typeof encoding === 'string')
- encoding = encoding.toLowerCase();
- if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',
-'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']
-.indexOf((encoding + '').toLowerCase()) > -1))
- throw new TypeError('Unknown encoding: ' + encoding);
- this._writableState.defaultEncoding = encoding;
-};
-
-function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode &&
- state.decodeStrings !== false &&
- typeof chunk === 'string') {
- chunk = new Buffer(chunk, encoding);
- }
- return chunk;
-}
-
-// if we're already writing something, then just put this
-// in the queue, and wait our turn. Otherwise, call _write
-// If we return false, then we need a drain event, so set that flag.
-function writeOrBuffer(stream, state, chunk, encoding, cb) {
- chunk = decodeChunk(state, chunk, encoding);
-
- if (Buffer.isBuffer(chunk))
- encoding = 'buffer';
- var len = state.objectMode ? 1 : chunk.length;
-
- state.length += len;
-
- var ret = state.length < state.highWaterMark;
- // we must ensure that previous needDrain will not be reset to false.
- if (!ret)
- state.needDrain = true;
-
- if (state.writing || state.corked) {
- var last = state.lastBufferedRequest;
- state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
- if (last) {
- last.next = state.lastBufferedRequest;
- } else {
- state.bufferedRequest = state.lastBufferedRequest;
- }
- } else {
- doWrite(stream, state, false, len, chunk, encoding, cb);
- }
-
- return ret;
-}
-
-function doWrite(stream, state, writev, len, chunk, encoding, cb) {
- state.writelen = len;
- state.writecb = cb;
- state.writing = true;
- state.sync = true;
- if (writev)
- stream._writev(chunk, state.onwrite);
- else
- stream._write(chunk, encoding, state.onwrite);
- state.sync = false;
-}
-
-function onwriteError(stream, state, sync, er, cb) {
- --state.pendingcb;
- if (sync)
- processNextTick(cb, er);
- else
- cb(er);
-
- stream._writableState.errorEmitted = true;
- stream.emit('error', er);
-}
-
-function onwriteStateUpdate(state) {
- state.writing = false;
- state.writecb = null;
- state.length -= state.writelen;
- state.writelen = 0;
-}
-
-function onwrite(stream, er) {
- var state = stream._writableState;
- var sync = state.sync;
- var cb = state.writecb;
-
- onwriteStateUpdate(state);
-
- if (er)
- onwriteError(stream, state, sync, er, cb);
- else {
- // Check if we're actually ready to finish, but don't emit yet
- var finished = needFinish(state);
-
- if (!finished &&
- !state.corked &&
- !state.bufferProcessing &&
- state.bufferedRequest) {
- clearBuffer(stream, state);
- }
-
- if (sync) {
- processNextTick(afterWrite, stream, state, finished, cb);
- } else {
- afterWrite(stream, state, finished, cb);
- }
- }
-}
-
-function afterWrite(stream, state, finished, cb) {
- if (!finished)
- onwriteDrain(stream, state);
- state.pendingcb--;
- cb();
- finishMaybe(stream, state);
-}
-
-// Must force callback to be called on nextTick, so that we don't
-// emit 'drain' before the write() consumer gets the 'false' return
-// value, and has a chance to attach a 'drain' listener.
-function onwriteDrain(stream, state) {
- if (state.length === 0 && state.needDrain) {
- state.needDrain = false;
- stream.emit('drain');
- }
-}
-
-
-// if there's something in the buffer waiting, then process it
-function clearBuffer(stream, state) {
- state.bufferProcessing = true;
- var entry = state.bufferedRequest;
-
- if (stream._writev && entry && entry.next) {
- // Fast case, write everything using _writev()
- var buffer = [];
- var cbs = [];
- while (entry) {
- cbs.push(entry.callback);
- buffer.push(entry);
- entry = entry.next;
- }
-
- // count the one we are adding, as well.
- // TODO(isaacs) clean this up
- state.pendingcb++;
- state.lastBufferedRequest = null;
- doWrite(stream, state, true, state.length, buffer, '', function(err) {
- for (var i = 0; i < cbs.length; i++) {
- state.pendingcb--;
- cbs[i](err);
- }
- });
-
- // Clear buffer
- } else {
- // Slow case, write chunks one-by-one
- while (entry) {
- var chunk = entry.chunk;
- var encoding = entry.encoding;
- var cb = entry.callback;
- var len = state.objectMode ? 1 : chunk.length;
-
- doWrite(stream, state, false, len, chunk, encoding, cb);
- entry = entry.next;
- // if we didn't call the onwrite immediately, then
- // it means that we need to wait until it does.
- // also, that means that the chunk and cb are currently
- // being processed, so move the buffer counter past them.
- if (state.writing) {
- break;
- }
- }
-
- if (entry === null)
- state.lastBufferedRequest = null;
- }
- state.bufferedRequest = entry;
- state.bufferProcessing = false;
-}
-
-Writable.prototype._write = function(chunk, encoding, cb) {
- cb(new Error('not implemented'));
-};
-
-Writable.prototype._writev = null;
-
-Writable.prototype.end = function(chunk, encoding, cb) {
- var state = this._writableState;
-
- if (typeof chunk === 'function') {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (chunk !== null && chunk !== undefined)
- this.write(chunk, encoding);
-
- // .end() fully uncorks
- if (state.corked) {
- state.corked = 1;
- this.uncork();
- }
-
- // ignore unnecessary end() calls.
- if (!state.ending && !state.finished)
- endWritable(this, state, cb);
-};
-
-
-function needFinish(state) {
- return (state.ending &&
- state.length === 0 &&
- state.bufferedRequest === null &&
- !state.finished &&
- !state.writing);
-}
-
-function prefinish(stream, state) {
- if (!state.prefinished) {
- state.prefinished = true;
- stream.emit('prefinish');
- }
-}
-
-function finishMaybe(stream, state) {
- var need = needFinish(state);
- if (need) {
- if (state.pendingcb === 0) {
- prefinish(stream, state);
- state.finished = true;
- stream.emit('finish');
- } else {
- prefinish(stream, state);
- }
- }
- return need;
-}
-
-function endWritable(stream, state, cb) {
- state.ending = true;
- finishMaybe(stream, state);
- if (cb) {
- if (state.finished)
- processNextTick(cb);
- else
- stream.once('finish', cb);
- }
- state.ended = true;
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md
deleted file mode 100644
index 5a76b4149..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# core-util-is
-
-The `util.is*` functions introduced in Node v0.12.
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch
deleted file mode 100644
index a06d5c05f..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch
+++ /dev/null
@@ -1,604 +0,0 @@
-diff --git a/lib/util.js b/lib/util.js
-index a03e874..9074e8e 100644
---- a/lib/util.js
-+++ b/lib/util.js
-@@ -19,430 +19,6 @@
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
-
--var formatRegExp = /%[sdj%]/g;
--exports.format = function(f) {
-- if (!isString(f)) {
-- var objects = [];
-- for (var i = 0; i < arguments.length; i++) {
-- objects.push(inspect(arguments[i]));
-- }
-- return objects.join(' ');
-- }
--
-- var i = 1;
-- var args = arguments;
-- var len = args.length;
-- var str = String(f).replace(formatRegExp, function(x) {
-- if (x === '%%') return '%';
-- if (i >= len) return x;
-- switch (x) {
-- case '%s': return String(args[i++]);
-- case '%d': return Number(args[i++]);
-- case '%j':
-- try {
-- return JSON.stringify(args[i++]);
-- } catch (_) {
-- return '[Circular]';
-- }
-- default:
-- return x;
-- }
-- });
-- for (var x = args[i]; i < len; x = args[++i]) {
-- if (isNull(x) || !isObject(x)) {
-- str += ' ' + x;
-- } else {
-- str += ' ' + inspect(x);
-- }
-- }
-- return str;
--};
--
--
--// Mark that a method should not be used.
--// Returns a modified function which warns once by default.
--// If --no-deprecation is set, then it is a no-op.
--exports.deprecate = function(fn, msg) {
-- // Allow for deprecating things in the process of starting up.
-- if (isUndefined(global.process)) {
-- return function() {
-- return exports.deprecate(fn, msg).apply(this, arguments);
-- };
-- }
--
-- if (process.noDeprecation === true) {
-- return fn;
-- }
--
-- var warned = false;
-- function deprecated() {
-- if (!warned) {
-- if (process.throwDeprecation) {
-- throw new Error(msg);
-- } else if (process.traceDeprecation) {
-- console.trace(msg);
-- } else {
-- console.error(msg);
-- }
-- warned = true;
-- }
-- return fn.apply(this, arguments);
-- }
--
-- return deprecated;
--};
--
--
--var debugs = {};
--var debugEnviron;
--exports.debuglog = function(set) {
-- if (isUndefined(debugEnviron))
-- debugEnviron = process.env.NODE_DEBUG || '';
-- set = set.toUpperCase();
-- if (!debugs[set]) {
-- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
-- var pid = process.pid;
-- debugs[set] = function() {
-- var msg = exports.format.apply(exports, arguments);
-- console.error('%s %d: %s', set, pid, msg);
-- };
-- } else {
-- debugs[set] = function() {};
-- }
-- }
-- return debugs[set];
--};
--
--
--/**
-- * Echos the value of a value. Trys to print the value out
-- * in the best way possible given the different types.
-- *
-- * @param {Object} obj The object to print out.
-- * @param {Object} opts Optional options object that alters the output.
-- */
--/* legacy: obj, showHidden, depth, colors*/
--function inspect(obj, opts) {
-- // default options
-- var ctx = {
-- seen: [],
-- stylize: stylizeNoColor
-- };
-- // legacy...
-- if (arguments.length >= 3) ctx.depth = arguments[2];
-- if (arguments.length >= 4) ctx.colors = arguments[3];
-- if (isBoolean(opts)) {
-- // legacy...
-- ctx.showHidden = opts;
-- } else if (opts) {
-- // got an "options" object
-- exports._extend(ctx, opts);
-- }
-- // set default options
-- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
-- if (isUndefined(ctx.depth)) ctx.depth = 2;
-- if (isUndefined(ctx.colors)) ctx.colors = false;
-- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
-- if (ctx.colors) ctx.stylize = stylizeWithColor;
-- return formatValue(ctx, obj, ctx.depth);
--}
--exports.inspect = inspect;
--
--
--// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
--inspect.colors = {
-- 'bold' : [1, 22],
-- 'italic' : [3, 23],
-- 'underline' : [4, 24],
-- 'inverse' : [7, 27],
-- 'white' : [37, 39],
-- 'grey' : [90, 39],
-- 'black' : [30, 39],
-- 'blue' : [34, 39],
-- 'cyan' : [36, 39],
-- 'green' : [32, 39],
-- 'magenta' : [35, 39],
-- 'red' : [31, 39],
-- 'yellow' : [33, 39]
--};
--
--// Don't use 'blue' not visible on cmd.exe
--inspect.styles = {
-- 'special': 'cyan',
-- 'number': 'yellow',
-- 'boolean': 'yellow',
-- 'undefined': 'grey',
-- 'null': 'bold',
-- 'string': 'green',
-- 'date': 'magenta',
-- // "name": intentionally not styling
-- 'regexp': 'red'
--};
--
--
--function stylizeWithColor(str, styleType) {
-- var style = inspect.styles[styleType];
--
-- if (style) {
-- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
-- '\u001b[' + inspect.colors[style][1] + 'm';
-- } else {
-- return str;
-- }
--}
--
--
--function stylizeNoColor(str, styleType) {
-- return str;
--}
--
--
--function arrayToHash(array) {
-- var hash = {};
--
-- array.forEach(function(val, idx) {
-- hash[val] = true;
-- });
--
-- return hash;
--}
--
--
--function formatValue(ctx, value, recurseTimes) {
-- // Provide a hook for user-specified inspect functions.
-- // Check that value is an object with an inspect function on it
-- if (ctx.customInspect &&
-- value &&
-- isFunction(value.inspect) &&
-- // Filter out the util module, it's inspect function is special
-- value.inspect !== exports.inspect &&
-- // Also filter out any prototype objects using the circular check.
-- !(value.constructor && value.constructor.prototype === value)) {
-- var ret = value.inspect(recurseTimes, ctx);
-- if (!isString(ret)) {
-- ret = formatValue(ctx, ret, recurseTimes);
-- }
-- return ret;
-- }
--
-- // Primitive types cannot have properties
-- var primitive = formatPrimitive(ctx, value);
-- if (primitive) {
-- return primitive;
-- }
--
-- // Look up the keys of the object.
-- var keys = Object.keys(value);
-- var visibleKeys = arrayToHash(keys);
--
-- if (ctx.showHidden) {
-- keys = Object.getOwnPropertyNames(value);
-- }
--
-- // Some type of object without properties can be shortcutted.
-- if (keys.length === 0) {
-- if (isFunction(value)) {
-- var name = value.name ? ': ' + value.name : '';
-- return ctx.stylize('[Function' + name + ']', 'special');
-- }
-- if (isRegExp(value)) {
-- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
-- }
-- if (isDate(value)) {
-- return ctx.stylize(Date.prototype.toString.call(value), 'date');
-- }
-- if (isError(value)) {
-- return formatError(value);
-- }
-- }
--
-- var base = '', array = false, braces = ['{', '}'];
--
-- // Make Array say that they are Array
-- if (isArray(value)) {
-- array = true;
-- braces = ['[', ']'];
-- }
--
-- // Make functions say that they are functions
-- if (isFunction(value)) {
-- var n = value.name ? ': ' + value.name : '';
-- base = ' [Function' + n + ']';
-- }
--
-- // Make RegExps say that they are RegExps
-- if (isRegExp(value)) {
-- base = ' ' + RegExp.prototype.toString.call(value);
-- }
--
-- // Make dates with properties first say the date
-- if (isDate(value)) {
-- base = ' ' + Date.prototype.toUTCString.call(value);
-- }
--
-- // Make error with message first say the error
-- if (isError(value)) {
-- base = ' ' + formatError(value);
-- }
--
-- if (keys.length === 0 && (!array || value.length == 0)) {
-- return braces[0] + base + braces[1];
-- }
--
-- if (recurseTimes < 0) {
-- if (isRegExp(value)) {
-- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
-- } else {
-- return ctx.stylize('[Object]', 'special');
-- }
-- }
--
-- ctx.seen.push(value);
--
-- var output;
-- if (array) {
-- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
-- } else {
-- output = keys.map(function(key) {
-- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
-- });
-- }
--
-- ctx.seen.pop();
--
-- return reduceToSingleString(output, base, braces);
--}
--
--
--function formatPrimitive(ctx, value) {
-- if (isUndefined(value))
-- return ctx.stylize('undefined', 'undefined');
-- if (isString(value)) {
-- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
-- .replace(/'/g, "\\'")
-- .replace(/\\"/g, '"') + '\'';
-- return ctx.stylize(simple, 'string');
-- }
-- if (isNumber(value)) {
-- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
-- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
-- if (value === 0 && 1 / value < 0)
-- return ctx.stylize('-0', 'number');
-- return ctx.stylize('' + value, 'number');
-- }
-- if (isBoolean(value))
-- return ctx.stylize('' + value, 'boolean');
-- // For some reason typeof null is "object", so special case here.
-- if (isNull(value))
-- return ctx.stylize('null', 'null');
--}
--
--
--function formatError(value) {
-- return '[' + Error.prototype.toString.call(value) + ']';
--}
--
--
--function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
-- var output = [];
-- for (var i = 0, l = value.length; i < l; ++i) {
-- if (hasOwnProperty(value, String(i))) {
-- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
-- String(i), true));
-- } else {
-- output.push('');
-- }
-- }
-- keys.forEach(function(key) {
-- if (!key.match(/^\d+$/)) {
-- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
-- key, true));
-- }
-- });
-- return output;
--}
--
--
--function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
-- var name, str, desc;
-- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
-- if (desc.get) {
-- if (desc.set) {
-- str = ctx.stylize('[Getter/Setter]', 'special');
-- } else {
-- str = ctx.stylize('[Getter]', 'special');
-- }
-- } else {
-- if (desc.set) {
-- str = ctx.stylize('[Setter]', 'special');
-- }
-- }
-- if (!hasOwnProperty(visibleKeys, key)) {
-- name = '[' + key + ']';
-- }
-- if (!str) {
-- if (ctx.seen.indexOf(desc.value) < 0) {
-- if (isNull(recurseTimes)) {
-- str = formatValue(ctx, desc.value, null);
-- } else {
-- str = formatValue(ctx, desc.value, recurseTimes - 1);
-- }
-- if (str.indexOf('\n') > -1) {
-- if (array) {
-- str = str.split('\n').map(function(line) {
-- return ' ' + line;
-- }).join('\n').substr(2);
-- } else {
-- str = '\n' + str.split('\n').map(function(line) {
-- return ' ' + line;
-- }).join('\n');
-- }
-- }
-- } else {
-- str = ctx.stylize('[Circular]', 'special');
-- }
-- }
-- if (isUndefined(name)) {
-- if (array && key.match(/^\d+$/)) {
-- return str;
-- }
-- name = JSON.stringify('' + key);
-- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
-- name = name.substr(1, name.length - 2);
-- name = ctx.stylize(name, 'name');
-- } else {
-- name = name.replace(/'/g, "\\'")
-- .replace(/\\"/g, '"')
-- .replace(/(^"|"$)/g, "'");
-- name = ctx.stylize(name, 'string');
-- }
-- }
--
-- return name + ': ' + str;
--}
--
--
--function reduceToSingleString(output, base, braces) {
-- var numLinesEst = 0;
-- var length = output.reduce(function(prev, cur) {
-- numLinesEst++;
-- if (cur.indexOf('\n') >= 0) numLinesEst++;
-- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
-- }, 0);
--
-- if (length > 60) {
-- return braces[0] +
-- (base === '' ? '' : base + '\n ') +
-- ' ' +
-- output.join(',\n ') +
-- ' ' +
-- braces[1];
-- }
--
-- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
--}
--
--
- // NOTE: These type checking functions intentionally don't use `instanceof`
- // because it is fragile and can be easily faked with `Object.create()`.
- function isArray(ar) {
-@@ -522,166 +98,10 @@ function isPrimitive(arg) {
- exports.isPrimitive = isPrimitive;
-
- function isBuffer(arg) {
-- return arg instanceof Buffer;
-+ return Buffer.isBuffer(arg);
- }
- exports.isBuffer = isBuffer;
-
- function objectToString(o) {
- return Object.prototype.toString.call(o);
--}
--
--
--function pad(n) {
-- return n < 10 ? '0' + n.toString(10) : n.toString(10);
--}
--
--
--var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
-- 'Oct', 'Nov', 'Dec'];
--
--// 26 Feb 16:19:34
--function timestamp() {
-- var d = new Date();
-- var time = [pad(d.getHours()),
-- pad(d.getMinutes()),
-- pad(d.getSeconds())].join(':');
-- return [d.getDate(), months[d.getMonth()], time].join(' ');
--}
--
--
--// log is just a thin wrapper to console.log that prepends a timestamp
--exports.log = function() {
-- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
--};
--
--
--/**
-- * Inherit the prototype methods from one constructor into another.
-- *
-- * The Function.prototype.inherits from lang.js rewritten as a standalone
-- * function (not on Function.prototype). NOTE: If this file is to be loaded
-- * during bootstrapping this function needs to be rewritten using some native
-- * functions as prototype setup using normal JavaScript does not work as
-- * expected during bootstrapping (see mirror.js in r114903).
-- *
-- * @param {function} ctor Constructor function which needs to inherit the
-- * prototype.
-- * @param {function} superCtor Constructor function to inherit prototype from.
-- */
--exports.inherits = function(ctor, superCtor) {
-- ctor.super_ = superCtor;
-- ctor.prototype = Object.create(superCtor.prototype, {
-- constructor: {
-- value: ctor,
-- enumerable: false,
-- writable: true,
-- configurable: true
-- }
-- });
--};
--
--exports._extend = function(origin, add) {
-- // Don't do anything if add isn't an object
-- if (!add || !isObject(add)) return origin;
--
-- var keys = Object.keys(add);
-- var i = keys.length;
-- while (i--) {
-- origin[keys[i]] = add[keys[i]];
-- }
-- return origin;
--};
--
--function hasOwnProperty(obj, prop) {
-- return Object.prototype.hasOwnProperty.call(obj, prop);
--}
--
--
--// Deprecated old stuff.
--
--exports.p = exports.deprecate(function() {
-- for (var i = 0, len = arguments.length; i < len; ++i) {
-- console.error(exports.inspect(arguments[i]));
-- }
--}, 'util.p: Use console.error() instead');
--
--
--exports.exec = exports.deprecate(function() {
-- return require('child_process').exec.apply(this, arguments);
--}, 'util.exec is now called `child_process.exec`.');
--
--
--exports.print = exports.deprecate(function() {
-- for (var i = 0, len = arguments.length; i < len; ++i) {
-- process.stdout.write(String(arguments[i]));
-- }
--}, 'util.print: Use console.log instead');
--
--
--exports.puts = exports.deprecate(function() {
-- for (var i = 0, len = arguments.length; i < len; ++i) {
-- process.stdout.write(arguments[i] + '\n');
-- }
--}, 'util.puts: Use console.log instead');
--
--
--exports.debug = exports.deprecate(function(x) {
-- process.stderr.write('DEBUG: ' + x + '\n');
--}, 'util.debug: Use console.error instead');
--
--
--exports.error = exports.deprecate(function(x) {
-- for (var i = 0, len = arguments.length; i < len; ++i) {
-- process.stderr.write(arguments[i] + '\n');
-- }
--}, 'util.error: Use console.error instead');
--
--
--exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
-- var callbackCalled = false;
--
-- function call(a, b, c) {
-- if (callback && !callbackCalled) {
-- callback(a, b, c);
-- callbackCalled = true;
-- }
-- }
--
-- readStream.addListener('data', function(chunk) {
-- if (writeStream.write(chunk) === false) readStream.pause();
-- });
--
-- writeStream.addListener('drain', function() {
-- readStream.resume();
-- });
--
-- readStream.addListener('end', function() {
-- writeStream.end();
-- });
--
-- readStream.addListener('close', function() {
-- call();
-- });
--
-- readStream.addListener('error', function(err) {
-- writeStream.end();
-- call(err);
-- });
--
-- writeStream.addListener('error', function(err) {
-- readStream.destroy();
-- call(err);
-- });
--}, 'util.pump(): Use readableStream.pipe() instead');
--
--
--var uv;
--exports._errnoException = function(err, syscall) {
-- if (isUndefined(uv)) uv = process.binding('uv');
-- var errname = uv.errname(err);
-- var e = new Error(syscall + ' ' + errname);
-- e.code = errname;
-- e.errno = errname;
-- e.syscall = syscall;
-- return e;
--};
-+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
deleted file mode 100644
index 9074e8ebc..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// NOTE: These type checking functions intentionally don't use `instanceof`
-// because it is fragile and can be easily faked with `Object.create()`.
-function isArray(ar) {
- return Array.isArray(ar);
-}
-exports.isArray = isArray;
-
-function isBoolean(arg) {
- return typeof arg === 'boolean';
-}
-exports.isBoolean = isBoolean;
-
-function isNull(arg) {
- return arg === null;
-}
-exports.isNull = isNull;
-
-function isNullOrUndefined(arg) {
- return arg == null;
-}
-exports.isNullOrUndefined = isNullOrUndefined;
-
-function isNumber(arg) {
- return typeof arg === 'number';
-}
-exports.isNumber = isNumber;
-
-function isString(arg) {
- return typeof arg === 'string';
-}
-exports.isString = isString;
-
-function isSymbol(arg) {
- return typeof arg === 'symbol';
-}
-exports.isSymbol = isSymbol;
-
-function isUndefined(arg) {
- return arg === void 0;
-}
-exports.isUndefined = isUndefined;
-
-function isRegExp(re) {
- return isObject(re) && objectToString(re) === '[object RegExp]';
-}
-exports.isRegExp = isRegExp;
-
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
-}
-exports.isObject = isObject;
-
-function isDate(d) {
- return isObject(d) && objectToString(d) === '[object Date]';
-}
-exports.isDate = isDate;
-
-function isError(e) {
- return isObject(e) &&
- (objectToString(e) === '[object Error]' || e instanceof Error);
-}
-exports.isError = isError;
-
-function isFunction(arg) {
- return typeof arg === 'function';
-}
-exports.isFunction = isFunction;
-
-function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
-}
-exports.isPrimitive = isPrimitive;
-
-function isBuffer(arg) {
- return Buffer.isBuffer(arg);
-}
-exports.isBuffer = isBuffer;
-
-function objectToString(o) {
- return Object.prototype.toString.call(o);
-} \ No newline at end of file
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json
deleted file mode 100644
index b67333380..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "name": "core-util-is",
- "version": "1.0.1",
- "description": "The `util.is*` functions introduced in Node v0.12.",
- "main": "lib/util.js",
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/core-util-is.git"
- },
- "keywords": [
- "util",
- "isBuffer",
- "isArray",
- "isNumber",
- "isString",
- "isRegExp",
- "isThis",
- "isThat",
- "polyfill"
- ],
- "author": {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me",
- "url": "http://blog.izs.me/"
- },
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/isaacs/core-util-is/issues"
- },
- "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n",
- "readmeFilename": "README.md",
- "homepage": "https://github.com/isaacs/core-util-is#readme",
- "_id": "core-util-is@1.0.1",
- "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538",
- "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz",
- "_from": "core-util-is@>=1.0.0 <1.1.0"
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/util.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/util.js
deleted file mode 100644
index 007fa1057..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/util.js
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// NOTE: These type checking functions intentionally don't use `instanceof`
-// because it is fragile and can be easily faked with `Object.create()`.
-function isArray(ar) {
- return Array.isArray(ar);
-}
-exports.isArray = isArray;
-
-function isBoolean(arg) {
- return typeof arg === 'boolean';
-}
-exports.isBoolean = isBoolean;
-
-function isNull(arg) {
- return arg === null;
-}
-exports.isNull = isNull;
-
-function isNullOrUndefined(arg) {
- return arg == null;
-}
-exports.isNullOrUndefined = isNullOrUndefined;
-
-function isNumber(arg) {
- return typeof arg === 'number';
-}
-exports.isNumber = isNumber;
-
-function isString(arg) {
- return typeof arg === 'string';
-}
-exports.isString = isString;
-
-function isSymbol(arg) {
- return typeof arg === 'symbol';
-}
-exports.isSymbol = isSymbol;
-
-function isUndefined(arg) {
- return arg === void 0;
-}
-exports.isUndefined = isUndefined;
-
-function isRegExp(re) {
- return isObject(re) && objectToString(re) === '[object RegExp]';
-}
-exports.isRegExp = isRegExp;
-
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
-}
-exports.isObject = isObject;
-
-function isDate(d) {
- return isObject(d) && objectToString(d) === '[object Date]';
-}
-exports.isDate = isDate;
-
-function isError(e) {
- return isObject(e) && objectToString(e) === '[object Error]';
-}
-exports.isError = isError;
-
-function isFunction(arg) {
- return typeof arg === 'function';
-}
-exports.isFunction = isFunction;
-
-function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
-}
-exports.isPrimitive = isPrimitive;
-
-function isBuffer(arg) {
- return arg instanceof Buffer;
-}
-exports.isBuffer = isBuffer;
-
-function objectToString(o) {
- return Object.prototype.toString.call(o);
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md
deleted file mode 100644
index 052a62b8d..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-
-# isarray
-
-`Array#isArray` for older browsers.
-
-## Usage
-
-```js
-var isArray = require('isarray');
-
-console.log(isArray([])); // => true
-console.log(isArray({})); // => false
-```
-
-## Installation
-
-With [npm](http://npmjs.org) do
-
-```bash
-$ npm install isarray
-```
-
-Then bundle for the browser with
-[browserify](https://github.com/substack/browserify).
-
-With [component](http://component.io) do
-
-```bash
-$ component install juliangruber/isarray
-```
-
-## License
-
-(MIT)
-
-Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js
deleted file mode 100644
index ec58596ae..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js
+++ /dev/null
@@ -1,209 +0,0 @@
-
-/**
- * Require the given path.
- *
- * @param {String} path
- * @return {Object} exports
- * @api public
- */
-
-function require(path, parent, orig) {
- var resolved = require.resolve(path);
-
- // lookup failed
- if (null == resolved) {
- orig = orig || path;
- parent = parent || 'root';
- var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
- err.path = orig;
- err.parent = parent;
- err.require = true;
- throw err;
- }
-
- var module = require.modules[resolved];
-
- // perform real require()
- // by invoking the module's
- // registered function
- if (!module.exports) {
- module.exports = {};
- module.client = module.component = true;
- module.call(this, module.exports, require.relative(resolved), module);
- }
-
- return module.exports;
-}
-
-/**
- * Registered modules.
- */
-
-require.modules = {};
-
-/**
- * Registered aliases.
- */
-
-require.aliases = {};
-
-/**
- * Resolve `path`.
- *
- * Lookup:
- *
- * - PATH/index.js
- * - PATH.js
- * - PATH
- *
- * @param {String} path
- * @return {String} path or null
- * @api private
- */
-
-require.resolve = function(path) {
- if (path.charAt(0) === '/') path = path.slice(1);
- var index = path + '/index.js';
-
- var paths = [
- path,
- path + '.js',
- path + '.json',
- path + '/index.js',
- path + '/index.json'
- ];
-
- for (var i = 0; i < paths.length; i++) {
- var path = paths[i];
- if (require.modules.hasOwnProperty(path)) return path;
- }
-
- if (require.aliases.hasOwnProperty(index)) {
- return require.aliases[index];
- }
-};
-
-/**
- * Normalize `path` relative to the current path.
- *
- * @param {String} curr
- * @param {String} path
- * @return {String}
- * @api private
- */
-
-require.normalize = function(curr, path) {
- var segs = [];
-
- if ('.' != path.charAt(0)) return path;
-
- curr = curr.split('/');
- path = path.split('/');
-
- for (var i = 0; i < path.length; ++i) {
- if ('..' == path[i]) {
- curr.pop();
- } else if ('.' != path[i] && '' != path[i]) {
- segs.push(path[i]);
- }
- }
-
- return curr.concat(segs).join('/');
-};
-
-/**
- * Register module at `path` with callback `definition`.
- *
- * @param {String} path
- * @param {Function} definition
- * @api private
- */
-
-require.register = function(path, definition) {
- require.modules[path] = definition;
-};
-
-/**
- * Alias a module definition.
- *
- * @param {String} from
- * @param {String} to
- * @api private
- */
-
-require.alias = function(from, to) {
- if (!require.modules.hasOwnProperty(from)) {
- throw new Error('Failed to alias "' + from + '", it does not exist');
- }
- require.aliases[to] = from;
-};
-
-/**
- * Return a require function relative to the `parent` path.
- *
- * @param {String} parent
- * @return {Function}
- * @api private
- */
-
-require.relative = function(parent) {
- var p = require.normalize(parent, '..');
-
- /**
- * lastIndexOf helper.
- */
-
- function lastIndexOf(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) return i;
- }
- return -1;
- }
-
- /**
- * The relative require() itself.
- */
-
- function localRequire(path) {
- var resolved = localRequire.resolve(path);
- return require(resolved, parent, path);
- }
-
- /**
- * Resolve relative to the parent.
- */
-
- localRequire.resolve = function(path) {
- var c = path.charAt(0);
- if ('/' == c) return path.slice(1);
- if ('.' == c) return require.normalize(p, path);
-
- // resolve deps by returning
- // the dep in the nearest "deps"
- // directory
- var segs = parent.split('/');
- var i = lastIndexOf(segs, 'deps') + 1;
- if (!i) i = 0;
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
- return path;
- };
-
- /**
- * Check if module is defined at `path`.
- */
-
- localRequire.exists = function(path) {
- return require.modules.hasOwnProperty(localRequire.resolve(path));
- };
-
- return localRequire;
-};
-require.register("isarray/index.js", function(exports, require, module){
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
-
-});
-require.alias("isarray/index.js", "isarray/index.js");
-
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json
deleted file mode 100644
index 9e31b6838..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name" : "isarray",
- "description" : "Array#isArray for older browsers",
- "version" : "0.0.1",
- "repository" : "juliangruber/isarray",
- "homepage": "https://github.com/juliangruber/isarray",
- "main" : "index.js",
- "scripts" : [
- "index.js"
- ],
- "dependencies" : {},
- "keywords": ["browser","isarray","array"],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT"
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js
deleted file mode 100644
index 5f5ad45d4..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json
deleted file mode 100644
index fb1eb3786..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "name": "isarray",
- "description": "Array#isArray for older browsers",
- "version": "0.0.1",
- "repository": {
- "type": "git",
- "url": "git://github.com/juliangruber/isarray.git"
- },
- "homepage": "https://github.com/juliangruber/isarray",
- "main": "index.js",
- "scripts": {
- "test": "tap test/*.js"
- },
- "dependencies": {},
- "devDependencies": {
- "tap": "*"
- },
- "keywords": [
- "browser",
- "isarray",
- "array"
- ],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT",
- "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/juliangruber/isarray/issues"
- },
- "_id": "isarray@0.0.1",
- "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
- "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
- "_from": "isarray@0.0.1"
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js
deleted file mode 100644
index 049521cad..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict';
-module.exports = nextTick;
-
-function nextTick(fn) {
- var args = new Array(arguments.length - 1);
- var i = 0;
- while (i < args.length) {
- args[i++] = arguments[i];
- }
- process.nextTick(function afterTick() {
- fn.apply(null, args);
- });
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json
deleted file mode 100644
index bfaa2785f..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name": "process-nextick-args",
- "version": "1.0.3",
- "description": "process.nextTick but always with args",
- "main": "index.js",
- "scripts": {
- "test": "node test.js"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/calvinmetcalf/process-nextick-args.git"
- },
- "author": "",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/calvinmetcalf/process-nextick-args/issues"
- },
- "homepage": "https://github.com/calvinmetcalf/process-nextick-args",
- "devDependencies": {
- "tap": "~0.2.6"
- },
- "readme": "process-nextick-args\n=====\n\n[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args)\n\n```bash\nnpm install --save process-nextick-args\n```\n\nAlways be able to pass arguments to process.nextTick, no matter the platform\n\n```js\nvar nextTick = require('process-nextick-args');\n\nnextTick(function (a, b, c) {\n console.log(a, b, c);\n}, 'step', 3, 'profit');\n```\n",
- "readmeFilename": "readme.md",
- "_id": "process-nextick-args@1.0.3",
- "_shasum": "e272eed825d5e9f4ea74d8d73b1fe311c3beb630",
- "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.3.tgz",
- "_from": "process-nextick-args@>=1.0.0 <1.1.0"
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md
deleted file mode 100644
index 78e7cfaeb..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md
+++ /dev/null
@@ -1,18 +0,0 @@
-process-nextick-args
-=====
-
-[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args)
-
-```bash
-npm install --save process-nextick-args
-```
-
-Always be able to pass arguments to process.nextTick, no matter the platform
-
-```js
-var nextTick = require('process-nextick-args');
-
-nextTick(function (a, b, c) {
- console.log(a, b, c);
-}, 'step', 3, 'profit');
-```
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js
deleted file mode 100644
index ef1572158..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js
+++ /dev/null
@@ -1,24 +0,0 @@
-var test = require("tap").test;
-var nextTick = require('./');
-
-test('should work', function (t) {
- t.plan(5);
- nextTick(function (a) {
- t.ok(a);
- nextTick(function (thing) {
- t.equals(thing, 7);
- }, 7);
- }, true);
- nextTick(function (a, b, c) {
- t.equals(a, 'step');
- t.equals(b, 3);
- t.equals(c, 'profit');
- }, 'step', 3, 'profit');
-});
-
-test('correct number of arguments', function (t) {
- t.plan(1);
- nextTick(function () {
- t.equals(2, arguments.length, 'correct number');
- }, 1, 2);
-});
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore
deleted file mode 100644
index 206320cc1..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build
-test
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE
deleted file mode 100644
index 6de584a48..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright Joyent, Inc. and other Node contributors.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to permit
-persons to whom the Software is furnished to do so, subject to the
-following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md
deleted file mode 100644
index 4d2aa0015..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-**string_decoder.js** (`require('string_decoder')`) from Node.js core
-
-Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details.
-
-Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**
-
-The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version. \ No newline at end of file
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js
deleted file mode 100644
index b00e54fb7..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var Buffer = require('buffer').Buffer;
-
-var isBufferEncoding = Buffer.isEncoding
- || function(encoding) {
- switch (encoding && encoding.toLowerCase()) {
- case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
- default: return false;
- }
- }
-
-
-function assertEncoding(encoding) {
- if (encoding && !isBufferEncoding(encoding)) {
- throw new Error('Unknown encoding: ' + encoding);
- }
-}
-
-// StringDecoder provides an interface for efficiently splitting a series of
-// buffers into a series of JS strings without breaking apart multi-byte
-// characters. CESU-8 is handled as part of the UTF-8 encoding.
-//
-// @TODO Handling all encodings inside a single object makes it very difficult
-// to reason about this code, so it should be split up in the future.
-// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
-// points as used by CESU-8.
-var StringDecoder = exports.StringDecoder = function(encoding) {
- this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
- assertEncoding(encoding);
- switch (this.encoding) {
- case 'utf8':
- // CESU-8 represents each of Surrogate Pair by 3-bytes
- this.surrogateSize = 3;
- break;
- case 'ucs2':
- case 'utf16le':
- // UTF-16 represents each of Surrogate Pair by 2-bytes
- this.surrogateSize = 2;
- this.detectIncompleteChar = utf16DetectIncompleteChar;
- break;
- case 'base64':
- // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
- this.surrogateSize = 3;
- this.detectIncompleteChar = base64DetectIncompleteChar;
- break;
- default:
- this.write = passThroughWrite;
- return;
- }
-
- // Enough space to store all bytes of a single character. UTF-8 needs 4
- // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
- this.charBuffer = new Buffer(6);
- // Number of bytes received for the current incomplete multi-byte character.
- this.charReceived = 0;
- // Number of bytes expected for the current incomplete multi-byte character.
- this.charLength = 0;
-};
-
-
-// write decodes the given buffer and returns it as JS string that is
-// guaranteed to not contain any partial multi-byte characters. Any partial
-// character found at the end of the buffer is buffered up, and will be
-// returned when calling write again with the remaining bytes.
-//
-// Note: Converting a Buffer containing an orphan surrogate to a String
-// currently works, but converting a String to a Buffer (via `new Buffer`, or
-// Buffer#write) will replace incomplete surrogates with the unicode
-// replacement character. See https://codereview.chromium.org/121173009/ .
-StringDecoder.prototype.write = function(buffer) {
- var charStr = '';
- // if our last write ended with an incomplete multibyte character
- while (this.charLength) {
- // determine how many remaining bytes this buffer has to offer for this char
- var available = (buffer.length >= this.charLength - this.charReceived) ?
- this.charLength - this.charReceived :
- buffer.length;
-
- // add the new bytes to the char buffer
- buffer.copy(this.charBuffer, this.charReceived, 0, available);
- this.charReceived += available;
-
- if (this.charReceived < this.charLength) {
- // still not enough chars in this buffer? wait for more ...
- return '';
- }
-
- // remove bytes belonging to the current character from the buffer
- buffer = buffer.slice(available, buffer.length);
-
- // get the character that was split
- charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
-
- // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
- var charCode = charStr.charCodeAt(charStr.length - 1);
- if (charCode >= 0xD800 && charCode <= 0xDBFF) {
- this.charLength += this.surrogateSize;
- charStr = '';
- continue;
- }
- this.charReceived = this.charLength = 0;
-
- // if there are no more bytes in this buffer, just emit our char
- if (buffer.length === 0) {
- return charStr;
- }
- break;
- }
-
- // determine and set charLength / charReceived
- this.detectIncompleteChar(buffer);
-
- var end = buffer.length;
- if (this.charLength) {
- // buffer the incomplete character bytes we got
- buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
- end -= this.charReceived;
- }
-
- charStr += buffer.toString(this.encoding, 0, end);
-
- var end = charStr.length - 1;
- var charCode = charStr.charCodeAt(end);
- // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
- if (charCode >= 0xD800 && charCode <= 0xDBFF) {
- var size = this.surrogateSize;
- this.charLength += size;
- this.charReceived += size;
- this.charBuffer.copy(this.charBuffer, size, 0, size);
- buffer.copy(this.charBuffer, 0, 0, size);
- return charStr.substring(0, end);
- }
-
- // or just emit the charStr
- return charStr;
-};
-
-// detectIncompleteChar determines if there is an incomplete UTF-8 character at
-// the end of the given buffer. If so, it sets this.charLength to the byte
-// length that character, and sets this.charReceived to the number of bytes
-// that are available for this character.
-StringDecoder.prototype.detectIncompleteChar = function(buffer) {
- // determine how many bytes we have to check at the end of this buffer
- var i = (buffer.length >= 3) ? 3 : buffer.length;
-
- // Figure out if one of the last i bytes of our buffer announces an
- // incomplete char.
- for (; i > 0; i--) {
- var c = buffer[buffer.length - i];
-
- // See http://en.wikipedia.org/wiki/UTF-8#Description
-
- // 110XXXXX
- if (i == 1 && c >> 5 == 0x06) {
- this.charLength = 2;
- break;
- }
-
- // 1110XXXX
- if (i <= 2 && c >> 4 == 0x0E) {
- this.charLength = 3;
- break;
- }
-
- // 11110XXX
- if (i <= 3 && c >> 3 == 0x1E) {
- this.charLength = 4;
- break;
- }
- }
- this.charReceived = i;
-};
-
-StringDecoder.prototype.end = function(buffer) {
- var res = '';
- if (buffer && buffer.length)
- res = this.write(buffer);
-
- if (this.charReceived) {
- var cr = this.charReceived;
- var buf = this.charBuffer;
- var enc = this.encoding;
- res += buf.slice(0, cr).toString(enc);
- }
-
- return res;
-};
-
-function passThroughWrite(buffer) {
- return buffer.toString(this.encoding);
-}
-
-function utf16DetectIncompleteChar(buffer) {
- this.charReceived = buffer.length % 2;
- this.charLength = this.charReceived ? 2 : 0;
-}
-
-function base64DetectIncompleteChar(buffer) {
- this.charReceived = buffer.length % 3;
- this.charLength = this.charReceived ? 3 : 0;
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json
deleted file mode 100644
index ee7070235..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "string_decoder",
- "version": "0.10.31",
- "description": "The string_decoder module from Node core",
- "main": "index.js",
- "dependencies": {},
- "devDependencies": {
- "tap": "~0.4.8"
- },
- "scripts": {
- "test": "tap test/simple/*.js"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/rvagg/string_decoder.git"
- },
- "homepage": "https://github.com/rvagg/string_decoder",
- "keywords": [
- "string",
- "decoder",
- "browser",
- "browserify"
- ],
- "license": "MIT",
- "readme": "**string_decoder.js** (`require('string_decoder')`) from Node.js core\n\nCopyright Joyent, Inc. and other Node contributors. See LICENCE file for details.\n\nVersion numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**\n\nThe *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/rvagg/string_decoder/issues"
- },
- "_id": "string_decoder@0.10.31",
- "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94",
- "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
- "_from": "string_decoder@>=0.10.0 <0.11.0"
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md
deleted file mode 100644
index acc867537..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md
+++ /dev/null
@@ -1,16 +0,0 @@
-
-1.0.2 / 2015-10-07
-==================
-
- * use try/catch when checking `localStorage` (#3, @kumavis)
-
-1.0.1 / 2014-11-25
-==================
-
- * browser: use `console.warn()` for deprecation calls
- * browser: more jsdocs
-
-1.0.0 / 2014-04-30
-==================
-
- * initial commit
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE
deleted file mode 100644
index 6a60e8c22..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md
deleted file mode 100644
index 75622fa7c..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md
+++ /dev/null
@@ -1,53 +0,0 @@
-util-deprecate
-==============
-### The Node.js `util.deprecate()` function with browser support
-
-In Node.js, this module simply re-exports the `util.deprecate()` function.
-
-In the web browser (i.e. via browserify), a browser-specific implementation
-of the `util.deprecate()` function is used.
-
-
-## API
-
-A `deprecate()` function is the only thing exposed by this module.
-
-``` javascript
-// setup:
-exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead');
-
-
-// users see:
-foo();
-// foo() is deprecated, use bar() instead
-foo();
-foo();
-```
-
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js
deleted file mode 100644
index 549ae2f06..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js
+++ /dev/null
@@ -1,67 +0,0 @@
-
-/**
- * Module exports.
- */
-
-module.exports = deprecate;
-
-/**
- * Mark that a method should not be used.
- * Returns a modified function which warns once by default.
- *
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
- *
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
- * will throw an Error when invoked.
- *
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
- * will invoke `console.trace()` instead of `console.error()`.
- *
- * @param {Function} fn - the function to deprecate
- * @param {String} msg - the string to print to the console when `fn` is invoked
- * @returns {Function} a new "deprecated" version of `fn`
- * @api public
- */
-
-function deprecate (fn, msg) {
- if (config('noDeprecation')) {
- return fn;
- }
-
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (config('throwDeprecation')) {
- throw new Error(msg);
- } else if (config('traceDeprecation')) {
- console.trace(msg);
- } else {
- console.warn(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
-
- return deprecated;
-}
-
-/**
- * Checks `localStorage` for boolean values for the given `name`.
- *
- * @param {String} name
- * @returns {Boolean}
- * @api private
- */
-
-function config (name) {
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
- try {
- if (!global.localStorage) return false;
- } catch (_) {
- return false;
- }
- var val = global.localStorage[name];
- if (null == val) return false;
- return String(val).toLowerCase() === 'true';
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js
deleted file mode 100644
index 5e6fcff5d..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js
+++ /dev/null
@@ -1,6 +0,0 @@
-
-/**
- * For Node.js, simply re-export the core `util.deprecate` function.
- */
-
-module.exports = require('util').deprecate;
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json b/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json
deleted file mode 100644
index ae0c70f6c..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "name": "util-deprecate",
- "version": "1.0.2",
- "description": "The Node.js `util.deprecate()` function with browser support",
- "main": "node.js",
- "browser": "browser.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/TooTallNate/util-deprecate.git"
- },
- "keywords": [
- "util",
- "deprecate",
- "browserify",
- "browser",
- "node"
- ],
- "author": {
- "name": "Nathan Rajlich",
- "email": "nathan@tootallnate.net",
- "url": "http://n8.io/"
- },
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/TooTallNate/util-deprecate/issues"
- },
- "homepage": "https://github.com/TooTallNate/util-deprecate",
- "gitHead": "475fb6857cd23fafff20c1be846c1350abf8e6d4",
- "_id": "util-deprecate@1.0.2",
- "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf",
- "_from": "util-deprecate@>=1.0.1 <1.1.0",
- "_npmVersion": "2.14.4",
- "_nodeVersion": "4.1.2",
- "_npmUser": {
- "name": "tootallnate",
- "email": "nathan@tootallnate.net"
- },
- "maintainers": [
- {
- "name": "tootallnate",
- "email": "nathan@tootallnate.net"
- }
- ],
- "dist": {
- "shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf",
- "tarball": "http://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
- },
- "directories": {},
- "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "readme": "ERROR: No README data found!"
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json b/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json
deleted file mode 100644
index 0d67d9bbb..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "readable-stream",
- "version": "2.0.2",
- "description": "Streams3, a user-land copy of the stream library from iojs v2.x",
- "main": "readable.js",
- "dependencies": {
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.1",
- "isarray": "0.0.1",
- "process-nextick-args": "~1.0.0",
- "string_decoder": "~0.10.x",
- "util-deprecate": "~1.0.1"
- },
- "devDependencies": {
- "tap": "~0.2.6",
- "tape": "~4.0.0",
- "zuul": "~3.0.0"
- },
- "scripts": {
- "test": "tap test/parallel/*.js",
- "browser": "zuul --browser-name $BROWSER_NAME --browser-version $BROWSER_VERSION -- test/browser.js"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/nodejs/readable-stream.git"
- },
- "keywords": [
- "readable",
- "stream",
- "pipe"
- ],
- "browser": {
- "util": false
- },
- "license": "MIT",
- "readme": "# readable-stream\n\n***Node-core streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)\n\n\n[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)\n[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)\n\n\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)\n\n```bash\nnpm install --save readable-stream\n```\n\n***Node-core streams for userland***\n\nThis package is a mirror of the Streams2 and Streams3 implementations in\nNode-core, including [documentation](doc/stream.markdown).\n\nIf you want to guarantee a stable streams base, regardless of what version of\nNode you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *\"stream\"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).\n\nAs of version 2.0.0 **readable-stream** uses semantic versioning. \n\n# Streams WG Team Members\n\n* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;\n - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B\n* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;\n - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242\n* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;\n - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D\n* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;\n* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;\n* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/nodejs/readable-stream/issues"
- },
- "homepage": "https://github.com/nodejs/readable-stream#readme",
- "_id": "readable-stream@2.0.2",
- "_shasum": "bec81beae8cf455168bc2e5b2b31f5bcfaed9b1b",
- "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.2.tgz",
- "_from": "readable-stream@>=2.0.0 <2.1.0"
-}
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js
deleted file mode 100644
index 27e8d8a55..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_passthrough.js")
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js
deleted file mode 100644
index 6222a5798..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var Stream = (function (){
- try {
- return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
- } catch(_){}
-}());
-exports = module.exports = require('./lib/_stream_readable.js');
-exports.Stream = Stream || exports;
-exports.Readable = exports;
-exports.Writable = require('./lib/_stream_writable.js');
-exports.Duplex = require('./lib/_stream_duplex.js');
-exports.Transform = require('./lib/_stream_transform.js');
-exports.PassThrough = require('./lib/_stream_passthrough.js');
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js
deleted file mode 100644
index 5d482f078..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_transform.js")
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js b/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js
deleted file mode 100644
index e1e9efdf3..000000000
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_writable.js")
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md b/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md
index 3f8eb69aa..8b4d8c22b 100644
--- a/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md
+++ b/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md
@@ -1,3 +1,12 @@
+# v1.5.0
+
+- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) (#892)
+- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. (#873)
+- `auto` now accepts an optional `concurrency` argument to limit the number of running tasks (#637)
+- Added `queue#workersList()`, to retrieve the list of currently running tasks. (#891)
+- Various code simplifications (#896, #904)
+- Various doc fixes :scroll: (#890, #894, #903, #905, #912)
+
# v1.4.2
- Ensure coverage files don't get published on npm (#879)
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/README.md b/node_modules/request/node_modules/form-data/node_modules/async/README.md
new file mode 100644
index 000000000..071d069b7
--- /dev/null
+++ b/node_modules/request/node_modules/form-data/node_modules/async/README.md
@@ -0,0 +1,1791 @@
+# Async.js
+
+[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async)
+[![NPM version](http://img.shields.io/npm/v/async.svg)](https://www.npmjs.org/package/async)
+[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master)
+[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+
+Async is a utility module which provides straight-forward, powerful functions
+for working with asynchronous JavaScript. Although originally designed for
+use with [Node.js](http://nodejs.org) and installable via `npm install async`,
+it can also be used directly in the browser.
+
+Async is also installable via:
+
+- [bower](http://bower.io/): `bower install async`
+- [component](https://github.com/component/component): `component install
+ caolan/async`
+- [jam](http://jamjs.org/): `jam install async`
+- [spm](http://spmjs.io/): `spm install async`
+
+Async provides around 20 functions that include the usual 'functional'
+suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns
+for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these
+functions assume you follow the Node.js convention of providing a single
+callback as the last argument of your `async` function.
+
+
+## Quick Examples
+
+```javascript
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+ // results is now an array of stats for each file
+});
+
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+ // results now equals an array of the existing files
+});
+
+async.parallel([
+ function(){ ... },
+ function(){ ... }
+], callback);
+
+async.series([
+ function(){ ... },
+ function(){ ... }
+]);
+```
+
+There are many more functions available so take a look at the docs below for a
+full list. This module aims to be comprehensive, so if you feel anything is
+missing please create a GitHub issue for it.
+
+## Common Pitfalls <sub>[(StackOverflow)](http://stackoverflow.com/questions/tagged/async.js)</sub>
+### Synchronous iteration functions
+
+If you get an error like `RangeError: Maximum call stack size exceeded.` or other stack overflow issues when using async, you are likely using a synchronous iterator. By *synchronous* we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with `async.setImmediate` to start a new call stack on the next tick of the event loop.
+
+This can also arise by accident if you callback early in certain cases:
+
+```js
+async.eachSeries(hugeArray, function iterator(item, callback) {
+ if (inCache(item)) {
+ callback(null, cache[item]); // if many items are cached, you'll overflow
+ } else {
+ doSomeIO(item, callback);
+ }
+}, function done() {
+ //...
+});
+```
+
+Just change it to:
+
+```js
+async.eachSeries(hugeArray, function iterator(item, callback) {
+ if (inCache(item)) {
+ async.setImmediate(function () {
+ callback(null, cache[item]);
+ });
+ } else {
+ doSomeIO(item, callback);
+ //...
+```
+
+Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with [`async.ensureAsync`](#ensureAsync) Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral.
+
+If JavaScript's event loop is still a bit nebulous, check out [this article](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/) or [this talk](http://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html) for more detailed information about how it works.
+
+
+### Multiple callbacks
+
+Make sure to always `return` when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases.
+
+```js
+async.waterfall([
+ function (callback) {
+ getSomething(options, function (err, result) {
+ if (err) {
+ callback(new Error("failed getting something:" + err.message));
+ // we should return here
+ }
+ // since we did not return, this callback still will be called and
+ // `processData` will be called twice
+ callback(null, result);
+ });
+ },
+ processData
+], done)
+```
+
+It is always good practice to `return callback(err, result)` whenever a callback call is not the last statement of a function.
+
+
+### Binding a context to an iterator
+
+This section is really about `bind`, not about `async`. If you are wondering how to
+make `async` execute your iterators in a given context, or are confused as to why
+a method of another library isn't working as an iterator, study this example:
+
+```js
+// Here is a simple object with an (unnecessarily roundabout) squaring method
+var AsyncSquaringLibrary = {
+ squareExponent: 2,
+ square: function(number, callback){
+ var result = Math.pow(number, this.squareExponent);
+ setTimeout(function(){
+ callback(null, result);
+ }, 200);
+ }
+};
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
+ // result is [NaN, NaN, NaN]
+ // This fails because the `this.squareExponent` expression in the square
+ // function is not evaluated in the context of AsyncSquaringLibrary, and is
+ // therefore undefined.
+});
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
+ // result is [1, 4, 9]
+ // With the help of bind we can attach a context to the iterator before
+ // passing it to async. Now the square function will be executed in its
+ // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
+ // will be as expected.
+});
+```
+
+## Download
+
+The source is available for download from
+[GitHub](https://github.com/caolan/async/blob/master/lib/async.js).
+Alternatively, you can install using Node Package Manager (`npm`):
+
+ npm install async
+
+As well as using Bower:
+
+ bower install async
+
+__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
+
+## In the Browser
+
+So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5.
+
+Usage:
+
+```html
+<script type="text/javascript" src="async.js"></script>
+<script type="text/javascript">
+
+ async.map(data, asyncProcess, function(err, results){
+ alert(results);
+ });
+
+</script>
+```
+
+## Documentation
+
+Some functions are also available in the following forms:
+* `<name>Series` - the same as `<name>` but runs only a single async operation at a time
+* `<name>Limit` - the same as `<name>` but runs a maximum of `limit` async operations at a time
+
+### Collections
+
+* [`each`](#each), `eachSeries`, `eachLimit`
+* [`forEachOf`](#forEachOf), `forEachOfSeries`, `forEachOfLimit`
+* [`map`](#map), `mapSeries`, `mapLimit`
+* [`filter`](#filter), `filterSeries`, `filterLimit`
+* [`reject`](#reject), `rejectSeries`, `rejectLimit`
+* [`reduce`](#reduce), [`reduceRight`](#reduceRight)
+* [`detect`](#detect), `detectSeries`, `detectLimit`
+* [`sortBy`](#sortBy)
+* [`some`](#some), `someLimit`
+* [`every`](#every), `everyLimit`
+* [`concat`](#concat), `concatSeries`
+
+### Control Flow
+
+* [`series`](#seriestasks-callback)
+* [`parallel`](#parallel), `parallelLimit`
+* [`whilst`](#whilst), [`doWhilst`](#doWhilst)
+* [`until`](#until), [`doUntil`](#doUntil)
+* [`during`](#during), [`doDuring`](#doDuring)
+* [`forever`](#forever)
+* [`waterfall`](#waterfall)
+* [`compose`](#compose)
+* [`seq`](#seq)
+* [`applyEach`](#applyEach), `applyEachSeries`
+* [`queue`](#queue), [`priorityQueue`](#priorityQueue)
+* [`cargo`](#cargo)
+* [`auto`](#auto)
+* [`retry`](#retry)
+* [`iterator`](#iterator)
+* [`times`](#times), `timesSeries`, `timesLimit`
+
+### Utils
+
+* [`apply`](#apply)
+* [`nextTick`](#nextTick)
+* [`memoize`](#memoize)
+* [`unmemoize`](#unmemoize)
+* [`ensureAsync`](#ensureAsync)
+* [`constant`](#constant)
+* [`asyncify`](#asyncify)
+* [`wrapSync`](#wrapSync)
+* [`log`](#log)
+* [`dir`](#dir)
+* [`noConflict`](#noConflict)
+
+## Collections
+
+<a name="forEach" />
+<a name="each" />
+### each(arr, iterator, [callback])
+
+Applies the function `iterator` to each item in `arr`, in parallel.
+The `iterator` is called with an item from the list, and a callback for when it
+has finished. If the `iterator` passes an error to its `callback`, the main
+`callback` (for the `each` function) is immediately called with the error.
+
+Note, that since this function applies `iterator` to each item in parallel,
+there is no guarantee that the iterator functions will complete in order.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err)` which must be called once it has
+ completed. If no error has occurred, the `callback` should be run without
+ arguments or with an explicit `null` argument. The array index is not passed
+ to the iterator. If you need the index, use [`forEachOf`](#forEachOf).
+* `callback(err)` - *Optional* A callback which is called when all `iterator` functions
+ have finished, or an error occurs.
+
+__Examples__
+
+
+```js
+// assuming openFiles is an array of file names and saveFile is a function
+// to save the modified contents of that file:
+
+async.each(openFiles, saveFile, function(err){
+ // if any of the saves produced an error, err would equal that error
+});
+```
+
+```js
+// assuming openFiles is an array of file names
+
+async.each(openFiles, function(file, callback) {
+
+ // Perform operation on file here.
+ console.log('Processing file ' + file);
+
+ if( file.length > 32 ) {
+ console.log('This file name is too long');
+ callback('File name too long');
+ } else {
+ // Do work to process file here
+ console.log('File processed');
+ callback();
+ }
+}, function(err){
+ // if any of the file processing produced an error, err would equal that error
+ if( err ) {
+ // One of the iterations produced an error.
+ // All processing will now stop.
+ console.log('A file failed to process');
+ } else {
+ console.log('All files have been processed successfully');
+ }
+});
+```
+
+__Related__
+
+* eachSeries(arr, iterator, [callback])
+* eachLimit(arr, limit, iterator, [callback])
+
+---------------------------------------
+
+<a name="forEachOf" />
+<a name="eachOf" />
+
+### forEachOf(obj, iterator, [callback])
+
+Like `each`, except that it iterates over objects, and passes the key as the second argument to the iterator.
+
+__Arguments__
+
+* `obj` - An object or array to iterate over.
+* `iterator(item, key, callback)` - A function to apply to each item in `obj`.
+The `key` is the item's key, or index in the case of an array. The iterator is
+passed a `callback(err)` which must be called once it has completed. If no
+error has occurred, the callback should be run without arguments or with an
+explicit `null` argument.
+* `callback(err)` - *Optional* A callback which is called when all `iterator` functions have finished, or an error occurs.
+
+__Example__
+
+```js
+var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
+var configs = {};
+
+async.forEachOf(obj, function (value, key, callback) {
+ fs.readFile(__dirname + value, "utf8", function (err, data) {
+ if (err) return callback(err);
+ try {
+ configs[key] = JSON.parse(data);
+ } catch (e) {
+ return callback(e);
+ }
+ callback();
+ })
+}, function (err) {
+ if (err) console.error(err.message);
+ // configs is now a map of JSON data
+ doSomethingWith(configs);
+})
+```
+
+__Related__
+
+* forEachOfSeries(obj, iterator, [callback])
+* forEachOfLimit(obj, limit, iterator, [callback])
+
+---------------------------------------
+
+<a name="map" />
+### map(arr, iterator, [callback])
+
+Produces a new array of values by mapping each value in `arr` through
+the `iterator` function. The `iterator` is called with an item from `arr` and a
+callback for when it has finished processing. Each of these callback takes 2 arguments:
+an `error`, and the transformed item from `arr`. If `iterator` passes an error to its
+callback, the main `callback` (for the `map` function) is immediately called with the error.
+
+Note, that since this function applies the `iterator` to each item in parallel,
+there is no guarantee that the `iterator` functions will complete in order.
+However, the results array will be in the same order as the original `arr`.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, transformed)` which must be called once
+ it has completed with an error (which can be `null`) and a transformed item.
+* `callback(err, results)` - *Optional* A callback which is called when all `iterator`
+ functions have finished, or an error occurs. Results is an array of the
+ transformed items from the `arr`.
+
+__Example__
+
+```js
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+ // results is now an array of stats for each file
+});
+```
+
+__Related__
+* mapSeries(arr, iterator, [callback])
+* mapLimit(arr, limit, iterator, [callback])
+
+---------------------------------------
+
+<a name="select" />
+<a name="filter" />
+### filter(arr, iterator, [callback])
+
+__Alias:__ `select`
+
+Returns a new array of all the values in `arr` which pass an async truth test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. This operation is
+performed in parallel, but the results array will be in the same order as the
+original.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+ The `iterator` is passed a `callback(truthValue)`, which must be called with a
+ boolean argument once it has completed.
+* `callback(results)` - *Optional* A callback which is called after all the `iterator`
+ functions have finished.
+
+__Example__
+
+```js
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+ // results now equals an array of the existing files
+});
+```
+
+__Related__
+
+* filterSeries(arr, iterator, [callback])
+* filterLimit(arr, limit, iterator, [callback])
+
+---------------------------------------
+
+<a name="reject" />
+### reject(arr, iterator, [callback])
+
+The opposite of [`filter`](#filter). Removes values that pass an `async` truth test.
+
+__Related__
+
+* rejectSeries(arr, iterator, [callback])
+* rejectLimit(arr, limit, iterator, [callback])
+
+---------------------------------------
+
+<a name="reduce" />
+### reduce(arr, memo, iterator, [callback])
+
+__Aliases:__ `inject`, `foldl`
+
+Reduces `arr` into a single value using an async `iterator` to return
+each successive step. `memo` is the initial state of the reduction.
+This function only operates in series.
+
+For performance reasons, it may make sense to split a call to this function into
+a parallel map, and then use the normal `Array.prototype.reduce` on the results.
+This function is for situations where each step in the reduction needs to be async;
+if you can get the data before reducing it, then it's probably a good idea to do so.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `memo` - The initial state of the reduction.
+* `iterator(memo, item, callback)` - A function applied to each item in the
+ array to produce the next step in the reduction. The `iterator` is passed a
+ `callback(err, reduction)` which accepts an optional error as its first
+ argument, and the state of the reduction as the second. If an error is
+ passed to the callback, the reduction is stopped and the main `callback` is
+ immediately called with the error.
+* `callback(err, result)` - *Optional* A callback which is called after all the `iterator`
+ functions have finished. Result is the reduced value.
+
+__Example__
+
+```js
+async.reduce([1,2,3], 0, function(memo, item, callback){
+ // pointless async:
+ process.nextTick(function(){
+ callback(null, memo + item)
+ });
+}, function(err, result){
+ // result is now equal to the last value of memo, which is 6
+});
+```
+
+---------------------------------------
+
+<a name="reduceRight" />
+### reduceRight(arr, memo, iterator, [callback])
+
+__Alias:__ `foldr`
+
+Same as [`reduce`](#reduce), only operates on `arr` in reverse order.
+
+
+---------------------------------------
+
+<a name="detect" />
+### detect(arr, iterator, [callback])
+
+Returns the first value in `arr` that passes an async truth test. The
+`iterator` is applied in parallel, meaning the first iterator to return `true` will
+fire the detect `callback` with that result. That means the result might not be
+the first item in the original `arr` (in terms of order) that passes the test.
+
+If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries).
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+ The iterator is passed a `callback(truthValue)` which must be called with a
+ boolean argument once it has completed. **Note: this callback does not take an error as its first argument.**
+* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns
+ `true`, or after all the `iterator` functions have finished. Result will be
+ the first item in the array that passes the truth test (iterator) or the
+ value `undefined` if none passed. **Note: this callback does not take an error as its first argument.**
+
+__Example__
+
+```js
+async.detect(['file1','file2','file3'], fs.exists, function(result){
+ // result now equals the first file in the list that exists
+});
+```
+
+__Related__
+
+* detectSeries(arr, iterator, [callback])
+* detectLimit(arr, limit, iterator, [callback])
+
+---------------------------------------
+
+<a name="sortBy" />
+### sortBy(arr, iterator, [callback])
+
+Sorts a list by the results of running each `arr` value through an async `iterator`.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, sortValue)` which must be called once it
+ has completed with an error (which can be `null`) and a value to use as the sort
+ criteria.
+* `callback(err, results)` - *Optional* A callback which is called after all the `iterator`
+ functions have finished, or an error occurs. Results is the items from
+ the original `arr` sorted by the values returned by the `iterator` calls.
+
+__Example__
+
+```js
+async.sortBy(['file1','file2','file3'], function(file, callback){
+ fs.stat(file, function(err, stats){
+ callback(err, stats.mtime);
+ });
+}, function(err, results){
+ // results is now the original array of files sorted by
+ // modified date
+});
+```
+
+__Sort Order__
+
+By modifying the callback parameter the sorting order can be influenced:
+
+```js
+//ascending order
+async.sortBy([1,9,3,5], function(x, callback){
+ callback(null, x);
+}, function(err,result){
+ //result callback
+} );
+
+//descending order
+async.sortBy([1,9,3,5], function(x, callback){
+ callback(null, x*-1); //<- x*-1 instead of x, turns the order around
+}, function(err,result){
+ //result callback
+} );
+```
+
+---------------------------------------
+
+<a name="some" />
+### some(arr, iterator, [callback])
+
+__Alias:__ `any`
+
+Returns `true` if at least one element in the `arr` satisfies an async test.
+_The callback for each iterator call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. Once any iterator
+call returns `true`, the main `callback` is immediately called.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+ in parallel. The iterator is passed a `callback(truthValue)`` which must be
+ called with a boolean argument once it has completed.
+* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns
+ `true`, or after all the iterator functions have finished. Result will be
+ either `true` or `false` depending on the values of the async tests.
+
+ **Note: the callbacks do not take an error as their first argument.**
+__Example__
+
+```js
+async.some(['file1','file2','file3'], fs.exists, function(result){
+ // if result is true then at least one of the files exists
+});
+```
+
+__Related__
+
+* someLimit(arr, limit, iterator, callback)
+
+---------------------------------------
+
+<a name="every" />
+### every(arr, iterator, [callback])
+
+__Alias:__ `all`
+
+Returns `true` if every element in `arr` satisfies an async test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+ in parallel. The iterator is passed a `callback(truthValue)` which must be
+ called with a boolean argument once it has completed.
+* `callback(result)` - *Optional* A callback which is called after all the `iterator`
+ functions have finished. Result will be either `true` or `false` depending on
+ the values of the async tests.
+
+ **Note: the callbacks do not take an error as their first argument.**
+
+__Example__
+
+```js
+async.every(['file1','file2','file3'], fs.exists, function(result){
+ // if result is true then every file exists
+});
+```
+
+__Related__
+
+* everyLimit(arr, limit, iterator, callback)
+
+---------------------------------------
+
+<a name="concat" />
+### concat(arr, iterator, [callback])
+
+Applies `iterator` to each item in `arr`, concatenating the results. Returns the
+concatenated list. The `iterator`s are called in parallel, and the results are
+concatenated as they return. There is no guarantee that the results array will
+be returned in the original order of `arr` passed to the `iterator` function.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, results)` which must be called once it
+ has completed with an error (which can be `null`) and an array of results.
+* `callback(err, results)` - *Optional* A callback which is called after all the `iterator`
+ functions have finished, or an error occurs. Results is an array containing
+ the concatenated results of the `iterator` function.
+
+__Example__
+
+```js
+async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
+ // files is now a list of filenames that exist in the 3 directories
+});
+```
+
+__Related__
+
+* concatSeries(arr, iterator, [callback])
+
+
+## Control Flow
+
+<a name="series" />
+### series(tasks, [callback])
+
+Run the functions in the `tasks` array in series, each one running once the previous
+function has completed. If any functions in the series pass an error to its
+callback, no more functions are run, and `callback` is immediately called with the value of the error.
+Otherwise, `callback` receives an array of results when `tasks` have completed.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function, and the results will be passed to the final `callback` as an object
+instead of an array. This can be a more readable way of handling results from
+[`series`](#series).
+
+**Note** that while many implementations preserve the order of object properties, the
+[ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
+explicitly states that
+
+> The mechanics and order of enumerating the properties is not specified.
+
+So if you rely on the order in which your series of functions are executed, and want
+this to work on all platforms, consider using an array.
+
+__Arguments__
+
+* `tasks` - An array or object containing functions to run, each function is passed
+ a `callback(err, result)` it must call on completion with an error `err` (which can
+ be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the `task` callbacks.
+
+__Example__
+
+```js
+async.series([
+ function(callback){
+ // do some stuff ...
+ callback(null, 'one');
+ },
+ function(callback){
+ // do some more stuff ...
+ callback(null, 'two');
+ }
+],
+// optional callback
+function(err, results){
+ // results is now equal to ['one', 'two']
+});
+
+
+// an example using an object instead of an array
+async.series({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ }
+},
+function(err, results) {
+ // results is now equal to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+<a name="parallel" />
+### parallel(tasks, [callback])
+
+Run the `tasks` array of functions in parallel, without waiting until the previous
+function has completed. If any of the functions pass an error to its
+callback, the main `callback` is immediately called with the value of the error.
+Once the `tasks` have completed, the results are passed to the final `callback` as an
+array.
+
+**Note:** `parallel` is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final `callback` as an object
+instead of an array. This can be a more readable way of handling results from
+[`parallel`](#parallel).
+
+
+__Arguments__
+
+* `tasks` - An array or object containing functions to run. Each function is passed
+ a `callback(err, result)` which it must call on completion with an error `err`
+ (which can be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the task callbacks.
+
+__Example__
+
+```js
+async.parallel([
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'one');
+ }, 200);
+ },
+ function(callback){
+ setTimeout(function(){
+ callback(null, 'two');
+ }, 100);
+ }
+],
+// optional callback
+function(err, results){
+ // the results array will equal ['one','two'] even though
+ // the second function had a shorter timeout.
+});
+
+
+// an example using an object instead of an array
+async.parallel({
+ one: function(callback){
+ setTimeout(function(){
+ callback(null, 1);
+ }, 200);
+ },
+ two: function(callback){
+ setTimeout(function(){
+ callback(null, 2);
+ }, 100);
+ }
+},
+function(err, results) {
+ // results is now equals to: {one: 1, two: 2}
+});
+```
+
+__Related__
+
+* parallelLimit(tasks, limit, [callback])
+
+---------------------------------------
+
+<a name="whilst" />
+### whilst(test, fn, callback)
+
+Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped,
+or an error occurs.
+
+__Arguments__
+
+* `test()` - synchronous truth test to perform before each execution of `fn`.
+* `fn(callback)` - A function which is called each time `test` passes. The function is
+ passed a `callback(err)`, which must be called once it has completed with an
+ optional `err` argument.
+* `callback(err)` - A callback which is called after the test fails and repeated
+ execution of `fn` has stopped.
+
+__Example__
+
+```js
+var count = 0;
+
+async.whilst(
+ function () { return count < 5; },
+ function (callback) {
+ count++;
+ setTimeout(callback, 1000);
+ },
+ function (err) {
+ // 5 seconds have passed
+ }
+);
+```
+
+---------------------------------------
+
+<a name="doWhilst" />
+### doWhilst(fn, test, callback)
+
+The post-check version of [`whilst`](#whilst). To reflect the difference in
+the order of operations, the arguments `test` and `fn` are switched.
+
+`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
+
+---------------------------------------
+
+<a name="until" />
+### until(test, fn, callback)
+
+Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped,
+or an error occurs.
+
+The inverse of [`whilst`](#whilst).
+
+---------------------------------------
+
+<a name="doUntil" />
+### doUntil(fn, test, callback)
+
+Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`.
+
+---------------------------------------
+
+<a name="during" />
+### during(test, fn, callback)
+
+Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error.
+
+__Example__
+
+```js
+var count = 0;
+
+async.during(
+ function (callback) {
+ return callback(null, count < 5);
+ },
+ function (callback) {
+ count++;
+ setTimeout(callback, 1000);
+ },
+ function (err) {
+ // 5 seconds have passed
+ }
+);
+```
+
+---------------------------------------
+
+<a name="doDuring" />
+### doDuring(fn, test, callback)
+
+The post-check version of [`during`](#during). To reflect the difference in
+the order of operations, the arguments `test` and `fn` are switched.
+
+Also a version of [`doWhilst`](#doWhilst) with asynchronous `test` function.
+
+---------------------------------------
+
+<a name="forever" />
+### forever(fn, [errback])
+
+Calls the asynchronous function `fn` with a callback parameter that allows it to
+call itself again, in series, indefinitely.
+
+If an error is passed to the callback then `errback` is called with the
+error, and execution stops, otherwise it will never be called.
+
+```js
+async.forever(
+ function(next) {
+ // next is suitable for passing to things that need a callback(err [, whatever]);
+ // it will result in this function being called again.
+ },
+ function(err) {
+ // if next is called with a value in its first parameter, it will appear
+ // in here as 'err', and execution will stop.
+ }
+);
+```
+
+---------------------------------------
+
+<a name="waterfall" />
+### waterfall(tasks, [callback])
+
+Runs the `tasks` array of functions in series, each passing their results to the next in
+the array. However, if any of the `tasks` pass an error to their own callback, the
+next function is not executed, and the main `callback` is immediately called with
+the error.
+
+__Arguments__
+
+* `tasks` - An array of functions to run, each function is passed a
+ `callback(err, result1, result2, ...)` it must call on completion. The first
+ argument is an error (which can be `null`) and any further arguments will be
+ passed as arguments in order to the next task.
+* `callback(err, [results])` - An optional callback to run once all the functions
+ have completed. This will be passed the results of the last task's callback.
+
+
+
+__Example__
+
+```js
+async.waterfall([
+ function(callback) {
+ callback(null, 'one', 'two');
+ },
+ function(arg1, arg2, callback) {
+ // arg1 now equals 'one' and arg2 now equals 'two'
+ callback(null, 'three');
+ },
+ function(arg1, callback) {
+ // arg1 now equals 'three'
+ callback(null, 'done');
+ }
+], function (err, result) {
+ // result now equals 'done'
+});
+```
+
+---------------------------------------
+<a name="compose" />
+### compose(fn1, fn2...)
+
+Creates a function which is a composition of the passed asynchronous
+functions. Each function consumes the return value of the function that
+follows. Composing functions `f()`, `g()`, and `h()` would produce the result of
+`f(g(h()))`, only this version uses callbacks to obtain the return values.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* `functions...` - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+function add1(n, callback) {
+ setTimeout(function () {
+ callback(null, n + 1);
+ }, 10);
+}
+
+function mul3(n, callback) {
+ setTimeout(function () {
+ callback(null, n * 3);
+ }, 10);
+}
+
+var add1mul3 = async.compose(mul3, add1);
+
+add1mul3(4, function (err, result) {
+ // result now equals 15
+});
+```
+
+---------------------------------------
+<a name="seq" />
+### seq(fn1, fn2...)
+
+Version of the compose function that is more natural to read.
+Each function consumes the return value of the previous function.
+It is the equivalent of [`compose`](#compose) with the arguments reversed.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* `functions...` - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+// Requires lodash (or underscore), express3 and dresende's orm2.
+// Part of an app, that fetches cats of the logged user.
+// This example uses `seq` function to avoid overnesting and error
+// handling clutter.
+app.get('/cats', function(request, response) {
+ var User = request.models.User;
+ async.seq(
+ _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data))
+ function(user, fn) {
+ user.getCats(fn); // 'getCats' has signature (callback(err, data))
+ }
+ )(req.session.user_id, function (err, cats) {
+ if (err) {
+ console.error(err);
+ response.json({ status: 'error', message: err.message });
+ } else {
+ response.json({ status: 'ok', message: 'Cats found', data: cats });
+ }
+ });
+});
+```
+
+---------------------------------------
+<a name="applyEach" />
+### applyEach(fns, args..., callback)
+
+Applies the provided arguments to each function in the array, calling
+`callback` after all functions have completed. If you only provide the first
+argument, then it will return a function which lets you pass in the
+arguments as if it were a single function call.
+
+__Arguments__
+
+* `fns` - the asynchronous functions to all call with the same arguments
+* `args...` - any number of separate arguments to pass to the function
+* `callback` - the final argument should be the callback, called when all
+ functions have completed processing
+
+
+__Example__
+
+```js
+async.applyEach([enableSearch, updateSchema], 'bucket', callback);
+
+// partial application example:
+async.each(
+ buckets,
+ async.applyEach([enableSearch, updateSchema]),
+ callback
+);
+```
+
+__Related__
+
+* applyEachSeries(tasks, args..., [callback])
+
+---------------------------------------
+
+<a name="queue" />
+### queue(worker, [concurrency])
+
+Creates a `queue` object with the specified `concurrency`. Tasks added to the
+`queue` are processed in parallel (up to the `concurrency` limit). If all
+`worker`s are in progress, the task is queued until one becomes available.
+Once a `worker` completes a `task`, that `task`'s callback is called.
+
+__Arguments__
+
+* `worker(task, callback)` - An asynchronous function for processing a queued
+ task, which must call its `callback(err)` argument when finished, with an
+ optional `error` as an argument. If you want to handle errors from an individual task, pass a callback to `q.push()`.
+* `concurrency` - An `integer` for determining how many `worker` functions should be
+ run in parallel. If omitted, the concurrency defaults to `1`. If the concurrency is `0`, an error is thrown.
+
+__Queue objects__
+
+The `queue` object returned by this function has the following properties and
+methods:
+
+* `length()` - a function returning the number of items waiting to be processed.
+* `started` - a function returning whether or not any items have been pushed and processed by the queue
+* `running()` - a function returning the number of items currently being processed.
+* `workersList()` - a function returning the array of items currently being processed.
+* `idle()` - a function returning false if there are items waiting or being processed, or true if not.
+* `concurrency` - an integer for determining how many `worker` functions should be
+ run in parallel. This property can be changed after a `queue` is created to
+ alter the concurrency on-the-fly.
+* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once
+ the `worker` has finished processing the task. Instead of a single task, a `tasks` array
+ can be submitted. The respective callback is used for every task in the list.
+* `unshift(task, [callback])` - add a new task to the front of the `queue`.
+* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit,
+ and further tasks will be queued.
+* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`.
+* `paused` - a boolean for determining whether the queue is in a paused state
+* `pause()` - a function that pauses the processing of tasks until `resume()` is called.
+* `resume()` - a function that resumes the processing of queued tasks when the queue is paused.
+* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle.
+
+__Example__
+
+```js
+// create a queue object with concurrency 2
+
+var q = async.queue(function (task, callback) {
+ console.log('hello ' + task.name);
+ callback();
+}, 2);
+
+
+// assign a callback
+q.drain = function() {
+ console.log('all items have been processed');
+}
+
+// add some items to the queue
+
+q.push({name: 'foo'}, function (err) {
+ console.log('finished processing foo');
+});
+q.push({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
+
+// add some items to the queue (batch-wise)
+
+q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
+ console.log('finished processing item');
+});
+
+// add some items to the front of the queue
+
+q.unshift({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
+```
+
+
+---------------------------------------
+
+<a name="priorityQueue" />
+### priorityQueue(worker, concurrency)
+
+The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects:
+
+* `push(task, priority, [callback])` - `priority` should be a number. If an array of
+ `tasks` is given, all tasks will be assigned the same priority.
+* The `unshift` method was removed.
+
+---------------------------------------
+
+<a name="cargo" />
+### cargo(worker, [payload])
+
+Creates a `cargo` object with the specified payload. Tasks added to the
+cargo will be processed altogether (up to the `payload` limit). If the
+`worker` is in progress, the task is queued until it becomes available. Once
+the `worker` has completed some tasks, each callback of those tasks is called.
+Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) for how `cargo` and `queue` work.
+
+While [queue](#queue) passes only one task to one of a group of workers
+at a time, cargo passes an array of tasks to a single worker, repeating
+when the worker is finished.
+
+__Arguments__
+
+* `worker(tasks, callback)` - An asynchronous function for processing an array of
+ queued tasks, which must call its `callback(err)` argument when finished, with
+ an optional `err` argument.
+* `payload` - An optional `integer` for determining how many tasks should be
+ processed per round; if omitted, the default is unlimited.
+
+__Cargo objects__
+
+The `cargo` object returned by this function has the following properties and
+methods:
+
+* `length()` - A function returning the number of items waiting to be processed.
+* `payload` - An `integer` for determining how many tasks should be
+ process per round. This property can be changed after a `cargo` is created to
+ alter the payload on-the-fly.
+* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called
+ once the `worker` has finished processing the task. Instead of a single task, an array of `tasks`
+ can be submitted. The respective callback is used for every task in the list.
+* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued.
+* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`.
+* `idle()`, `pause()`, `resume()`, `kill()` - cargo inherits all of the same methods and event calbacks as [`queue`](#queue)
+
+__Example__
+
+```js
+// create a cargo object with payload 2
+
+var cargo = async.cargo(function (tasks, callback) {
+ for(var i=0; i<tasks.length; i++){
+ console.log('hello ' + tasks[i].name);
+ }
+ callback();
+}, 2);
+
+
+// add some items
+
+cargo.push({name: 'foo'}, function (err) {
+ console.log('finished processing foo');
+});
+cargo.push({name: 'bar'}, function (err) {
+ console.log('finished processing bar');
+});
+cargo.push({name: 'baz'}, function (err) {
+ console.log('finished processing baz');
+});
+```
+
+---------------------------------------
+
+<a name="auto" />
+### auto(tasks, [concurrency], [callback])
+
+Determines the best order for running the functions in `tasks`, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied.
+
+If any of the functions pass an error to their callback, the `auto` sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main `callback` is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far.
+
+Note, all functions are called with a `results` object as a second argument,
+so it is unsafe to pass functions in the `tasks` object which cannot handle the
+extra argument.
+
+For example, this snippet of code:
+
+```js
+async.auto({
+ readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
+}, callback);
+```
+
+will have the effect of calling `readFile` with the results object as the last
+argument, which will fail:
+
+```js
+fs.readFile('data.txt', 'utf-8', cb, {});
+```
+
+Instead, wrap the call to `readFile` in a function which does not forward the
+`results` object:
+
+```js
+async.auto({
+ readData: function(cb, results){
+ fs.readFile('data.txt', 'utf-8', cb);
+ }
+}, callback);
+```
+
+__Arguments__
+
+* `tasks` - An object. Each of its properties is either a function or an array of
+ requirements, with the function itself the last item in the array. The object's key
+ of a property serves as the name of the task defined by that property,
+ i.e. can be used when specifying requirements for other tasks.
+ The function receives two arguments: (1) a `callback(err, result)` which must be
+ called when finished, passing an `error` (which can be `null`) and the result of
+ the function's execution, and (2) a `results` object, containing the results of
+ the previously executed functions.
+* `concurrency` - An optional `integer` for determining the maximum number of tasks that can be run in parallel. By default, as many as possible.
+* `callback(err, results)` - An optional callback which is called when all the
+ tasks have been completed. It receives the `err` argument if any `tasks`
+ pass an error to their callback. Results are always returned; however, if
+ an error occurs, no further `tasks` will be performed, and the results
+ object will only contain partial results.
+
+
+__Example__
+
+```js
+async.auto({
+ get_data: function(callback){
+ console.log('in get_data');
+ // async code to get some data
+ callback(null, 'data', 'converted to array');
+ },
+ make_folder: function(callback){
+ console.log('in make_folder');
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ callback(null, 'folder');
+ },
+ write_file: ['get_data', 'make_folder', function(callback, results){
+ console.log('in write_file', JSON.stringify(results));
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
+ callback(null, 'filename');
+ }],
+ email_link: ['write_file', function(callback, results){
+ console.log('in email_link', JSON.stringify(results));
+ // once the file is written let's email a link to it...
+ // results.write_file contains the filename returned by write_file.
+ callback(null, {'file':results.write_file, 'email':'user@example.com'});
+ }]
+}, function(err, results) {
+ console.log('err = ', err);
+ console.log('results = ', results);
+});
+```
+
+This is a fairly trivial example, but to do this using the basic parallel and
+series functions would look like this:
+
+```js
+async.parallel([
+ function(callback){
+ console.log('in get_data');
+ // async code to get some data
+ callback(null, 'data', 'converted to array');
+ },
+ function(callback){
+ console.log('in make_folder');
+ // async code to create a directory to store a file in
+ // this is run at the same time as getting the data
+ callback(null, 'folder');
+ }
+],
+function(err, results){
+ async.series([
+ function(callback){
+ console.log('in write_file', JSON.stringify(results));
+ // once there is some data and the directory exists,
+ // write the data to a file in the directory
+ results.push('filename');
+ callback(null);
+ },
+ function(callback){
+ console.log('in email_link', JSON.stringify(results));
+ // once the file is written let's email a link to it...
+ callback(null, {'file':results.pop(), 'email':'user@example.com'});
+ }
+ ]);
+});
+```
+
+For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding
+new tasks much easier (and the code more readable).
+
+
+---------------------------------------
+
+<a name="retry" />
+### retry([opts = {times: 5, interval: 0}| 5], task, [callback])
+
+Attempts to get a successful response from `task` no more than `times` times before
+returning an error. If the task is successful, the `callback` will be passed the result
+of the successful task. If all attempts fail, the callback will be passed the error and
+result (if any) of the final attempt.
+
+__Arguments__
+
+* `opts` - Can be either an object with `times` and `interval` or a number. `times` is how many attempts should be made before giving up. `interval` is how long to wait inbetween attempts. Defaults to {times: 5, interval: 0}
+ * if a number is passed in it sets `times` only (with `interval` defaulting to 0).
+* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)`
+ which must be called when finished, passing `err` (which can be `null`) and the `result` of
+ the function's execution, and (2) a `results` object, containing the results of
+ the previously executed functions (if nested inside another control flow).
+* `callback(err, results)` - An optional callback which is called when the
+ task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`.
+
+The [`retry`](#retry) function can be used as a stand-alone control flow by passing a
+callback, as shown below:
+
+```js
+async.retry(3, apiMethod, function(err, result) {
+ // do something with the result
+});
+```
+
+```js
+async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
+ // do something with the result
+});
+```
+
+It can also be embedded within other control flow functions to retry individual methods
+that are not as reliable, like this:
+
+```js
+async.auto({
+ users: api.getUsers.bind(api),
+ payments: async.retry(3, api.getPayments.bind(api))
+}, function(err, results) {
+ // do something with the results
+});
+```
+
+
+---------------------------------------
+
+<a name="iterator" />
+### iterator(tasks)
+
+Creates an iterator function which calls the next function in the `tasks` array,
+returning a continuation to call the next one after that. It's also possible to
+“peek” at the next iterator with `iterator.next()`.
+
+This function is used internally by the `async` module, but can be useful when
+you want to manually control the flow of functions in series.
+
+__Arguments__
+
+* `tasks` - An array of functions to run.
+
+__Example__
+
+```js
+var iterator = async.iterator([
+ function(){ sys.p('one'); },
+ function(){ sys.p('two'); },
+ function(){ sys.p('three'); }
+]);
+
+node> var iterator2 = iterator();
+'one'
+node> var iterator3 = iterator2();
+'two'
+node> iterator3();
+'three'
+node> var nextfn = iterator2.next();
+node> nextfn();
+'three'
+```
+
+---------------------------------------
+
+<a name="apply" />
+### apply(function, arguments..)
+
+Creates a continuation function with some arguments already applied.
+
+Useful as a shorthand when combined with other control flow functions. Any arguments
+passed to the returned function are added to the arguments originally passed
+to apply.
+
+__Arguments__
+
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to automatically apply when the
+ continuation is called.
+
+__Example__
+
+```js
+// using apply
+
+async.parallel([
+ async.apply(fs.writeFile, 'testfile1', 'test1'),
+ async.apply(fs.writeFile, 'testfile2', 'test2'),
+]);
+
+
+// the same process without using apply
+
+async.parallel([
+ function(callback){
+ fs.writeFile('testfile1', 'test1', callback);
+ },
+ function(callback){
+ fs.writeFile('testfile2', 'test2', callback);
+ }
+]);
+```
+
+It's possible to pass any number of additional arguments when calling the
+continuation:
+
+```js
+node> var fn = async.apply(sys.puts, 'one');
+node> fn('two', 'three');
+one
+two
+three
+```
+
+---------------------------------------
+
+<a name="nextTick" />
+### nextTick(callback), setImmediate(callback)
+
+Calls `callback` on a later loop around the event loop. In Node.js this just
+calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)`
+if available, otherwise `setTimeout(callback, 0)`, which means other higher priority
+events may precede the execution of `callback`.
+
+This is used internally for browser-compatibility purposes.
+
+__Arguments__
+
+* `callback` - The function to call on a later loop around the event loop.
+
+__Example__
+
+```js
+var call_order = [];
+async.nextTick(function(){
+ call_order.push('two');
+ // call_order now equals ['one','two']
+});
+call_order.push('one')
+```
+
+<a name="times" />
+### times(n, iterator, [callback])
+
+Calls the `iterator` function `n` times, and accumulates results in the same manner
+you would use with [`map`](#map).
+
+__Arguments__
+
+* `n` - The number of times to run the function.
+* `iterator` - The function to call `n` times.
+* `callback` - see [`map`](#map)
+
+__Example__
+
+```js
+// Pretend this is some complicated async factory
+var createUser = function(id, callback) {
+ callback(null, {
+ id: 'user' + id
+ })
+}
+// generate 5 users
+async.times(5, function(n, next){
+ createUser(n, function(err, user) {
+ next(err, user)
+ })
+}, function(err, users) {
+ // we should now have 5 users
+});
+```
+
+__Related__
+
+* timesSeries(n, iterator, [callback])
+* timesLimit(n, limit, iterator, [callback])
+
+
+## Utils
+
+<a name="memoize" />
+### memoize(fn, [hasher])
+
+Caches the results of an `async` function. When creating a hash to store function
+results against, the callback is omitted from the hash and an optional hash
+function can be used.
+
+If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function.
+
+The cache of results is exposed as the `memo` property of the function returned
+by `memoize`.
+
+__Arguments__
+
+* `fn` - The function to proxy and cache results from.
+* `hasher` - An optional function for generating a custom hash for storing
+ results. It has all the arguments applied to it apart from the callback, and
+ must be synchronous.
+
+__Example__
+
+```js
+var slow_fn = function (name, callback) {
+ // do something
+ callback(null, result);
+};
+var fn = async.memoize(slow_fn);
+
+// fn can now be used as if it were slow_fn
+fn('some name', function () {
+ // callback
+});
+```
+
+<a name="unmemoize" />
+### unmemoize(fn)
+
+Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized
+form. Handy for testing.
+
+__Arguments__
+
+* `fn` - the memoized function
+
+---------------------------------------
+
+<a name="ensureAsync" />
+### ensureAsync(fn)
+
+Wrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (`RangeError: Maximum call stack size exceeded`) and generally keeping [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) contained.
+
+__Arguments__
+
+* `fn` - an async function, one that expects a node-style callback as its last argument
+
+Returns a wrapped function with the exact same call signature as the function passed in.
+
+__Example__
+
+```js
+function sometimesAsync(arg, callback) {
+ if (cache[arg]) {
+ return callback(null, cache[arg]); // this would be synchronous!!
+ } else {
+ doSomeIO(arg, callback); // this IO would be asynchronous
+ }
+}
+
+// this has a risk of stack overflows if many results are cached in a row
+async.mapSeries(args, sometimesAsync, done);
+
+// this will defer sometimesAsync's callback if necessary,
+// preventing stack overflows
+async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
+
+```
+
+---------------------------------------
+
+<a name="constant">
+### constant(values...)
+
+Returns a function that when called, calls-back with the values provided. Useful as the first function in a `waterfall`, or for plugging values in to `auto`.
+
+__Example__
+
+```js
+async.waterfall([
+ async.constant(42),
+ function (value, next) {
+ // value === 42
+ },
+ //...
+], callback);
+
+async.waterfall([
+ async.constant(filename, "utf8"),
+ fs.readFile,
+ function (fileData, next) {
+ //...
+ }
+ //...
+], callback);
+
+async.auto({
+ hostname: async.constant("https://server.net/"),
+ port: findFreePort,
+ launchServer: ["hostname", "port", function (cb, options) {
+ startServer(options, cb);
+ }],
+ //...
+}, callback);
+
+```
+
+---------------------------------------
+
+<a name="asyncify">
+<a name="wrapSync">
+### asyncify(func)
+
+__Alias:__ `wrapSync`
+
+Take a sync function and make it async, passing its return value to a callback. This is useful for plugging sync functions into a waterfall, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback.
+
+__Example__
+
+```js
+async.waterfall([
+ async.apply(fs.readFile, filename, "utf8"),
+ async.asyncify(JSON.parse),
+ function (data, next) {
+ // data is the result of parsing the text.
+ // If there was a parsing error, it would have been caught.
+ }
+], callback)
+```
+
+---------------------------------------
+
+<a name="log" />
+### log(function, arguments)
+
+Logs the result of an `async` function to the `console`. Only works in Node.js or
+in browsers that support `console.log` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.log` is
+called on each argument in order.
+
+__Arguments__
+
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, 'hello ' + name);
+ }, 1000);
+};
+```
+```js
+node> async.log(hello, 'world');
+'hello world'
+```
+
+---------------------------------------
+
+<a name="dir" />
+### dir(function, arguments)
+
+Logs the result of an `async` function to the `console` using `console.dir` to
+display the properties of the resulting object. Only works in Node.js or
+in browsers that support `console.dir` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.dir` is
+called on each argument in order.
+
+__Arguments__
+
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+ setTimeout(function(){
+ callback(null, {hello: name});
+ }, 1000);
+};
+```
+```js
+node> async.dir(hello, 'world');
+{hello: 'world'}
+```
+
+---------------------------------------
+
+<a name="noConflict" />
+### noConflict()
+
+Changes the value of `async` back to its original value, returning a reference to the
+`async` object.
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/dist/async.js b/node_modules/request/node_modules/form-data/node_modules/async/dist/async.js
new file mode 100644
index 000000000..888934402
--- /dev/null
+++ b/node_modules/request/node_modules/form-data/node_modules/async/dist/async.js
@@ -0,0 +1,1260 @@
+/*!
+ * async
+ * https://github.com/caolan/async
+ *
+ * Copyright 2010-2014 Caolan McMahon
+ * Released under the MIT license
+ */
+(function () {
+
+ var async = {};
+ function noop() {}
+ function identity(v) {
+ return v;
+ }
+ function toBool(v) {
+ return !!v;
+ }
+ function notId(v) {
+ return !v;
+ }
+
+ // global on the server, window in the browser
+ var previous_async;
+
+ // Establish the root object, `window` (`self`) in the browser, `global`
+ // on the server, or `this` in some virtual machines. We use `self`
+ // instead of `window` for `WebWorker` support.
+ var root = typeof self === 'object' && self.self === self && self ||
+ typeof global === 'object' && global.global === global && global ||
+ this;
+
+ if (root != null) {
+ previous_async = root.async;
+ }
+
+ async.noConflict = function () {
+ root.async = previous_async;
+ return async;
+ };
+
+ function only_once(fn) {
+ return function() {
+ if (fn === null) throw new Error("Callback was already called.");
+ fn.apply(this, arguments);
+ fn = null;
+ };
+ }
+
+ function _once(fn) {
+ return function() {
+ if (fn === null) return;
+ fn.apply(this, arguments);
+ fn = null;
+ };
+ }
+
+ //// cross-browser compatiblity functions ////
+
+ var _toString = Object.prototype.toString;
+
+ var _isArray = Array.isArray || function (obj) {
+ return _toString.call(obj) === '[object Array]';
+ };
+
+ // Ported from underscore.js isObject
+ var _isObject = function(obj) {
+ var type = typeof obj;
+ return type === 'function' || type === 'object' && !!obj;
+ };
+
+ function _isArrayLike(arr) {
+ return _isArray(arr) || (
+ // has a positive integer length property
+ typeof arr.length === "number" &&
+ arr.length >= 0 &&
+ arr.length % 1 === 0
+ );
+ }
+
+ function _arrayEach(arr, iterator) {
+ var index = -1,
+ length = arr.length;
+
+ while (++index < length) {
+ iterator(arr[index], index, arr);
+ }
+ }
+
+ function _map(arr, iterator) {
+ var index = -1,
+ length = arr.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = iterator(arr[index], index, arr);
+ }
+ return result;
+ }
+
+ function _range(count) {
+ return _map(Array(count), function (v, i) { return i; });
+ }
+
+ function _reduce(arr, iterator, memo) {
+ _arrayEach(arr, function (x, i, a) {
+ memo = iterator(memo, x, i, a);
+ });
+ return memo;
+ }
+
+ function _forEachOf(object, iterator) {
+ _arrayEach(_keys(object), function (key) {
+ iterator(object[key], key);
+ });
+ }
+
+ function _indexOf(arr, item) {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] === item) return i;
+ }
+ return -1;
+ }
+
+ var _keys = Object.keys || function (obj) {
+ var keys = [];
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ keys.push(k);
+ }
+ }
+ return keys;
+ };
+
+ function _keyIterator(coll) {
+ var i = -1;
+ var len;
+ var keys;
+ if (_isArrayLike(coll)) {
+ len = coll.length;
+ return function next() {
+ i++;
+ return i < len ? i : null;
+ };
+ } else {
+ keys = _keys(coll);
+ len = keys.length;
+ return function next() {
+ i++;
+ return i < len ? keys[i] : null;
+ };
+ }
+ }
+
+ // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html)
+ // This accumulates the arguments passed into an array, after a given index.
+ // From underscore.js (https://github.com/jashkenas/underscore/pull/2140).
+ function _restParam(func, startIndex) {
+ startIndex = startIndex == null ? func.length - 1 : +startIndex;
+ return function() {
+ var length = Math.max(arguments.length - startIndex, 0);
+ var rest = Array(length);
+ for (var index = 0; index < length; index++) {
+ rest[index] = arguments[index + startIndex];
+ }
+ switch (startIndex) {
+ case 0: return func.call(this, rest);
+ case 1: return func.call(this, arguments[0], rest);
+ }
+ // Currently unused but handle cases outside of the switch statement:
+ // var args = Array(startIndex + 1);
+ // for (index = 0; index < startIndex; index++) {
+ // args[index] = arguments[index];
+ // }
+ // args[startIndex] = rest;
+ // return func.apply(this, args);
+ };
+ }
+
+ function _withoutIndex(iterator) {
+ return function (value, index, callback) {
+ return iterator(value, callback);
+ };
+ }
+
+ //// exported async module functions ////
+
+ //// nextTick implementation with browser-compatible fallback ////
+
+ // capture the global reference to guard against fakeTimer mocks
+ var _setImmediate = typeof setImmediate === 'function' && setImmediate;
+
+ var _delay = _setImmediate ? function(fn) {
+ // not a direct alias for IE10 compatibility
+ _setImmediate(fn);
+ } : function(fn) {
+ setTimeout(fn, 0);
+ };
+
+ if (typeof process === 'object' && typeof process.nextTick === 'function') {
+ async.nextTick = process.nextTick;
+ } else {
+ async.nextTick = _delay;
+ }
+ async.setImmediate = _setImmediate ? _delay : async.nextTick;
+
+
+ async.forEach =
+ async.each = function (arr, iterator, callback) {
+ return async.eachOf(arr, _withoutIndex(iterator), callback);
+ };
+
+ async.forEachSeries =
+ async.eachSeries = function (arr, iterator, callback) {
+ return async.eachOfSeries(arr, _withoutIndex(iterator), callback);
+ };
+
+
+ async.forEachLimit =
+ async.eachLimit = function (arr, limit, iterator, callback) {
+ return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback);
+ };
+
+ async.forEachOf =
+ async.eachOf = function (object, iterator, callback) {
+ callback = _once(callback || noop);
+ object = object || [];
+
+ var iter = _keyIterator(object);
+ var key, completed = 0;
+
+ while ((key = iter()) != null) {
+ completed += 1;
+ iterator(object[key], key, only_once(done));
+ }
+
+ if (completed === 0) callback(null);
+
+ function done(err) {
+ completed--;
+ if (err) {
+ callback(err);
+ }
+ // Check key is null in case iterator isn't exhausted
+ // and done resolved synchronously.
+ else if (key === null && completed <= 0) {
+ callback(null);
+ }
+ }
+ };
+
+ async.forEachOfSeries =
+ async.eachOfSeries = function (obj, iterator, callback) {
+ callback = _once(callback || noop);
+ obj = obj || [];
+ var nextKey = _keyIterator(obj);
+ var key = nextKey();
+ function iterate() {
+ var sync = true;
+ if (key === null) {
+ return callback(null);
+ }
+ iterator(obj[key], key, only_once(function (err) {
+ if (err) {
+ callback(err);
+ }
+ else {
+ key = nextKey();
+ if (key === null) {
+ return callback(null);
+ } else {
+ if (sync) {
+ async.setImmediate(iterate);
+ } else {
+ iterate();
+ }
+ }
+ }
+ }));
+ sync = false;
+ }
+ iterate();
+ };
+
+
+
+ async.forEachOfLimit =
+ async.eachOfLimit = function (obj, limit, iterator, callback) {
+ _eachOfLimit(limit)(obj, iterator, callback);
+ };
+
+ function _eachOfLimit(limit) {
+
+ return function (obj, iterator, callback) {
+ callback = _once(callback || noop);
+ obj = obj || [];
+ var nextKey = _keyIterator(obj);
+ if (limit <= 0) {
+ return callback(null);
+ }
+ var done = false;
+ var running = 0;
+ var errored = false;
+
+ (function replenish () {
+ if (done && running <= 0) {
+ return callback(null);
+ }
+
+ while (running < limit && !errored) {
+ var key = nextKey();
+ if (key === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
+ }
+ running += 1;
+ iterator(obj[key], key, only_once(function (err) {
+ running -= 1;
+ if (err) {
+ callback(err);
+ errored = true;
+ }
+ else {
+ replenish();
+ }
+ }));
+ }
+ })();
+ };
+ }
+
+
+ function doParallel(fn) {
+ return function (obj, iterator, callback) {
+ return fn(async.eachOf, obj, iterator, callback);
+ };
+ }
+ function doParallelLimit(fn) {
+ return function (obj, limit, iterator, callback) {
+ return fn(_eachOfLimit(limit), obj, iterator, callback);
+ };
+ }
+ function doSeries(fn) {
+ return function (obj, iterator, callback) {
+ return fn(async.eachOfSeries, obj, iterator, callback);
+ };
+ }
+
+ function _asyncMap(eachfn, arr, iterator, callback) {
+ callback = _once(callback || noop);
+ arr = arr || [];
+ var results = _isArrayLike(arr) ? [] : {};
+ eachfn(arr, function (value, index, callback) {
+ iterator(value, function (err, v) {
+ results[index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+
+ async.map = doParallel(_asyncMap);
+ async.mapSeries = doSeries(_asyncMap);
+ async.mapLimit = doParallelLimit(_asyncMap);
+
+ // reduce only has a series version, as doing reduce in parallel won't
+ // work in many situations.
+ async.inject =
+ async.foldl =
+ async.reduce = function (arr, memo, iterator, callback) {
+ async.eachOfSeries(arr, function (x, i, callback) {
+ iterator(memo, x, function (err, v) {
+ memo = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, memo);
+ });
+ };
+
+ async.foldr =
+ async.reduceRight = function (arr, memo, iterator, callback) {
+ var reversed = _map(arr, identity).reverse();
+ async.reduce(reversed, memo, iterator, callback);
+ };
+
+ async.transform = function (arr, memo, iterator, callback) {
+ if (arguments.length === 3) {
+ callback = iterator;
+ iterator = memo;
+ memo = _isArray(arr) ? [] : {};
+ }
+
+ async.eachOf(arr, function(v, k, cb) {
+ iterator(memo, v, k, cb);
+ }, function(err) {
+ callback(err, memo);
+ });
+ };
+
+ function _filter(eachfn, arr, iterator, callback) {
+ var results = [];
+ eachfn(arr, function (x, index, callback) {
+ iterator(x, function (v) {
+ if (v) {
+ results.push({index: index, value: x});
+ }
+ callback();
+ });
+ }, function () {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ }
+
+ async.select =
+ async.filter = doParallel(_filter);
+
+ async.selectLimit =
+ async.filterLimit = doParallelLimit(_filter);
+
+ async.selectSeries =
+ async.filterSeries = doSeries(_filter);
+
+ function _reject(eachfn, arr, iterator, callback) {
+ _filter(eachfn, arr, function(value, cb) {
+ iterator(value, function(v) {
+ cb(!v);
+ });
+ }, callback);
+ }
+ async.reject = doParallel(_reject);
+ async.rejectLimit = doParallelLimit(_reject);
+ async.rejectSeries = doSeries(_reject);
+
+ function _createTester(eachfn, check, getResult) {
+ return function(arr, limit, iterator, cb) {
+ function done() {
+ if (cb) cb(getResult(false, void 0));
+ }
+ function iteratee(x, _, callback) {
+ if (!cb) return callback();
+ iterator(x, function (v) {
+ if (cb && check(v)) {
+ cb(getResult(true, x));
+ cb = iterator = false;
+ }
+ callback();
+ });
+ }
+ if (arguments.length > 3) {
+ eachfn(arr, limit, iteratee, done);
+ } else {
+ cb = iterator;
+ iterator = limit;
+ eachfn(arr, iteratee, done);
+ }
+ };
+ }
+
+ async.any =
+ async.some = _createTester(async.eachOf, toBool, identity);
+
+ async.someLimit = _createTester(async.eachOfLimit, toBool, identity);
+
+ async.all =
+ async.every = _createTester(async.eachOf, notId, notId);
+
+ async.everyLimit = _createTester(async.eachOfLimit, notId, notId);
+
+ function _findGetResult(v, x) {
+ return x;
+ }
+ async.detect = _createTester(async.eachOf, identity, _findGetResult);
+ async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult);
+ async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult);
+
+ async.sortBy = function (arr, iterator, callback) {
+ async.map(arr, function (x, callback) {
+ iterator(x, function (err, criteria) {
+ if (err) {
+ callback(err);
+ }
+ else {
+ callback(null, {value: x, criteria: criteria});
+ }
+ });
+ }, function (err, results) {
+ if (err) {
+ return callback(err);
+ }
+ else {
+ callback(null, _map(results.sort(comparator), function (x) {
+ return x.value;
+ }));
+ }
+
+ });
+
+ function comparator(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }
+ };
+
+ async.auto = function (tasks, concurrency, callback) {
+ if (!callback) {
+ // concurrency is optional, shift the args.
+ callback = concurrency;
+ concurrency = null;
+ }
+ callback = _once(callback || noop);
+ var keys = _keys(tasks);
+ var remainingTasks = keys.length;
+ if (!remainingTasks) {
+ return callback(null);
+ }
+ if (!concurrency) {
+ concurrency = remainingTasks;
+ }
+
+ var results = {};
+ var runningTasks = 0;
+
+ var listeners = [];
+ function addListener(fn) {
+ listeners.unshift(fn);
+ }
+ function removeListener(fn) {
+ var idx = _indexOf(listeners, fn);
+ if (idx >= 0) listeners.splice(idx, 1);
+ }
+ function taskComplete() {
+ remainingTasks--;
+ _arrayEach(listeners.slice(0), function (fn) {
+ fn();
+ });
+ }
+
+ addListener(function () {
+ if (!remainingTasks) {
+ callback(null, results);
+ }
+ });
+
+ _arrayEach(keys, function (k) {
+ var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];
+ var taskCallback = _restParam(function(err, args) {
+ runningTasks--;
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ if (err) {
+ var safeResults = {};
+ _forEachOf(results, function(val, rkey) {
+ safeResults[rkey] = val;
+ });
+ safeResults[k] = args;
+ callback(err, safeResults);
+ }
+ else {
+ results[k] = args;
+ async.setImmediate(taskComplete);
+ }
+ });
+ var requires = task.slice(0, task.length - 1);
+ // prevent dead-locks
+ var len = requires.length;
+ var dep;
+ while (len--) {
+ if (!(dep = tasks[requires[len]])) {
+ throw new Error('Has inexistant dependency');
+ }
+ if (_isArray(dep) && _indexOf(dep, k) >= 0) {
+ throw new Error('Has cyclic dependencies');
+ }
+ }
+ function ready() {
+ return runningTasks < concurrency && _reduce(requires, function (a, x) {
+ return (a && results.hasOwnProperty(x));
+ }, true) && !results.hasOwnProperty(k);
+ }
+ if (ready()) {
+ runningTasks++;
+ task[task.length - 1](taskCallback, results);
+ }
+ else {
+ addListener(listener);
+ }
+ function listener() {
+ if (ready()) {
+ runningTasks++;
+ removeListener(listener);
+ task[task.length - 1](taskCallback, results);
+ }
+ }
+ });
+ };
+
+
+
+ async.retry = function(times, task, callback) {
+ var DEFAULT_TIMES = 5;
+ var DEFAULT_INTERVAL = 0;
+
+ var attempts = [];
+
+ var opts = {
+ times: DEFAULT_TIMES,
+ interval: DEFAULT_INTERVAL
+ };
+
+ function parseTimes(acc, t){
+ if(typeof t === 'number'){
+ acc.times = parseInt(t, 10) || DEFAULT_TIMES;
+ } else if(typeof t === 'object'){
+ acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
+ acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
+ } else {
+ throw new Error('Unsupported argument type for \'times\': ' + typeof t);
+ }
+ }
+
+ var length = arguments.length;
+ if (length < 1 || length > 3) {
+ throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
+ } else if (length <= 2 && typeof times === 'function') {
+ callback = task;
+ task = times;
+ }
+ if (typeof times !== 'function') {
+ parseTimes(opts, times);
+ }
+ opts.callback = callback;
+ opts.task = task;
+
+ function wrappedTask(wrappedCallback, wrappedResults) {
+ function retryAttempt(task, finalAttempt) {
+ return function(seriesCallback) {
+ task(function(err, result){
+ seriesCallback(!err || finalAttempt, {err: err, result: result});
+ }, wrappedResults);
+ };
+ }
+
+ function retryInterval(interval){
+ return function(seriesCallback){
+ setTimeout(function(){
+ seriesCallback(null);
+ }, interval);
+ };
+ }
+
+ while (opts.times) {
+
+ var finalAttempt = !(opts.times-=1);
+ attempts.push(retryAttempt(opts.task, finalAttempt));
+ if(!finalAttempt && opts.interval > 0){
+ attempts.push(retryInterval(opts.interval));
+ }
+ }
+
+ async.series(attempts, function(done, data){
+ data = data[data.length - 1];
+ (wrappedCallback || opts.callback)(data.err, data.result);
+ });
+ }
+
+ // If a callback is passed, run this as a controll flow
+ return opts.callback ? wrappedTask() : wrappedTask;
+ };
+
+ async.waterfall = function (tasks, callback) {
+ callback = _once(callback || noop);
+ if (!_isArray(tasks)) {
+ var err = new Error('First argument to waterfall must be an array of functions');
+ return callback(err);
+ }
+ if (!tasks.length) {
+ return callback();
+ }
+ function wrapIterator(iterator) {
+ return _restParam(function (err, args) {
+ if (err) {
+ callback.apply(null, [err].concat(args));
+ }
+ else {
+ var next = iterator.next();
+ if (next) {
+ args.push(wrapIterator(next));
+ }
+ else {
+ args.push(callback);
+ }
+ ensureAsync(iterator).apply(null, args);
+ }
+ });
+ }
+ wrapIterator(async.iterator(tasks))();
+ };
+
+ function _parallel(eachfn, tasks, callback) {
+ callback = callback || noop;
+ var results = _isArrayLike(tasks) ? [] : {};
+
+ eachfn(tasks, function (task, key, callback) {
+ task(_restParam(function (err, args) {
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[key] = args;
+ callback(err);
+ }));
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+
+ async.parallel = function (tasks, callback) {
+ _parallel(async.eachOf, tasks, callback);
+ };
+
+ async.parallelLimit = function(tasks, limit, callback) {
+ _parallel(_eachOfLimit(limit), tasks, callback);
+ };
+
+ async.series = function(tasks, callback) {
+ _parallel(async.eachOfSeries, tasks, callback);
+ };
+
+ async.iterator = function (tasks) {
+ function makeCallback(index) {
+ function fn() {
+ if (tasks.length) {
+ tasks[index].apply(null, arguments);
+ }
+ return fn.next();
+ }
+ fn.next = function () {
+ return (index < tasks.length - 1) ? makeCallback(index + 1): null;
+ };
+ return fn;
+ }
+ return makeCallback(0);
+ };
+
+ async.apply = _restParam(function (fn, args) {
+ return _restParam(function (callArgs) {
+ return fn.apply(
+ null, args.concat(callArgs)
+ );
+ });
+ });
+
+ function _concat(eachfn, arr, fn, callback) {
+ var result = [];
+ eachfn(arr, function (x, index, cb) {
+ fn(x, function (err, y) {
+ result = result.concat(y || []);
+ cb(err);
+ });
+ }, function (err) {
+ callback(err, result);
+ });
+ }
+ async.concat = doParallel(_concat);
+ async.concatSeries = doSeries(_concat);
+
+ async.whilst = function (test, iterator, callback) {
+ callback = callback || noop;
+ if (test()) {
+ var next = _restParam(function(err, args) {
+ if (err) {
+ callback(err);
+ } else if (test.apply(this, args)) {
+ iterator(next);
+ } else {
+ callback(null);
+ }
+ });
+ iterator(next);
+ } else {
+ callback(null);
+ }
+ };
+
+ async.doWhilst = function (iterator, test, callback) {
+ var calls = 0;
+ return async.whilst(function() {
+ return ++calls <= 1 || test.apply(this, arguments);
+ }, iterator, callback);
+ };
+
+ async.until = function (test, iterator, callback) {
+ return async.whilst(function() {
+ return !test.apply(this, arguments);
+ }, iterator, callback);
+ };
+
+ async.doUntil = function (iterator, test, callback) {
+ return async.doWhilst(iterator, function() {
+ return !test.apply(this, arguments);
+ }, callback);
+ };
+
+ async.during = function (test, iterator, callback) {
+ callback = callback || noop;
+
+ var next = _restParam(function(err, args) {
+ if (err) {
+ callback(err);
+ } else {
+ args.push(check);
+ test.apply(this, args);
+ }
+ });
+
+ var check = function(err, truth) {
+ if (err) {
+ callback(err);
+ } else if (truth) {
+ iterator(next);
+ } else {
+ callback(null);
+ }
+ };
+
+ test(check);
+ };
+
+ async.doDuring = function (iterator, test, callback) {
+ var calls = 0;
+ async.during(function(next) {
+ if (calls++ < 1) {
+ next(null, true);
+ } else {
+ test.apply(this, arguments);
+ }
+ }, iterator, callback);
+ };
+
+ function _queue(worker, concurrency, payload) {
+ if (concurrency == null) {
+ concurrency = 1;
+ }
+ else if(concurrency === 0) {
+ throw new Error('Concurrency must not be zero');
+ }
+ function _insert(q, data, pos, callback) {
+ if (callback != null && typeof callback !== "function") {
+ throw new Error("task callback must be a function");
+ }
+ q.started = true;
+ if (!_isArray(data)) {
+ data = [data];
+ }
+ if(data.length === 0 && q.idle()) {
+ // call drain immediately if there are no tasks
+ return async.setImmediate(function() {
+ q.drain();
+ });
+ }
+ _arrayEach(data, function(task) {
+ var item = {
+ data: task,
+ callback: callback || noop
+ };
+
+ if (pos) {
+ q.tasks.unshift(item);
+ } else {
+ q.tasks.push(item);
+ }
+
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
+ });
+ async.setImmediate(q.process);
+ }
+ function _next(q, tasks) {
+ return function(){
+ workers -= 1;
+
+ var removed = false;
+ var args = arguments;
+ _arrayEach(tasks, function (task) {
+ _arrayEach(workersList, function (worker, index) {
+ if (worker === task && !removed) {
+ workersList.splice(index, 1);
+ removed = true;
+ }
+ });
+
+ task.callback.apply(task, args);
+ });
+ if (q.tasks.length + workers === 0) {
+ q.drain();
+ }
+ q.process();
+ };
+ }
+
+ var workers = 0;
+ var workersList = [];
+ var q = {
+ tasks: [],
+ concurrency: concurrency,
+ payload: payload,
+ saturated: noop,
+ empty: noop,
+ drain: noop,
+ started: false,
+ paused: false,
+ push: function (data, callback) {
+ _insert(q, data, false, callback);
+ },
+ kill: function () {
+ q.drain = noop;
+ q.tasks = [];
+ },
+ unshift: function (data, callback) {
+ _insert(q, data, true, callback);
+ },
+ process: function () {
+ if (!q.paused && workers < q.concurrency && q.tasks.length) {
+ while(workers < q.concurrency && q.tasks.length){
+ var tasks = q.payload ?
+ q.tasks.splice(0, q.payload) :
+ q.tasks.splice(0, q.tasks.length);
+
+ var data = _map(tasks, function (task) {
+ return task.data;
+ });
+
+ if (q.tasks.length === 0) {
+ q.empty();
+ }
+ workers += 1;
+ workersList.push(tasks[0]);
+ var cb = only_once(_next(q, tasks));
+ worker(data, cb);
+ }
+ }
+ },
+ length: function () {
+ return q.tasks.length;
+ },
+ running: function () {
+ return workers;
+ },
+ workersList: function () {
+ return workersList;
+ },
+ idle: function() {
+ return q.tasks.length + workers === 0;
+ },
+ pause: function () {
+ q.paused = true;
+ },
+ resume: function () {
+ if (q.paused === false) { return; }
+ q.paused = false;
+ var resumeCount = Math.min(q.concurrency, q.tasks.length);
+ // Need to call q.process once per concurrent
+ // worker to preserve full concurrency after pause
+ for (var w = 1; w <= resumeCount; w++) {
+ async.setImmediate(q.process);
+ }
+ }
+ };
+ return q;
+ }
+
+ async.queue = function (worker, concurrency) {
+ var q = _queue(function (items, cb) {
+ worker(items[0], cb);
+ }, concurrency, 1);
+
+ return q;
+ };
+
+ async.priorityQueue = function (worker, concurrency) {
+
+ function _compareTasks(a, b){
+ return a.priority - b.priority;
+ }
+
+ function _binarySearch(sequence, item, compare) {
+ var beg = -1,
+ end = sequence.length - 1;
+ while (beg < end) {
+ var mid = beg + ((end - beg + 1) >>> 1);
+ if (compare(item, sequence[mid]) >= 0) {
+ beg = mid;
+ } else {
+ end = mid - 1;
+ }
+ }
+ return beg;
+ }
+
+ function _insert(q, data, priority, callback) {
+ if (callback != null && typeof callback !== "function") {
+ throw new Error("task callback must be a function");
+ }
+ q.started = true;
+ if (!_isArray(data)) {
+ data = [data];
+ }
+ if(data.length === 0) {
+ // call drain immediately if there are no tasks
+ return async.setImmediate(function() {
+ q.drain();
+ });
+ }
+ _arrayEach(data, function(task) {
+ var item = {
+ data: task,
+ priority: priority,
+ callback: typeof callback === 'function' ? callback : noop
+ };
+
+ q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
+
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
+ async.setImmediate(q.process);
+ });
+ }
+
+ // Start with a normal queue
+ var q = async.queue(worker, concurrency);
+
+ // Override push to accept second parameter representing priority
+ q.push = function (data, priority, callback) {
+ _insert(q, data, priority, callback);
+ };
+
+ // Remove unshift function
+ delete q.unshift;
+
+ return q;
+ };
+
+ async.cargo = function (worker, payload) {
+ return _queue(worker, 1, payload);
+ };
+
+ function _console_fn(name) {
+ return _restParam(function (fn, args) {
+ fn.apply(null, args.concat([_restParam(function (err, args) {
+ if (typeof console === 'object') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ }
+ else if (console[name]) {
+ _arrayEach(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ })]));
+ });
+ }
+ async.log = _console_fn('log');
+ async.dir = _console_fn('dir');
+ /*async.info = _console_fn('info');
+ async.warn = _console_fn('warn');
+ async.error = _console_fn('error');*/
+
+ async.memoize = function (fn, hasher) {
+ var memo = {};
+ var queues = {};
+ hasher = hasher || identity;
+ var memoized = _restParam(function memoized(args) {
+ var callback = args.pop();
+ var key = hasher.apply(null, args);
+ if (key in memo) {
+ async.setImmediate(function () {
+ callback.apply(null, memo[key]);
+ });
+ }
+ else if (key in queues) {
+ queues[key].push(callback);
+ }
+ else {
+ queues[key] = [callback];
+ fn.apply(null, args.concat([_restParam(function (args) {
+ memo[key] = args;
+ var q = queues[key];
+ delete queues[key];
+ for (var i = 0, l = q.length; i < l; i++) {
+ q[i].apply(null, args);
+ }
+ })]));
+ }
+ });
+ memoized.memo = memo;
+ memoized.unmemoized = fn;
+ return memoized;
+ };
+
+ async.unmemoize = function (fn) {
+ return function () {
+ return (fn.unmemoized || fn).apply(null, arguments);
+ };
+ };
+
+ function _times(mapper) {
+ return function (count, iterator, callback) {
+ mapper(_range(count), iterator, callback);
+ };
+ }
+
+ async.times = _times(async.map);
+ async.timesSeries = _times(async.mapSeries);
+ async.timesLimit = function (count, limit, iterator, callback) {
+ return async.mapLimit(_range(count), limit, iterator, callback);
+ };
+
+ async.seq = function (/* functions... */) {
+ var fns = arguments;
+ return _restParam(function (args) {
+ var that = this;
+
+ var callback = args[args.length - 1];
+ if (typeof callback == 'function') {
+ args.pop();
+ } else {
+ callback = noop;
+ }
+
+ async.reduce(fns, args, function (newargs, fn, cb) {
+ fn.apply(that, newargs.concat([_restParam(function (err, nextargs) {
+ cb(err, nextargs);
+ })]));
+ },
+ function (err, results) {
+ callback.apply(that, [err].concat(results));
+ });
+ });
+ };
+
+ async.compose = function (/* functions... */) {
+ return async.seq.apply(null, Array.prototype.reverse.call(arguments));
+ };
+
+
+ function _applyEach(eachfn) {
+ return _restParam(function(fns, args) {
+ var go = _restParam(function(args) {
+ var that = this;
+ var callback = args.pop();
+ return eachfn(fns, function (fn, _, cb) {
+ fn.apply(that, args.concat([cb]));
+ },
+ callback);
+ });
+ if (args.length) {
+ return go.apply(this, args);
+ }
+ else {
+ return go;
+ }
+ });
+ }
+
+ async.applyEach = _applyEach(async.eachOf);
+ async.applyEachSeries = _applyEach(async.eachOfSeries);
+
+
+ async.forever = function (fn, callback) {
+ var done = only_once(callback || noop);
+ var task = ensureAsync(fn);
+ function next(err) {
+ if (err) {
+ return done(err);
+ }
+ task(next);
+ }
+ next();
+ };
+
+ function ensureAsync(fn) {
+ return _restParam(function (args) {
+ var callback = args.pop();
+ args.push(function () {
+ var innerArgs = arguments;
+ if (sync) {
+ async.setImmediate(function () {
+ callback.apply(null, innerArgs);
+ });
+ } else {
+ callback.apply(null, innerArgs);
+ }
+ });
+ var sync = true;
+ fn.apply(this, args);
+ sync = false;
+ });
+ }
+
+ async.ensureAsync = ensureAsync;
+
+ async.constant = _restParam(function(values) {
+ var args = [null].concat(values);
+ return function (callback) {
+ return callback.apply(this, args);
+ };
+ });
+
+ async.wrapSync =
+ async.asyncify = function asyncify(func) {
+ return _restParam(function (args) {
+ var callback = args.pop();
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ // if result is Promise object
+ if (_isObject(result) && typeof result.then === "function") {
+ result.then(function(value) {
+ callback(null, value);
+ })["catch"](function(err) {
+ callback(err.message ? err : new Error(err));
+ });
+ } else {
+ callback(null, result);
+ }
+ });
+ };
+
+ // Node.js
+ if (typeof module === 'object' && module.exports) {
+ module.exports = async;
+ }
+ // AMD / RequireJS
+ else if (typeof define === 'function' && define.amd) {
+ define([], function () {
+ return async;
+ });
+ }
+ // included directly via <script> tag
+ else {
+ root.async = async;
+ }
+
+}());
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js b/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js
new file mode 100644
index 000000000..b947fc489
--- /dev/null
+++ b/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js
@@ -0,0 +1,2 @@
+!function(){function n(){}function t(n){return n}function e(n){return!!n}function r(n){return!n}function u(n){return function(){if(null===n)throw new Error("Callback was already called.");n.apply(this,arguments),n=null}}function i(n){return function(){null!==n&&(n.apply(this,arguments),n=null)}}function o(n){return M(n)||"number"==typeof n.length&&n.length>=0&&n.length%1===0}function c(n,t){for(var e=-1,r=n.length;++e<r;)t(n[e],e,n)}function a(n,t){for(var e=-1,r=n.length,u=Array(r);++e<r;)u[e]=t(n[e],e,n);return u}function f(n){return a(Array(n),function(n,t){return t})}function l(n,t,e){return c(n,function(n,r,u){e=t(e,n,r,u)}),e}function s(n,t){c(W(n),function(e){t(n[e],e)})}function p(n,t){for(var e=0;e<n.length;e++)if(n[e]===t)return e;return-1}function h(n){var t,e,r=-1;return o(n)?(t=n.length,function(){return r++,t>r?r:null}):(e=W(n),t=e.length,function(){return r++,t>r?e[r]:null})}function m(n,t){return t=null==t?n.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),u=0;e>u;u++)r[u]=arguments[u+t];switch(t){case 0:return n.call(this,r);case 1:return n.call(this,arguments[0],r)}}}function y(n){return function(t,e,r){return n(t,r)}}function v(t){return function(e,r,o){o=i(o||n),e=e||[];var c=h(e);if(0>=t)return o(null);var a=!1,f=0,l=!1;!function s(){if(a&&0>=f)return o(null);for(;t>f&&!l;){var n=c();if(null===n)return a=!0,void(0>=f&&o(null));f+=1,r(e[n],n,u(function(n){f-=1,n?(o(n),l=!0):s()}))}}()}}function d(n){return function(t,e,r){return n(C.eachOf,t,e,r)}}function g(n){return function(t,e,r,u){return n(v(e),t,r,u)}}function k(n){return function(t,e,r){return n(C.eachOfSeries,t,e,r)}}function b(t,e,r,u){u=i(u||n),e=e||[];var c=o(e)?[]:{};t(e,function(n,t,e){r(n,function(n,r){c[t]=r,e(n)})},function(n){u(n,c)})}function w(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(e){e&&u.push({index:t,value:n}),r()})},function(){r(a(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})}function O(n,t,e,r){w(n,t,function(n,t){e(n,function(n){t(!n)})},r)}function S(n,t,e){return function(r,u,i,o){function c(){o&&o(e(!1,void 0))}function a(n,r,u){return o?void i(n,function(r){o&&t(r)&&(o(e(!0,n)),o=i=!1),u()}):u()}arguments.length>3?n(r,u,a,c):(o=i,i=u,n(r,a,c))}}function E(n,t){return t}function L(t,e,r){r=r||n;var u=o(e)?[]:{};t(e,function(n,t,e){n(m(function(n,r){r.length<=1&&(r=r[0]),u[t]=r,e(n)}))},function(n){r(n,u)})}function I(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(n,t){u=u.concat(t||[]),r(n)})},function(n){r(n,u)})}function x(t,e,r){function i(t,e,r,u){if(null!=u&&"function"!=typeof u)throw new Error("task callback must be a function");return t.started=!0,M(e)||(e=[e]),0===e.length&&t.idle()?C.setImmediate(function(){t.drain()}):(c(e,function(e){var i={data:e,callback:u||n};r?t.tasks.unshift(i):t.tasks.push(i),t.tasks.length===t.concurrency&&t.saturated()}),void C.setImmediate(t.process))}function o(n,t){return function(){f-=1;var e=!1,r=arguments;c(t,function(n){c(l,function(t,r){t!==n||e||(l.splice(r,1),e=!0)}),n.callback.apply(n,r)}),n.tasks.length+f===0&&n.drain(),n.process()}}if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var f=0,l=[],s={tasks:[],concurrency:e,payload:r,saturated:n,empty:n,drain:n,started:!1,paused:!1,push:function(n,t){i(s,n,!1,t)},kill:function(){s.drain=n,s.tasks=[]},unshift:function(n,t){i(s,n,!0,t)},process:function(){if(!s.paused&&f<s.concurrency&&s.tasks.length)for(;f<s.concurrency&&s.tasks.length;){var n=s.payload?s.tasks.splice(0,s.payload):s.tasks.splice(0,s.tasks.length),e=a(n,function(n){return n.data});0===s.tasks.length&&s.empty(),f+=1,l.push(n[0]);var r=u(o(s,n));t(e,r)}},length:function(){return s.tasks.length},running:function(){return f},workersList:function(){return l},idle:function(){return s.tasks.length+f===0},pause:function(){s.paused=!0},resume:function(){if(s.paused!==!1){s.paused=!1;for(var n=Math.min(s.concurrency,s.tasks.length),t=1;n>=t;t++)C.setImmediate(s.process)}}};return s}function j(n){return m(function(t,e){t.apply(null,e.concat([m(function(t,e){"object"==typeof console&&(t?console.error&&console.error(t):console[n]&&c(e,function(t){console[n](t)}))})]))})}function A(n){return function(t,e,r){n(f(t),e,r)}}function T(n){return m(function(t,e){var r=m(function(e){var r=this,u=e.pop();return n(t,function(n,t,u){n.apply(r,e.concat([u]))},u)});return e.length?r.apply(this,e):r})}function z(n){return m(function(t){var e=t.pop();t.push(function(){var n=arguments;r?C.setImmediate(function(){e.apply(null,n)}):e.apply(null,n)});var r=!0;n.apply(this,t),r=!1})}var q,C={},P="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this;null!=P&&(q=P.async),C.noConflict=function(){return P.async=q,C};var H=Object.prototype.toString,M=Array.isArray||function(n){return"[object Array]"===H.call(n)},U=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},W=Object.keys||function(n){var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t},B="function"==typeof setImmediate&&setImmediate,D=B?function(n){B(n)}:function(n){setTimeout(n,0)};"object"==typeof process&&"function"==typeof process.nextTick?C.nextTick=process.nextTick:C.nextTick=D,C.setImmediate=B?D:C.nextTick,C.forEach=C.each=function(n,t,e){return C.eachOf(n,y(t),e)},C.forEachSeries=C.eachSeries=function(n,t,e){return C.eachOfSeries(n,y(t),e)},C.forEachLimit=C.eachLimit=function(n,t,e,r){return v(t)(n,y(e),r)},C.forEachOf=C.eachOf=function(t,e,r){function o(n){f--,n?r(n):null===c&&0>=f&&r(null)}r=i(r||n),t=t||[];for(var c,a=h(t),f=0;null!=(c=a());)f+=1,e(t[c],c,u(o));0===f&&r(null)},C.forEachOfSeries=C.eachOfSeries=function(t,e,r){function o(){var n=!0;return null===a?r(null):(e(t[a],a,u(function(t){if(t)r(t);else{if(a=c(),null===a)return r(null);n?C.setImmediate(o):o()}})),void(n=!1))}r=i(r||n),t=t||[];var c=h(t),a=c();o()},C.forEachOfLimit=C.eachOfLimit=function(n,t,e,r){v(t)(n,e,r)},C.map=d(b),C.mapSeries=k(b),C.mapLimit=g(b),C.inject=C.foldl=C.reduce=function(n,t,e,r){C.eachOfSeries(n,function(n,r,u){e(t,n,function(n,e){t=e,u(n)})},function(n){r(n,t)})},C.foldr=C.reduceRight=function(n,e,r,u){var i=a(n,t).reverse();C.reduce(i,e,r,u)},C.transform=function(n,t,e,r){3===arguments.length&&(r=e,e=t,t=M(n)?[]:{}),C.eachOf(n,function(n,r,u){e(t,n,r,u)},function(n){r(n,t)})},C.select=C.filter=d(w),C.selectLimit=C.filterLimit=g(w),C.selectSeries=C.filterSeries=k(w),C.reject=d(O),C.rejectLimit=g(O),C.rejectSeries=k(O),C.any=C.some=S(C.eachOf,e,t),C.someLimit=S(C.eachOfLimit,e,t),C.all=C.every=S(C.eachOf,r,r),C.everyLimit=S(C.eachOfLimit,r,r),C.detect=S(C.eachOf,t,E),C.detectSeries=S(C.eachOfSeries,t,E),C.detectLimit=S(C.eachOfLimit,t,E),C.sortBy=function(n,t,e){function r(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0}C.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,a(t.sort(r),function(n){return n.value}))})},C.auto=function(t,e,r){function u(n){d.unshift(n)}function o(n){var t=p(d,n);t>=0&&d.splice(t,1)}function a(){h--,c(d.slice(0),function(n){n()})}r||(r=e,e=null),r=i(r||n);var f=W(t),h=f.length;if(!h)return r(null);e||(e=h);var y={},v=0,d=[];u(function(){h||r(null,y)}),c(f,function(n){function i(){return e>v&&l(g,function(n,t){return n&&y.hasOwnProperty(t)},!0)&&!y.hasOwnProperty(n)}function c(){i()&&(v++,o(c),h[h.length-1](d,y))}for(var f,h=M(t[n])?t[n]:[t[n]],d=m(function(t,e){if(v--,e.length<=1&&(e=e[0]),t){var u={};s(y,function(n,t){u[t]=n}),u[n]=e,r(t,u)}else y[n]=e,C.setImmediate(a)}),g=h.slice(0,h.length-1),k=g.length;k--;){if(!(f=t[g[k]]))throw new Error("Has inexistant dependency");if(M(f)&&p(f,n)>=0)throw new Error("Has cyclic dependencies")}i()?(v++,h[h.length-1](d,y)):u(c)})},C.retry=function(n,t,e){function r(n,t){if("number"==typeof t)n.times=parseInt(t,10)||i;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);n.times=parseInt(t.times,10)||i,n.interval=parseInt(t.interval,10)||o}}function u(n,t){function e(n,e){return function(r){n(function(n,t){r(!n||e,{err:n,result:t})},t)}}function r(n){return function(t){setTimeout(function(){t(null)},n)}}for(;a.times;){var u=!(a.times-=1);c.push(e(a.task,u)),!u&&a.interval>0&&c.push(r(a.interval))}C.series(c,function(t,e){e=e[e.length-1],(n||a.callback)(e.err,e.result)})}var i=5,o=0,c=[],a={times:i,interval:o},f=arguments.length;if(1>f||f>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=f&&"function"==typeof n&&(e=t,t=n),"function"!=typeof n&&r(a,n),a.callback=e,a.task=t,a.callback?u():u},C.waterfall=function(t,e){function r(n){return m(function(t,u){if(t)e.apply(null,[t].concat(u));else{var i=n.next();i?u.push(r(i)):u.push(e),z(n).apply(null,u)}})}if(e=i(e||n),!M(t)){var u=new Error("First argument to waterfall must be an array of functions");return e(u)}return t.length?void r(C.iterator(t))():e()},C.parallel=function(n,t){L(C.eachOf,n,t)},C.parallelLimit=function(n,t,e){L(v(t),n,e)},C.series=function(n,t){L(C.eachOfSeries,n,t)},C.iterator=function(n){function t(e){function r(){return n.length&&n[e].apply(null,arguments),r.next()}return r.next=function(){return e<n.length-1?t(e+1):null},r}return t(0)},C.apply=m(function(n,t){return m(function(e){return n.apply(null,t.concat(e))})}),C.concat=d(I),C.concatSeries=k(I),C.whilst=function(t,e,r){if(r=r||n,t()){var u=m(function(n,i){n?r(n):t.apply(this,i)?e(u):r(null)});e(u)}else r(null)},C.doWhilst=function(n,t,e){var r=0;return C.whilst(function(){return++r<=1||t.apply(this,arguments)},n,e)},C.until=function(n,t,e){return C.whilst(function(){return!n.apply(this,arguments)},t,e)},C.doUntil=function(n,t,e){return C.doWhilst(n,function(){return!t.apply(this,arguments)},e)},C.during=function(t,e,r){r=r||n;var u=m(function(n,e){n?r(n):(e.push(i),t.apply(this,e))}),i=function(n,t){n?r(n):t?e(u):r(null)};t(i)},C.doDuring=function(n,t,e){var r=0;C.during(function(n){r++<1?n(null,!0):t.apply(this,arguments)},n,e)},C.queue=function(n,t){var e=x(function(t,e){n(t[0],e)},t,1);return e},C.priorityQueue=function(t,e){function r(n,t){return n.priority-t.priority}function u(n,t,e){for(var r=-1,u=n.length-1;u>r;){var i=r+(u-r+1>>>1);e(t,n[i])>=0?r=i:u=i-1}return r}function i(t,e,i,o){if(null!=o&&"function"!=typeof o)throw new Error("task callback must be a function");return t.started=!0,M(e)||(e=[e]),0===e.length?C.setImmediate(function(){t.drain()}):void c(e,function(e){var c={data:e,priority:i,callback:"function"==typeof o?o:n};t.tasks.splice(u(t.tasks,c,r)+1,0,c),t.tasks.length===t.concurrency&&t.saturated(),C.setImmediate(t.process)})}var o=C.queue(t,e);return o.push=function(n,t,e){i(o,n,t,e)},delete o.unshift,o},C.cargo=function(n,t){return x(n,1,t)},C.log=j("log"),C.dir=j("dir"),C.memoize=function(n,e){var r={},u={};e=e||t;var i=m(function(t){var i=t.pop(),o=e.apply(null,t);o in r?C.setImmediate(function(){i.apply(null,r[o])}):o in u?u[o].push(i):(u[o]=[i],n.apply(null,t.concat([m(function(n){r[o]=n;var t=u[o];delete u[o];for(var e=0,i=t.length;i>e;e++)t[e].apply(null,n)})])))});return i.memo=r,i.unmemoized=n,i},C.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},C.times=A(C.map),C.timesSeries=A(C.mapSeries),C.timesLimit=function(n,t,e,r){return C.mapLimit(f(n),t,e,r)},C.seq=function(){var t=arguments;return m(function(e){var r=this,u=e[e.length-1];"function"==typeof u?e.pop():u=n,C.reduce(t,e,function(n,t,e){t.apply(r,n.concat([m(function(n,t){e(n,t)})]))},function(n,t){u.apply(r,[n].concat(t))})})},C.compose=function(){return C.seq.apply(null,Array.prototype.reverse.call(arguments))},C.applyEach=T(C.eachOf),C.applyEachSeries=T(C.eachOfSeries),C.forever=function(t,e){function r(n){return n?i(n):void o(r)}var i=u(e||n),o=z(t);r()},C.ensureAsync=z,C.constant=m(function(n){var t=[null].concat(n);return function(n){return n.apply(this,t)}}),C.wrapSync=C.asyncify=function(n){return m(function(t){var e,r=t.pop();try{e=n.apply(this,t)}catch(u){return r(u)}U(e)&&"function"==typeof e.then?e.then(function(n){r(null,n)})["catch"](function(n){r(n.message?n:new Error(n))}):r(null,e)})},"object"==typeof module&&module.exports?module.exports=C:"function"==typeof define&&define.amd?define([],function(){return C}):P.async=C}();
+//# sourceMappingURL=dist/async.min.map \ No newline at end of file
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js b/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
index 1f1e0effa..888934402 100644
--- a/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
+++ b/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
@@ -77,12 +77,6 @@
);
}
- function _each(coll, iterator) {
- return _isArrayLike(coll) ?
- _arrayEach(coll, iterator) :
- _forEachOf(coll, iterator);
- }
-
function _arrayEach(arr, iterator) {
var index = -1,
length = arr.length;
@@ -230,23 +224,26 @@
async.eachOf = function (object, iterator, callback) {
callback = _once(callback || noop);
object = object || [];
- var size = _isArrayLike(object) ? object.length : _keys(object).length;
- var completed = 0;
- if (!size) {
- return callback(null);
- }
- _each(object, function (value, key) {
+
+ var iter = _keyIterator(object);
+ var key, completed = 0;
+
+ while ((key = iter()) != null) {
+ completed += 1;
iterator(object[key], key, only_once(done));
- });
+ }
+
+ if (completed === 0) callback(null);
+
function done(err) {
+ completed--;
if (err) {
callback(err);
}
- else {
- completed += 1;
- if (completed >= size) {
- callback(null);
- }
+ // Check key is null in case iterator isn't exhausted
+ // and done resolved synchronously.
+ else if (key === null && completed <= 0) {
+ callback(null);
}
}
};
@@ -272,7 +269,7 @@
return callback(null);
} else {
if (sync) {
- async.nextTick(iterate);
+ async.setImmediate(iterate);
} else {
iterate();
}
@@ -353,7 +350,8 @@
function _asyncMap(eachfn, arr, iterator, callback) {
callback = _once(callback || noop);
- var results = [];
+ arr = arr || [];
+ var results = _isArrayLike(arr) ? [] : {};
eachfn(arr, function (value, index, callback) {
iterator(value, function (err, v) {
results[index] = v;
@@ -379,7 +377,7 @@
callback(err);
});
}, function (err) {
- callback(err || null, memo);
+ callback(err, memo);
});
};
@@ -389,6 +387,20 @@
async.reduce(reversed, memo, iterator, callback);
};
+ async.transform = function (arr, memo, iterator, callback) {
+ if (arguments.length === 3) {
+ callback = iterator;
+ iterator = memo;
+ memo = _isArray(arr) ? [] : {};
+ }
+
+ async.eachOf(arr, function(v, k, cb) {
+ iterator(memo, v, k, cb);
+ }, function(err) {
+ callback(err, memo);
+ });
+ };
+
function _filter(eachfn, arr, iterator, callback) {
var results = [];
eachfn(arr, function (x, index, callback) {
@@ -497,15 +509,24 @@
}
};
- async.auto = function (tasks, callback) {
+ async.auto = function (tasks, concurrency, callback) {
+ if (!callback) {
+ // concurrency is optional, shift the args.
+ callback = concurrency;
+ concurrency = null;
+ }
callback = _once(callback || noop);
var keys = _keys(tasks);
var remainingTasks = keys.length;
if (!remainingTasks) {
return callback(null);
}
+ if (!concurrency) {
+ concurrency = remainingTasks;
+ }
var results = {};
+ var runningTasks = 0;
var listeners = [];
function addListener(fn) {
@@ -531,6 +552,7 @@
_arrayEach(keys, function (k) {
var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];
var taskCallback = _restParam(function(err, args) {
+ runningTasks--;
if (args.length <= 1) {
args = args[0];
}
@@ -560,11 +582,12 @@
}
}
function ready() {
- return _reduce(requires, function (a, x) {
+ return runningTasks < concurrency && _reduce(requires, function (a, x) {
return (a && results.hasOwnProperty(x));
}, true) && !results.hasOwnProperty(k);
}
if (ready()) {
+ runningTasks++;
task[task.length - 1](taskCallback, results);
}
else {
@@ -572,6 +595,7 @@
}
function listener() {
if (ready()) {
+ runningTasks++;
removeListener(listener);
task[task.length - 1](taskCallback, results);
}
@@ -863,8 +887,17 @@
function _next(q, tasks) {
return function(){
workers -= 1;
+
+ var removed = false;
var args = arguments;
_arrayEach(tasks, function (task) {
+ _arrayEach(workersList, function (worker, index) {
+ if (worker === task && !removed) {
+ workersList.splice(index, 1);
+ removed = true;
+ }
+ });
+
task.callback.apply(task, args);
});
if (q.tasks.length + workers === 0) {
@@ -875,6 +908,7 @@
}
var workers = 0;
+ var workersList = [];
var q = {
tasks: [],
concurrency: concurrency,
@@ -909,6 +943,7 @@
q.empty();
}
workers += 1;
+ workersList.push(tasks[0]);
var cb = only_once(_next(q, tasks));
worker(data, cb);
}
@@ -920,6 +955,9 @@
running: function () {
return workers;
},
+ workersList: function () {
+ return workersList;
+ },
idle: function() {
return q.tasks.length + workers === 0;
},
@@ -1048,7 +1086,7 @@
var callback = args.pop();
var key = hasher.apply(null, args);
if (key in memo) {
- async.nextTick(function () {
+ async.setImmediate(function () {
callback.apply(null, memo[key]);
});
}
diff --git a/node_modules/request/node_modules/form-data/node_modules/async/package.json b/node_modules/request/node_modules/form-data/node_modules/async/package.json
index cdc0f8ccc..3072aa7ac 100644
--- a/node_modules/request/node_modules/form-data/node_modules/async/package.json
+++ b/node_modules/request/node_modules/form-data/node_modules/async/package.json
@@ -1,28 +1,46 @@
{
- "name": "async",
- "description": "Higher-order functions and common patterns for asynchronous code",
- "main": "lib/async.js",
- "files": [
- "lib"
+ "_args": [
+ [
+ "async@^1.4.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/form-data"
+ ]
],
- "author": {
- "name": "Caolan McMahon"
+ "_from": "async@>=1.4.0 <2.0.0",
+ "_id": "async@1.5.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/form-data/async",
+ "_nodeVersion": "0.10.26",
+ "_npmUser": {
+ "email": "alexander.early@gmail.com",
+ "name": "aearly"
},
- "version": "1.4.2",
- "keywords": [
- "async",
- "callback",
- "utility",
- "module"
+ "_npmVersion": "2.14.2",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "async",
+ "raw": "async@^1.4.0",
+ "rawSpec": "^1.4.0",
+ "scope": null,
+ "spec": ">=1.4.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/form-data"
],
- "repository": {
- "type": "git",
- "url": "git+https://github.com/caolan/async.git"
+ "_resolved": "https://registry.npmjs.org/async/-/async-1.5.0.tgz",
+ "_shasum": "2796642723573859565633fc6274444bee2f8ce3",
+ "_shrinkwrap": null,
+ "_spec": "async@^1.4.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/form-data",
+ "author": {
+ "name": "Caolan McMahon"
},
"bugs": {
"url": "https://github.com/caolan/async/issues"
},
- "license": "MIT",
+ "dependencies": {},
+ "description": "Higher-order functions and common patterns for asynchronous code",
"devDependencies": {
"benchmark": "github:bestiejs/benchmark.js",
"bluebird": "^2.9.32",
@@ -43,48 +61,89 @@
"nodeunit": ">0.0.0",
"nyc": "^2.1.0",
"rsvp": "^3.0.18",
+ "semver": "^4.3.6",
"uglify-js": "~2.4.0",
"xyz": "^0.5.0",
"yargs": "~3.9.1"
},
+ "directories": {},
+ "dist": {
+ "shasum": "2796642723573859565633fc6274444bee2f8ce3",
+ "tarball": "http://registry.npmjs.org/async/-/async-1.5.0.tgz"
+ },
+ "files": [
+ "dist/async.js",
+ "dist/async.min.js",
+ "lib"
+ ],
+ "gitHead": "621f13805aa326865b85dbbf7128baf7146ab976",
+ "homepage": "https://github.com/caolan/async#readme",
"jam": {
- "main": "lib/async.js",
+ "categories": [
+ "Utilities"
+ ],
"include": [
- "lib/async.js",
+ "LICENSE",
"README.md",
- "LICENSE"
+ "lib/async.js"
],
- "categories": [
- "Utilities"
- ]
+ "main": "lib/async.js"
+ },
+ "keywords": [
+ "async",
+ "callback",
+ "module",
+ "utility"
+ ],
+ "license": "MIT",
+ "main": "lib/async.js",
+ "maintainers": [
+ {
+ "name": "caolan",
+ "email": "caolan.mcmahon@gmail.com"
+ },
+ {
+ "name": "beaugunderson",
+ "email": "beau@beaugunderson.com"
+ },
+ {
+ "name": "aearly",
+ "email": "alexander.early@gmail.com"
+ },
+ {
+ "name": "megawac",
+ "email": "megawac@gmail.com"
+ }
+ ],
+ "name": "async",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/caolan/async.git"
},
"scripts": {
- "mocha-node-test": "mocha mocha_test/",
+ "coverage": "nyc npm test && nyc report",
+ "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
+ "lint": "jshint lib/*.js test/*.js perf/*.js && jscs lib/*.js test/*.js perf/*.js",
"mocha-browser-test": "karma start",
+ "mocha-node-test": "mocha mocha_test/",
"mocha-test": "npm run mocha-node-test && npm run mocha-browser-test",
"nodeunit-test": "nodeunit test/test-async.js",
- "test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test",
- "lint": "jshint lib/*.js test/*.js perf/*.js && jscs lib/*.js test/*.js perf/*.js",
- "coverage": "nyc npm test && nyc report",
- "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ "test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test"
},
"spm": {
"main": "lib/async.js"
},
+ "version": "1.5.0",
"volo": {
- "main": "lib/async.js",
"ignore": [
"**/.*",
- "node_modules",
"bower_components",
+ "node_modules",
"test",
"tests"
- ]
- },
- "readme": "ERROR: No README data found!",
- "homepage": "https://github.com/caolan/async#readme",
- "_id": "async@1.4.2",
- "_shasum": "6c9edcb11ced4f0dd2f2d40db0d49a109c088aab",
- "_resolved": "https://registry.npmjs.org/async/-/async-1.4.2.tgz",
- "_from": "async@>=1.4.0 <2.0.0"
+ ],
+ "main": "lib/async.js"
+ }
}
diff --git a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/index.js b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/index.js
index 7820e6497..f24db9b1c 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/index.js
+++ b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/index.js
@@ -190,7 +190,7 @@ var compile = function(schema, cache, root, reporter, opts) {
validate('for (var %s = %d; %s < %s.length; %s++) {', i, node.items.length, i, name, i)
visit(name+'['+i+']', node.additionalItems, reporter, filter)
validate('}')
- }
+ }
}
if (node.format && fmts[node.format]) {
@@ -395,7 +395,7 @@ var compile = function(schema, cache, root, reporter, opts) {
node.anyOf.forEach(function(sch, i) {
if (i === 0) {
validate('var %s = errors', prev)
- } else {
+ } else {
validate('if (errors !== %s) {', prev)
('errors = %s', prev)
}
@@ -446,7 +446,7 @@ var compile = function(schema, cache, root, reporter, opts) {
if (node.maxProperties !== undefined) {
if (type !== 'object') validate('if (%s) {', types.object(name))
-
+
validate('if (Object.keys(%s).length > %d) {', name, node.maxProperties)
error('has more properties than allowed')
validate('}')
@@ -456,7 +456,7 @@ var compile = function(schema, cache, root, reporter, opts) {
if (node.minProperties !== undefined) {
if (type !== 'object') validate('if (%s) {', types.object(name))
-
+
validate('if (Object.keys(%s).length < %d) {', name, node.minProperties)
error('has less properties than allowed')
validate('}')
@@ -466,7 +466,7 @@ var compile = function(schema, cache, root, reporter, opts) {
if (node.maxItems !== undefined) {
if (type !== 'array') validate('if (%s) {', types.array(name))
-
+
validate('if (%s.length > %d) {', name, node.maxItems)
error('has more items than allowed')
validate('}')
@@ -476,7 +476,7 @@ var compile = function(schema, cache, root, reporter, opts) {
if (node.minItems !== undefined) {
if (type !== 'array') validate('if (%s) {', types.array(name))
-
+
validate('if (%s.length < %d) {', name, node.minItems)
error('has less items than allowed')
validate('}')
@@ -543,14 +543,16 @@ var compile = function(schema, cache, root, reporter, opts) {
validate = validate.toFunction(scope)
validate.errors = null
- validate.__defineGetter__('error', function() {
- if (!validate.errors) return ''
- return validate.errors
- .map(function(err) {
- return err.field+' '+err.message
- })
- .join('\n')
- })
+ if (Object.defineProperty) {
+ Object.defineProperty(validate, 'error', {
+ get: function() {
+ if (!validate.errors) return ''
+ return validate.errors.map(function(err) {
+ return err.field + ' ' + err.message;
+ }).join('\n')
+ }
+ })
+ }
validate.toJSON = function() {
return schema
diff --git a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/immutable.js b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/immutable.js
index 5b760152b..94889c9de 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/immutable.js
+++ b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/immutable.js
@@ -1,5 +1,7 @@
module.exports = extend
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
function extend() {
var target = {}
@@ -7,7 +9,7 @@ function extend() {
var source = arguments[i]
for (var key in source) {
- if (source.hasOwnProperty(key)) {
+ if (hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
diff --git a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/mutable.js b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/mutable.js
index a34475ebd..72debede6 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/mutable.js
+++ b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/mutable.js
@@ -1,11 +1,13 @@
module.exports = extend
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
function extend(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i]
for (var key in source) {
- if (source.hasOwnProperty(key)) {
+ if (hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
diff --git a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/package.json b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/package.json
index c087642df..f16c4235f 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/package.json
+++ b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/package.json
@@ -1,32 +1,46 @@
{
- "name": "xtend",
- "version": "4.0.0",
- "description": "extend like a boss",
- "keywords": [
- "extend",
- "merge",
- "options",
- "opts",
- "object",
- "array"
+ "_args": [
+ [
+ "xtend@^4.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid"
+ ]
],
- "author": {
- "name": "Raynos",
- "email": "raynos2@gmail.com"
+ "_from": "xtend@>=4.0.0 <5.0.0",
+ "_id": "xtend@4.0.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/har-validator/is-my-json-valid/xtend",
+ "_nodeVersion": "0.10.32",
+ "_npmUser": {
+ "email": "raynos2@gmail.com",
+ "name": "raynos"
},
- "repository": {
- "type": "git",
- "url": "git://github.com/Raynos/xtend.git"
+ "_npmVersion": "2.14.1",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "xtend",
+ "raw": "xtend@^4.0.0",
+ "rawSpec": "^4.0.0",
+ "scope": null,
+ "spec": ">=4.0.0 <5.0.0",
+ "type": "range"
},
- "main": "immutable",
- "scripts": {
- "test": "node test"
+ "_requiredBy": [
+ "/request/har-validator/is-my-json-valid"
+ ],
+ "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+ "_shasum": "a5c6d532be656e23db820efb943a1f04998d63af",
+ "_shrinkwrap": null,
+ "_spec": "xtend@^4.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid",
+ "author": {
+ "email": "raynos2@gmail.com",
+ "name": "Raynos"
},
- "dependencies": {},
- "devDependencies": {
- "tape": "~1.1.0"
+ "bugs": {
+ "email": "raynos2@gmail.com",
+ "url": "https://github.com/Raynos/xtend/issues"
},
- "homepage": "https://github.com/Raynos/xtend",
"contributors": [
{
"name": "Jake Verbaten"
@@ -35,38 +49,61 @@
"name": "Matt Esch"
}
],
- "bugs": {
- "url": "https://github.com/Raynos/xtend/issues",
- "email": "raynos2@gmail.com"
+ "dependencies": {},
+ "description": "extend like a boss",
+ "devDependencies": {
+ "tape": "~1.1.0"
},
- "licenses": [
+ "directories": {},
+ "dist": {
+ "shasum": "a5c6d532be656e23db820efb943a1f04998d63af",
+ "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz"
+ },
+ "engines": {
+ "node": ">=0.4"
+ },
+ "gitHead": "23dc302a89756da89c1897bc732a752317e35390",
+ "homepage": "https://github.com/Raynos/xtend",
+ "keywords": [
+ "array",
+ "extend",
+ "merge",
+ "object",
+ "options",
+ "opts"
+ ],
+ "license": "MIT",
+ "main": "immutable",
+ "maintainers": [
{
- "type": "MIT",
- "url": "http://github.com/raynos/xtend/raw/master/LICENSE"
+ "name": "raynos",
+ "email": "raynos2@gmail.com"
}
],
+ "name": "xtend",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/Raynos/xtend.git"
+ },
+ "scripts": {
+ "test": "node test"
+ },
"testling": {
- "files": "test.js",
"browsers": [
- "ie/7..latest",
- "firefox/16..latest",
- "firefox/nightly",
"chrome/22..latest",
"chrome/canary",
+ "firefox/16..latest",
+ "firefox/nightly",
+ "ie/7..latest",
+ "ipad/6.0..latest",
+ "iphone/6.0..latest",
"opera/12..latest",
"opera/next",
- "safari/5.1..latest",
- "ipad/6.0..latest",
- "iphone/6.0..latest"
- ]
- },
- "engines": {
- "node": ">=0.4"
+ "safari/5.1..latest"
+ ],
+ "files": "test.js"
},
- "readme": "# xtend\n\n[![browser support][3]][4]\n\n[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges)\n\nExtend like a boss\n\nxtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence.\n\n## Examples\n\n```js\nvar extend = require(\"xtend\")\n\n// extend returns a new object. Does not mutate arguments\nvar combination = extend({\n a: \"a\",\n b: 'c'\n}, {\n b: \"b\"\n})\n// { a: \"a\", b: \"b\" }\n```\n\n## Stability status: Locked\n\n## MIT Licenced\n\n\n [3]: http://ci.testling.com/Raynos/xtend.png\n [4]: http://ci.testling.com/Raynos/xtend\n",
- "readmeFilename": "README.md",
- "_id": "xtend@4.0.0",
- "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f",
- "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz",
- "_from": "xtend@>=4.0.0 <5.0.0"
+ "version": "4.0.1"
}
diff --git a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js
index 3369d7966..093a2b061 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js
+++ b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js
@@ -61,3 +61,23 @@ test("mutable", function (assert) {
assert.equal(a.bar, "baz")
assert.end()
})
+
+test("null prototype", function(assert) {
+ var a = { a: "foo" }
+ var b = Object.create(null)
+ b.b = "bar";
+
+ assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
+ assert.end()
+})
+
+test("null prototype mutable", function (assert) {
+ var a = { foo: "bar" }
+ var b = Object.create(null)
+ b.bar = "baz";
+
+ mutableExtend(a, b)
+
+ assert.equal(a.bar, "baz")
+ assert.end()
+})
diff --git a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/package.json b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/package.json
index 4dfb435af..837c529e6 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/package.json
+++ b/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/package.json
@@ -1,42 +1,96 @@
{
- "name": "is-my-json-valid",
- "version": "2.12.2",
- "description": "A JSONSchema validator that uses code generation to be extremely fast",
- "main": "index.js",
+ "_args": [
+ [
+ "is-my-json-valid@^2.12.3",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator"
+ ]
+ ],
+ "_from": "is-my-json-valid@>=2.12.3 <3.0.0",
+ "_id": "is-my-json-valid@2.12.3",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/har-validator/is-my-json-valid",
+ "_nodeVersion": "4.1.1",
+ "_npmUser": {
+ "email": "mathiasbuus@gmail.com",
+ "name": "mafintosh"
+ },
+ "_npmVersion": "2.14.4",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "is-my-json-valid",
+ "raw": "is-my-json-valid@^2.12.3",
+ "rawSpec": "^2.12.3",
+ "scope": null,
+ "spec": ">=2.12.3 <3.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/har-validator"
+ ],
+ "_resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.3.tgz",
+ "_shasum": "5a39d1d76b2dbb83140bbd157b1d5ee4bdc85ad6",
+ "_shrinkwrap": null,
+ "_spec": "is-my-json-valid@^2.12.3",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator",
+ "author": {
+ "name": "Mathias Buus"
+ },
+ "bugs": {
+ "url": "https://github.com/mafintosh/is-my-json-valid/issues"
+ },
"dependencies": {
"generate-function": "^2.0.0",
"generate-object-property": "^1.1.0",
"jsonpointer": "2.0.0",
"xtend": "^4.0.0"
},
+ "description": "A JSONSchema validator that uses code generation to be extremely fast",
"devDependencies": {
"tape": "^2.13.4"
},
- "scripts": {
- "test": "tape test/*.js"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/mafintosh/is-my-json-valid.git"
+ "directories": {},
+ "dist": {
+ "shasum": "5a39d1d76b2dbb83140bbd157b1d5ee4bdc85ad6",
+ "tarball": "http://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.3.tgz"
},
+ "gitHead": "822c5815f7ae4c50ed0c71451cb4dc3ea177be14",
+ "homepage": "https://github.com/mafintosh/is-my-json-valid",
"keywords": [
"json",
- "schema",
+ "jsonschema",
"orderly",
- "jsonschema"
+ "schema"
],
- "author": {
- "name": "Mathias Buus"
- },
"license": "MIT",
- "bugs": {
- "url": "https://github.com/mafintosh/is-my-json-valid/issues"
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "freeall",
+ "email": "freeall@gmail.com"
+ },
+ {
+ "name": "mafintosh",
+ "email": "mathiasbuus@gmail.com"
+ },
+ {
+ "name": "watson",
+ "email": "w@tson.dk"
+ },
+ {
+ "name": "yoshuawuyts",
+ "email": "i@yoshuawuyts.com"
+ }
+ ],
+ "name": "is-my-json-valid",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/mafintosh/is-my-json-valid.git"
},
- "homepage": "https://github.com/mafintosh/is-my-json-valid",
- "readme": "# is-my-json-valid\n\nA [JSONSchema](http://json-schema.org/) validator that uses code generation\nto be extremely fast\n\n```\nnpm install is-my-json-valid\n```\n\nIt passes the entire JSONSchema v4 test suite except for `remoteRefs` and `maxLength`/`minLength` when using unicode surrogate pairs.\n\n[![build status](http://img.shields.io/travis/mafintosh/is-my-json-valid.svg?style=flat)](http://travis-ci.org/mafintosh/is-my-json-valid)\n\n## Usage\n\nSimply pass a schema to compile it\n\n``` js\nvar validator = require('is-my-json-valid')\n\nvar validate = validator({\n required: true,\n type: 'object',\n properties: {\n hello: {\n required: true,\n type: 'string'\n }\n }\n})\n\nconsole.log('should be valid', validate({hello: 'world'}))\nconsole.log('should not be valid', validate({}))\n\n// get the last list of errors by checking validate.errors\n// the following will print [{field: 'data.hello', message: 'is required'}]\nconsole.log(validate.errors)\n```\n\nYou can also pass the schema as a string\n\n``` js\nvar validate = validate('{\"type\": ... }')\n```\n\nOptionally you can use the require submodule to load a schema from `__dirname`\n\n``` js\nvar validator = require('is-my-json-valid/require')\nvar validate = validator('my-schema.json')\n```\n\n## Custom formats\n\nis-my-json-valid supports the formats specified in JSON schema v4 (such as date-time).\nIf you want to add your own custom formats pass them as the formats options to the validator\n\n``` js\nvar validate = validator({\n type: 'string',\n required: true,\n format: 'only-a'\n}, {\n formats: {\n 'only-a': /^a+$/\n }\n})\n\nconsole.log(validate('aa')) // true\nconsole.log(validate('ab')) // false\n```\n\n## External schemas\n\nYou can pass in external schemas that you reference using the `$ref` attribute as the `schemas` option\n\n``` js\nvar ext = {\n required: true,\n type: 'string'\n}\n\nvar schema = {\n $ref: '#ext' // references another schema called ext\n}\n\n// pass the external schemas as an option\nvar validate = validator(schema, {schemas: {ext: ext}})\n\nvalidate('hello') // returns true\nvalidate(42) // return false\n```\n\n## Filtering away additional properties\n\nis-my-json-valid supports filtering away properties not in the schema\n\n``` js\nvar filter = validator.filter({\n required: true,\n type: 'object',\n properties: {\n hello: {type: 'string', required: true}\n },\n additionalProperties: false\n})\n\nvar doc = {hello: 'world', notInSchema: true}\nconsole.log(filter(doc)) // {hello: 'world'}\n```\n\n## Verbose mode outputs the value on errors\n\nis-my-json-valid outputs the value causing an error when verbose is set to true\n\n``` js\nvar validate = validator({\n required: true,\n type: 'object',\n properties: {\n hello: {\n required: true,\n type: 'string'\n }\n }\n}, {\n verbose: true\n})\n\nvalidate({hello: 100});\nconsole.log(validate.errors) // {field: 'data.hello', message: 'is the wrong type', value: 100}\n```\n\n## Greedy mode tries to validate as much as possible\n\nBy default is-my-json-valid bails on first validation error but when greedy is\nset to true it tries to validate as much as possible:\n\n``` js\nvar validate = validator({\n type: 'object',\n properties: {\n x: {\n type: 'number'\n }\n },\n required: ['x', 'y']\n}, {\n greedy: true\n});\n\nvalidate({x: 'string'});\nconsole.log(validate.errors) // [{field: 'data.y', message: 'is required'},\n // {field: 'data.x', message: 'is the wrong type'}]\n```\n\n## Performance\n\nis-my-json-valid uses code generation to turn your JSON schema into basic javascript code that is easily optimizeable by v8.\n\nAt the time of writing, is-my-json-valid is the __fastest validator__ when running\n\n* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)\n* [cosmicreals.com benchmark](http://cosmicrealms.com/blog/2014/08/29/benchmark-of-node-dot-js-json-validation-modules-part-3/)\n* [jsck benchmark](https://github.com/pandastrike/jsck/issues/72#issuecomment-70992684)\n* [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)\n* [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)\n\nIf you know any other relevant benchmarks open a PR and I'll add them.\n\n## License\n\nMIT\n",
- "readmeFilename": "README.md",
- "_id": "is-my-json-valid@2.12.2",
- "_shasum": "0d65859318c846ce3a134402fd3fbc504272ccc9",
- "_resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.2.tgz",
- "_from": "is-my-json-valid@>=2.12.2 <3.0.0"
+ "scripts": {
+ "test": "tape test/*.js"
+ },
+ "version": "2.12.3"
}
diff --git a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/index.js b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/index.js
index a7e3dc385..fb36c2a45 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/index.js
+++ b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/index.js
@@ -5,9 +5,9 @@ var SETTLED = 'settled';
var FULFILLED = 'fulfilled';
var REJECTED = 'rejected';
var NOOP = function () {};
+var isNode = typeof process !== 'undefined' && typeof process.emit === 'function';
-// async calls
-var asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;
+var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
var asyncQueue = [];
var asyncTimer;
@@ -83,17 +83,18 @@ function handleThenable(promise, value) {
}
if (value && (typeof value === 'function' || typeof value === 'object')) {
- var then = value.then; // then should be retrived only once
+ // then should be retrieved only once
+ var then = value.then;
if (typeof then === 'function') {
then.call(value, function (val) {
if (!resolved) {
resolved = true;
- if (value !== val) {
- resolve(promise, val);
- } else {
+ if (value === val) {
fulfill(promise, val);
+ } else {
+ resolve(promise, val);
}
}
}, function (reason) {
@@ -154,6 +155,13 @@ function publishFulfillment(promise) {
function publishRejection(promise) {
promise._state = REJECTED;
publish(promise);
+ if (!promise._handled && isNode) {
+ process.emit('unhandledRejection', promise._data, promise);
+ }
+}
+
+function notifyRejectionHandled(promise) {
+ process.emit('rejectionHandled', promise);
}
/**
@@ -179,6 +187,7 @@ Promise.prototype = {
_state: PENDING,
_then: null,
_data: undefined,
+ _handled: false,
then: function (onFulfillment, onRejection) {
var subscriber = {
@@ -188,6 +197,13 @@ Promise.prototype = {
rejected: onRejection
};
+ if ((onRejection || onFulfillment) && !this._handled) {
+ this._handled = true;
+ if (this._state === REJECTED && isNode) {
+ asyncCall(notifyRejectionHandled, this);
+ }
+ }
+
if (this._state === FULFILLED || this._state === REJECTED) {
// already resolved, call callback async
asyncCall(invokeCallback, subscriber);
@@ -199,7 +215,7 @@ Promise.prototype = {
return subscriber.then;
},
- 'catch': function (onRejection) {
+ catch: function (onRejection) {
return this.then(null, onRejection);
}
};
diff --git a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/package.json b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/package.json
index 3a4c88269..2c263f29f 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/package.json
+++ b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/package.json
@@ -1,43 +1,92 @@
{
- "name": "pinkie",
- "version": "1.0.0",
- "description": "Itty bitty little wittle twinkie pinkie ES6 Promise implementation",
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/floatdrop/pinkie.git"
+ "_args": [
+ [
+ "pinkie@^2.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise"
+ ]
+ ],
+ "_from": "pinkie@>=2.0.0 <3.0.0",
+ "_id": "pinkie@2.0.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/har-validator/pinkie-promise/pinkie",
+ "_nodeVersion": "4.2.0",
+ "_npmUser": {
+ "email": "floatdrop@gmail.com",
+ "name": "floatdrop"
},
+ "_npmVersion": "2.14.7",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "pinkie",
+ "raw": "pinkie@^2.0.0",
+ "rawSpec": "^2.0.0",
+ "scope": null,
+ "spec": ">=2.0.0 <3.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/har-validator/pinkie-promise"
+ ],
+ "_resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.1.tgz",
+ "_shasum": "4236c86fc29f261c2045bbe81f78cbb2a5e8306c",
+ "_shrinkwrap": null,
+ "_spec": "pinkie@^2.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise",
"author": {
- "name": "Vsevolod Strukchinsky",
"email": "floatdrop@gmail.com",
+ "name": "Vsevolod Strukchinsky",
"url": "github.com/floatdrop"
},
+ "bugs": {
+ "url": "https://github.com/floatdrop/pinkie/issues"
+ },
+ "dependencies": {},
+ "description": "Itty bitty little widdle twinkie pinkie ES2015 Promise implementation",
+ "devDependencies": {
+ "core-assert": "^0.1.1",
+ "coveralls": "^2.11.4",
+ "mocha": "*",
+ "nyc": "^3.2.2",
+ "promises-aplus-tests": "*",
+ "xo": "^0.10.1"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "4236c86fc29f261c2045bbe81f78cbb2a5e8306c",
+ "tarball": "http://registry.npmjs.org/pinkie/-/pinkie-2.0.1.tgz"
+ },
"engines": {
"node": ">=0.10.0"
},
- "scripts": {
- "test": "mocha"
- },
"files": [
"index.js"
],
+ "gitHead": "11d969408e6004f50c3b442fe330f2ead7eb3619",
+ "homepage": "https://github.com/floatdrop/pinkie",
"keywords": [
+ "es2015",
+ "es6",
"promise",
- "es6"
+ "promises"
],
- "dependencies": {},
- "devDependencies": {
- "mocha": "*",
- "promises-aplus-tests": "*"
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "floatdrop",
+ "email": "floatdrop@gmail.com"
+ }
+ ],
+ "name": "pinkie",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/floatdrop/pinkie.git"
},
- "readme": "<h1 align=\"center\">\n\t<br>\n\t<img width=\"300\" src=\"https://rawgit.com/floatdrop/pinkie/master/media/logo.png\" alt=\"pinkie\">\n\t<br>\n\t<br>\n</h1>\n\n> Itty bitty little wittle twinkie pinkie [ES6 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation\n\n[![Build Status](https://travis-ci.org/floatdrop/pinkie.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie)\n\nThere are [tons of Promise implementations](https://github.com/sorrycc/awesome-javascript#control-flow) out there, but all of them focused on browser compatibility and often bloated with functionality.\n\nThis module focused to be exactly Promise specification polyfill (like [native-promise-only](https://github.com/getify/native-promise-only)), but in NodeJS land (it should be browserify-able thou).\n\n\n## Install\n\n```\n$ npm install --save pinkie\n```\n\n\n## Usage\n\n```js\nvar Promise = require('pinkie');\n\nnew Promise(function (resolve, reject) {\n\tgot('google.com', function (err, data) {\n\t\tif (err) {\n\t\t\treturn reject(err);\n\t\t}\n\n\t\tresolve(data);\n\t});\n});\n//=> Promise\n```\n\n\n### API\n\n`pinkie` exports bare [ES6 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation. In case you forgot:\n\n#### new Promise(executor)\n\nReturns new instance of `Promise`.\n\n##### executor\n\n*Required* \nType: `function`\n\nFunction with two arguments resolve and reject. The first argument fulfills the promise, the second argument rejects it.\n\n#### pinkie.all(promises)\n\nReturns a promise that resolves when all of the promises in the `promises` Array argument have resolved.\n\n#### pinkie.race(promises)\n\nReturns a promise that resolves or rejects as soon as one of the promises in the `promises` Array resolves or rejects, with the value or reason from that promise.\n\n#### pinkie.reject(reason)\n\nReturns a Promise object that is rejected with the given `reason`.\n\n#### pinkie.resolve(value)\n\nReturns a Promise object that is resolved with the given `value`. If the `value` is a thenable (i.e. has a then method), the returned promise will \"follow\" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the `value`.\n\n## License\n\nMIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)\n",
- "readmeFilename": "readme.md",
- "bugs": {
- "url": "https://github.com/floatdrop/pinkie/issues"
+ "scripts": {
+ "coverage": "nyc report --reporter=text-lcov | coveralls",
+ "test": "xo && nyc mocha"
},
- "homepage": "https://github.com/floatdrop/pinkie#readme",
- "_id": "pinkie@1.0.0",
- "_shasum": "5a47f28ba1015d0201bda7bf0f358e47bec8c7e4",
- "_resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz",
- "_from": "pinkie@>=1.0.0 <2.0.0"
+ "version": "2.0.1"
}
diff --git a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/readme.md b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/readme.md
index faa9b2b88..7e0f95505 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/readme.md
+++ b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/readme.md
@@ -1,17 +1,17 @@
<h1 align="center">
<br>
- <img width="300" src="https://rawgit.com/floatdrop/pinkie/master/media/logo.png" alt="pinkie">
+ <img width="256" src="media/logo.png" alt="pinkie">
<br>
<br>
</h1>
-> Itty bitty little wittle twinkie pinkie [ES6 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation
+> Itty bitty little widdle twinkie pinkie [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation
-[![Build Status](https://travis-ci.org/floatdrop/pinkie.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie)
+[![Build Status](https://travis-ci.org/floatdrop/pinkie.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie) [![Coverage Status](https://coveralls.io/repos/floatdrop/pinkie/badge.svg?branch=master&service=github)](https://coveralls.io/github/floatdrop/pinkie?branch=master)
-There are [tons of Promise implementations](https://github.com/sorrycc/awesome-javascript#control-flow) out there, but all of them focused on browser compatibility and often bloated with functionality.
+There are [tons of Promise implementations](https://github.com/promises-aplus/promises-spec/blob/master/implementations.md#standalone) out there, but all of them focus on browser compatibility and are often bloated with functionality.
-This module focused to be exactly Promise specification polyfill (like [native-promise-only](https://github.com/getify/native-promise-only)), but in NodeJS land (it should be browserify-able thou).
+This module is an exact Promise specification polyfill (like [native-promise-only](https://github.com/getify/native-promise-only)), but in Node.js land (it should be browserify-able though).
## Install
@@ -24,12 +24,14 @@ $ npm install --save pinkie
## Usage
```js
+var fs = require('fs');
var Promise = require('pinkie');
new Promise(function (resolve, reject) {
- got('google.com', function (err, data) {
+ fs.readFile('foo.json', 'utf8', function (err, data) {
if (err) {
- return reject(err);
+ reject(err);
+ return;
}
resolve(data);
@@ -41,7 +43,7 @@ new Promise(function (resolve, reject) {
### API
-`pinkie` exports bare [ES6 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation. In case you forgot:
+`pinkie` exports bare [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation and polyfills [Node.js rejection events](https://nodejs.org/api/process.html#process_event_unhandledrejection). In case you forgot:
#### new Promise(executor)
@@ -52,7 +54,7 @@ Returns new instance of `Promise`.
*Required*
Type: `function`
-Function with two arguments resolve and reject. The first argument fulfills the promise, the second argument rejects it.
+Function with two arguments `resolve` and `reject`. The first argument fulfills the promise, the second argument rejects it.
#### pinkie.all(promises)
@@ -70,6 +72,12 @@ Returns a Promise object that is rejected with the given `reason`.
Returns a Promise object that is resolved with the given `value`. If the `value` is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the `value`.
+
+## Related
+
+- [pinkie-promise](https://github.com/floatdrop/pinkie-promise) - Returns the native Promise or this module
+
+
## License
MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)
diff --git a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json
index bd4e66f8d..82ca19807 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json
+++ b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json
@@ -1,46 +1,90 @@
{
- "name": "pinkie-promise",
- "version": "1.0.0",
- "description": "ES6 Promise ponyfill",
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/floatdrop/pinkie-promise.git"
+ "_args": [
+ [
+ "pinkie-promise@^2.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator"
+ ]
+ ],
+ "_from": "pinkie-promise@>=2.0.0 <3.0.0",
+ "_id": "pinkie-promise@2.0.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/har-validator/pinkie-promise",
+ "_nodeVersion": "4.2.0",
+ "_npmUser": {
+ "email": "floatdrop@gmail.com",
+ "name": "floatdrop"
+ },
+ "_npmVersion": "2.14.7",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "pinkie-promise",
+ "raw": "pinkie-promise@^2.0.0",
+ "rawSpec": "^2.0.0",
+ "scope": null,
+ "spec": ">=2.0.0 <3.0.0",
+ "type": "range"
},
+ "_requiredBy": [
+ "/request/har-validator"
+ ],
+ "_resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
+ "_shasum": "4c83538de1f6e660c29e0a13446844f7a7e88259",
+ "_shrinkwrap": null,
+ "_spec": "pinkie-promise@^2.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/har-validator",
"author": {
- "name": "Vsevolod Strukchinsky",
"email": "floatdrop@gmail.com",
+ "name": "Vsevolod Strukchinsky",
"url": "github.com/floatdrop"
},
+ "bugs": {
+ "url": "https://github.com/floatdrop/pinkie-promise/issues"
+ },
+ "dependencies": {
+ "pinkie": "^2.0.0"
+ },
+ "description": "ES2015 Promise ponyfill",
+ "devDependencies": {
+ "mocha": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "4c83538de1f6e660c29e0a13446844f7a7e88259",
+ "tarball": "http://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz"
+ },
"engines": {
"node": ">=0.10.0"
},
- "scripts": {
- "test": "mocha"
- },
"files": [
"index.js"
],
+ "gitHead": "f90fcae9838bcae7ae1ae4ebc9b29f11e5db4980",
+ "homepage": "https://github.com/floatdrop/pinkie-promise",
"keywords": [
- "promise",
+ "es2015",
"es6",
"polyfill",
- "ponyfill"
+ "ponyfill",
+ "promise",
+ "promises"
],
- "dependencies": {
- "pinkie": "^1.0.0"
- },
- "devDependencies": {
- "mocha": "*"
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "floatdrop",
+ "email": "floatdrop@gmail.com"
+ }
+ ],
+ "name": "pinkie-promise",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/floatdrop/pinkie-promise.git"
},
- "readme": "# pinkie-promise [![Build Status](https://travis-ci.org/floatdrop/pinkie-promise.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie-promise)\n\n> [ES6 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) ponyfill\n>\n> Ponyfill: A polyfill that doesn't overwrite the native method\n\nModule exports global Promise object (if available) or [`pinkie`](http://github.com/floatdrop/pinkie) Promise polyfill.\n\n## Install\n\n```\n$ npm install --save pinkie-promise\n```\n\n## Usage\n\n```js\nvar Promise = require('pinkie-promise');\n\nnew Promise(function (resolve) { resolve('unicorns'); });\n//=> Promise { 'unicorns' }\n```\n\n## License\n\nMIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)\n",
- "readmeFilename": "readme.md",
- "bugs": {
- "url": "https://github.com/floatdrop/pinkie-promise/issues"
+ "scripts": {
+ "test": "mocha"
},
- "homepage": "https://github.com/floatdrop/pinkie-promise#readme",
- "_id": "pinkie-promise@1.0.0",
- "_shasum": "d1da67f5482563bb7cf57f286ae2822ecfbf3670",
- "_resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz",
- "_from": "pinkie-promise@>=1.0.0 <2.0.0"
+ "version": "2.0.0"
}
diff --git a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/readme.md b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/readme.md
index bb5e9d2e0..78477f429 100644
--- a/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/readme.md
+++ b/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/readme.md
@@ -1,8 +1,6 @@
# pinkie-promise [![Build Status](https://travis-ci.org/floatdrop/pinkie-promise.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie-promise)
-> [ES6 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) ponyfill
->
-> Ponyfill: A polyfill that doesn't overwrite the native method
+> [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) ponyfill
Module exports global Promise object (if available) or [`pinkie`](http://github.com/floatdrop/pinkie) Promise polyfill.
@@ -21,6 +19,10 @@ new Promise(function (resolve) { resolve('unicorns'); });
//=> Promise { 'unicorns' }
```
+## Related
+
+- [pify](https://github.com/sindresorhus/pify) - Promisify a callback-style function
+
## License
MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)
diff --git a/node_modules/request/node_modules/har-validator/package.json b/node_modules/request/node_modules/har-validator/package.json
index 7892afc27..a04e2467c 100644
--- a/node_modules/request/node_modules/har-validator/package.json
+++ b/node_modules/request/node_modules/har-validator/package.json
@@ -1,88 +1,116 @@
{
- "version": "2.0.2",
- "name": "har-validator",
- "description": "Extremely fast HTTP Archive (HAR) validator using JSON Schema",
+ "_args": [
+ [
+ "har-validator@~2.0.2",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "har-validator@>=2.0.2 <2.1.0",
+ "_id": "har-validator@2.0.3",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/har-validator",
+ "_nodeVersion": "4.1.2",
+ "_npmUser": {
+ "email": "ahmad@ahmadnassri.com",
+ "name": "ahmadnassri"
+ },
+ "_npmVersion": "2.14.4",
+ "_phantomChildren": {
+ "ansi-regex": "2.0.0",
+ "strip-ansi": "3.0.0"
+ },
+ "_requested": {
+ "name": "har-validator",
+ "raw": "har-validator@~2.0.2",
+ "rawSpec": "~2.0.2",
+ "scope": null,
+ "spec": ">=2.0.2 <2.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request"
+ ],
+ "_resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.3.tgz",
+ "_shasum": "5a9e12564a571cf0b81ef93c2157bd1617168883",
+ "_shrinkwrap": null,
+ "_spec": "har-validator@~2.0.2",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
"author": {
- "name": "Ahmad Nassri",
"email": "ahmad@ahmadnassri.com",
+ "name": "Ahmad Nassri",
"url": "https://www.ahmadnassri.com/"
},
- "homepage": "https://github.com/ahmadnassri/har-validator",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/ahmadnassri/har-validator.git"
- },
- "license": "ISC",
- "main": "lib/index",
"bin": {
"har-validator": "bin/har-validator"
},
- "keywords": [
- "har",
- "http",
- "archive",
- "validate",
- "validator"
- ],
- "engines": {
- "node": ">=0.10"
- },
- "files": [
- "bin",
- "lib"
- ],
"bugs": {
"url": "https://github.com/ahmadnassri/har-validator/issues"
},
- "scripts": {
- "pretest": "standard && echint",
- "test": "mocha",
- "posttest": "npm run coverage",
- "coverage": "istanbul cover --dir coverage _mocha -- -R dot",
- "codeclimate": "codeclimate < coverage/lcov.info"
- },
- "echint": {
- "ignore": [
- "coverage/**"
- ]
+ "dependencies": {
+ "chalk": "^1.1.1",
+ "commander": "^2.9.0",
+ "is-my-json-valid": "^2.12.3",
+ "pinkie-promise": "^2.0.0"
},
+ "description": "Extremely fast HTTP Archive (HAR) validator using JSON Schema",
"devDependencies": {
"codeclimate-test-reporter": "0.1.1",
"echint": "^1.5.0",
- "istanbul": "^0.3.21",
- "mocha": "^2.3.3",
+ "istanbul": "^0.4.0",
+ "mocha": "^2.3.4",
"require-directory": "^2.1.1",
- "should": "^7.1.0",
+ "should": "^7.1.1",
"should-promised": "^0.3.1",
- "standard": "^5.3.1"
+ "standard": "^5.4.1"
},
- "dependencies": {
- "chalk": "^1.1.1",
- "commander": "^2.8.1",
- "is-my-json-valid": "^2.12.2",
- "pinkie-promise": "^1.0.0"
+ "directories": {},
+ "dist": {
+ "shasum": "5a9e12564a571cf0b81ef93c2157bd1617168883",
+ "tarball": "http://registry.npmjs.org/har-validator/-/har-validator-2.0.3.tgz"
},
- "gitHead": "46efd17253a81fb70614e904d9e766aa4de4f394",
- "_id": "har-validator@2.0.2",
- "_shasum": "233d0fa887b98a4f345969f811a2eec70d97aed7",
- "_from": "har-validator@>=2.0.2 <2.1.0",
- "_npmVersion": "2.14.4",
- "_nodeVersion": "4.1.1",
- "_npmUser": {
- "name": "ahmadnassri",
- "email": "ahmad@ahmadnassri.com"
+ "echint": {
+ "ignore": [
+ "coverage/**"
+ ]
},
+ "engines": {
+ "node": ">=0.10"
+ },
+ "files": [
+ "bin",
+ "lib"
+ ],
+ "gitHead": "a71163c62b8786a41d503248fb60893598f3c26f",
+ "homepage": "https://github.com/ahmadnassri/har-validator",
+ "keywords": [
+ "archive",
+ "har",
+ "http",
+ "validate",
+ "validator"
+ ],
+ "license": "ISC",
+ "main": "lib/index",
"maintainers": [
{
"name": "ahmadnassri",
"email": "ahmad@ahmadnassri.com"
}
],
- "dist": {
- "shasum": "233d0fa887b98a4f345969f811a2eec70d97aed7",
- "tarball": "http://registry.npmjs.org/har-validator/-/har-validator-2.0.2.tgz"
+ "name": "har-validator",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/ahmadnassri/har-validator.git"
},
- "directories": {},
- "_resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.2.tgz",
- "readme": "ERROR: No README data found!"
+ "scripts": {
+ "codeclimate": "codeclimate < coverage/lcov.info",
+ "coverage": "istanbul cover --dir coverage _mocha -- -R dot",
+ "posttest": "npm run coverage",
+ "pretest": "standard && echint",
+ "test": "mocha"
+ },
+ "version": "2.0.3"
}
diff --git a/node_modules/request/node_modules/hawk/dist/client.js b/node_modules/request/node_modules/hawk/dist/client.js
new file mode 100644
index 000000000..155412351
--- /dev/null
+++ b/node_modules/request/node_modules/hawk/dist/client.js
@@ -0,0 +1,340 @@
+'use strict'
+
+// Load modules
+
+;
+
+function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
+
+var Url = require('url');
+var Hoek = require('hoek');
+var Cryptiles = require('cryptiles');
+var Crypto = require('./crypto');
+var Utils = require('./utils');
+
+// Declare internals
+
+var internals = {};
+
+// Generate an Authorization header for a given request
+
+/*
+ uri: 'http://example.com/resource?a=b' or object from Url.parse()
+ method: HTTP verb (e.g. 'GET', 'POST')
+ options: {
+
+ // Required
+
+ credentials: {
+ id: 'dh37fgj492je',
+ key: 'aoijedoaijsdlaksjdl',
+ algorithm: 'sha256' // 'sha1', 'sha256'
+ },
+
+ // Optional
+
+ ext: 'application-specific', // Application specific data sent via the ext attribute
+ timestamp: Date.now(), // A pre-calculated timestamp
+ nonce: '2334f34f', // A pre-generated nonce
+ localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided)
+ payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided)
+ contentType: 'application/json', // Payload content-type (ignored if hash provided)
+ hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash
+ app: '24s23423f34dx', // Oz application id
+ dlg: '234sz34tww3sd' // Oz delegated-by application id
+ }
+*/
+
+exports.header = function (uri, method, options) {
+
+ var result = {
+ field: '',
+ artifacts: {}
+ };
+
+ // Validate inputs
+
+ if (!uri || typeof uri !== 'string' && (typeof uri === 'undefined' ? 'undefined' : _typeof(uri)) !== 'object' || !method || typeof method !== 'string' || !options || (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object') {
+
+ result.err = 'Invalid argument type';
+ return result;
+ }
+
+ // Application time
+
+ var timestamp = options.timestamp || Utils.nowSecs(options.localtimeOffsetMsec);
+
+ // Validate credentials
+
+ var credentials = options.credentials;
+ if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) {
+
+ result.err = 'Invalid credential object';
+ return result;
+ }
+
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ result.err = 'Unknown algorithm';
+ return result;
+ }
+
+ // Parse URI
+
+ if (typeof uri === 'string') {
+ uri = Url.parse(uri);
+ }
+
+ // Calculate signature
+
+ var artifacts = {
+ ts: timestamp,
+ nonce: options.nonce || Cryptiles.randomString(6),
+ method: method,
+ resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
+ host: uri.hostname,
+ port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
+ hash: options.hash,
+ ext: options.ext,
+ app: options.app,
+ dlg: options.dlg
+ };
+
+ result.artifacts = artifacts;
+
+ // Calculate payload hash
+
+ if (!artifacts.hash && (options.payload || options.payload === '')) {
+
+ artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
+ }
+
+ var mac = Crypto.calculateMac('header', credentials, artifacts);
+
+ // Construct header
+
+ var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed
+ var header = 'Hawk id="' + credentials.id + '", ts="' + artifacts.ts + '", nonce="' + artifacts.nonce + (artifacts.hash ? '", hash="' + artifacts.hash : '') + (hasExt ? '", ext="' + Hoek.escapeHeaderAttribute(artifacts.ext) : '') + '", mac="' + mac + '"';
+
+ if (artifacts.app) {
+ header = header + ', app="' + artifacts.app + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"';
+ }
+
+ result.field = header;
+
+ return result;
+};
+
+// Validate server response
+
+/*
+ res: node's response object
+ artifacts: object received from header().artifacts
+ options: {
+ payload: optional payload received
+ required: specifies if a Server-Authorization header is required. Defaults to 'false'
+ }
+*/
+
+exports.authenticate = function (res, credentials, artifacts, options) {
+
+ artifacts = Hoek.clone(artifacts);
+ options = options || {};
+
+ if (res.headers['www-authenticate']) {
+
+ // Parse HTTP WWW-Authenticate header
+
+ var wwwAttributes = Utils.parseAuthorizationHeader(res.headers['www-authenticate'], ['ts', 'tsm', 'error']);
+ if (wwwAttributes instanceof Error) {
+ return false;
+ }
+
+ // Validate server timestamp (not used to update clock since it is done via the SNPT client)
+
+ if (wwwAttributes.ts) {
+ var tsm = Crypto.calculateTsMac(wwwAttributes.ts, credentials);
+ if (tsm !== wwwAttributes.tsm) {
+ return false;
+ }
+ }
+ }
+
+ // Parse HTTP Server-Authorization header
+
+ if (!res.headers['server-authorization'] && !options.required) {
+
+ return true;
+ }
+
+ var attributes = Utils.parseAuthorizationHeader(res.headers['server-authorization'], ['mac', 'ext', 'hash']);
+ if (attributes instanceof Error) {
+ return false;
+ }
+
+ artifacts.ext = attributes.ext;
+ artifacts.hash = attributes.hash;
+
+ var mac = Crypto.calculateMac('response', credentials, artifacts);
+ if (mac !== attributes.mac) {
+ return false;
+ }
+
+ if (!options.payload && options.payload !== '') {
+
+ return true;
+ }
+
+ if (!attributes.hash) {
+ return false;
+ }
+
+ var calculatedHash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, res.headers['content-type']);
+ return calculatedHash === attributes.hash;
+};
+
+// Generate a bewit value for a given URI
+
+/*
+ uri: 'http://example.com/resource?a=b' or object from Url.parse()
+ options: {
+
+ // Required
+
+ credentials: {
+ id: 'dh37fgj492je',
+ key: 'aoijedoaijsdlaksjdl',
+ algorithm: 'sha256' // 'sha1', 'sha256'
+ },
+ ttlSec: 60 * 60, // TTL in seconds
+
+ // Optional
+
+ ext: 'application-specific', // Application specific data sent via the ext attribute
+ localtimeOffsetMsec: 400 // Time offset to sync with server time
+ };
+*/
+
+exports.getBewit = function (uri, options) {
+
+ // Validate inputs
+
+ if (!uri || typeof uri !== 'string' && (typeof uri === 'undefined' ? 'undefined' : _typeof(uri)) !== 'object' || !options || (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' || !options.ttlSec) {
+
+ return '';
+ }
+
+ options.ext = options.ext === null || options.ext === undefined ? '' : options.ext; // Zero is valid value
+
+ // Application time
+
+ var now = Utils.now(options.localtimeOffsetMsec);
+
+ // Validate credentials
+
+ var credentials = options.credentials;
+ if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) {
+
+ return '';
+ }
+
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ return '';
+ }
+
+ // Parse URI
+
+ if (typeof uri === 'string') {
+ uri = Url.parse(uri);
+ }
+
+ // Calculate signature
+
+ var exp = Math.floor(now / 1000) + options.ttlSec;
+ var mac = Crypto.calculateMac('bewit', credentials, {
+ ts: exp,
+ nonce: '',
+ method: 'GET',
+ resource: uri.pathname + (uri.search || ''), // Maintain trailing '?'
+ host: uri.hostname,
+ port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
+ ext: options.ext
+ });
+
+ // Construct bewit: id\exp\mac\ext
+
+ var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext;
+ return Hoek.base64urlEncode(bewit);
+};
+
+// Generate an authorization string for a message
+
+/*
+ host: 'example.com',
+ port: 8000,
+ message: '{"some":"payload"}', // UTF-8 encoded string for body hash generation
+ options: {
+
+ // Required
+
+ credentials: {
+ id: 'dh37fgj492je',
+ key: 'aoijedoaijsdlaksjdl',
+ algorithm: 'sha256' // 'sha1', 'sha256'
+ },
+
+ // Optional
+
+ timestamp: Date.now(), // A pre-calculated timestamp
+ nonce: '2334f34f', // A pre-generated nonce
+ localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided)
+ }
+*/
+
+exports.message = function (host, port, message, options) {
+
+ // Validate inputs
+
+ if (!host || typeof host !== 'string' || !port || typeof port !== 'number' || message === null || message === undefined || typeof message !== 'string' || !options || (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object') {
+
+ return null;
+ }
+
+ // Application time
+
+ var timestamp = options.timestamp || Utils.nowSecs(options.localtimeOffsetMsec);
+
+ // Validate credentials
+
+ var credentials = options.credentials;
+ if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) {
+
+ // Invalid credential object
+ return null;
+ }
+
+ if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ return null;
+ }
+
+ // Calculate signature
+
+ var artifacts = {
+ ts: timestamp,
+ nonce: options.nonce || Cryptiles.randomString(6),
+ host: host,
+ port: port,
+ hash: Crypto.calculatePayloadHash(message, credentials.algorithm)
+ };
+
+ // Construct authorization
+
+ var result = {
+ id: credentials.id,
+ ts: artifacts.ts,
+ nonce: artifacts.nonce,
+ hash: artifacts.hash,
+ mac: Crypto.calculateMac('message', credentials, artifacts)
+ };
+
+ return result;
+};
diff --git a/node_modules/request/node_modules/hawk/lib/browser.js b/node_modules/request/node_modules/hawk/lib/browser.js
index 7ccacf613..a7945d0dd 100755
--- a/node_modules/request/node_modules/hawk/lib/browser.js
+++ b/node_modules/request/node_modules/hawk/lib/browser.js
@@ -93,8 +93,8 @@ hawk.client = {
ts: timestamp,
nonce: options.nonce || hawk.utils.randomString(6),
method: method,
- resource: uri.relative,
- host: uri.hostname,
+ resource: uri.resource,
+ host: uri.host,
port: uri.port,
hash: options.hash,
ext: options.ext,
@@ -201,8 +201,8 @@ hawk.client = {
ts: exp,
nonce: '',
method: 'GET',
- resource: uri.relative, // Maintain trailing '?' and query params
- host: uri.hostname,
+ resource: uri.resource, // Maintain trailing '?' and query params
+ host: uri.host,
port: uri.port,
ext: options.ext
});
@@ -583,26 +583,20 @@ hawk.utils = {
return result.join('');
},
+ uriRegex: /^([^:]+)\:\/\/(?:[^@]*@)?([^\/:]+)(?:\:(\d+))?([^#]*)(?:#.*)?$/, // scheme://credentials@host:port/resource#fragment
parseUri: function (input) {
- // Based on: parseURI 1.2.2
- // http://blog.stevenlevithan.com/archives/parseuri
- // (c) Steven Levithan <stevenlevithan.com>
- // MIT License
-
- var keys = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'hostname', 'port', 'resource', 'relative', 'pathname', 'directory', 'file', 'query', 'fragment'];
-
- var uriRegex = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?)(?:#(.*))?)/;
- var uriByNumber = input.match(uriRegex);
- var uri = {};
-
- for (var i = 0, il = keys.length; i < il; ++i) {
- uri[keys[i]] = uriByNumber[i] || '';
+ var parts = input.match(hawk.utils.uriRegex);
+ if (!parts) {
+ return { host: '', port: '', resource: '' };
}
- if (uri.port === '') {
- uri.port = (uri.protocol.toLowerCase() === 'http' ? '80' : (uri.protocol.toLowerCase() === 'https' ? '443' : ''));
- }
+ var scheme = parts[1].toLowerCase();
+ var uri = {
+ host: parts[2],
+ port: parts[3] || (scheme === 'http' ? '80' : (scheme === 'https' ? '443' : '')),
+ resource: parts[4]
+ };
return uri;
},
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/README.md b/node_modules/request/node_modules/hawk/node_modules/boom/README.md
index cb1e9089f..cbd91c931 100755
--- a/node_modules/request/node_modules/hawk/node_modules/boom/README.md
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/README.md
@@ -27,6 +27,41 @@ object (instance of `Error`) which includes the following properties:
The `Boom` object also supports the following method:
- `reformat()` - rebuilds `error.output` using the other object properties.
+## Overview
+
+- Helper methods
+ - [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message)
+ - [`create(statusCode, [message], [data])`](#createstatuscode-message-data)
+- HTTP 4xx Errors
+ - 400: [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data)
+ - 401: [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes)
+ - 403: [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data)
+ - 404: [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data)
+ - 405: [`Boom.methodNotAllowed([message], [data])`](#boommethodnotallowedmessage-data)
+ - 406: [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data)
+ - 407: [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data)
+ - 408: [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data)
+ - 409: [`Boom.conflict([message], [data])`](#boomconflictmessage-data)
+ - 410: [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data)
+ - 411: [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data)
+ - 412: [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data)
+ - 413: [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data)
+ - 414: [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data)
+ - 415: [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data)
+ - 416: [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data)
+ - 417: [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data)
+ - 422: [`Boom.badData([message], [data])`](#boombaddatamessage-data)
+ - 428: [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data)
+ - 429: [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data)
+- HTTP 5xx Errors
+ - 500: [`Boom.badImplementation([message], [data])`](#boombadimplementationmessage-data)
+ - 501: [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data)
+ - 502: [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data)
+ - 503: [`Boom.serverTimeout([message], [data])`](#boomservertimeoutmessage-data)
+ - 504: [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data)
+- [FAQ](#faq)
+
+
## Helper Methods
### `wrap(error, [statusCode], [message])`
@@ -467,6 +502,26 @@ Generates the following response payload:
}
```
+### `Boom.preconditionRequired([message], [data])`
+
+Returns a 428 Precondition Required error where:
+- `message` - optional message.
+- `data` - optional additional error data.
+
+```js
+Boom.preconditionRequired('you must supply an If-Match header');
+```
+
+Generates the following response payload:
+
+```json
+{
+ "statusCode": 428,
+ "error": "Precondition Required",
+ "message": "you must supply an If-Match header"
+}
+```
+
### `Boom.tooManyRequests([message], [data])`
Returns a 429 Too Many Requests error where:
@@ -491,6 +546,26 @@ Generates the following response payload:
All 500 errors hide your message from the end user. Your message is recorded in the server log.
+### `Boom.badImplementation([message], [data])`
+
+Returns a 500 Internal Server Error error where:
+- `message` - optional message.
+- `data` - optional additional error data.
+
+```js
+Boom.badImplementation('terrible implementation');
+```
+
+Generates the following response payload:
+
+```json
+{
+ "statusCode": 500,
+ "error": "Internal Server Error",
+ "message": "An internal server error occurred"
+}
+```
+
### `Boom.notImplemented([message], [data])`
Returns a 501 Not Implemented error where:
@@ -570,26 +645,6 @@ Generates the following response payload:
}
```
-### `Boom.badImplementation([message], [data])`
-
-Returns a 500 Internal Server Error error where:
-- `message` - optional message.
-- `data` - optional additional error data.
-
-```js
-Boom.badImplementation('terrible implementation');
-```
-
-Generates the following response payload:
-
-```json
-{
- "statusCode": 500,
- "error": "Internal Server Error",
- "message": "An internal server error occurred"
-}
-```
-
## F.A.Q.
###### How do I include extra information in my responses? `output.payload` is missing `data`, what gives?
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js b/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js
index 239a441e8..6bdea6936 100755
--- a/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js
@@ -253,6 +253,12 @@ exports.badData = function (message, data) {
};
+exports.preconditionRequired = function (message, data) {
+
+ return internals.create(428, message, data, exports.preconditionRequired);
+};
+
+
exports.tooManyRequests = function (message, data) {
return internals.create(429, message, data, exports.tooManyRequests);
@@ -272,7 +278,7 @@ internals.serverError = function (message, data, statusCode, ctor) {
if (data instanceof Error) {
error = exports.wrap(data, statusCode, message);
} else {
- error = internals.create(statusCode || 500, message, ctor);
+ error = internals.create(statusCode || 500, message, undefined, ctor);
error.data = data;
}
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/package.json b/node_modules/request/node_modules/hawk/node_modules/boom/package.json
index c9d3f09b6..42749188a 100644
--- a/node_modules/request/node_modules/hawk/node_modules/boom/package.json
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/package.json
@@ -1,45 +1,66 @@
{
- "name": "boom",
- "description": "HTTP-friendly error objects",
- "version": "2.9.0",
- "repository": {
- "type": "git",
- "url": "git://github.com/hapijs/boom.git"
+ "_args": [
+ [
+ "boom@2.x.x",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/hawk"
+ ]
+ ],
+ "_from": "boom@>=2.0.0 <3.0.0",
+ "_id": "boom@2.10.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/hawk/boom",
+ "_nodeVersion": "0.10.40",
+ "_npmUser": {
+ "email": "arbretz@gmail.com",
+ "name": "arb"
},
- "main": "lib/index.js",
- "keywords": [
- "error",
- "http"
+ "_npmVersion": "2.11.1",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "boom",
+ "raw": "boom@2.x.x",
+ "rawSpec": "2.x.x",
+ "scope": null,
+ "spec": ">=2.0.0 <3.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/hawk",
+ "/request/hawk/cryptiles"
],
- "engines": {
- "node": ">=0.10.40"
+ "_resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
+ "_shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
+ "_shrinkwrap": null,
+ "_spec": "boom@2.x.x",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/hawk",
+ "bugs": {
+ "url": "https://github.com/hapijs/boom/issues"
},
"dependencies": {
"hoek": "2.x.x"
},
+ "description": "HTTP-friendly error objects",
"devDependencies": {
"code": "1.x.x",
- "lab": "5.x.x"
+ "lab": "7.x.x"
},
- "scripts": {
- "test": "lab -a code -t 100 -L",
- "test-cov-html": "lab -a code -r html -o coverage.html -L"
+ "directories": {},
+ "dist": {
+ "shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
+ "tarball": "http://registry.npmjs.org/boom/-/boom-2.10.1.tgz"
},
- "license": "BSD-3-Clause",
- "gitHead": "2ffee0e9d9868140911d30c7acfd7925e534623e",
- "bugs": {
- "url": "https://github.com/hapijs/boom/issues"
+ "engines": {
+ "node": ">=0.10.40"
},
+ "gitHead": "ff1a662a86b39426cdd18f4441b112d307a34a6f",
"homepage": "https://github.com/hapijs/boom#readme",
- "_id": "boom@2.9.0",
- "_shasum": "a54b7fd2fee477d351bf9e371680cbea67f12715",
- "_from": "boom@>=2.8.0 <3.0.0",
- "_npmVersion": "2.11.1",
- "_nodeVersion": "0.10.40",
- "_npmUser": {
- "name": "arb",
- "email": "arbretz@gmail.com"
- },
+ "keywords": [
+ "error",
+ "http"
+ ],
+ "license": "BSD-3-Clause",
+ "main": "lib/index.js",
"maintainers": [
{
"name": "hueniverse",
@@ -54,11 +75,16 @@
"email": "arbretz@gmail.com"
}
],
- "dist": {
- "shasum": "a54b7fd2fee477d351bf9e371680cbea67f12715",
- "tarball": "http://registry.npmjs.org/boom/-/boom-2.9.0.tgz"
+ "name": "boom",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/hapijs/boom.git"
},
- "directories": {},
- "_resolved": "https://registry.npmjs.org/boom/-/boom-2.9.0.tgz",
- "readme": "ERROR: No README data found!"
+ "scripts": {
+ "test": "lab -a code -t 100 -L",
+ "test-cov-html": "lab -a code -r html -o coverage.html -L"
+ },
+ "version": "2.10.1"
}
diff --git a/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js b/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js
index 6c261ac07..79a59e9f4 100755
--- a/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js
+++ b/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js
@@ -1,6 +1,5 @@
// Load modules
-var Util = require('util');
var Code = require('code');
var Boom = require('../lib');
var Lab = require('lab');
@@ -460,6 +459,22 @@ describe('badData()', function () {
});
+describe('preconditionRequired()', function () {
+
+ it('returns a 428 error statusCode', function (done) {
+
+ expect(Boom.preconditionRequired().output.statusCode).to.equal(428);
+ done();
+ });
+
+ it('sets the message with the passed in message', function (done) {
+
+ expect(Boom.preconditionRequired('my message').message).to.equal('my message');
+ done();
+ });
+});
+
+
describe('tooManyRequests()', function () {
it('returns a 429 error statusCode', function (done) {
@@ -614,3 +629,26 @@ describe('badImplementation()', function () {
done();
});
});
+
+describe('stack trace', function () {
+
+ it('should omit lib', function (done) {
+
+ ['badRequest', 'unauthorized', 'forbidden', 'notFound', 'methodNotAllowed',
+ 'notAcceptable', 'proxyAuthRequired', 'clientTimeout', 'conflict',
+ 'resourceGone', 'lengthRequired', 'preconditionFailed', 'entityTooLarge',
+ 'uriTooLong', 'unsupportedMediaType', 'rangeNotSatisfiable', 'expectationFailed',
+ 'badData', 'preconditionRequired', 'tooManyRequests',
+
+ // 500s
+ 'internal', 'notImplemented', 'badGateway', 'serverTimeout', 'gatewayTimeout',
+ 'badImplementation'
+ ].forEach(function (name) {
+
+ var err = Boom[name]();
+ expect(err.stack).to.not.match(/\/lib\/index\.js/);
+ });
+
+ done();
+ });
+});
diff --git a/node_modules/request/node_modules/hawk/package.json b/node_modules/request/node_modules/hawk/package.json
index 5a835b2e4..4a51ea4ca 100644
--- a/node_modules/request/node_modules/hawk/package.json
+++ b/node_modules/request/node_modules/hawk/package.json
@@ -1,68 +1,93 @@
{
- "name": "hawk",
- "description": "HTTP Hawk Authentication Scheme",
- "version": "3.1.0",
- "author": {
- "name": "Eran Hammer",
+ "_args": [
+ [
+ "hawk@~3.1.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "hawk@>=3.1.0 <3.2.0",
+ "_id": "hawk@3.1.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/hawk",
+ "_nodeVersion": "5.0.0",
+ "_npmUser": {
"email": "eran@hammer.io",
- "url": "http://hueniverse.com"
+ "name": "hueniverse"
},
- "contributors": [],
- "repository": {
- "type": "git",
- "url": "git://github.com/hueniverse/hawk.git"
+ "_npmVersion": "3.3.12",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "hawk",
+ "raw": "hawk@~3.1.0",
+ "rawSpec": "~3.1.0",
+ "scope": null,
+ "spec": ">=3.1.0 <3.2.0",
+ "type": "range"
},
- "main": "lib/index.js",
- "keywords": [
- "http",
- "authentication",
- "scheme",
- "hawk"
+ "_requiredBy": [
+ "/request"
],
- "engines": {
- "node": ">=0.10.32"
+ "_resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.2.tgz",
+ "_shasum": "90c90118886e21975d1ad4ae9b3e284ed19a2de8",
+ "_shrinkwrap": null,
+ "_spec": "hawk@~3.1.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
+ "author": {
+ "email": "eran@hammer.io",
+ "name": "Eran Hammer",
+ "url": "http://hueniverse.com"
},
"browser": "./lib/browser.js",
+ "bugs": {
+ "url": "https://github.com/hueniverse/hawk/issues"
+ },
+ "contributors": [],
"dependencies": {
- "hoek": "2.x.x",
- "boom": "^2.8.x",
+ "boom": "2.x.x",
"cryptiles": "2.x.x",
+ "hoek": "2.x.x",
"sntp": "1.x.x"
},
+ "description": "HTTP Hawk Authentication Scheme",
"devDependencies": {
"code": "1.x.x",
"lab": "5.x.x"
},
- "scripts": {
- "test": "lab -a code -t 100 -L",
- "test-cov-html": "lab -a code -r html -o coverage.html"
+ "directories": {},
+ "dist": {
+ "shasum": "90c90118886e21975d1ad4ae9b3e284ed19a2de8",
+ "tarball": "http://registry.npmjs.org/hawk/-/hawk-3.1.2.tgz"
},
- "license": "BSD-3-Clause",
- "gitHead": "fdb9d05e383d5237631eaddc4f51422e54fa8b52",
- "bugs": {
- "url": "https://github.com/hueniverse/hawk/issues"
+ "engines": {
+ "node": ">=0.10.32"
},
+ "gitHead": "66dd8f9b32058c2e834b0976b2f112e19f38ee72",
"homepage": "https://github.com/hueniverse/hawk#readme",
- "_id": "hawk@3.1.0",
- "_shasum": "8a13ae19977ec607602f3f0b9fd676f18c384e44",
- "_from": "hawk@>=3.1.0 <3.2.0",
- "_npmVersion": "2.10.0",
- "_nodeVersion": "0.10.38",
- "_npmUser": {
- "name": "hueniverse",
- "email": "eran@hammer.io"
- },
- "dist": {
- "shasum": "8a13ae19977ec607602f3f0b9fd676f18c384e44",
- "tarball": "http://registry.npmjs.org/hawk/-/hawk-3.1.0.tgz"
- },
+ "keywords": [
+ "authentication",
+ "hawk",
+ "http",
+ "scheme"
+ ],
+ "license": "BSD-3-Clause",
+ "main": "lib/index.js",
"maintainers": [
{
"name": "hueniverse",
"email": "eran@hueniverse.com"
}
],
- "directories": {},
- "_resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.0.tgz",
- "readme": "ERROR: No README data found!"
+ "name": "hawk",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/hueniverse/hawk.git"
+ },
+ "scripts": {
+ "test": "lab -a code -t 100 -L",
+ "test-cov-html": "lab -a code -r html -o coverage.html"
+ },
+ "version": "3.1.2"
}
diff --git a/node_modules/request/node_modules/hawk/test/browser.js b/node_modules/request/node_modules/hawk/test/browser.js
index 49dc4cadd..9bec675fe 100755
--- a/node_modules/request/node_modules/hawk/test/browser.js
+++ b/node_modules/request/node_modules/hawk/test/browser.js
@@ -44,15 +44,15 @@ describe('Browser', function () {
port: 80
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var bewit = Browser.client.bewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials, ttlSec: 60 * 60 * 24 * 365 * 100, ext: 'some-app-data' });
+ var bewit = Browser.client.bewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100, ext: 'some-app-data' });
req.url += '&bewit=' + bewit;
- Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+ Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials2, attributes) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(attributes.ext).to.equal('some-app-data');
done();
});
@@ -68,15 +68,15 @@ describe('Browser', function () {
port: 80
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var bewit = Browser.client.bewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials, ttlSec: 60 * 60 * 24 * 365 * 100 });
+ var bewit = Browser.client.bewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100 });
req.url += '&bewit=' + bewit;
- Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+ Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials2, attributes) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
done();
});
});
@@ -242,15 +242,15 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' }).field;
expect(req.authorization).to.exist();
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
done();
});
@@ -270,17 +270,17 @@ describe('Browser', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -292,10 +292,10 @@ describe('Browser', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
expect(res.headers['server-authorization']).to.exist();
- expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
+ expect(Browser.client.authenticate(res, credentials2, artifacts, { payload: 'some reply' })).to.equal(true);
done();
});
});
@@ -314,17 +314,17 @@ describe('Browser', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -336,10 +336,10 @@ describe('Browser', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
expect(res.headers['server-authorization']).to.exist();
- expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
+ expect(Browser.client.authenticate(res, credentials2, artifacts, { payload: 'some reply' })).to.equal(true);
done();
});
});
@@ -354,15 +354,15 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', localtimeOffsetMsec: 100000 }).field;
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', localtimeOffsetMsec: 100000 }).field;
expect(req.authorization).to.exist();
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 100000 }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 100000 }, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
done();
});
@@ -382,17 +382,17 @@ describe('Browser', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -404,10 +404,10 @@ describe('Browser', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts);
expect(res.headers['server-authorization']).to.exist();
- expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+ expect(Browser.client.authenticate(res, credentials2, artifacts)).to.equal(true);
done();
});
});
@@ -426,17 +426,17 @@ describe('Browser', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -448,7 +448,7 @@ describe('Browser', function () {
}
};
- expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+ expect(Browser.client.authenticate(res, credentials2, artifacts)).to.equal(true);
done();
});
});
@@ -463,14 +463,14 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
Browser.utils.setNtpOffset(60 * 60 * 1000);
- var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
+ var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' });
req.authorization = header.field;
expect(req.authorization).to.exist();
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts2) {
expect(err).to.exist();
expect(err.message).to.equal('Stale timestamp');
@@ -479,24 +479,24 @@ describe('Browser', function () {
headers: {
'www-authenticate': err.output.headers['WWW-Authenticate']
},
- getResponseHeader: function (header) {
+ getResponseHeader: function (lookup) {
- return res.headers[header.toLowerCase()];
+ return res.headers[lookup.toLowerCase()];
}
};
expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
- expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
+ expect(Browser.client.authenticate(res, credentials2, header.artifacts)).to.equal(true);
expect(Browser.utils.getNtpOffset()).to.equal(0);
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials2, ext: 'some-app-data' }).field;
expect(req.authorization).to.exist();
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials3, artifacts3) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
- expect(artifacts.ext).to.equal('some-app-data');
+ expect(credentials3.user).to.equal('steve');
+ expect(artifacts3.ext).to.equal('some-app-data');
done();
});
});
@@ -512,18 +512,18 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
var localStorage = new Browser.internals.LocalStorage();
Browser.utils.setStorage(localStorage);
Browser.utils.setNtpOffset(60 * 60 * 1000);
- var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
+ var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' });
req.authorization = header.field;
expect(req.authorization).to.exist();
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts2) {
expect(err).to.exist();
expect(err.message).to.equal('Stale timestamp');
@@ -532,26 +532,26 @@ describe('Browser', function () {
headers: {
'www-authenticate': err.output.headers['WWW-Authenticate']
},
- getResponseHeader: function (header) {
+ getResponseHeader: function (lookup) {
- return res.headers[header.toLowerCase()];
+ return res.headers[lookup.toLowerCase()];
}
};
expect(parseInt(localStorage.getItem('hawk_ntp_offset'))).to.equal(60 * 60 * 1000);
expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
- expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
+ expect(Browser.client.authenticate(res, credentials2, header.artifacts)).to.equal(true);
expect(Browser.utils.getNtpOffset()).to.equal(0);
expect(parseInt(localStorage.getItem('hawk_ntp_offset'))).to.equal(0);
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials2, ext: 'some-app-data' }).field;
expect(req.authorization).to.exist();
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials3, artifacts3) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
- expect(artifacts.ext).to.equal('some-app-data');
+ expect(credentials3.user).to.equal('steve');
+ expect(artifacts3.ext).to.equal('some-app-data');
done();
});
});
@@ -571,17 +571,17 @@ describe('Browser', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -593,10 +593,10 @@ describe('Browser', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts);
expect(res.headers['server-authorization']).to.exist();
- expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(false);
+ expect(Browser.client.authenticate(res, credentials2, artifacts, { payload: 'some reply' })).to.equal(false);
done();
});
});
@@ -611,13 +611,13 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
done();
});
@@ -633,16 +633,16 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts)).to.be.true();
- expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts)).to.be.false();
+ expect(Hawk.server.authenticatePayload('hola!', credentials2, artifacts)).to.be.true();
+ expect(Hawk.server.authenticatePayload('hello!', credentials2, artifacts)).to.be.false();
done();
});
});
@@ -657,13 +657,13 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
expect(artifacts.app).to.equal('asd23ased');
done();
@@ -680,13 +680,13 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
expect(artifacts.app).to.equal('asd23ased');
expect(artifacts.dlg).to.equal('23434szr3q4d');
@@ -704,10 +704,10 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
- Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials, artifacts) {
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials2, artifacts) {
expect(err).to.exist();
expect(err.output.payload.message).to.equal('Bad payload hash');
@@ -725,15 +725,15 @@ describe('Browser', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' }).field;
req.url = '/something/else';
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.exist();
- expect(credentials).to.exist();
+ expect(credentials2).to.exist();
done();
});
});
@@ -1123,15 +1123,15 @@ describe('Browser', function () {
it('generates an authorization then successfully parse it', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Browser.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Browser.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
done();
});
});
@@ -1429,19 +1429,52 @@ describe('Browser', function () {
describe('parseUri()', function () {
+ it('returns empty object on invalid', function (done) {
+
+ var uri = Browser.utils.parseUri('ftp');
+ expect(uri).to.deep.equal({ host: '', port: '', resource: '' });
+ done();
+ });
+
it('returns empty port when unknown scheme', function (done) {
- var uri = Browser.utils.parseUri('ftp://domain');
+ var uri = Browser.utils.parseUri('ftp://example.com');
expect(uri.port).to.equal('');
done();
});
it('returns default port when missing', function (done) {
- var uri = Browser.utils.parseUri('http://');
+ var uri = Browser.utils.parseUri('http://example.com');
expect(uri.port).to.equal('80');
done();
});
+
+ it('handles unusual characters correctly', function (done) {
+
+ var parts = {
+ protocol: 'http+vnd.my-extension',
+ user: 'user!$&\'()*+,;=%40my-domain.com',
+ password: 'pass!$&\'()*+,;=%40:word',
+ hostname: 'foo-bar.com',
+ port: '99',
+ pathname: '/path/%40/!$&\'()*+,;=:@/',
+ query: 'query%40/!$&\'()*+,;=:@/?',
+ fragment: 'fragm%40/!$&\'()*+,;=:@/?'
+ };
+
+ parts.userInfo = parts.user + ':' + parts.password;
+ parts.authority = parts.userInfo + '@' + parts.hostname + ':' + parts.port;
+ parts.relative = parts.pathname + '?' + parts.query;
+ parts.resource = parts.relative + '#' + parts.fragment;
+ parts.source = parts.protocol + '://' + parts.authority + parts.resource;
+
+ var uri = Browser.utils.parseUri(parts.source);
+ expect(uri.host).to.equal('foo-bar.com');
+ expect(uri.port).to.equal('99');
+ expect(uri.resource).to.equal(parts.pathname + '?' + parts.query);
+ done();
+ });
});
var str = 'https://www.google.ca/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=url';
diff --git a/node_modules/request/node_modules/hawk/test/index.js b/node_modules/request/node_modules/hawk/test/index.js
index 39f2c5b86..e67afab57 100755
--- a/node_modules/request/node_modules/hawk/test/index.js
+++ b/node_modules/request/node_modules/hawk/test/index.js
@@ -42,15 +42,15 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header(Url.parse('http://example.com:8080/resource/4?filter=a'), req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ req.authorization = Hawk.client.header(Url.parse('http://example.com:8080/resource/4?filter=a'), req.method, { credentials: credentials1, ext: 'some-app-data' }).field;
expect(req.authorization).to.exist();
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
done();
});
@@ -70,17 +70,17 @@ describe('Hawk', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -88,10 +88,10 @@ describe('Hawk', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
expect(res.headers['server-authorization']).to.exist();
- expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
+ expect(Hawk.client.authenticate(res, credentials2, artifacts, { payload: 'some reply' })).to.equal(true);
done();
});
});
@@ -110,17 +110,17 @@ describe('Hawk', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -128,10 +128,10 @@ describe('Hawk', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
expect(res.headers['server-authorization']).to.exist();
- expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
+ expect(Hawk.client.authenticate(res, credentials2, artifacts, { payload: 'some reply' })).to.equal(true);
done();
});
});
@@ -150,17 +150,17 @@ describe('Hawk', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -168,10 +168,10 @@ describe('Hawk', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts);
expect(res.headers['server-authorization']).to.exist();
- expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(true);
+ expect(Hawk.client.authenticate(res, credentials2, artifacts)).to.equal(true);
done();
});
});
@@ -190,17 +190,17 @@ describe('Hawk', function () {
var payload = 'some not so random text';
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+ var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
req.headers.authorization = reqHeader.field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+ expect(Hawk.server.authenticatePayload(payload, credentials2, artifacts, req.headers['content-type'])).to.equal(true);
var res = {
headers: {
@@ -208,10 +208,10 @@ describe('Hawk', function () {
}
};
- res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+ res.headers['server-authorization'] = Hawk.server.header(credentials2, artifacts);
expect(res.headers['server-authorization']).to.exist();
- expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(false);
+ expect(Hawk.client.authenticate(res, credentials2, artifacts, { payload: 'some reply' })).to.equal(false);
done();
});
});
@@ -226,13 +226,13 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
done();
});
@@ -248,16 +248,16 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
- expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts)).to.be.true();
- expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts)).to.be.false();
+ expect(Hawk.server.authenticatePayload('hola!', credentials2, artifacts)).to.be.true();
+ expect(Hawk.server.authenticatePayload('hello!', credentials2, artifacts)).to.be.false();
done();
});
});
@@ -272,13 +272,13 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
- Hawk.server.authenticate(req, credentialsFunc, { payload: 'hola!' }, function (err, credentials, artifacts) {
+ req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, { payload: 'hola!' }, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
done();
});
@@ -294,13 +294,13 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
expect(artifacts.app).to.equal('asd23ased');
done();
@@ -317,13 +317,13 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(artifacts.ext).to.equal('some-app-data');
expect(artifacts.app).to.equal('asd23ased');
expect(artifacts.dlg).to.equal('23434szr3q4d');
@@ -341,10 +341,10 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
- Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials, artifacts) {
+ req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, payload: 'hola!', ext: 'some-app-data' }).field;
+ Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials2, artifacts) {
expect(err).to.exist();
expect(err.output.payload.message).to.equal('Bad payload hash');
@@ -362,15 +362,15 @@ describe('Hawk', function () {
port: 8080
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+ req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials1, ext: 'some-app-data' }).field;
req.url = '/something/else';
- Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials2, artifacts) {
expect(err).to.exist();
- expect(credentials).to.exist();
+ expect(credentials2).to.exist();
done();
});
});
diff --git a/node_modules/request/node_modules/hawk/test/server.js b/node_modules/request/node_modules/hawk/test/server.js
index b95b7cd02..66ce36c9d 100755
--- a/node_modules/request/node_modules/hawk/test/server.js
+++ b/node_modules/request/node_modules/hawk/test/server.js
@@ -200,12 +200,12 @@ describe('Server', function () {
}
};
- Hawk.server.authenticate(req, credentialsFunc, options, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, options, function (err, credentials1, artifacts1) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials1.user).to.equal('steve');
- Hawk.server.authenticate(req, credentialsFunc, options, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFunc, options, function (err, credentials2, artifacts2) {
expect(err).to.exist();
expect(err.output.payload.message).to.equal('Invalid nonce');
@@ -232,7 +232,7 @@ describe('Server', function () {
authorization: 'Hawk id="456", ts="1353788437", nonce="k3j4h2", mac="LXfmTnRzrLd9TD7yfH+4se46Bx6AHyhpM94hLCiNia4=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
var credentials = {
'123': {
@@ -266,15 +266,15 @@ describe('Server', function () {
}
};
- Hawk.server.authenticate(reqSteve, credentialsFunc, options, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(reqSteve, credentialsFuncion, options, function (err, credentials1, artifacts1) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials1.user).to.equal('steve');
- Hawk.server.authenticate(reqBob, credentialsFunc, options, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(reqBob, credentialsFuncion, options, function (err, credentials2, artifacts2) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('bob');
+ expect(credentials2.user).to.equal('bob');
done();
});
});
@@ -579,12 +579,12 @@ describe('Server', function () {
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
return callback(new Error('Unknown user'));
};
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFuncion, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
expect(err).to.exist();
expect(err.message).to.equal('Unknown user');
@@ -602,12 +602,12 @@ describe('Server', function () {
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
return callback(new Error('Unknown user'), { some: 'value' });
};
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFuncion, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
expect(err).to.exist();
expect(err.message).to.equal('Unknown user');
@@ -626,12 +626,12 @@ describe('Server', function () {
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
return callback(null, null);
};
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFuncion, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
expect(err).to.exist();
expect(err.output.payload.message).to.equal('Unknown credentials');
@@ -649,7 +649,7 @@ describe('Server', function () {
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
var credentials = {
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
@@ -659,7 +659,7 @@ describe('Server', function () {
return callback(null, credentials);
};
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFuncion, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid credentials');
@@ -678,7 +678,7 @@ describe('Server', function () {
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
var credentials = {
id: '23434d3q4d5345d',
@@ -688,7 +688,7 @@ describe('Server', function () {
return callback(null, credentials);
};
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFuncion, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid credentials');
@@ -707,7 +707,7 @@ describe('Server', function () {
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
var credentials = {
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
@@ -718,7 +718,7 @@ describe('Server', function () {
return callback(null, credentials);
};
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFuncion, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
expect(err).to.exist();
expect(err.message).to.equal('Unknown algorithm');
@@ -737,7 +737,7 @@ describe('Server', function () {
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcU4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
};
- var credentialsFunc = function (id, callback) {
+ var credentialsFuncion = function (id, callback) {
var credentials = {
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
@@ -748,7 +748,7 @@ describe('Server', function () {
return callback(null, credentials);
};
- Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+ Hawk.server.authenticate(req, credentialsFuncion, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
expect(err).to.exist();
expect(err.output.payload.message).to.equal('Bad mac');
@@ -974,12 +974,12 @@ describe('Server', function () {
it('errors on invalid authorization (ts)', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
delete auth.ts;
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid authorization');
@@ -990,12 +990,12 @@ describe('Server', function () {
it('errors on invalid authorization (nonce)', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
delete auth.nonce;
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid authorization');
@@ -1006,12 +1006,12 @@ describe('Server', function () {
it('errors on invalid authorization (hash)', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
delete auth.hash;
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid authorization');
@@ -1022,18 +1022,18 @@ describe('Server', function () {
it('errors with credentials', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, function (id, callback) {
callback(new Error('something'), { some: 'value' });
- }, {}, function (err, credentials) {
+ }, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('something');
- expect(credentials.some).to.equal('value');
+ expect(credentials2.some).to.equal('value');
done();
});
});
@@ -1041,15 +1041,15 @@ describe('Server', function () {
it('errors on nonce collision', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {
nonceFunc: function (key, nonce, ts, nonceCallback) {
nonceCallback(true);
}
- }, function (err, credentials) {
+ }, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid nonce');
@@ -1058,29 +1058,17 @@ describe('Server', function () {
});
});
- var credentialsFunc = function (id, callback) {
-
- var credentials = {
- id: id,
- key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
- algorithm: (id === '1' ? 'sha1' : 'sha256'),
- user: 'steve'
- };
-
- return callback(null, credentials);
- };
-
it('should generate an authorization then successfully parse it', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
done();
});
});
@@ -1088,12 +1076,12 @@ describe('Server', function () {
it('should fail authorization on mismatching host', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example1.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example1.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Bad mac');
@@ -1104,12 +1092,12 @@ describe('Server', function () {
it('should fail authorization on stale timestamp', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { localtimeOffsetMsec: 100000 }, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { localtimeOffsetMsec: 100000 }, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Stale timestamp');
@@ -1120,12 +1108,12 @@ describe('Server', function () {
it('overrides timestampSkewSec', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials, localtimeOffsetMsec: 100000 });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1, localtimeOffsetMsec: 100000 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { timestampSkewSec: 500 }, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { timestampSkewSec: 500 }, function (err, credentials2) {
expect(err).to.not.exist();
done();
@@ -1135,13 +1123,13 @@ describe('Server', function () {
it('should fail authorization on invalid authorization', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
delete auth.id;
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid authorization');
@@ -1152,12 +1140,12 @@ describe('Server', function () {
it('should fail authorization on bad hash', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message1', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message1', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Bad message hash');
@@ -1168,9 +1156,9 @@ describe('Server', function () {
it('should fail authorization on nonce error', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {
@@ -1178,7 +1166,7 @@ describe('Server', function () {
callback(new Error('kaboom'));
}
- }, function (err, credentials) {
+ }, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid nonce');
@@ -1189,9 +1177,9 @@ describe('Server', function () {
it('should fail authorization on credentials error', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -1199,7 +1187,7 @@ describe('Server', function () {
callback(new Error('kablooey'));
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('kablooey');
@@ -1210,9 +1198,9 @@ describe('Server', function () {
it('should fail authorization on missing credentials', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -1220,7 +1208,7 @@ describe('Server', function () {
callback();
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Unknown credentials');
@@ -1231,9 +1219,9 @@ describe('Server', function () {
it('should fail authorization on invalid credentials', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -1241,7 +1229,7 @@ describe('Server', function () {
callback(null, {});
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid credentials');
@@ -1252,9 +1240,9 @@ describe('Server', function () {
it('should fail authorization on invalid credentials algorithm', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -1262,7 +1250,7 @@ describe('Server', function () {
callback(null, { key: '123', algorithm: '456' });
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Unknown algorithm');
diff --git a/node_modules/request/node_modules/hawk/test/uri.js b/node_modules/request/node_modules/hawk/test/uri.js
index 1b623c091..f3c6ba2d6 100755
--- a/node_modules/request/node_modules/hawk/test/uri.js
+++ b/node_modules/request/node_modules/hawk/test/uri.js
@@ -28,7 +28,7 @@ describe('Uri', function () {
var credentials = {
id: id,
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
- algorithm: 'sha256',
+ algorithm: (id === '1' ? 'sha1' : 'sha256'),
user: 'steve'
};
@@ -44,15 +44,15 @@ describe('Uri', function () {
port: 80
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials, ttlSec: 60 * 60 * 24 * 365 * 100, ext: 'some-app-data' });
+ var bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100, ext: 'some-app-data' });
req.url += '&bewit=' + bewit;
- Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+ Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials2, attributes) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
expect(attributes.ext).to.equal('some-app-data');
done();
});
@@ -68,15 +68,15 @@ describe('Uri', function () {
port: 80
};
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials, ttlSec: 60 * 60 * 24 * 365 * 100 });
+ var bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials1, ttlSec: 60 * 60 * 24 * 365 * 100 });
req.url += '&bewit=' + bewit;
- Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+ Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials2, attributes) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
done();
});
});
@@ -156,7 +156,7 @@ describe('Uri', function () {
it('should fail on method other than GET', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
var req = {
method: 'POST',
@@ -167,7 +167,7 @@ describe('Uri', function () {
var exp = Math.floor(Hawk.utils.now() / 1000) + 60;
var ext = 'some-app-data';
- var mac = Hawk.crypto.calculateMac('bewit', credentials, {
+ var mac = Hawk.crypto.calculateMac('bewit', credentials1, {
timestamp: exp,
nonce: '',
method: req.method,
@@ -177,11 +177,11 @@ describe('Uri', function () {
ext: ext
});
- var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + ext;
+ var bewit = credentials1.id + '\\' + exp + '\\' + mac + '\\' + ext;
req.url += '&bewit=' + Hoek.base64urlEncode(bewit);
- Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+ Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials2, attributes) {
expect(err).to.exist();
expect(err.output.payload.message).to.equal('Invalid method');
@@ -601,31 +601,20 @@ describe('Uri', function () {
done();
});
});
- describe('authenticateMessage()', function () {
-
- var credentialsFunc = function (id, callback) {
- var credentials = {
- id: id,
- key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
- algorithm: (id === '1' ? 'sha1' : 'sha256'),
- user: 'steve'
- };
-
- return callback(null, credentials);
- };
+ describe('authenticateMessage()', function () {
it('should generate an authorization then successfully parse it', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.not.exist();
- expect(credentials.user).to.equal('steve');
+ expect(credentials2.user).to.equal('steve');
done();
});
});
@@ -633,12 +622,12 @@ describe('Uri', function () {
it('should fail authorization on mismatching host', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example1.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example1.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Bad mac');
@@ -649,12 +638,12 @@ describe('Uri', function () {
it('should fail authorization on stale timestamp', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { localtimeOffsetMsec: 100000 }, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { localtimeOffsetMsec: 100000 }, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Stale timestamp');
@@ -665,12 +654,12 @@ describe('Uri', function () {
it('overrides timestampSkewSec', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials, localtimeOffsetMsec: 100000 });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1, localtimeOffsetMsec: 100000 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { timestampSkewSec: 500 }, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { timestampSkewSec: 500 }, function (err, credentials2) {
expect(err).to.not.exist();
done();
@@ -680,13 +669,13 @@ describe('Uri', function () {
it('should fail authorization on invalid authorization', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
delete auth.id;
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid authorization');
@@ -697,12 +686,12 @@ describe('Uri', function () {
it('should fail authorization on bad hash', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
- Hawk.server.authenticateMessage('example.com', 8080, 'some message1', auth, credentialsFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message1', auth, credentialsFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Bad message hash');
@@ -713,9 +702,9 @@ describe('Uri', function () {
it('should fail authorization on nonce error', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {
@@ -723,7 +712,7 @@ describe('Uri', function () {
callback(new Error('kaboom'));
}
- }, function (err, credentials) {
+ }, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid nonce');
@@ -734,9 +723,9 @@ describe('Uri', function () {
it('should fail authorization on credentials error', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -744,7 +733,7 @@ describe('Uri', function () {
callback(new Error('kablooey'));
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('kablooey');
@@ -755,9 +744,9 @@ describe('Uri', function () {
it('should fail authorization on missing credentials', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -765,7 +754,7 @@ describe('Uri', function () {
callback();
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Unknown credentials');
@@ -776,9 +765,9 @@ describe('Uri', function () {
it('should fail authorization on invalid credentials', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -786,7 +775,7 @@ describe('Uri', function () {
callback(null, {});
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Invalid credentials');
@@ -797,9 +786,9 @@ describe('Uri', function () {
it('should fail authorization on invalid credentials algorithm', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials1 });
expect(auth).to.exist();
var errFunc = function (id, callback) {
@@ -807,7 +796,7 @@ describe('Uri', function () {
callback(null, { key: '123', algorithm: '456' });
};
- Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+ Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials2) {
expect(err).to.exist();
expect(err.message).to.equal('Unknown algorithm');
@@ -818,9 +807,9 @@ describe('Uri', function () {
it('should fail on missing host', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var auth = Hawk.client.message(null, 8080, 'some message', { credentials: credentials });
+ var auth = Hawk.client.message(null, 8080, 'some message', { credentials: credentials1 });
expect(auth).to.not.exist();
done();
});
@@ -835,9 +824,9 @@ describe('Uri', function () {
it('should fail on invalid algorithm', function (done) {
- credentialsFunc('123456', function (err, credentials) {
+ credentialsFunc('123456', function (err, credentials1) {
- var creds = Hoek.clone(credentials);
+ var creds = Hoek.clone(credentials1);
creds.algorithm = 'blah';
var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: creds });
expect(auth).to.not.exist();
diff --git a/node_modules/request/node_modules/http-signature/CHANGES.md b/node_modules/request/node_modules/http-signature/CHANGES.md
new file mode 100644
index 000000000..82be35900
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/CHANGES.md
@@ -0,0 +1,39 @@
+# node-http-signature changelog
+
+## 1.1.0
+
+- Bump version of `sshpk` dependency, remove peerDependency on it since
+ it now supports exchanging objects between multiple versions of itself
+ where possible
+
+## 1.0.2
+
+- Bump min version of `jsprim` dependency, to include fixes for using
+ http-signature with `browserify`
+
+## 1.0.1
+
+- Bump minimum version of `sshpk` dependency, to include fixes for
+ whitespace tolerance in key parsing.
+
+## 1.0.0
+
+- First semver release.
+- #36: Ensure verifySignature does not leak useful timing information
+- #42: Bring the library up to the latest version of the spec (including the
+ request-target changes)
+- Support for ECDSA keys and signatures.
+- Now uses `sshpk` for key parsing, validation and conversion.
+- Fixes for #21, #47, #39 and compatibility with node 0.8
+
+## 0.11.0
+
+- Split up HMAC and Signature verification to avoid vulnerabilities where a
+ key intended for use with one can be validated against the other method
+ instead.
+
+## 0.10.2
+
+- Updated versions of most dependencies.
+- Utility functions exported for PEM => SSH-RSA conversion.
+- Improvements to tests and examples.
diff --git a/node_modules/request/node_modules/http-signature/http_signing.md b/node_modules/request/node_modules/http-signature/http_signing.md
index dd81ee5b5..d08a5250c 100644
--- a/node_modules/request/node_modules/http-signature/http_signing.md
+++ b/node_modules/request/node_modules/http-signature/http_signing.md
@@ -120,10 +120,10 @@ All requests refer to the following request (body omitted):
POST /foo HTTP/1.1
Host: example.org
- Date: Tue, 07 Jun 2011 20:51:35 GMT
+ Date: Tue, 07 Jun 2014 20:51:35 GMT
Content-Type: application/json
- Content-MD5: h0auK8hnYJKmHTLhKtMTkQ==
- Content-Length: 123
+ Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=
+ Content-Length: 18
The "rsa-key-1" keyId refers to a private key known to the client and a public
key known to the server. The "hmac-key-1" keyId refers to key known to the
@@ -137,21 +137,21 @@ The authorization header and signature would be generated as:
The client would compose the signing string as:
- date: Tue, 07 Jun 2011 20:51:35 GMT
+ date: Tue, 07 Jun 2014 20:51:35 GMT
## Header List
The authorization header and signature would be generated as:
- Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",headers="request-line date content-type content-md5",signature="Base64(RSA-SHA256(signing string))"
+ Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",headers="(request-target) date content-type digest",signature="Base64(RSA-SHA256(signing string))"
The client would compose the signing string as (`+ "\n"` inserted for
readability):
- POST /foo HTTP/1.1 + "\n"
+ (request-target) post /foo + "\n"
date: Tue, 07 Jun 2011 20:51:35 GMT + "\n"
content-type: application/json + "\n"
- content-md5: h0auK8hnYJKmHTLhKtMTkQ==
+ digest: SHA-256=Base64(SHA256(Body))
## Algorithm
@@ -261,9 +261,9 @@ And all examples use this request:
POST /foo?param=value&pet=dog HTTP/1.1
Host: example.com
- Date: Thu, 05 Jan 2012 21:31:40 GMT
+ Date: Thu, 05 Jan 2014 21:31:40 GMT
Content-Type: application/json
- Content-MD5: Sd/dVLAcvNLSq16eXua5uQ==
+ Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=
Content-Length: 18
{"hello": "world"}
@@ -272,7 +272,7 @@ And all examples use this request:
The string to sign would be:
- date: Thu, 05 Jan 2012 21:31:40 GMT
+ date: Thu, 05 Jan 2014 21:31:40 GMT
The Authorization header would be:
@@ -283,14 +283,13 @@ The Authorization header would be:
Parameterized to include all headers, the string to sign would be (`+ "\n"`
inserted for readability):
- POST /foo?param=value&pet=dog HTTP/1.1 + "\n"
- host: example.com + "\n"
- date: Thu, 05 Jan 2012 21:31:40 GMT + "\n"
- content-type: application/json + "\n"
- content-md5: Sd/dVLAcvNLSq16eXua5uQ== + "\n"
+ (request-target): post /foo?param=value&pet=dog
+ host: example.com
+ date: Thu, 05 Jan 2014 21:31:40 GMT
+ content-type: application/json
+ digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=
content-length: 18
The Authorization header would be:
- Authorization: Signature keyId="Test",algorithm="rsa-sha256",headers="request-line host date content-type content-md5 content-length",signature="H/AaTDkJvLELy4i1RujnKlS6dm8QWiJvEpn9cKRMi49kKF+mohZ15z1r+mF+XiKS5kOOscyS83olfBtsVhYjPg2Ei3/D9D4Mvb7bFm9IaLJgYTFFuQCghrKQQFPiqJN320emjHxFowpIm1BkstnEU7lktH/XdXVBo8a6Uteiztw="
-
+ Authorization: Signature keyId="Test",algorithm="rsa-sha256",headers="(request-target) host date content-type digest content-length",signature="jgSqYK0yKclIHfF9zdApVEbDp5eqj8C4i4X76pE+XHoxugXv7qnVrGR+30bmBgtpR39I4utq17s9ghz/2QFVxlnToYAvbSVZJ9ulLd1HQBugO0jOyn9sXOtcN7uNHBjqNCqUsnt0sw/cJA6B6nJZpyNqNyAXKdxZZItOuhIs78w="
diff --git a/node_modules/request/node_modules/http-signature/lib/index.js b/node_modules/request/node_modules/http-signature/lib/index.js
index 56a9967da..54d46030f 100644
--- a/node_modules/request/node_modules/http-signature/lib/index.js
+++ b/node_modules/request/node_modules/http-signature/lib/index.js
@@ -3,7 +3,7 @@
var parser = require('./parser');
var signer = require('./signer');
var verify = require('./verify');
-var util = require('./util');
+var utils = require('./utils');
@@ -16,10 +16,12 @@ module.exports = {
sign: signer.signRequest,
signRequest: signer.signRequest,
+ createSigner: signer.createSigner,
+ isSigner: signer.isSigner,
- sshKeyToPEM: util.sshKeyToPEM,
- sshKeyFingerprint: util.fingerprint,
- pemToRsaSSHKey: util.pemToRsaSSHKey,
+ sshKeyToPEM: utils.sshKeyToPEM,
+ sshKeyFingerprint: utils.fingerprint,
+ pemToRsaSSHKey: utils.pemToRsaSSHKey,
verify: verify.verifySignature,
verifySignature: verify.verifySignature,
diff --git a/node_modules/request/node_modules/http-signature/lib/parser.js b/node_modules/request/node_modules/http-signature/lib/parser.js
index fd9ac1022..7c841b317 100644
--- a/node_modules/request/node_modules/http-signature/lib/parser.js
+++ b/node_modules/request/node_modules/http-signature/lib/parser.js
@@ -2,20 +2,17 @@
var assert = require('assert-plus');
var util = require('util');
+var utils = require('./utils');
///--- Globals
-var Algorithms = {
- 'rsa-sha1': true,
- 'rsa-sha256': true,
- 'rsa-sha512': true,
- 'dsa-sha1': true,
- 'hmac-sha1': true,
- 'hmac-sha256': true,
- 'hmac-sha512': true
-};
+var HASH_ALGOS = utils.HASH_ALGOS;
+var PK_ALGOS = utils.PK_ALGOS;
+var HttpSignatureError = utils.HttpSignatureError;
+var InvalidAlgorithmError = utils.InvalidAlgorithmError;
+var validateAlgorithm = utils.validateAlgorithm;
var State = {
New: 0,
@@ -30,17 +27,8 @@ var ParamsState = {
};
-
///--- Specific Errors
-function HttpSignatureError(message, caller) {
- if (Error.captureStackTrace)
- Error.captureStackTrace(this, caller || HttpSignatureError);
-
- this.message = message;
- this.name = caller.name;
-}
-util.inherits(HttpSignatureError, Error);
function ExpiredRequestError(message) {
HttpSignatureError.call(this, message, ExpiredRequestError);
@@ -65,7 +53,10 @@ function MissingHeaderError(message) {
}
util.inherits(MissingHeaderError, HttpSignatureError);
-
+function StrictParsingError(message) {
+ HttpSignatureError.call(this, message, StrictParsingError);
+}
+util.inherits(StrictParsingError, HttpSignatureError);
///--- Exported API
@@ -88,7 +79,7 @@ module.exports = {
* "algorithm": "rsa-sha256",
* "headers": [
* "date" or "x-date",
- * "content-md5"
+ * "digest"
* ],
* "signature": "base64"
* },
@@ -100,6 +91,8 @@ module.exports = {
* - clockSkew: allowed clock skew in seconds (default 300).
* - headers: required header names (def: date or x-date)
* - algorithms: algorithms to support (default: all).
+ * - strict: should enforce latest spec parsing
+ * (default: false).
* @return {Object} parsed out object (see above).
* @throws {TypeError} on invalid input.
* @throws {InvalidHeaderError} on an invalid Authorization header error.
@@ -108,6 +101,8 @@ module.exports = {
* either in the request headers from the params,
* or not in the params from a required header
* in options.
+ * @throws {StrictParsingError} if old attributes are used in strict parsing
+ * mode.
* @throws {ExpiredRequestError} if the value of date or x-date exceeds skew.
*/
parseRequest: function parseRequest(request, options) {
@@ -148,7 +143,6 @@ module.exports = {
get keyId() {
return this.params.keyId;
}
-
};
var authz = request.headers.authorization;
@@ -243,23 +237,43 @@ module.exports = {
// Check the algorithm against the official list
parsed.params.algorithm = parsed.params.algorithm.toLowerCase();
- if (!Algorithms[parsed.params.algorithm])
- throw new InvalidParamsError(parsed.params.algorithm +
- ' is not supported');
+ try {
+ validateAlgorithm(parsed.params.algorithm);
+ } catch (e) {
+ if (e instanceof InvalidAlgorithmError)
+ throw (new InvalidParamsError(parsed.params.algorithm + ' is not ' +
+ 'supported'));
+ else
+ throw (e);
+ }
// Build the signingString
for (i = 0; i < parsed.params.headers.length; i++) {
var h = parsed.params.headers[i].toLowerCase();
parsed.params.headers[i] = h;
- if (h !== 'request-line') {
+ if (h === 'request-line') {
+ if (!options.strict) {
+ /*
+ * We allow headers from the older spec drafts if strict parsing isn't
+ * specified in options.
+ */
+ parsed.signingString +=
+ request.method + ' ' + request.url + ' HTTP/' + request.httpVersion;
+ } else {
+ /* Strict parsing doesn't allow older draft headers. */
+ throw (new StrictParsingError('request-line is not a valid header ' +
+ 'with strict parsing enabled.'));
+ }
+ } else if (h === '(request-target)') {
+ parsed.signingString +=
+ '(request-target): ' + request.method.toLowerCase() + ' ' +
+ request.url;
+ } else {
var value = request.headers[h];
- if (!value)
+ if (value === undefined)
throw new MissingHeaderError(h + ' was not in the request');
parsed.signingString += h + ': ' + value;
- } else {
- parsed.signingString +=
- request.method + ' ' + request.url + ' HTTP/' + request.httpVersion;
}
if ((i + 1) < parsed.params.headers.length)
diff --git a/node_modules/request/node_modules/http-signature/lib/signer.js b/node_modules/request/node_modules/http-signature/lib/signer.js
index 3507f4dbf..c8fd366ee 100644
--- a/node_modules/request/node_modules/http-signature/lib/signer.js
+++ b/node_modules/request/node_modules/http-signature/lib/signer.js
@@ -3,88 +3,252 @@
var assert = require('assert-plus');
var crypto = require('crypto');
var http = require('http');
+var util = require('util');
+var sshpk = require('sshpk');
+var jsprim = require('jsprim');
+var utils = require('./utils');
var sprintf = require('util').format;
-
+var HASH_ALGOS = utils.HASH_ALGOS;
+var PK_ALGOS = utils.PK_ALGOS;
+var InvalidAlgorithmError = utils.InvalidAlgorithmError;
+var HttpSignatureError = utils.HttpSignatureError;
+var validateAlgorithm = utils.validateAlgorithm;
///--- Globals
-var Algorithms = {
- 'rsa-sha1': true,
- 'rsa-sha256': true,
- 'rsa-sha512': true,
- 'dsa-sha1': true,
- 'hmac-sha1': true,
- 'hmac-sha256': true,
- 'hmac-sha512': true
-};
-
-var Authorization =
+var AUTHZ_FMT =
'Signature keyId="%s",algorithm="%s",headers="%s",signature="%s"';
-
-
///--- Specific Errors
function MissingHeaderError(message) {
- this.name = 'MissingHeaderError';
- this.message = message;
- this.stack = (new Error()).stack;
+ HttpSignatureError.call(this, message, MissingHeaderError);
}
-MissingHeaderError.prototype = new Error();
-
+util.inherits(MissingHeaderError, HttpSignatureError);
-function InvalidAlgorithmError(message) {
- this.name = 'InvalidAlgorithmError';
- this.message = message;
- this.stack = (new Error()).stack;
+function StrictParsingError(message) {
+ HttpSignatureError.call(this, message, StrictParsingError);
}
-InvalidAlgorithmError.prototype = new Error();
+util.inherits(StrictParsingError, HttpSignatureError);
+
+/* See createSigner() */
+function RequestSigner(options) {
+ assert.object(options, 'options');
+ var alg = [];
+ if (options.algorithm !== undefined) {
+ assert.string(options.algorithm, 'options.algorithm');
+ alg = validateAlgorithm(options.algorithm);
+ }
+ this.rs_alg = alg;
+ /*
+ * RequestSigners come in two varieties: ones with an rs_signFunc, and ones
+ * with an rs_signer.
+ *
+ * rs_signFunc-based RequestSigners have to build up their entire signing
+ * string within the rs_lines array and give it to rs_signFunc as a single
+ * concat'd blob. rs_signer-based RequestSigners can add a line at a time to
+ * their signing state by using rs_signer.update(), thus only needing to
+ * buffer the hash function state and one line at a time.
+ */
+ if (options.sign !== undefined) {
+ assert.func(options.sign, 'options.sign');
+ this.rs_signFunc = options.sign;
-///--- Internal Functions
+ } else if (alg[0] === 'hmac' && options.key !== undefined) {
+ assert.string(options.keyId, 'options.keyId');
+ this.rs_keyId = options.keyId;
+
+ if (typeof (options.key) !== 'string' && !Buffer.isBuffer(options.key))
+ throw (new TypeError('options.key for HMAC must be a string or Buffer'));
+
+ /*
+ * Make an rs_signer for HMACs, not a rs_signFunc -- HMACs digest their
+ * data in chunks rather than requiring it all to be given in one go
+ * at the end, so they are more similar to signers than signFuncs.
+ */
+ this.rs_signer = crypto.createHmac(alg[1].toUpperCase(), options.key);
+ this.rs_signer.sign = function () {
+ var digest = this.digest('base64');
+ return ({
+ hashAlgorithm: alg[1],
+ toString: function () { return (digest); }
+ });
+ };
+
+ } else if (options.key !== undefined) {
+ var key = options.key;
+ if (typeof (key) === 'string' || Buffer.isBuffer(key))
+ key = sshpk.parsePrivateKey(key);
+
+ assert.ok(sshpk.PrivateKey.isPrivateKey(key, [1, 2]),
+ 'options.key must be a sshpk.PrivateKey');
+ this.rs_key = key;
-function _pad(val) {
- if (parseInt(val, 10) < 10) {
- val = '0' + val;
+ assert.string(options.keyId, 'options.keyId');
+ this.rs_keyId = options.keyId;
+
+ if (!PK_ALGOS[key.type]) {
+ throw (new InvalidAlgorithmError(key.type.toUpperCase() + ' type ' +
+ 'keys are not supported'));
+ }
+
+ if (alg[0] !== undefined && key.type !== alg[0]) {
+ throw (new InvalidAlgorithmError('options.key must be a ' +
+ alg[0].toUpperCase() + ' key, was given a ' +
+ key.type.toUpperCase() + ' key instead'));
+ }
+
+ this.rs_signer = key.createSign(alg[1]);
+
+ } else {
+ throw (new TypeError('options.sign (func) or options.key is required'));
}
- return val;
+
+ this.rs_headers = [];
+ this.rs_lines = [];
}
+/**
+ * Adds a header to be signed, with its value, into this signer.
+ *
+ * @param {String} header
+ * @param {String} value
+ * @return {String} value written
+ */
+RequestSigner.prototype.writeHeader = function (header, value) {
+ assert.string(header, 'header');
+ header = header.toLowerCase();
+ assert.string(value, 'value');
+
+ this.rs_headers.push(header);
+
+ if (this.rs_signFunc) {
+ this.rs_lines.push(header + ': ' + value);
+
+ } else {
+ var line = header + ': ' + value;
+ if (this.rs_headers.length > 0)
+ line = '\n' + line;
+ this.rs_signer.update(line);
+ }
-function _rfc1123() {
- var date = new Date();
-
- var months = ['Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec'];
- var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
- return days[date.getUTCDay()] + ', ' +
- _pad(date.getUTCDate()) + ' ' +
- months[date.getUTCMonth()] + ' ' +
- date.getUTCFullYear() + ' ' +
- _pad(date.getUTCHours()) + ':' +
- _pad(date.getUTCMinutes()) + ':' +
- _pad(date.getUTCSeconds()) +
- ' GMT';
-}
+ return (value);
+};
+
+/**
+ * Adds a default Date header, returning its value.
+ *
+ * @return {String}
+ */
+RequestSigner.prototype.writeDateHeader = function () {
+ return (this.writeHeader('date', jsprim.rfc1123(new Date())));
+};
+/**
+ * Adds the request target line to be signed.
+ *
+ * @param {String} method, HTTP method (e.g. 'get', 'post', 'put')
+ * @param {String} path
+ */
+RequestSigner.prototype.writeTarget = function (method, path) {
+ assert.string(method, 'method');
+ assert.string(path, 'path');
+ method = method.toLowerCase();
+ this.writeHeader('(request-target)', method + ' ' + path);
+};
+/**
+ * Calculate the value for the Authorization header on this request
+ * asynchronously.
+ *
+ * @param {Func} callback (err, authz)
+ */
+RequestSigner.prototype.sign = function (cb) {
+ assert.func(cb, 'callback');
+
+ if (this.rs_headers.length < 1)
+ throw (new Error('At least one header must be signed'));
+
+ var alg, authz;
+ if (this.rs_signFunc) {
+ var data = this.rs_lines.join('\n');
+ var self = this;
+ this.rs_signFunc(data, function (err, sig) {
+ if (err) {
+ cb(err);
+ return;
+ }
+ try {
+ assert.object(sig, 'signature');
+ assert.string(sig.keyId, 'signature.keyId');
+ assert.string(sig.algorithm, 'signature.algorithm');
+ assert.string(sig.signature, 'signature.signature');
+ alg = validateAlgorithm(sig.algorithm);
+
+ authz = sprintf(AUTHZ_FMT,
+ sig.keyId,
+ sig.algorithm,
+ self.rs_headers.join(' '),
+ sig.signature);
+ } catch (e) {
+ cb(e);
+ return;
+ }
+ cb(null, authz);
+ });
+
+ } else {
+ try {
+ var sigObj = this.rs_signer.sign();
+ } catch (e) {
+ cb(e);
+ return;
+ }
+ alg = (this.rs_alg[0] || this.rs_key.type) + '-' + sigObj.hashAlgorithm;
+ var signature = sigObj.toString();
+ authz = sprintf(AUTHZ_FMT,
+ this.rs_keyId,
+ alg,
+ this.rs_headers.join(' '),
+ signature);
+ cb(null, authz);
+ }
+};
///--- Exported API
module.exports = {
+ /**
+ * Identifies whether a given object is a request signer or not.
+ *
+ * @param {Object} object, the object to identify
+ * @returns {Boolean}
+ */
+ isSigner: function (obj) {
+ if (typeof (obj) === 'object' && obj instanceof RequestSigner)
+ return (true);
+ return (false);
+ },
+
+ /**
+ * Creates a request signer, used to asynchronously build a signature
+ * for a request (does not have to be an http.ClientRequest).
+ *
+ * @param {Object} options, either:
+ * - {String} keyId
+ * - {String|Buffer} key
+ * - {String} algorithm (optional, required for HMAC)
+ * or:
+ * - {Func} sign (data, cb)
+ * @return {RequestSigner}
+ */
+ createSigner: function createSigner(options) {
+ return (new RequestSigner(options));
+ },
/**
* Adds an 'Authorization' header to an http.ClientRequest object.
@@ -96,16 +260,26 @@ module.exports = {
* You shouldn't need to check the return type; it's just there if you want
* to be pedantic.
*
+ * The optional flag indicates whether parsing should use strict enforcement
+ * of the version draft-cavage-http-signatures-04 of the spec or beyond.
+ * The default is to be loose and support
+ * older versions for compatibility.
+ *
* @param {Object} request an instance of http.ClientRequest.
* @param {Object} options signing parameters object:
* - {String} keyId required.
* - {String} key required (either a PEM or HMAC key).
* - {Array} headers optional; defaults to ['date'].
- * - {String} algorithm optional; defaults to 'rsa-sha256'.
+ * - {String} algorithm optional (unless key is HMAC);
+ * default is the same as the sshpk default
+ * signing algorithm for the type of key given
* - {String} httpVersion optional; defaults to '1.1'.
+ * - {Boolean} strict optional; defaults to 'false'.
* @return {Boolean} true if Authorization (and optionally Date) were added.
* @throws {TypeError} on bad parameter types (input).
- * @throws {InvalidAlgorithmError} if algorithm was bad.
+ * @throws {InvalidAlgorithmError} if algorithm was bad or incompatible with
+ * the given key.
+ * @throws {sshpk.KeyParseError} if key was bad.
* @throws {MissingHeaderError} if a header to be signed was specified but
* was not present.
*/
@@ -118,18 +292,17 @@ module.exports = {
assert.optionalString(options.httpVersion, 'options.httpVersion');
if (!request.getHeader('Date'))
- request.setHeader('Date', _rfc1123());
+ request.setHeader('Date', jsprim.rfc1123(new Date()));
if (!options.headers)
options.headers = ['date'];
- if (!options.algorithm)
- options.algorithm = 'rsa-sha256';
if (!options.httpVersion)
options.httpVersion = '1.1';
- options.algorithm = options.algorithm.toLowerCase();
-
- if (!Algorithms[options.algorithm])
- throw new InvalidAlgorithmError(options.algorithm + ' is not supported');
+ var alg = [];
+ if (options.algorithm) {
+ options.algorithm = options.algorithm.toLowerCase();
+ alg = validateAlgorithm(options.algorithm);
+ }
var i;
var stringToSign = '';
@@ -139,34 +312,77 @@ module.exports = {
var h = options.headers[i].toLowerCase();
- if (h !== 'request-line') {
+ if (h === 'request-line') {
+ if (!options.strict) {
+ /**
+ * We allow headers from the older spec drafts if strict parsing isn't
+ * specified in options.
+ */
+ stringToSign +=
+ request.method + ' ' + request.path + ' HTTP/' +
+ options.httpVersion;
+ } else {
+ /* Strict parsing doesn't allow older draft headers. */
+ throw (new StrictParsingError('request-line is not a valid header ' +
+ 'with strict parsing enabled.'));
+ }
+ } else if (h === '(request-target)') {
+ stringToSign +=
+ '(request-target): ' + request.method.toLowerCase() + ' ' +
+ request.path;
+ } else {
var value = request.getHeader(h);
- if (!value) {
+ if (value === undefined || value === '') {
throw new MissingHeaderError(h + ' was not in the request');
}
stringToSign += h + ': ' + value;
- } else {
- stringToSign +=
- request.method + ' ' + request.path + ' HTTP/' + options.httpVersion;
}
if ((i + 1) < options.headers.length)
stringToSign += '\n';
}
- var alg = options.algorithm.match(/(hmac|rsa)-(\w+)/);
var signature;
- if (alg[1] === 'hmac') {
- var hmac = crypto.createHmac(alg[2].toUpperCase(), options.key);
+ if (alg[0] === 'hmac') {
+ if (typeof (options.key) !== 'string' && !Buffer.isBuffer(options.key))
+ throw (new TypeError('options.key must be a string or Buffer'));
+
+ var hmac = crypto.createHmac(alg[1].toUpperCase(), options.key);
hmac.update(stringToSign);
signature = hmac.digest('base64');
+
} else {
- var signer = crypto.createSign(options.algorithm.toUpperCase());
+ var key = options.key;
+ if (typeof (key) === 'string' || Buffer.isBuffer(key))
+ key = sshpk.parsePrivateKey(options.key);
+
+ assert.ok(sshpk.PrivateKey.isPrivateKey(key, [1, 2]),
+ 'options.key must be a sshpk.PrivateKey');
+
+ if (!PK_ALGOS[key.type]) {
+ throw (new InvalidAlgorithmError(key.type.toUpperCase() + ' type ' +
+ 'keys are not supported'));
+ }
+
+ if (alg[0] !== undefined && key.type !== alg[0]) {
+ throw (new InvalidAlgorithmError('options.key must be a ' +
+ alg[0].toUpperCase() + ' key, was given a ' +
+ key.type.toUpperCase() + ' key instead'));
+ }
+
+ var signer = key.createSign(alg[1]);
signer.update(stringToSign);
- signature = signer.sign(options.key, 'base64');
+ var sigObj = signer.sign();
+ if (!HASH_ALGOS[sigObj.hashAlgorithm]) {
+ throw (new InvalidAlgorithmError(sigObj.hashAlgorithm.toUpperCase() +
+ ' is not a supported hash algorithm'));
+ }
+ options.algorithm = key.type + '-' + sigObj.hashAlgorithm;
+ signature = sigObj.toString();
+ assert.notStrictEqual(signature, '', 'empty signature produced');
}
- request.setHeader('Authorization', sprintf(Authorization,
+ request.setHeader('Authorization', sprintf(AUTHZ_FMT,
options.keyId,
options.algorithm,
options.headers.join(' '),
diff --git a/node_modules/request/node_modules/http-signature/lib/util.js b/node_modules/request/node_modules/http-signature/lib/util.js
deleted file mode 100644
index 2e1ce4d46..000000000
--- a/node_modules/request/node_modules/http-signature/lib/util.js
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright 2012 Joyent, Inc. All rights reserved.
-
-var assert = require('assert-plus');
-var crypto = require('crypto');
-
-var asn1 = require('asn1');
-var ctype = require('ctype');
-
-
-
-///--- Helpers
-
-function readNext(buffer, offset) {
- var len = ctype.ruint32(buffer, 'big', offset);
- offset += 4;
-
- var newOffset = offset + len;
-
- return {
- data: buffer.slice(offset, newOffset),
- offset: newOffset
- };
-}
-
-
-function writeInt(writer, buffer) {
- writer.writeByte(0x02); // ASN1.Integer
- writer.writeLength(buffer.length);
-
- for (var i = 0; i < buffer.length; i++)
- writer.writeByte(buffer[i]);
-
- return writer;
-}
-
-
-function rsaToPEM(key) {
- var buffer;
- var der;
- var exponent;
- var i;
- var modulus;
- var newKey = '';
- var offset = 0;
- var type;
- var tmp;
-
- try {
- buffer = new Buffer(key.split(' ')[1], 'base64');
-
- tmp = readNext(buffer, offset);
- type = tmp.data.toString();
- offset = tmp.offset;
-
- if (type !== 'ssh-rsa')
- throw new Error('Invalid ssh key type: ' + type);
-
- tmp = readNext(buffer, offset);
- exponent = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- modulus = tmp.data;
- } catch (e) {
- throw new Error('Invalid ssh key: ' + key);
- }
-
- // DER is a subset of BER
- der = new asn1.BerWriter();
-
- der.startSequence();
-
- der.startSequence();
- der.writeOID('1.2.840.113549.1.1.1');
- der.writeNull();
- der.endSequence();
-
- der.startSequence(0x03); // bit string
- der.writeByte(0x00);
-
- // Actual key
- der.startSequence();
- writeInt(der, modulus);
- writeInt(der, exponent);
- der.endSequence();
-
- // bit string
- der.endSequence();
-
- der.endSequence();
-
- tmp = der.buffer.toString('base64');
- for (i = 0; i < tmp.length; i++) {
- if ((i % 64) === 0)
- newKey += '\n';
- newKey += tmp.charAt(i);
- }
-
- if (!/\\n$/.test(newKey))
- newKey += '\n';
-
- return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
-}
-
-
-function dsaToPEM(key) {
- var buffer;
- var offset = 0;
- var tmp;
- var der;
- var newKey = '';
-
- var type;
- var p;
- var q;
- var g;
- var y;
-
- try {
- buffer = new Buffer(key.split(' ')[1], 'base64');
-
- tmp = readNext(buffer, offset);
- type = tmp.data.toString();
- offset = tmp.offset;
-
- /* JSSTYLED */
- if (!/^ssh-ds[as].*/.test(type))
- throw new Error('Invalid ssh key type: ' + type);
-
- tmp = readNext(buffer, offset);
- p = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- q = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- g = tmp.data;
- offset = tmp.offset;
-
- tmp = readNext(buffer, offset);
- y = tmp.data;
- } catch (e) {
- console.log(e.stack);
- throw new Error('Invalid ssh key: ' + key);
- }
-
- // DER is a subset of BER
- der = new asn1.BerWriter();
-
- der.startSequence();
-
- der.startSequence();
- der.writeOID('1.2.840.10040.4.1');
-
- der.startSequence();
- writeInt(der, p);
- writeInt(der, q);
- writeInt(der, g);
- der.endSequence();
-
- der.endSequence();
-
- der.startSequence(0x03); // bit string
- der.writeByte(0x00);
- writeInt(der, y);
- der.endSequence();
-
- der.endSequence();
-
- tmp = der.buffer.toString('base64');
- for (var i = 0; i < tmp.length; i++) {
- if ((i % 64) === 0)
- newKey += '\n';
- newKey += tmp.charAt(i);
- }
-
- if (!/\\n$/.test(newKey))
- newKey += '\n';
-
- return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
-}
-
-
-///--- API
-
-module.exports = {
-
- /**
- * Converts an OpenSSH public key (rsa only) to a PKCS#8 PEM file.
- *
- * The intent of this module is to interoperate with OpenSSL only,
- * specifically the node crypto module's `verify` method.
- *
- * @param {String} key an OpenSSH public key.
- * @return {String} PEM encoded form of the RSA public key.
- * @throws {TypeError} on bad input.
- * @throws {Error} on invalid ssh key formatted data.
- */
- sshKeyToPEM: function sshKeyToPEM(key) {
- assert.string(key, 'ssh_key');
-
- /* JSSTYLED */
- if (/^ssh-rsa.*/.test(key))
- return rsaToPEM(key);
-
- /* JSSTYLED */
- if (/^ssh-ds[as].*/.test(key))
- return dsaToPEM(key);
-
- throw new Error('Only RSA and DSA public keys are allowed');
- },
-
-
- /**
- * Generates an OpenSSH fingerprint from an ssh public key.
- *
- * @param {String} key an OpenSSH public key.
- * @return {String} key fingerprint.
- * @throws {TypeError} on bad input.
- * @throws {Error} if what you passed doesn't look like an ssh public key.
- */
- fingerprint: function fingerprint(key) {
- assert.string(key, 'ssh_key');
-
- var pieces = key.split(' ');
- if (!pieces || !pieces.length || pieces.length < 2)
- throw new Error('invalid ssh key');
-
- var data = new Buffer(pieces[1], 'base64');
-
- var hash = crypto.createHash('md5');
- hash.update(data);
- var digest = hash.digest('hex');
-
- var fp = '';
- for (var i = 0; i < digest.length; i++) {
- if (i && i % 2 === 0)
- fp += ':';
-
- fp += digest[i];
- }
-
- return fp;
- },
-
- /**
- * Converts a PKGCS#8 PEM file to an OpenSSH public key (rsa)
- *
- * The reverse of the above function.
- */
- pemToRsaSSHKey: function pemToRsaSSHKey(pem, comment) {
- assert.equal('string', typeof (pem), 'typeof pem');
-
- // chop off the BEGIN PUBLIC KEY and END PUBLIC KEY portion
- var cleaned = pem.split('\n').slice(1, -2).join('');
-
- var buf = new Buffer(cleaned, 'base64');
-
- var der = new asn1.BerReader(buf);
-
- der.readSequence();
- der.readSequence();
-
- var oid = der.readOID();
- assert.equal(oid, '1.2.840.113549.1.1.1', 'pem not in RSA format');
-
- // Null -- XXX this probably isn't good practice
- der.readByte();
- der.readByte();
-
- // bit string sequence
- der.readSequence(0x03);
- der.readByte();
- der.readSequence();
-
- // modulus
- assert.equal(der.peek(), asn1.Ber.Integer, 'modulus not an integer');
- der._offset = der.readLength(der.offset + 1);
- var modulus = der._buf.slice(der.offset, der.offset + der.length);
- der._offset += der.length;
-
- // exponent
- assert.equal(der.peek(), asn1.Ber.Integer, 'exponent not an integer');
- der._offset = der.readLength(der.offset + 1);
- var exponent = der._buf.slice(der.offset, der.offset + der.length);
- der._offset += der.length;
-
- // now, make the key
- var type = new Buffer('ssh-rsa');
- var buffer = new Buffer(4 + type.length + 4 + modulus.length +
- 4 + exponent.length);
- var i = 0;
- buffer.writeUInt32BE(type.length, i); i += 4;
- type.copy(buffer, i); i += type.length;
- buffer.writeUInt32BE(exponent.length, i); i += 4;
- exponent.copy(buffer, i); i += exponent.length;
- buffer.writeUInt32BE(modulus.length, i); i += 4;
- modulus.copy(buffer, i); i += modulus.length;
-
- var s = (type.toString() + ' ' + buffer.toString('base64') + ' ' +
- (comment || ''));
- return s;
- }
-};
diff --git a/node_modules/request/node_modules/http-signature/lib/utils.js b/node_modules/request/node_modules/http-signature/lib/utils.js
new file mode 100644
index 000000000..bbf2aa895
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/lib/utils.js
@@ -0,0 +1,112 @@
+// Copyright 2012 Joyent, Inc. All rights reserved.
+
+var assert = require('assert-plus');
+var sshpk = require('sshpk');
+var util = require('util');
+
+var HASH_ALGOS = {
+ 'sha1': true,
+ 'sha256': true,
+ 'sha512': true
+};
+
+var PK_ALGOS = {
+ 'rsa': true,
+ 'dsa': true,
+ 'ecdsa': true
+};
+
+function HttpSignatureError(message, caller) {
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, caller || HttpSignatureError);
+
+ this.message = message;
+ this.name = caller.name;
+}
+util.inherits(HttpSignatureError, Error);
+
+function InvalidAlgorithmError(message) {
+ HttpSignatureError.call(this, message, InvalidAlgorithmError);
+}
+util.inherits(InvalidAlgorithmError, HttpSignatureError);
+
+function validateAlgorithm(algorithm) {
+ var alg = algorithm.toLowerCase().split('-');
+
+ if (alg.length !== 2) {
+ throw (new InvalidAlgorithmError(alg[0].toUpperCase() + ' is not a ' +
+ 'valid algorithm'));
+ }
+
+ if (alg[0] !== 'hmac' && !PK_ALGOS[alg[0]]) {
+ throw (new InvalidAlgorithmError(alg[0].toUpperCase() + ' type keys ' +
+ 'are not supported'));
+ }
+
+ if (!HASH_ALGOS[alg[1]]) {
+ throw (new InvalidAlgorithmError(alg[1].toUpperCase() + ' is not a ' +
+ 'supported hash algorithm'));
+ }
+
+ return (alg);
+}
+
+///--- API
+
+module.exports = {
+
+ HASH_ALGOS: HASH_ALGOS,
+ PK_ALGOS: PK_ALGOS,
+
+ HttpSignatureError: HttpSignatureError,
+ InvalidAlgorithmError: InvalidAlgorithmError,
+
+ validateAlgorithm: validateAlgorithm,
+
+ /**
+ * Converts an OpenSSH public key (rsa only) to a PKCS#8 PEM file.
+ *
+ * The intent of this module is to interoperate with OpenSSL only,
+ * specifically the node crypto module's `verify` method.
+ *
+ * @param {String} key an OpenSSH public key.
+ * @return {String} PEM encoded form of the RSA public key.
+ * @throws {TypeError} on bad input.
+ * @throws {Error} on invalid ssh key formatted data.
+ */
+ sshKeyToPEM: function sshKeyToPEM(key) {
+ assert.string(key, 'ssh_key');
+
+ var k = sshpk.parseKey(key, 'ssh');
+ return (k.toString('pem'));
+ },
+
+
+ /**
+ * Generates an OpenSSH fingerprint from an ssh public key.
+ *
+ * @param {String} key an OpenSSH public key.
+ * @return {String} key fingerprint.
+ * @throws {TypeError} on bad input.
+ * @throws {Error} if what you passed doesn't look like an ssh public key.
+ */
+ fingerprint: function fingerprint(key) {
+ assert.string(key, 'ssh_key');
+
+ var k = sshpk.parseKey(key, 'ssh');
+ return (k.fingerprint('md5').toString('hex'));
+ },
+
+ /**
+ * Converts a PKGCS#8 PEM file to an OpenSSH public key (rsa)
+ *
+ * The reverse of the above function.
+ */
+ pemToRsaSSHKey: function pemToRsaSSHKey(pem, comment) {
+ assert.equal('string', typeof (pem), 'typeof pem');
+
+ var k = sshpk.parseKey(pem, 'pem');
+ k.comment = comment;
+ return (k.toString('ssh'));
+ }
+};
diff --git a/node_modules/request/node_modules/http-signature/lib/verify.js b/node_modules/request/node_modules/http-signature/lib/verify.js
index f6ad0c2b1..b053fd6bf 100644
--- a/node_modules/request/node_modules/http-signature/lib/verify.js
+++ b/node_modules/request/node_modules/http-signature/lib/verify.js
@@ -2,8 +2,14 @@
var assert = require('assert-plus');
var crypto = require('crypto');
+var sshpk = require('sshpk');
+var utils = require('./utils');
-
+var HASH_ALGOS = utils.HASH_ALGOS;
+var PK_ALGOS = utils.PK_ALGOS;
+var InvalidAlgorithmError = utils.InvalidAlgorithmError;
+var HttpSignatureError = utils.HttpSignatureError;
+var validateAlgorithm = utils.validateAlgorithm;
///--- Exported API
@@ -16,19 +22,21 @@ module.exports = {
* @param {String} pubkey RSA/DSA private key PEM.
* @return {Boolean} true if valid, false otherwise.
* @throws {TypeError} if you pass in bad arguments.
+ * @throws {InvalidAlgorithmError}
*/
verifySignature: function verifySignature(parsedSignature, pubkey) {
assert.object(parsedSignature, 'parsedSignature');
- assert.string(pubkey, 'pubkey');
+ if (typeof (pubkey) === 'string' || Buffer.isBuffer(pubkey))
+ pubkey = sshpk.parseKey(pubkey);
+ assert.ok(sshpk.Key.isKey(pubkey, [1, 1]), 'pubkey must be a sshpk.Key');
- var alg = parsedSignature.algorithm.match(/^(RSA|DSA)-(\w+)/);
- if (!alg || alg.length !== 3)
- throw new TypeError('parsedSignature: unsupported algorithm ' +
- parsedSignature.algorithm);
+ var alg = validateAlgorithm(parsedSignature.algorithm);
+ if (alg[0] === 'hmac' || alg[0] !== pubkey.type)
+ return (false);
- var verify = crypto.createVerify(alg[0]);
- verify.update(parsedSignature.signingString);
- return verify.verify(pubkey, parsedSignature.params.signature, 'base64');
+ var v = pubkey.createVerify(alg[1]);
+ v.update(parsedSignature.signingString);
+ return (v.verify(parsedSignature.params.signature, 'base64'));
},
/**
@@ -39,18 +47,42 @@ module.exports = {
* @param {String} secret HMAC shared secret.
* @return {Boolean} true if valid, false otherwise.
* @throws {TypeError} if you pass in bad arguments.
+ * @throws {InvalidAlgorithmError}
*/
verifyHMAC: function verifyHMAC(parsedSignature, secret) {
assert.object(parsedSignature, 'parsedHMAC');
assert.string(secret, 'secret');
- var alg = parsedSignature.algorithm.match(/^HMAC-(\w+)/);
- if (!alg || alg.length !== 2)
- throw new TypeError('parsedSignature: unsupported algorithm ' +
- parsedSignature.algorithm);
+ var alg = validateAlgorithm(parsedSignature.algorithm);
+ if (alg[0] !== 'hmac')
+ return (false);
+
+ var hashAlg = alg[1].toUpperCase();
- var hmac = crypto.createHmac(alg[1].toUpperCase(), secret);
+ var hmac = crypto.createHmac(hashAlg, secret);
hmac.update(parsedSignature.signingString);
- return (hmac.digest('base64') === parsedSignature.params.signature);
+
+ /*
+ * Now double-hash to avoid leaking timing information - there's
+ * no easy constant-time compare in JS, so we use this approach
+ * instead. See for more info:
+ * https://www.isecpartners.com/blog/2011/february/double-hmac-
+ * verification.aspx
+ */
+ var h1 = crypto.createHmac(hashAlg, secret);
+ h1.update(hmac.digest());
+ h1 = h1.digest();
+ var h2 = crypto.createHmac(hashAlg, secret);
+ h2.update(new Buffer(parsedSignature.params.signature, 'base64'));
+ h2 = h2.digest();
+
+ /* Node 0.8 returns strings from .digest(). */
+ if (typeof (h1) === 'string')
+ return (h1 === h2);
+ /* And node 0.10 lacks the .equals() method on Buffers. */
+ if (Buffer.isBuffer(h1) && !h1.equals)
+ return (h1.toString('binary') === h2.toString('binary'));
+
+ return (h1.equals(h2));
}
};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-conv b/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-conv
new file mode 120000
index 000000000..a2a295c80
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-conv
@@ -0,0 +1 @@
+../sshpk/bin/sshpk-conv \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json b/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
deleted file mode 100644
index 034c2b48f..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "author": {
- "name": "Mark Cavage",
- "email": "mcavage@gmail.com"
- },
- "contributors": [
- {
- "name": "David Gwynne",
- "email": "loki@animata.net"
- },
- {
- "name": "Yunong Xiao",
- "email": "yunong@joyent.com"
- }
- ],
- "name": "asn1",
- "description": "Contains parsers and serializers for ASN.1 (currently BER only)",
- "version": "0.1.11",
- "repository": {
- "type": "git",
- "url": "git://github.com/mcavage/node-asn1.git"
- },
- "main": "lib/index.js",
- "engines": {
- "node": ">=0.4.9"
- },
- "dependencies": {},
- "devDependencies": {
- "tap": "0.1.4"
- },
- "scripts": {
- "pretest": "which gjslint; if [[ \"$?\" = 0 ]] ; then gjslint --nojsdoc -r lib -r tst; else echo \"Missing gjslint. Skipping lint\"; fi",
- "test": "tap ./tst"
- },
- "readme": "node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.\nCurrently BER encoding is supported; at some point I'll likely have to do DER.\n\n## Usage\n\nMostly, if you're *actually* needing to read and write ASN.1, you probably don't\nneed this readme to explain what and why. If you have no idea what ASN.1 is,\nsee this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc\n\nThe source is pretty much self-explanatory, and has read/write methods for the\ncommon types out there.\n\n### Decoding\n\nThe following reads an ASN.1 sequence with a boolean.\n\n var Ber = require('asn1').Ber;\n\n var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));\n\n reader.readSequence();\n console.log('Sequence len: ' + reader.length);\n if (reader.peek() === Ber.Boolean)\n console.log(reader.readBoolean());\n\n### Encoding\n\nThe following generates the same payload as above.\n\n var Ber = require('asn1').Ber;\n\n var writer = new Ber.Writer();\n\n writer.startSequence();\n writer.writeBoolean(true);\n writer.endSequence();\n\n console.log(writer.buffer);\n\n## Installation\n\n npm install asn1\n\n## License\n\nMIT.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-asn1/issues>.\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/mcavage/node-asn1/issues"
- },
- "homepage": "https://github.com/mcavage/node-asn1#readme",
- "_id": "asn1@0.1.11",
- "_shasum": "559be18376d08a4ec4dbe80877d27818639b2df7",
- "_resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz",
- "_from": "asn1@0.1.11"
-}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore
deleted file mode 100644
index dc6d3b24d..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-tst/
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG b/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
deleted file mode 100644
index 426da9ef0..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
+++ /dev/null
@@ -1,78 +0,0 @@
-This contains tickets fixed in each version release in reverse chronological
-order. There is one ticket per line. Each commits message has the tickets fixed
-in it. The commit message also has the corresponding github issue. i.e. CTYPE-42
-would be issue 42. Each issue can be found at:
-https://github.com/rmustacc/node-ctype/issues/%d.
-
-v0.5.3
-CTYPE-50 Release 0.5.3
-Contributed by Nick Schonning:
-CTYPE-49 Add repository section to package.json
-Contributed by Jonathan Ong:
-CTYPE-48 Create .npmignore
-
-v0.5.2
-CTYPE-46 Release 0.5.2
-CTYPE-45 error in setEndian logic
-
-v0.5.1
-CTYPE-44 Release 0.5.1
-Contributed by Terin Stock:
-CTYPE-41 CTypeParser.writeStruct should return its offset
-Contributed by Terin Stock:
-CTYPE-42 int64_t returns wrong size
-
-v0.5.0
-CTYPE-40 Release 0.5.0
-CTYPE-39 want > 0.6 engine support
-
-v0.4.0
-CTYPE-37 Release v0.4.0
-CTYPE-6 want additional entry point for write
-CTYPE-20 Add 64-bit int support into core parser
-CTYPE-31 Fix bounds errors node/2129
-CTYPE-33 Update copyright holders
-CTYPE-34 ctf.js confuses sign bit.
-CTYPE-35 Make the README more useful for getting started
-CTYPE-36 want manual page on ctio functions
-
-v0.3.1
-CTYPE-29 Release 0.3.1
-CTYPE-28 Want v0.6 npm support
-
-v0.3.0
-CTYPE-27 Release v0.3.0
-CTYPE-26 Want alternate default char behavior
-
-v0.2.1
-CTYPE-25 Release v0.2.1
-CTYPE-24 Writing structs is busted
-
-v0.2.0:
-CTYPE-23 Release v0.2.0
-CTYPE-21 Add support for CTF JSON data
-CTYPE-22 Add Javascriptlint profile
-CTYPE-15 Pull in ctio updates from node/master
-
-v0.1.0:
-CTYPE-18 Bump version to v0.1.0
-CTYPE-17 Fix nested structures
-CTYPE-16 Remove extraneous logging
-CTYPE-14 toAbs64 and toApprox64 are not exported
-
-v0.0.3:
-CTYPE-12 Bump version to v0.0.3
-CTYPE-11 fix typo in wuint64
-CTYPE-10 Integrate jsstyle
-
-v0.0.2:
-CTYPE-8 dump npm version to v0.0.2
-CTYPE-9 want changelog
-CTYPE-7 fix typo in detypes.
-
-v0.0.1:
-CTYPE-5 Missing from NPM registry
-CTYPE-4 int16_t calls wrong read function
-CTYPE-3 API example types are missing quotes as strings
-CTYPE-2 doc missing 64-bit functions
-CTYPE-1 Need license
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/README b/node_modules/request/node_modules/http-signature/node_modules/ctype/README
deleted file mode 100644
index 4efd7ee5c..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/README
+++ /dev/null
@@ -1,82 +0,0 @@
-Node-CType is a way to read and write binary data in structured and easy to use
-format. Its name comes from the C header file.
-
-To get started, simply clone the repository or use npm to install it. Once it is
-there, simply require it.
-
-git clone git://github.com/rmustacc/node-ctype
-npm install ctype
-var mod_ctype = require('ctype')
-
-
-There are two APIs that you can use, depending on what abstraction you'd like.
-The low level API let's you read and write individual integers and floats from
-buffers. The higher level API let's you read and write structures of these. To
-illustrate this, let's looks look at how we would read and write a binary
-encoded x,y point.
-
-In C we would define this structure as follows:
-
-typedef struct point {
- uint16_t p_x;
- uint16_t p_y;
-} point_t;
-
-To read a binary encoded point from a Buffer, we first need to create a CType
-parser (where we specify the endian and other options) and add the typedef.
-
-var parser = new mod_ctype.Parser({ endian: 'big' });
-parser.typedef('point_t', [
- { x: { type: 'uint16_t' } },
- { y: { type: 'uint16_t' } }
-]);
-
-From here, given a buffer buf and an offset into it, we can read a point.
-
-var out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);
-console.log(out);
-{ point: { x: 23, y: 42 } }
-
-Another way to get the same information would be to use the low level methods.
-Note that these require you to manually deal with the offset. Here's how we'd
-get the same values of x and y from the buffer.
-
-var x = mod_ctype.ruint16(buf, 'big', 0);
-var y = mod_ctype.ruint16(buf, 'big', 2);
-console.log(x + ', ' + y);
-23, 42
-
-The true power of this API comes from the ability to define and nest typedefs,
-just as you would in C. By default, the following types are defined by default.
-Note that they return a Number, unless indicated otherwise.
-
- * int8_t
- * int16_t
- * int32_t
- * int64_t (returns an array where val[0] << 32 + val[1] would be the value)
- * uint8_t
- * uint16_t
- * uint32_t
- * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
- * float
- * double
- * char (either returns a buffer with that character or a uint8_t)
- * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
-
-
-ctf2json integration:
-
-Node-CType supports consuming the output of ctf2json. Once you read in a JSON file,
-all you have to do to add all the definitions it contains is:
-
-var data, parser;
-data = JSON.parse(parsedJSONData);
-parser = mod_ctype.parseCTF(data, { endian: 'big' });
-
-For more documentation, see the file README.old. Full documentation is in the
-process of being rewritten as a series of manual pages which will be available
-in the repository and online for viewing.
-
-To read the ctio manual page simple run, from the root of the workspace:
-
-man -Mman -s 3ctype ctio
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old b/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old
deleted file mode 100644
index 9326b725f..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old
+++ /dev/null
@@ -1,298 +0,0 @@
-This library provides a way to read and write binary data.
-
-Node CType is a way to read and write binary data in structured and easy to use
-formats. It's name comes from the header file, though it does not share as much
-with it as it perhaps should.
-
-There are two levels of the API. One is the raw API which everything is built on
-top of, while the other provides a much nicer abstraction and is built entirely
-by using the lower level API. The hope is that the low level API is both clear
-and useful. The low level API gets it's names from stdint.h (a rather
-appropriate source). The lower level API is presented at the end of this
-document.
-
-Standard CType API
-
-The CType interface is presented as a parser object that controls the
-endianness combined with a series of methods to change that value, parse and
-write out buffers, and a way to provide typedefs. Standard Types
-
-The CType parser supports the following basic types which return Numbers except
-as indicated:
-
- * int8_t
- * int16_t
- * int32_t
- * int64_t (returns an array where val[0] << 32 + val[1] would be the value)
- * uint8_t
- * uint16_t
- * uint32_t
- * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
- * float
- * double
- * char (returns a buffer with just that single character)
- * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
-
-Specifying Structs
-
-The CType parser also supports the notion of structs. A struct is an array of
-JSON objects that defines an order of keys which have types and values. One
-would build a struct to represent a point (x,y) as follows:
-
-[
- { x: { type: 'int16_t' }},
- { y: { type: 'int16_t' }}
-]
-
-When this is passed into the read routine, it would read the first two bytes
-(as defined by int16_t) to determine the Number to use for X, and then it would
-read the next two bytes to determine the value of Y. When read this could
-return something like:
-
-{
- x: 42,
- y: -23
-}
-
-When someone wants to write values, we use the same format as above, but with
-additional value field:
-
-[
- { x: { type: 'int16_t', value: 42 }},
- { y: { type: 'int16_t', value: -23 }}
-]
-
-Now, the structure above may be optionally annotated with offsets. This tells
-us to rather than read continuously we should read the given value at the
-specified offset. If an offset is provided, it is is effectively the equivalent
-of lseek(offset, SEEK_SET). Thus, subsequent values will be read from that
-offset and incremented by the appropriate value. As an example:
-
-[
- { x: { type: 'int16_t' }},
- { y: { type: 'int16_t', offset: 20 }},
- { z: { type: 'int16_t' }}
-]
-
-We would read x from the first starting offset given to us, for the sake of
-example, let's assume that's 0. After reading x, the next offset to read from
-would be 2; however, y specifies an offset, thus we jump directly to that
-offset and read y from byte 20. We would then read z from byte 22.
-
-The same offsets may be used when writing values.
-
-Typedef
-
-The basic set of types while covers the basics, is somewhat limiting. To make
-this richer, there is functionality to typedef something like in C. One can use
-typedef to add a new name to an existing type or to define a name to refer to a
-struct. Thus the following are all examples of a typedef:
-
-typedef('size_t', 'uint32_t');
-typedef('ssize_t', 'int32_t');
-typedef('point_t', [
- { x: { type: 'int16_t' }},
- { y: { type: 'int16_t' }}
-]);
-
-Once something has been typedef'd it can be used in any of the definitions
-previously shown.
-
-One cannot remove a typedef once created, this is analogous to C.
-
-The set of defined types can be printed with lstypes. The format of this output
-is subject to change, but likely will look something like:
-
-> lstypes();
-{
- size_t: 'uint32_t',
- ssize_t: 'int32_t',
- point_t: [
- { x: { type: 'int16_t' }},
- { y: { type: 'int16_t' }}
- ]
-}
-
-Specifying arrays
-
-Arrays can be specified by appending []s to a type. Arrays must have the size
-specified. The size must be specified and it can be done in one of two ways:
-
- * An explicit non-zero integer size
- * A name of a previously declared variable in the struct whose value is a
- number.
-
-Note, that when using the name of a variable, it should be the string name for
-the key. This is only valid inside structs and the value must be declared
-before the value with the array. The following are examples:
-
-[
- { ip_addr4: { type: 'uint8_t[4]' }},
- { len: { type: 'uint32_t' }},
- { data: { type: 'uint8_t[len]' }}
-]
-
-Arrays are permitted in typedefs; however, they must have a declared integer
-size. The following are examples of valid and invalid arrays:
-
-typedef('path', 'char[1024]'); /* Good */
-typedef('path', 'char[len]'); /* Bad! */
-
-64 bit values:
-
-Unfortunately Javascript represents values with a double, so you lose precision
-and the ability to represent Integers roughly beyond 2^53. To alleviate this, I
-propose the following for returning 64 bit integers when read:
-
-value[2]: Each entry is a 32 bit number which can be reconstructed to the
-original by the following formula:
-
-value[0] << 32 + value[1] (Note this will not work in Javascript)
-
-CTF JSON data:
-
-node-ctype can also handle JSON data that mathces the format described in the
-documentation of the tool ctf2json. Given the JSON data which specifies type
-information, it will transform that into a parser that understands all of the
-types defined inside of it. This is useful for more complicated structures that
-have a lot of typedefs.
-
-Interface overview
-
-The following is the header-file like interface to the parser object:
-
-/*
- * Create a new instance of the parser. Each parser has its own store of
- * typedefs and endianness. Conf is an object with the following values:
- *
- * endian Either 'big' or 'little' do determine the endianness we
- * want to read from or write to.
- *
- */
-function CTypeParser(conf);
-
-/*
- * Parses the CTF JSON data and creates a parser that understands all of those
- * types.
- *
- * data Parsed JSON data that maches that CTF JSON
- * specification.
- *
- * conf The configuration object to create a new CTypeParser
- * from.
- */
-CTypeParser parseCTF(data, conf);
-
-/*
- * This is what we were born to do. We read the data from a buffer and return it
- * in an object whose keys match the values from the object.
- *
- * def The array definition of the data to read in
- *
- * buffer The buffer to read data from
- *
- * offset The offset to start writing to
- *
- * Returns an object where each key corresponds to an entry in def and the value
- * is the read value.
- */
-Object CTypeParser.readData(<Type Definition>, buffer, offset);
-
-/*
- * This is the second half of what we were born to do, write out the data
- * itself.
- *
- * def The array definition of the data to write out with
- * values
- *
- * buffer The buffer to write to
- *
- * offset The offset in the buffer to write to
- */
-void CTypeParser.writeData(<Type Definition>, buffer, offset);
-
-/*
- * A user has requested to add a type, let us honor their request. Yet, if their
- * request doth spurn us, send them unto the Hells which Dante describes.
- *
- * name The string for the type definition we're adding
- *
- * value Either a string that is a type/array name or an object
- * that describes a struct.
- */
-void CTypeParser.prototype.typedef(name, value);
-
-Object CTypeParser.prototype.lstypes();
-
-/*
- * Get the endian value for the current parser
- */
-String CTypeParser.prototype.getEndian();
-
-/*
- * Sets the current endian value for the Parser. If the value is not valid,
- * throws an Error.
- *
- * endian Either 'big' or 'little' do determine the endianness we
- * want to read from or write to.
- *
- */
-void CTypeParser.protoype.setEndian(String);
-
-/*
- * Attempts to convert an array of two integers returned from rsint64 / ruint64
- * into an absolute 64 bit number. If however the value would exceed 2^52 this
- * will instead throw an error. The mantissa in a double is a 52 bit number and
- * rather than potentially give you a value that is an approximation this will
- * error. If you would rather an approximation, please see toApprox64.
- *
- * val An array of two 32-bit integers
- */
-Number function toAbs64(val)
-
-/*
- * Will return the 64 bit value as returned in an array from rsint64 / ruint64
- * to a value as close as it can. Note that Javascript stores all numbers as a
- * double and the mantissa only has 52 bits. Thus this version may approximate
- * the value.
- *
- * val An array of two 32-bit integers
- */
-Number function toApprox64(val)
-
-Low Level API
-
-The following function are provided at the low level:
-
-Read unsigned integers from a buffer:
-Number ruint8(buffer, endian, offset);
-Number ruint16(buffer, endian, offset);
-Number ruint32(buffer, endian, offset);
-Number[] ruint64(buffer, endian, offset);
-
-Read signed integers from a buffer:
-Number rsint8(buffer, endian, offset);
-Number rsint16(buffer, endian, offset);
-Number rsint32(buffer, endian, offset);
-Number[] rsint64(buffer, endian, offset);
-
-Read floating point numbers from a buffer:
-Number rfloat(buffer, endian, offset); /* IEEE-754 Single precision */
-Number rdouble(buffer, endian, offset); /* IEEE-754 Double precision */
-
-Write unsigned integers to a buffer:
-void wuint8(Number, endian, buffer, offset);
-void wuint16(Number, endian, buffer, offset);
-void wuint32(Number, endian, buffer, offset);
-void wuint64(Number[], endian, buffer, offset);
-
-Write signed integers from a buffer:
-void wsint8(Number, endian, buffer, offset);
-void wsint16(Number, endian, buffer, offset);
-void wsint32(Number, endian, buffer, offset);
-void wsint64(Number[], endian, buffer offset);
-
-Write floating point numbers from a buffer:
-void wfloat(Number, buffer, endian, offset); /* IEEE-754 Single precision */
-void wdouble(Number, buffer, endian, offset); /* IEEE-754 Double precision */
-
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js b/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js
deleted file mode 100644
index 66d5f7352..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * ctf.js
- *
- * Understand and parse all of the different JSON formats of CTF data and
- * translate that into a series of node-ctype friendly pieces. The reason for
- * the abstraction is to handle different changes in the file format.
- *
- * We have to be careful here that we don't end up using a name that is already
- * a built in type.
- */
-var mod_assert = require('assert');
-var ASSERT = mod_assert.ok;
-
-var ctf_versions = [ '1.0' ];
-var ctf_entries = [ 'integer', 'float', 'typedef', 'struct' ];
-var ctf_deftypes = [ 'int8_t', 'uint8_t', 'int16_t', 'uint16_t', 'int32_t',
- 'uint32_t', 'float', 'double' ];
-
-function ctfParseInteger(entry, ctype)
-{
- var name, sign, len, type;
-
- name = entry['name'];
- if (!('signed' in entry['integer']))
- throw (new Error('Malformed CTF JSON: integer missing ' +
- 'signed value'));
-
-
- if (!('length' in entry['integer']))
- throw (new Error('Malformed CTF JSON: integer missing ' +
- 'length value'));
-
- sign = entry['integer']['signed'];
- len = entry['integer']['length'];
- type = null;
-
- if (sign && len == 1)
- type = 'int8_t';
- else if (len == 1)
- type = 'uint8_t';
- else if (sign && len == 2)
- type = 'int16_t';
- else if (len == 2)
- type = 'uint16_t';
- else if (sign && len == 4)
- type = 'int32_t';
- else if (len == 4)
- type = 'uint32_t';
- else if (sign && len == 8)
- type = 'int64_t';
- else if (len == 8)
- type = 'uint64_t';
-
- if (type === null)
- throw (new Error('Malformed CTF JSON: integer has ' +
- 'unsupported length and sign - ' + len + '/' + sign));
-
- /*
- * This means that this is the same as one of our built in types. If
- * that's the case defining it would be an error. So instead of trying
- * to typedef it, we'll return here.
- */
- if (name == type)
- return;
-
- if (name == 'char') {
- ASSERT(type == 'int8_t');
- return;
- }
-
- ctype.typedef(name, type);
-}
-
-function ctfParseFloat(entry, ctype)
-{
- var name, len;
-
- name = entry['name'];
- if (!('length' in entry['float']))
- throw (new Error('Malformed CTF JSON: float missing ' +
- 'length value'));
-
- len = entry['float']['length'];
- if (len != 4 && len != 8)
- throw (new Error('Malformed CTF JSON: float has invalid ' +
- 'length value'));
-
- if (len == 4) {
- if (name == 'float')
- return;
- ctype.typedef(name, 'float');
- } else if (len == 8) {
- if (name == 'double')
- return;
- ctype.typedef(name, 'double');
- }
-}
-
-function ctfParseTypedef(entry, ctype)
-{
- var name, type, ii;
-
- name = entry['name'];
- if (typeof (entry['typedef']) != 'string')
- throw (new Error('Malformed CTF JSON: typedef value in not ' +
- 'a string'));
-
- type = entry['typedef'];
-
- /*
- * We need to ensure that we're not looking at type that's one of our
- * built in types. Traditionally in C a uint32_t would be a typedef to
- * some kind of integer. However, those size types are built ins.
- */
- for (ii = 0; ii < ctf_deftypes.length; ii++) {
- if (name == ctf_deftypes[ii])
- return;
- }
-
- ctype.typedef(name, type);
-}
-
-function ctfParseStruct(entry, ctype)
-{
- var name, type, ii, val, index, member, push;
-
- member = [];
- if (!Array.isArray(entry['struct']))
- throw (new Error('Malformed CTF JSON: struct value is not ' +
- 'an array'));
-
- for (ii = 0; ii < entry['struct'].length; ii++) {
- val = entry['struct'][ii];
- if (!('name' in val))
- throw (new Error('Malformed CTF JSON: struct member ' +
- 'missing name'));
-
- if (!('type' in val))
- throw (new Error('Malformed CTF JSON: struct member ' +
- 'missing type'));
-
- if (typeof (val['name']) != 'string')
- throw (new Error('Malformed CTF JSON: struct member ' +
- 'name isn\'t a string'));
-
- if (typeof (val['type']) != 'string')
- throw (new Error('Malformed CTF JSON: struct member ' +
- 'type isn\'t a string'));
-
- /*
- * CTF version 2 specifies array names as <type> [<num>] where
- * as node-ctype does this as <type>[<num>].
- */
- name = val['name'];
- type = val['type'];
- index = type.indexOf(' [');
- if (index != -1) {
- type = type.substring(0, index) +
- type.substring(index + 1, type.length);
- }
- push = {};
- push[name] = { 'type': type };
- member.push(push);
- }
-
- name = entry['name'];
- ctype.typedef(name, member);
-}
-
-function ctfParseEntry(entry, ctype)
-{
- var ii, found;
-
- if (!('name' in entry))
- throw (new Error('Malformed CTF JSON: entry missing "name" ' +
- 'section'));
-
- for (ii = 0; ii < ctf_entries.length; ii++) {
- if (ctf_entries[ii] in entry)
- found++;
- }
-
- if (found === 0)
- throw (new Error('Malformed CTF JSON: found no entries'));
-
- if (found >= 2)
- throw (new Error('Malformed CTF JSON: found more than one ' +
- 'entry'));
-
- if ('integer' in entry) {
- ctfParseInteger(entry, ctype);
- return;
- }
-
- if ('float' in entry) {
- ctfParseFloat(entry, ctype);
- return;
- }
-
- if ('typedef' in entry) {
- ctfParseTypedef(entry, ctype);
- return;
- }
-
- if ('struct' in entry) {
- ctfParseStruct(entry, ctype);
- return;
- }
-
- ASSERT(false, 'shouldn\'t reach here');
-}
-
-function ctfParseJson(json, ctype)
-{
- var version, ii;
-
- ASSERT(json);
- ASSERT(ctype);
- if (!('metadata' in json))
- throw (new Error('Invalid CTF JSON: missing metadata section'));
-
- if (!('ctf2json_version' in json['metadata']))
- throw (new Error('Invalid CTF JSON: missing ctf2json_version'));
-
- version = json['metadata']['ctf2json_version'];
- for (ii = 0; ii < ctf_versions.length; ii++) {
- if (ctf_versions[ii] == version)
- break;
- }
-
- if (ii == ctf_versions.length)
- throw (new Error('Unsuported ctf2json_version: ' + version));
-
- if (!('data' in json))
- throw (new Error('Invalid CTF JSON: missing data section'));
-
- if (!Array.isArray(json['data']))
- throw (new Error('Malformed CTF JSON: data section is not ' +
- 'an array'));
-
- for (ii = 0; ii < json['data'].length; ii++)
- ctfParseEntry(json['data'][ii], ctype);
-}
-
-exports.ctfParseJson = ctfParseJson;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js b/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js
deleted file mode 100644
index 62c5d7b23..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js
+++ /dev/null
@@ -1,1485 +0,0 @@
-/*
- * rm - Feb 2011
- * ctio.js:
- *
- * A simple way to read and write simple ctypes. Of course, as you'll find the
- * code isn't as simple as it might appear. The following types are currently
- * supported in big and little endian formats:
- *
- * uint8_t int8_t
- * uint16_t int16_t
- * uint32_t int32_t
- * float (single precision IEEE 754)
- * double (double precision IEEE 754)
- *
- * This is designed to work in Node and v8. It may in fact work in other
- * Javascript interpreters (that'd be pretty neat), but it hasn't been tested.
- * If you find that it does in fact work, that's pretty cool. Try and pass word
- * back to the original author.
- *
- * Note to the reader: If you're tabstop isn't set to 8, parts of this may look
- * weird.
- */
-
-/*
- * Numbers in Javascript have a secret: all numbers must be represented with an
- * IEEE-754 double. The double has a mantissa with a length of 52 bits with an
- * implicit one. Thus the range of integers that can be represented is limited
- * to the size of the mantissa, this makes reading and writing 64-bit integers
- * difficult, but far from impossible.
- *
- * Another side effect of this representation is what happens when you use the
- * bitwise operators, i.e. shift left, shift right, and, or, etc. In Javascript,
- * each operand and the result is cast to a signed 32-bit number. However, in
- * the case of >>> the values are cast to an unsigned number.
- */
-
-/*
- * A reminder on endian related issues:
- *
- * Big Endian: MSB -> First byte
- * Little Endian: MSB->Last byte
- */
-var mod_assert = require('assert');
-
-/*
- * An 8 bit unsigned integer involves doing no significant work.
- */
-function ruint8(buffer, endian, offset)
-{
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- return (buffer[offset]);
-}
-
-/*
- * For 16 bit unsigned numbers we can do all the casting that we want to do.
- */
-function rgint16(buffer, endian, offset)
-{
- var val = 0;
-
- if (endian == 'big') {
- val = buffer[offset] << 8;
- val |= buffer[offset+1];
- } else {
- val = buffer[offset];
- val |= buffer[offset+1] << 8;
- }
-
- return (val);
-
-}
-
-function ruint16(buffer, endian, offset)
-{
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 1 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- return (rgint16(buffer, endian, offset));
-}
-
-/*
- * Because most bitshifting is done using signed numbers, if we would go into
- * the realm where we use that 32nd bit, we'll end up going into the negative
- * range. i.e.:
- * > 200 << 24
- * -939524096
- *
- * Not the value you'd expect. To work around this, we end up having to do some
- * abuse of the JavaScript standard. in this case, we know that a >>> shift is
- * defined to cast our value to an *unsigned* 32-bit number. Because of that, we
- * use that instead to save us some additional math, though it does feel a
- * little weird and it isn't obvious as to why you woul dwant to do this at
- * first.
- */
-function rgint32(buffer, endian, offset)
-{
- var val = 0;
-
- if (endian == 'big') {
- val = buffer[offset+1] << 16;
- val |= buffer[offset+2] << 8;
- val |= buffer[offset+3];
- val = val + (buffer[offset] << 24 >>> 0);
- } else {
- val = buffer[offset+2] << 16;
- val |= buffer[offset+1] << 8;
- val |= buffer[offset];
- val = val + (buffer[offset + 3] << 24 >>> 0);
- }
-
- return (val);
-}
-
-function ruint32(buffer, endian, offset)
-{
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 3 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- return (rgint32(buffer, endian, offset));
-}
-
-/*
- * Reads a 64-bit unsigned number. The astue observer will note that this
- * doesn't quite work. Javascript has chosen to only have numbers that can be
- * represented by a double. A double only has 52 bits of mantissa with an
- * implicit 1, thus we have up to 53 bits to represent an integer. However, 2^53
- * doesn't quite give us what we want. Isn't 53 bits enough for anyone? What
- * could you have possibly wanted to represent that was larger than that? Oh,
- * maybe a size? You mean we bypassed the 4 GB limit on file sizes, when did
- * that happen?
- *
- * To get around this egregious language issue, we're going to instead construct
- * an array of two 32 bit unsigned integers. Where arr[0] << 32 + arr[1] would
- * give the actual number. However, note that the above code probably won't
- * produce the desired results because of the way Javascript numbers are
- * doubles.
- */
-function rgint64(buffer, endian, offset)
-{
- var val = new Array(2);
-
- if (endian == 'big') {
- val[0] = ruint32(buffer, endian, offset);
- val[1] = ruint32(buffer, endian, offset+4);
- } else {
- val[0] = ruint32(buffer, endian, offset+4);
- val[1] = ruint32(buffer, endian, offset);
- }
-
- return (val);
-}
-
-function ruint64(buffer, endian, offset)
-{
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 7 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- return (rgint64(buffer, endian, offset));
-}
-
-
-/*
- * Signed integer types, yay team! A reminder on how two's complement actually
- * works. The first bit is the signed bit, i.e. tells us whether or not the
- * number should be positive or negative. If the two's complement value is
- * positive, then we're done, as it's equivalent to the unsigned representation.
- *
- * Now if the number is positive, you're pretty much done, you can just leverage
- * the unsigned translations and return those. Unfortunately, negative numbers
- * aren't quite that straightforward.
- *
- * At first glance, one might be inclined to use the traditional formula to
- * translate binary numbers between the positive and negative values in two's
- * complement. (Though it doesn't quite work for the most negative value)
- * Mainly:
- * - invert all the bits
- * - add one to the result
- *
- * Of course, this doesn't quite work in Javascript. Take for example the value
- * of -128. This could be represented in 16 bits (big-endian) as 0xff80. But of
- * course, Javascript will do the following:
- *
- * > ~0xff80
- * -65409
- *
- * Whoh there, Javascript, that's not quite right. But wait, according to
- * Javascript that's perfectly correct. When Javascript ends up seeing the
- * constant 0xff80, it has no notion that it is actually a signed number. It
- * assumes that we've input the unsigned value 0xff80. Thus, when it does the
- * binary negation, it casts it into a signed value, (positive 0xff80). Then
- * when you perform binary negation on that, it turns it into a negative number.
- *
- * Instead, we're going to have to use the following general formula, that works
- * in a rather Javascript friendly way. I'm glad we don't support this kind of
- * weird numbering scheme in the kernel.
- *
- * (BIT-MAX - (unsigned)val + 1) * -1
- *
- * The astute observer, may think that this doesn't make sense for 8-bit numbers
- * (really it isn't necessary for them). However, when you get 16-bit numbers,
- * you do. Let's go back to our prior example and see how this will look:
- *
- * (0xffff - 0xff80 + 1) * -1
- * (0x007f + 1) * -1
- * (0x0080) * -1
- *
- * Doing it this way ends up allowing us to treat it appropriately in
- * Javascript. Sigh, that's really quite ugly for what should just be a few bit
- * shifts, ~ and &.
- */
-
-/*
- * Endianness doesn't matter for 8-bit signed values. We could in fact optimize
- * this case because the more traditional methods work, but for consistency,
- * we'll keep doing this the same way.
- */
-function rsint8(buffer, endian, offset)
-{
- var neg;
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- neg = buffer[offset] & 0x80;
- if (!neg)
- return (buffer[offset]);
-
- return ((0xff - buffer[offset] + 1) * -1);
-}
-
-/*
- * The 16-bit version requires a bit more effort. In this case, we can leverage
- * our unsigned code to generate the value we want to return.
- */
-function rsint16(buffer, endian, offset)
-{
- var neg, val;
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 1 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = rgint16(buffer, endian, offset);
- neg = val & 0x8000;
- if (!neg)
- return (val);
-
- return ((0xffff - val + 1) * -1);
-}
-
-/*
- * We really shouldn't leverage our 32-bit code here and instead utilize the
- * fact that we know that since these are signed numbers, we can do all the
- * shifting and binary anding to generate the 32-bit number. But, for
- * consistency we'll do the same. If we want to do otherwise, we should instead
- * make the 32 bit unsigned code do the optimization. But as long as there
- * aren't floats secretly under the hood for that, we /should/ be okay.
- */
-function rsint32(buffer, endian, offset)
-{
- var neg, val;
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 3 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = rgint32(buffer, endian, offset);
- neg = val & 0x80000000;
- if (!neg)
- return (val);
-
- return ((0xffffffff - val + 1) * -1);
-}
-
-/*
- * The signed version of this code suffers from all of the same problems of the
- * other 64 bit version.
- */
-function rsint64(buffer, endian, offset)
-{
- var neg, val;
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 3 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = rgint64(buffer, endian, offset);
- neg = val[0] & 0x80000000;
-
- if (!neg)
- return (val);
-
- val[0] = (0xffffffff - val[0]) * -1;
- val[1] = (0xffffffff - val[1] + 1) * -1;
-
- /*
- * If we had the key 0x8000000000000000, that would leave the lower 32
- * bits as 0xffffffff, however, since we're goint to add one, that would
- * actually leave the lower 32-bits as 0x100000000, which would break
- * our ability to write back a value that we received. To work around
- * this, if we actually get that value, we're going to bump the upper
- * portion by 1 and set this to zero.
- */
- mod_assert.ok(val[1] <= 0x100000000);
- if (val[1] == -0x100000000) {
- val[1] = 0;
- val[0]--;
- }
-
- return (val);
-}
-
-/*
- * We now move onto IEEE 754: The traditional form for floating point numbers
- * and what is secretly hiding at the heart of everything in this. I really hope
- * that someone is actually using this, as otherwise, this effort is probably
- * going to be more wasted.
- *
- * One might be tempted to use parseFloat here, but that wouldn't work at all
- * for several reasons. Mostly due to the way floats actually work, and
- * parseFloat only actually works in base 10. I don't see base 10 anywhere near
- * this file.
- *
- * In this case we'll implement the single and double precision versions. The
- * quadruple precision, while probably useful, wouldn't really be accepted by
- * Javascript, so let's not even waste our time.
- *
- * So let's review how this format looks like. A single precision value is 32
- * bits and has three parts:
- * - Sign bit
- * - Exponent (Using bias notation)
- * - Mantissa
- *
- * |s|eeeeeeee|mmmmmmmmmmmmmmmmmmmmmmmmm|
- * 31| 30-23 | 22 - 0 |
- *
- * The exponent is stored in a biased input. The bias in this case 127.
- * Therefore, our exponent is equal to the 8-bit value - 127.
- *
- * By default, a number is normalized in IEEE, that means that the mantissa has
- * an implicit one that we don't see. So really the value stored is 1.m.
- * However, if the exponent is all zeros, then instead we have to shift
- * everything to the right one and there is no more implicit one.
- *
- * Special values:
- * - Positive Infinity:
- * Sign: 0
- * Exponent: All 1s
- * Mantissa: 0
- * - Negative Infinity:
- * Sign: 1
- * Exponent: All 1s
- * Mantissa: 0
- * - NaN:
- * Sign: *
- * Exponent: All 1s
- * Mantissa: non-zero
- * - Zero:
- * Sign: *
- * Exponent: All 0s
- * Mantissa: 0
- *
- * In the case of zero, the sign bit determines whether we get a positive or
- * negative zero. However, since Javascript cannot determine the difference
- * between the two: i.e. -0 == 0, we just always return 0.
- *
- */
-function rfloat(buffer, endian, offset)
-{
- var bytes = [];
- var sign, exponent, mantissa, val;
- var bias = 127;
- var maxexp = 0xff;
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 3 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- /* Normalize the bytes to be in endian order */
- if (endian == 'big') {
- bytes[0] = buffer[offset];
- bytes[1] = buffer[offset+1];
- bytes[2] = buffer[offset+2];
- bytes[3] = buffer[offset+3];
- } else {
- bytes[3] = buffer[offset];
- bytes[2] = buffer[offset+1];
- bytes[1] = buffer[offset+2];
- bytes[0] = buffer[offset+3];
- }
-
- sign = bytes[0] & 0x80;
- exponent = (bytes[0] & 0x7f) << 1;
- exponent |= (bytes[1] & 0x80) >>> 7;
- mantissa = (bytes[1] & 0x7f) << 16;
- mantissa |= bytes[2] << 8;
- mantissa |= bytes[3];
-
- /* Check for special cases before we do general parsing */
- if (!sign && exponent == maxexp && mantissa === 0)
- return (Number.POSITIVE_INFINITY);
-
- if (sign && exponent == maxexp && mantissa === 0)
- return (Number.NEGATIVE_INFINITY);
-
- if (exponent == maxexp && mantissa !== 0)
- return (Number.NaN);
-
- /*
- * Javascript really doesn't have support for positive or negative zero.
- * So we're not going to try and give it to you. That would be just
- * plain weird. Besides -0 == 0.
- */
- if (exponent === 0 && mantissa === 0)
- return (0);
-
- /*
- * Now we can deal with the bias and the determine whether the mantissa
- * has the implicit one or not.
- */
- exponent -= bias;
- if (exponent == -bias) {
- exponent++;
- val = 0;
- } else {
- val = 1;
- }
-
- val = (val + mantissa * Math.pow(2, -23)) * Math.pow(2, exponent);
-
- if (sign)
- val *= -1;
-
- return (val);
-}
-
-/*
- * Doubles in IEEE 754 are like their brothers except for a few changes and
- * increases in size:
- * - The exponent is now 11 bits
- * - The mantissa is now 52 bits
- * - The bias is now 1023
- *
- * |s|eeeeeeeeeee|mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm|
- * 63| 62 - 52 | 51 - 0 |
- * 63| 62 - 52 | 51 - 0 |
- *
- * While the size has increased a fair amount, we're going to end up keeping the
- * same general formula for calculating the final value. As a reminder, this
- * formula is:
- *
- * (-1)^s * (n + m) * 2^(e-b)
- *
- * Where:
- * s is the sign bit
- * n is (exponent > 0) ? 1 : 0 -- Determines whether we're normalized
- * or not
- * m is the mantissa
- * e is the exponent specified
- * b is the bias for the exponent
- *
- */
-function rdouble(buffer, endian, offset)
-{
- var bytes = [];
- var sign, exponent, mantissa, val, lowmant;
- var bias = 1023;
- var maxexp = 0x7ff;
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 7 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- /* Normalize the bytes to be in endian order */
- if (endian == 'big') {
- bytes[0] = buffer[offset];
- bytes[1] = buffer[offset+1];
- bytes[2] = buffer[offset+2];
- bytes[3] = buffer[offset+3];
- bytes[4] = buffer[offset+4];
- bytes[5] = buffer[offset+5];
- bytes[6] = buffer[offset+6];
- bytes[7] = buffer[offset+7];
- } else {
- bytes[7] = buffer[offset];
- bytes[6] = buffer[offset+1];
- bytes[5] = buffer[offset+2];
- bytes[4] = buffer[offset+3];
- bytes[3] = buffer[offset+4];
- bytes[2] = buffer[offset+5];
- bytes[1] = buffer[offset+6];
- bytes[0] = buffer[offset+7];
- }
-
- /*
- * We can construct the exponent and mantissa the same way as we did in
- * the case of a float, just increase the range of the exponent.
- */
- sign = bytes[0] & 0x80;
- exponent = (bytes[0] & 0x7f) << 4;
- exponent |= (bytes[1] & 0xf0) >>> 4;
-
- /*
- * This is going to be ugly but then again, we're dealing with IEEE 754.
- * This could probably be done as a node add on in a few lines of C++,
- * but oh we'll, we've made it this far so let's be native the rest of
- * the way...
- *
- * What we're going to do is break the mantissa into two parts, the
- * lower 24 bits and the upper 28 bits. We'll multiply the upper 28 bits
- * by the appropriate power and then add in the lower 24-bits. Not
- * really that great. It's pretty much a giant kludge to deal with
- * Javascript eccentricities around numbers.
- */
- lowmant = bytes[7];
- lowmant |= bytes[6] << 8;
- lowmant |= bytes[5] << 16;
- mantissa = bytes[4];
- mantissa |= bytes[3] << 8;
- mantissa |= bytes[2] << 16;
- mantissa |= (bytes[1] & 0x0f) << 24;
- mantissa *= Math.pow(2, 24); /* Equivalent to << 24, but JS compat */
- mantissa += lowmant;
-
- /* Check for special cases before we do general parsing */
- if (!sign && exponent == maxexp && mantissa === 0)
- return (Number.POSITIVE_INFINITY);
-
- if (sign && exponent == maxexp && mantissa === 0)
- return (Number.NEGATIVE_INFINITY);
-
- if (exponent == maxexp && mantissa !== 0)
- return (Number.NaN);
-
- /*
- * Javascript really doesn't have support for positive or negative zero.
- * So we're not going to try and give it to you. That would be just
- * plain weird. Besides -0 == 0.
- */
- if (exponent === 0 && mantissa === 0)
- return (0);
-
- /*
- * Now we can deal with the bias and the determine whether the mantissa
- * has the implicit one or not.
- */
- exponent -= bias;
- if (exponent == -bias) {
- exponent++;
- val = 0;
- } else {
- val = 1;
- }
-
- val = (val + mantissa * Math.pow(2, -52)) * Math.pow(2, exponent);
-
- if (sign)
- val *= -1;
-
- return (val);
-}
-
-/*
- * Now that we have gone through the pain of reading the individual types, we're
- * probably going to want some way to write these back. None of this is going to
- * be good. But since we have Javascript numbers this should certainly be more
- * interesting. Though we can constrain this end a little bit more in what is
- * valid. For now, let's go back to our friends the unsigned value.
- */
-
-/*
- * Unsigned numbers seem deceptively easy. Here are the general steps and rules
- * that we are going to take:
- * - If the number is negative, throw an Error
- * - Truncate any floating point portion
- * - Take the modulus of the number in our base
- * - Write it out to the buffer in the endian format requested at the offset
- */
-
-/*
- * We have to make sure that the value is a valid integer. This means that it is
- * non-negative. It has no fractional component and that it does not exceed the
- * maximum allowed value.
- *
- * value The number to check for validity
- *
- * max The maximum value
- */
-function prepuint(value, max)
-{
- if (typeof (value) != 'number')
- throw (new (Error('cannot write a non-number as a number')));
-
- if (value < 0)
- throw (new Error('specified a negative value for writing an ' +
- 'unsigned value'));
-
- if (value > max)
- throw (new Error('value is larger than maximum value for ' +
- 'type'));
-
- if (Math.floor(value) !== value)
- throw (new Error('value has a fractional component'));
-
- return (value);
-}
-
-/*
- * 8-bit version, classy. We can ignore endianness which is good.
- */
-function wuint8(value, endian, buffer, offset)
-{
- var val;
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = prepuint(value, 0xff);
- buffer[offset] = val;
-}
-
-/*
- * Pretty much the same as the 8-bit version, just this time we need to worry
- * about endian related issues.
- */
-function wgint16(val, endian, buffer, offset)
-{
- if (endian == 'big') {
- buffer[offset] = (val & 0xff00) >>> 8;
- buffer[offset+1] = val & 0x00ff;
- } else {
- buffer[offset+1] = (val & 0xff00) >>> 8;
- buffer[offset] = val & 0x00ff;
- }
-}
-
-function wuint16(value, endian, buffer, offset)
-{
- var val;
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 1 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = prepuint(value, 0xffff);
- wgint16(val, endian, buffer, offset);
-}
-
-/*
- * The 32-bit version is going to have to be a little different unfortunately.
- * We can't quite bitshift to get the largest byte, because that would end up
- * getting us caught by the signed values.
- *
- * And yes, we do want to subtract out the lower part by default. This means
- * that when we do the division, it will be treated as a bit shift and we won't
- * end up generating a floating point value. If we did generate a floating point
- * value we'd have to truncate it intelligently, this saves us that problem and
- * may even be somewhat faster under the hood.
- */
-function wgint32(val, endian, buffer, offset)
-{
- if (endian == 'big') {
- buffer[offset] = (val - (val & 0x00ffffff)) / Math.pow(2, 24);
- buffer[offset+1] = (val >>> 16) & 0xff;
- buffer[offset+2] = (val >>> 8) & 0xff;
- buffer[offset+3] = val & 0xff;
- } else {
- buffer[offset+3] = (val - (val & 0x00ffffff)) /
- Math.pow(2, 24);
- buffer[offset+2] = (val >>> 16) & 0xff;
- buffer[offset+1] = (val >>> 8) & 0xff;
- buffer[offset] = val & 0xff;
- }
-}
-
-function wuint32(value, endian, buffer, offset)
-{
- var val;
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 3 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = prepuint(value, 0xffffffff);
- wgint32(val, endian, buffer, offset);
-}
-
-/*
- * Unlike the other versions, we expect the value to be in the form of two
- * arrays where value[0] << 32 + value[1] would result in the value that we
- * want.
- */
-function wgint64(value, endian, buffer, offset)
-{
- if (endian == 'big') {
- wgint32(value[0], endian, buffer, offset);
- wgint32(value[1], endian, buffer, offset+4);
- } else {
- wgint32(value[0], endian, buffer, offset+4);
- wgint32(value[1], endian, buffer, offset);
- }
-}
-
-function wuint64(value, endian, buffer, offset)
-{
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (!(value instanceof Array))
- throw (new Error('value must be an array'));
-
- if (value.length != 2)
- throw (new Error('value must be an array of length 2'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 7 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- prepuint(value[0], 0xffffffff);
- prepuint(value[1], 0xffffffff);
- wgint64(value, endian, buffer, offset);
-}
-
-/*
- * We now move onto our friends in the signed number category. Unlike unsigned
- * numbers, we're going to have to worry a bit more about how we put values into
- * arrays. Since we are only worrying about signed 32-bit values, we're in
- * slightly better shape. Unfortunately, we really can't do our favorite binary
- * & in this system. It really seems to do the wrong thing. For example:
- *
- * > -32 & 0xff
- * 224
- *
- * What's happening above is really: 0xe0 & 0xff = 0xe0. However, the results of
- * this aren't treated as a signed number. Ultimately a bad thing.
- *
- * What we're going to want to do is basically create the unsigned equivalent of
- * our representation and pass that off to the wuint* functions. To do that
- * we're going to do the following:
- *
- * - if the value is positive
- * we can pass it directly off to the equivalent wuint
- * - if the value is negative
- * we do the following computation:
- * mb + val + 1, where
- * mb is the maximum unsigned value in that byte size
- * val is the Javascript negative integer
- *
- *
- * As a concrete value, take -128. In signed 16 bits this would be 0xff80. If
- * you do out the computations:
- *
- * 0xffff - 128 + 1
- * 0xffff - 127
- * 0xff80
- *
- * You can then encode this value as the signed version. This is really rather
- * hacky, but it should work and get the job done which is our goal here.
- *
- * Thus the overall flow is:
- * - Truncate the floating point part of the number
- * - We don't have to take the modulus, because the unsigned versions will
- * take care of that for us. And we don't have to worry about that
- * potentially causing bad things to happen because of sign extension
- * - Pass it off to the appropriate unsigned version, potentially modifying
- * the negative portions as necessary.
- */
-
-/*
- * A series of checks to make sure we actually have a signed 32-bit number
- */
-function prepsint(value, max, min)
-{
- if (typeof (value) != 'number')
- throw (new (Error('cannot write a non-number as a number')));
-
- if (value > max)
- throw (new Error('value larger than maximum allowed value'));
-
- if (value < min)
- throw (new Error('value smaller than minimum allowed value'));
-
- if (Math.floor(value) !== value)
- throw (new Error('value has a fractional component'));
-
- return (value);
-}
-
-/*
- * The 8-bit version of the signed value. Overall, fairly straightforward.
- */
-function wsint8(value, endian, buffer, offset)
-{
- var val;
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = prepsint(value, 0x7f, -0x80);
- if (val >= 0)
- wuint8(val, endian, buffer, offset);
- else
- wuint8(0xff + val + 1, endian, buffer, offset);
-}
-
-/*
- * The 16-bit version of the signed value. Also, fairly straightforward.
- */
-function wsint16(value, endian, buffer, offset)
-{
- var val;
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 1 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = prepsint(value, 0x7fff, -0x8000);
- if (val >= 0)
- wgint16(val, endian, buffer, offset);
- else
- wgint16(0xffff + val + 1, endian, buffer, offset);
-
-}
-
-/*
- * We can do this relatively easily by leveraging the code used for 32-bit
- * unsigned code.
- */
-function wsint32(value, endian, buffer, offset)
-{
- var val;
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 3 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- val = prepsint(value, 0x7fffffff, -0x80000000);
- if (val >= 0)
- wgint32(val, endian, buffer, offset);
- else
- wgint32(0xffffffff + val + 1, endian, buffer, offset);
-}
-
-/*
- * The signed 64 bit integer should by in the same format as when received.
- * Mainly it should ensure that the value is an array of two integers where
- * value[0] << 32 + value[1] is the desired number. Furthermore, the two values
- * need to be equal.
- */
-function wsint64(value, endian, buffer, offset)
-{
- var vzpos, vopos;
- var vals = new Array(2);
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (!(value instanceof Array))
- throw (new Error('value must be an array'));
-
- if (value.length != 2)
- throw (new Error('value must be an array of length 2'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
- if (offset + 7 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- /*
- * We need to make sure that we have the same sign on both values. The
- * hokiest way to to do this is to multiply the number by +inf. If we do
- * this, we'll get either +/-inf depending on the sign of the value.
- * Once we have this, we can compare it to +inf to see if the number is
- * positive or not.
- */
- vzpos = (value[0] * Number.POSITIVE_INFINITY) ==
- Number.POSITIVE_INFINITY;
- vopos = (value[1] * Number.POSITIVE_INFINITY) ==
- Number.POSITIVE_INFINITY;
-
- /*
- * If either of these is zero, then we don't actually need this check.
- */
- if (value[0] != 0 && value[1] != 0 && vzpos != vopos)
- throw (new Error('Both entries in the array must have ' +
- 'the same sign'));
-
- /*
- * Doing verification for a signed 64-bit integer is actually a big
- * trickier than it appears. We can't quite use our standard techniques
- * because we need to compare both sets of values. The first value is
- * pretty straightforward. If the first value is beond the extremes than
- * we error out. However, the valid range of the second value varies
- * based on the first one. If the first value is negative, and *not* the
- * largest negative value, than it can be any integer within the range [
- * 0, 0xffffffff ]. If it is the largest negative number, it must be
- * zero.
- *
- * If the first number is positive, than it doesn't matter what the
- * value is. We just simply have to make sure we have a valid positive
- * integer.
- */
- if (vzpos) {
- prepuint(value[0], 0x7fffffff);
- prepuint(value[1], 0xffffffff);
- } else {
- prepsint(value[0], 0, -0x80000000);
- prepsint(value[1], 0, -0xffffffff);
- if (value[0] == -0x80000000 && value[1] != 0)
- throw (new Error('value smaller than minimum ' +
- 'allowed value'));
- }
-
- /* Fix negative numbers */
- if (value[0] < 0 || value[1] < 0) {
- vals[0] = 0xffffffff - Math.abs(value[0]);
- vals[1] = 0x100000000 - Math.abs(value[1]);
- if (vals[1] == 0x100000000) {
- vals[1] = 0;
- vals[0]++;
- }
- } else {
- vals[0] = value[0];
- vals[1] = value[1];
- }
- wgint64(vals, endian, buffer, offset);
-}
-
-/*
- * Now we are moving onto the weirder of these, the float and double. For this
- * we're going to just have to do something that's pretty weird. First off, we
- * have no way to get at the underlying float representation, at least not
- * easily. But that doesn't mean we can't figure it out, we just have to use our
- * heads.
- *
- * One might propose to use Number.toString(2). Of course, this is not really
- * that good, because the ECMAScript 262 v3 Standard says the following Section
- * 15.7.4.2-Number.prototype.toString (radix):
- *
- * If radix is an integer from 2 to 36, but not 10, the result is a string, the
- * choice of which is implementation-dependent.
- *
- * Well that doesn't really help us one bit now does it? We could use the
- * standard base 10 version of the string, but that's just going to create more
- * errors as we end up trying to convert it back to a binary value. So, really
- * this just means we have to be non-lazy and parse the structure intelligently.
- *
- * First off, we can do the basic checks: NaN, positive and negative infinity.
- *
- * Now that those are done we can work backwards to generate the mantissa and
- * exponent.
- *
- * The first thing we need to do is determine the sign bit, easy to do, check
- * whether the value is less than 0. And convert the number to its absolute
- * value representation. Next, we need to determine if the value is less than
- * one or greater than or equal to one and from there determine what power was
- * used to get there. What follows is now specific to floats, though the general
- * ideas behind this will hold for doubles as well, but the exact numbers
- * involved will change.
- *
- * Once we have that power we can determine the exponent and the mantissa. Call
- * the value that has the number of bits to reach the power ebits. In the
- * general case they have the following values:
- *
- * exponent 127 + ebits
- * mantissa value * 2^(23 - ebits) & 0x7fffff
- *
- * In the case where the value of ebits is <= -127 we are now in the case where
- * we no longer have normalized numbers. In this case the values take on the
- * following values:
- *
- * exponent 0
- * mantissa value * 2^149 & 0x7fffff
- *
- * Once we have the values for the sign, mantissa, and exponent. We reconstruct
- * the four bytes as follows:
- *
- * byte0 sign bit and seven most significant bits from the exp
- * sign << 7 | (exponent & 0xfe) >>> 1
- *
- * byte1 lsb from the exponent and 7 top bits from the mantissa
- * (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16
- *
- * byte2 bits 8-15 (zero indexing) from mantissa
- * mantissa & 0xff00 >> 8
- *
- * byte3 bits 0-7 from mantissa
- * mantissa & 0xff
- *
- * Once we have this we have to assign them into the buffer in proper endian
- * order.
- */
-
-/*
- * Compute the log base 2 of the value. Now, someone who remembers basic
- * properties of logarithms will point out that we could use the change of base
- * formula for logs, and in fact that would be astute, because that's what we'll
- * do for now. It feels cleaner, albeit it may be less efficient than just
- * iterating and dividing by 2. We may want to come back and revisit that some
- * day.
- */
-function log2(value)
-{
- return (Math.log(value) / Math.log(2));
-}
-
-/*
- * Helper to determine the exponent of the number we're looking at.
- */
-function intexp(value)
-{
- return (Math.floor(log2(value)));
-}
-
-/*
- * Helper to determine the exponent of the fractional part of the value.
- */
-function fracexp(value)
-{
- return (Math.floor(log2(value)));
-}
-
-function wfloat(value, endian, buffer, offset)
-{
- var sign, exponent, mantissa, ebits;
- var bytes = [];
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
-
- if (offset + 3 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- if (isNaN(value)) {
- sign = 0;
- exponent = 0xff;
- mantissa = 23;
- } else if (value == Number.POSITIVE_INFINITY) {
- sign = 0;
- exponent = 0xff;
- mantissa = 0;
- } else if (value == Number.NEGATIVE_INFINITY) {
- sign = 1;
- exponent = 0xff;
- mantissa = 0;
- } else {
- /* Well we have some work to do */
-
- /* Thankfully the sign bit is trivial */
- if (value < 0) {
- sign = 1;
- value = Math.abs(value);
- } else {
- sign = 0;
- }
-
- /* Use the correct function to determine number of bits */
- if (value < 1)
- ebits = fracexp(value);
- else
- ebits = intexp(value);
-
- /* Time to deal with the issues surrounding normalization */
- if (ebits <= -127) {
- exponent = 0;
- mantissa = (value * Math.pow(2, 149)) & 0x7fffff;
- } else {
- exponent = 127 + ebits;
- mantissa = value * Math.pow(2, 23 - ebits);
- mantissa &= 0x7fffff;
- }
- }
-
- bytes[0] = sign << 7 | (exponent & 0xfe) >>> 1;
- bytes[1] = (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16;
- bytes[2] = (mantissa & 0x00ff00) >>> 8;
- bytes[3] = mantissa & 0x0000ff;
-
- if (endian == 'big') {
- buffer[offset] = bytes[0];
- buffer[offset+1] = bytes[1];
- buffer[offset+2] = bytes[2];
- buffer[offset+3] = bytes[3];
- } else {
- buffer[offset] = bytes[3];
- buffer[offset+1] = bytes[2];
- buffer[offset+2] = bytes[1];
- buffer[offset+3] = bytes[0];
- }
-}
-
-/*
- * Now we move onto doubles. Doubles are similar to floats in pretty much all
- * ways except that the processing isn't quite as straightforward because we
- * can't always use shifting, i.e. we have > 32 bit values.
- *
- * We're going to proceed in an identical fashion to floats and utilize the same
- * helper functions. All that really is changing are the specific values that we
- * use to do the calculations. Thus, to review we have to do the following.
- *
- * First get the sign bit and convert the value to its absolute value
- * representation. Next, we determine the number of bits that we used to get to
- * the value, branching whether the value is greater than or less than 1. Once
- * we have that value which we will again call ebits, we have to do the
- * following in the general case:
- *
- * exponent 1023 + ebits
- * mantissa [value * 2^(52 - ebits)] % 2^52
- *
- * In the case where the value of ebits <= -1023 we no longer use normalized
- * numbers, thus like with floats we have to do slightly different processing:
- *
- * exponent 0
- * mantissa [value * 2^1074] % 2^52
- *
- * Once we have determined the sign, exponent and mantissa we can construct the
- * bytes as follows:
- *
- * byte0 sign bit and seven most significant bits form the exp
- * sign << 7 | (exponent & 0x7f0) >>> 4
- *
- * byte1 Remaining 4 bits from the exponent and the four most
- * significant bits from the mantissa 48-51
- * (exponent & 0x00f) << 4 | mantissa >>> 48
- *
- * byte2 Bits 40-47 from the mantissa
- * (mantissa >>> 40) & 0xff
- *
- * byte3 Bits 32-39 from the mantissa
- * (mantissa >>> 32) & 0xff
- *
- * byte4 Bits 24-31 from the mantissa
- * (mantissa >>> 24) & 0xff
- *
- * byte5 Bits 16-23 from the Mantissa
- * (mantissa >>> 16) & 0xff
- *
- * byte6 Bits 8-15 from the mantissa
- * (mantissa >>> 8) & 0xff
- *
- * byte7 Bits 0-7 from the mantissa
- * mantissa & 0xff
- *
- * Now we can't quite do the right shifting that we want in bytes 1 - 3, because
- * we'll have extended too far and we'll lose those values when we try and do
- * the shift. Instead we have to use an alternate approach. To try and stay out
- * of floating point, what we'll do is say that mantissa -= bytes[4-7] and then
- * divide by 2^32. Once we've done that we can use binary arithmetic. Oof,
- * that's ugly, but it seems to avoid using floating point (just based on how v8
- * seems to be optimizing for base 2 arithmetic).
- */
-function wdouble(value, endian, buffer, offset)
-{
- var sign, exponent, mantissa, ebits;
- var bytes = [];
-
- if (value === undefined)
- throw (new Error('missing value'));
-
- if (endian === undefined)
- throw (new Error('missing endian'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer'));
-
- if (offset === undefined)
- throw (new Error('missing offset'));
-
-
- if (offset + 7 >= buffer.length)
- throw (new Error('Trying to read beyond buffer length'));
-
- if (isNaN(value)) {
- sign = 0;
- exponent = 0x7ff;
- mantissa = 23;
- } else if (value == Number.POSITIVE_INFINITY) {
- sign = 0;
- exponent = 0x7ff;
- mantissa = 0;
- } else if (value == Number.NEGATIVE_INFINITY) {
- sign = 1;
- exponent = 0x7ff;
- mantissa = 0;
- } else {
- /* Well we have some work to do */
-
- /* Thankfully the sign bit is trivial */
- if (value < 0) {
- sign = 1;
- value = Math.abs(value);
- } else {
- sign = 0;
- }
-
- /* Use the correct function to determine number of bits */
- if (value < 1)
- ebits = fracexp(value);
- else
- ebits = intexp(value);
-
- /*
- * This is a total hack to determine a denormalized value.
- * Unfortunately, we sometimes do not get a proper value for
- * ebits, i.e. we lose the values that would get rounded off.
- *
- *
- * The astute observer may wonder why we would be
- * multiplying by two Math.pows rather than just summing
- * them. Well, that's to get around a small bug in the
- * way v8 seems to implement the function. On occasion
- * doing:
- *
- * foo * Math.pow(2, 1023 + 51)
- *
- * Causes us to overflow to infinity, where as doing:
- *
- * foo * Math.pow(2, 1023) * Math.pow(2, 51)
- *
- * Does not cause us to overflow. Go figure.
- *
- */
- if (value <= 2.225073858507201e-308 || ebits <= -1023) {
- exponent = 0;
- mantissa = value * Math.pow(2, 1023) * Math.pow(2, 51);
- mantissa %= Math.pow(2, 52);
- } else {
- /*
- * We might have gotten fucked by our floating point
- * logarithm magic. This is rather crappy, but that's
- * our luck. If we just had a log base 2 or access to
- * the stupid underlying representation this would have
- * been much easier and we wouldn't have such stupid
- * kludges or hacks.
- */
- if (ebits > 1023)
- ebits = 1023;
- exponent = 1023 + ebits;
- mantissa = value * Math.pow(2, -ebits);
- mantissa *= Math.pow(2, 52);
- mantissa %= Math.pow(2, 52);
- }
- }
-
- /* Fill the bytes in backwards to deal with the size issues */
- bytes[7] = mantissa & 0xff;
- bytes[6] = (mantissa >>> 8) & 0xff;
- bytes[5] = (mantissa >>> 16) & 0xff;
- mantissa = (mantissa - (mantissa & 0xffffff)) / Math.pow(2, 24);
- bytes[4] = mantissa & 0xff;
- bytes[3] = (mantissa >>> 8) & 0xff;
- bytes[2] = (mantissa >>> 16) & 0xff;
- bytes[1] = (exponent & 0x00f) << 4 | mantissa >>> 24;
- bytes[0] = (sign << 7) | (exponent & 0x7f0) >>> 4;
-
- if (endian == 'big') {
- buffer[offset] = bytes[0];
- buffer[offset+1] = bytes[1];
- buffer[offset+2] = bytes[2];
- buffer[offset+3] = bytes[3];
- buffer[offset+4] = bytes[4];
- buffer[offset+5] = bytes[5];
- buffer[offset+6] = bytes[6];
- buffer[offset+7] = bytes[7];
- } else {
- buffer[offset+7] = bytes[0];
- buffer[offset+6] = bytes[1];
- buffer[offset+5] = bytes[2];
- buffer[offset+4] = bytes[3];
- buffer[offset+3] = bytes[4];
- buffer[offset+2] = bytes[5];
- buffer[offset+1] = bytes[6];
- buffer[offset] = bytes[7];
- }
-}
-
-/*
- * Actually export our work above. One might argue that we shouldn't expose
- * these interfaces and just force people to use the higher level abstractions
- * around this work. However, unlike say other libraries we've come across, this
- * interface has several properties: it makes sense, it's simple, and it's
- * useful.
- */
-exports.ruint8 = ruint8;
-exports.ruint16 = ruint16;
-exports.ruint32 = ruint32;
-exports.ruint64 = ruint64;
-exports.wuint8 = wuint8;
-exports.wuint16 = wuint16;
-exports.wuint32 = wuint32;
-exports.wuint64 = wuint64;
-
-exports.rsint8 = rsint8;
-exports.rsint16 = rsint16;
-exports.rsint32 = rsint32;
-exports.rsint64 = rsint64;
-exports.wsint8 = wsint8;
-exports.wsint16 = wsint16;
-exports.wsint32 = wsint32;
-exports.wsint64 = wsint64;
-
-exports.rfloat = rfloat;
-exports.rdouble = rdouble;
-exports.wfloat = wfloat;
-exports.wdouble = wdouble;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js b/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js
deleted file mode 100644
index 7d2f4a5a6..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js
+++ /dev/null
@@ -1,944 +0,0 @@
-/*
- * rm - Feb 2011
- * ctype.js
- *
- * This module provides a simple abstraction towards reading and writing
- * different types of binary data. It is designed to use ctio.js and provide a
- * richer and more expressive API on top of it.
- *
- * By default we support the following as built in basic types:
- * int8_t
- * int16_t
- * int32_t
- * uint8_t
- * uint16_t
- * uint32_t
- * uint64_t
- * float
- * double
- * char
- * char[]
- *
- * Each type is returned as a Number, with the exception of char and char[]
- * which are returned as Node Buffers. A char is considered a uint8_t.
- *
- * Requests to read and write data are specified as an array of JSON objects.
- * This is also the same way that one declares structs. Even if just a single
- * value is requested, it must be done as a struct. The array order determines
- * the order that we try and read values. Each entry has the following format
- * with values marked with a * being optional.
- *
- * { key: { type: /type/, value*: /value/, offset*: /offset/ }
- *
- * If offset is defined, we lseek(offset, SEEK_SET) before reading the next
- * value. Value is defined when we're writing out data, otherwise it's ignored.
- *
- */
-
-var mod_ctf = require('./ctf.js');
-var mod_ctio = require('./ctio.js');
-var mod_assert = require('assert');
-
-/*
- * This is the set of basic types that we support.
- *
- * read The function to call to read in a value from a buffer
- *
- * write The function to call to write a value to a buffer
- *
- */
-var deftypes = {
- 'uint8_t': { read: ctReadUint8, write: ctWriteUint8 },
- 'uint16_t': { read: ctReadUint16, write: ctWriteUint16 },
- 'uint32_t': { read: ctReadUint32, write: ctWriteUint32 },
- 'uint64_t': { read: ctReadUint64, write: ctWriteUint64 },
- 'int8_t': { read: ctReadSint8, write: ctWriteSint8 },
- 'int16_t': { read: ctReadSint16, write: ctWriteSint16 },
- 'int32_t': { read: ctReadSint32, write: ctWriteSint32 },
- 'int64_t': { read: ctReadSint64, write: ctWriteSint64 },
- 'float': { read: ctReadFloat, write: ctWriteFloat },
- 'double': { read: ctReadDouble, write: ctWriteDouble },
- 'char': { read: ctReadChar, write: ctWriteChar },
- 'char[]': { read: ctReadCharArray, write: ctWriteCharArray }
-};
-
-/*
- * The following are wrappers around the CType IO low level API. They encode
- * knowledge about the size and return something in the expected format.
- */
-function ctReadUint8(endian, buffer, offset)
-{
- var val = mod_ctio.ruint8(buffer, endian, offset);
- return ({ value: val, size: 1 });
-}
-
-function ctReadUint16(endian, buffer, offset)
-{
- var val = mod_ctio.ruint16(buffer, endian, offset);
- return ({ value: val, size: 2 });
-}
-
-function ctReadUint32(endian, buffer, offset)
-{
- var val = mod_ctio.ruint32(buffer, endian, offset);
- return ({ value: val, size: 4 });
-}
-
-function ctReadUint64(endian, buffer, offset)
-{
- var val = mod_ctio.ruint64(buffer, endian, offset);
- return ({ value: val, size: 8 });
-}
-
-function ctReadSint8(endian, buffer, offset)
-{
- var val = mod_ctio.rsint8(buffer, endian, offset);
- return ({ value: val, size: 1 });
-}
-
-function ctReadSint16(endian, buffer, offset)
-{
- var val = mod_ctio.rsint16(buffer, endian, offset);
- return ({ value: val, size: 2 });
-}
-
-function ctReadSint32(endian, buffer, offset)
-{
- var val = mod_ctio.rsint32(buffer, endian, offset);
- return ({ value: val, size: 4 });
-}
-
-function ctReadSint64(endian, buffer, offset)
-{
- var val = mod_ctio.rsint64(buffer, endian, offset);
- return ({ value: val, size: 8 });
-}
-
-function ctReadFloat(endian, buffer, offset)
-{
- var val = mod_ctio.rfloat(buffer, endian, offset);
- return ({ value: val, size: 4 });
-}
-
-function ctReadDouble(endian, buffer, offset)
-{
- var val = mod_ctio.rdouble(buffer, endian, offset);
- return ({ value: val, size: 8 });
-}
-
-/*
- * Reads a single character into a node buffer
- */
-function ctReadChar(endian, buffer, offset)
-{
- var res = new Buffer(1);
- res[0] = mod_ctio.ruint8(buffer, endian, offset);
- return ({ value: res, size: 1 });
-}
-
-function ctReadCharArray(length, endian, buffer, offset)
-{
- var ii;
- var res = new Buffer(length);
-
- for (ii = 0; ii < length; ii++)
- res[ii] = mod_ctio.ruint8(buffer, endian, offset + ii);
-
- return ({ value: res, size: length });
-}
-
-function ctWriteUint8(value, endian, buffer, offset)
-{
- mod_ctio.wuint8(value, endian, buffer, offset);
- return (1);
-}
-
-function ctWriteUint16(value, endian, buffer, offset)
-{
- mod_ctio.wuint16(value, endian, buffer, offset);
- return (2);
-}
-
-function ctWriteUint32(value, endian, buffer, offset)
-{
- mod_ctio.wuint32(value, endian, buffer, offset);
- return (4);
-}
-
-function ctWriteUint64(value, endian, buffer, offset)
-{
- mod_ctio.wuint64(value, endian, buffer, offset);
- return (8);
-}
-
-function ctWriteSint8(value, endian, buffer, offset)
-{
- mod_ctio.wsint8(value, endian, buffer, offset);
- return (1);
-}
-
-function ctWriteSint16(value, endian, buffer, offset)
-{
- mod_ctio.wsint16(value, endian, buffer, offset);
- return (2);
-}
-
-function ctWriteSint32(value, endian, buffer, offset)
-{
- mod_ctio.wsint32(value, endian, buffer, offset);
- return (4);
-}
-
-function ctWriteSint64(value, endian, buffer, offset)
-{
- mod_ctio.wsint64(value, endian, buffer, offset);
- return (8);
-}
-
-function ctWriteFloat(value, endian, buffer, offset)
-{
- mod_ctio.wfloat(value, endian, buffer, offset);
- return (4);
-}
-
-function ctWriteDouble(value, endian, buffer, offset)
-{
- mod_ctio.wdouble(value, endian, buffer, offset);
- return (8);
-}
-
-/*
- * Writes a single character into a node buffer
- */
-function ctWriteChar(value, endian, buffer, offset)
-{
- if (!(value instanceof Buffer))
- throw (new Error('Input must be a buffer'));
-
- mod_ctio.ruint8(value[0], endian, buffer, offset);
- return (1);
-}
-
-/*
- * We're going to write 0s into the buffer if the string is shorter than the
- * length of the array.
- */
-function ctWriteCharArray(value, length, endian, buffer, offset)
-{
- var ii;
-
- if (!(value instanceof Buffer))
- throw (new Error('Input must be a buffer'));
-
- if (value.length > length)
- throw (new Error('value length greater than array length'));
-
- for (ii = 0; ii < value.length && ii < length; ii++)
- mod_ctio.wuint8(value[ii], endian, buffer, offset + ii);
-
- for (; ii < length; ii++)
- mod_ctio.wuint8(0, endian, offset + ii);
-
-
- return (length);
-}
-
-/*
- * Each parser has their own set of types. We want to make sure that they each
- * get their own copy as they may need to modify it.
- */
-function ctGetBasicTypes()
-{
- var ret = {};
- var key;
- for (key in deftypes)
- ret[key] = deftypes[key];
-
- return (ret);
-}
-
-/*
- * Given a string in the form of type[length] we want to split this into an
- * object that extracts that information. We want to note that we could possibly
- * have nested arrays so this should only check the furthest one. It may also be
- * the case that we have no [] pieces, in which case we just return the current
- * type.
- */
-function ctParseType(str)
-{
- var begInd, endInd;
- var type, len;
- if (typeof (str) != 'string')
- throw (new Error('type must be a Javascript string'));
-
- endInd = str.lastIndexOf(']');
- if (endInd == -1) {
- if (str.lastIndexOf('[') != -1)
- throw (new Error('found invalid type with \'[\' but ' +
- 'no corresponding \']\''));
-
- return ({ type: str });
- }
-
- begInd = str.lastIndexOf('[');
- if (begInd == -1)
- throw (new Error('found invalid type with \']\' but ' +
- 'no corresponding \'[\''));
-
- if (begInd >= endInd)
- throw (new Error('malformed type, \']\' appears before \'[\''));
-
- type = str.substring(0, begInd);
- len = str.substring(begInd + 1, endInd);
-
- return ({ type: type, len: len });
-}
-
-/*
- * Given a request validate that all of the fields for it are valid and make
- * sense. This includes verifying the following notions:
- * - Each type requested is present in types
- * - Only allow a name for a field to be specified once
- * - If an array is specified, validate that the requested field exists and
- * comes before it.
- * - If fields is defined, check that each entry has the occurrence of field
- */
-function ctCheckReq(def, types, fields)
-{
- var ii, jj;
- var req, keys, key;
- var found = {};
-
- if (!(def instanceof Array))
- throw (new Error('definition is not an array'));
-
- if (def.length === 0)
- throw (new Error('definition must have at least one element'));
-
- for (ii = 0; ii < def.length; ii++) {
- req = def[ii];
- if (!(req instanceof Object))
- throw (new Error('definition must be an array of' +
- 'objects'));
-
- keys = Object.keys(req);
- if (keys.length != 1)
- throw (new Error('definition entry must only have ' +
- 'one key'));
-
- if (keys[0] in found)
- throw (new Error('Specified name already ' +
- 'specified: ' + keys[0]));
-
- if (!('type' in req[keys[0]]))
- throw (new Error('missing required type definition'));
-
- key = ctParseType(req[keys[0]]['type']);
-
- /*
- * We may have nested arrays, we need to check the validity of
- * the types until the len field is undefined in key. However,
- * each time len is defined we need to verify it is either an
- * integer or corresponds to an already seen key.
- */
- while (key['len'] !== undefined) {
- if (isNaN(parseInt(key['len'], 10))) {
- if (!(key['len'] in found))
- throw (new Error('Given an array ' +
- 'length without a matching type'));
-
- }
-
- key = ctParseType(key['type']);
- }
-
- /* Now we can validate if the type is valid */
- if (!(key['type'] in types))
- throw (new Error('type not found or typdefed: ' +
- key['type']));
-
- /* Check for any required fields */
- if (fields !== undefined) {
- for (jj = 0; jj < fields.length; jj++) {
- if (!(fields[jj] in req[keys[0]]))
- throw (new Error('Missing required ' +
- 'field: ' + fields[jj]));
- }
- }
-
- found[keys[0]] = true;
- }
-}
-
-
-/*
- * Create a new instance of the parser. Each parser has its own store of
- * typedefs and endianness. Conf is an object with the following required
- * values:
- *
- * endian Either 'big' or 'little' do determine the endianness we
- * want to read from or write to.
- *
- * And the following optional values:
- *
- * char-type Valid options here are uint8 and int8. If uint8 is
- * specified this changes the default behavior of a single
- * char from being a buffer of a single character to being
- * a uint8_t. If int8, it becomes an int8_t instead.
- */
-function CTypeParser(conf)
-{
- if (!conf) throw (new Error('missing required argument'));
-
- if (!('endian' in conf))
- throw (new Error('missing required endian value'));
-
- if (conf['endian'] != 'big' && conf['endian'] != 'little')
- throw (new Error('Invalid endian type'));
-
- if ('char-type' in conf && (conf['char-type'] != 'uint8' &&
- conf['char-type'] != 'int8'))
- throw (new Error('invalid option for char-type: ' +
- conf['char-type']));
-
- this.endian = conf['endian'];
- this.types = ctGetBasicTypes();
-
- /*
- * There may be a more graceful way to do this, but this will have to
- * serve.
- */
- if ('char-type' in conf && conf['char-type'] == 'uint8')
- this.types['char'] = this.types['uint8_t'];
-
- if ('char-type' in conf && conf['char-type'] == 'int8')
- this.types['char'] = this.types['int8_t'];
-}
-
-/*
- * Sets the current endian value for the Parser. If the value is not valid,
- * throws an Error.
- *
- * endian Either 'big' or 'little' do determine the endianness we
- * want to read from or write to.
- *
- */
-CTypeParser.prototype.setEndian = function (endian)
-{
- if (endian != 'big' && endian != 'little')
- throw (new Error('invalid endian type, must be big or ' +
- 'little'));
-
- this.endian = endian;
-};
-
-/*
- * Returns the current value of the endian value for the parser.
- */
-CTypeParser.prototype.getEndian = function ()
-{
- return (this.endian);
-};
-
-/*
- * A user has requested to add a type, let us honor their request. Yet, if their
- * request doth spurn us, send them unto the Hells which Dante describes.
- *
- * name The string for the type definition we're adding
- *
- * value Either a string that is a type/array name or an object
- * that describes a struct.
- */
-CTypeParser.prototype.typedef = function (name, value)
-{
- var type;
-
- if (name === undefined)
- throw (new (Error('missing required typedef argument: name')));
-
- if (value === undefined)
- throw (new (Error('missing required typedef argument: value')));
-
- if (typeof (name) != 'string')
- throw (new (Error('the name of a type must be a string')));
-
- type = ctParseType(name);
-
- if (type['len'] !== undefined)
- throw (new Error('Cannot have an array in the typedef name'));
-
- if (name in this.types)
- throw (new Error('typedef name already present: ' + name));
-
- if (typeof (value) != 'string' && !(value instanceof Array))
- throw (new Error('typedef value must either be a string or ' +
- 'struct'));
-
- if (typeof (value) == 'string') {
- type = ctParseType(value);
- if (type['len'] !== undefined) {
- if (isNaN(parseInt(type['len'], 10)))
- throw (new (Error('typedef value must use ' +
- 'fixed size array when outside of a ' +
- 'struct')));
- }
-
- this.types[name] = value;
- } else {
- /* We have a struct, validate it */
- ctCheckReq(value, this.types);
- this.types[name] = value;
- }
-};
-
-/*
- * Include all of the typedefs, but none of the built in types. This should be
- * treated as read-only.
- */
-CTypeParser.prototype.lstypes = function ()
-{
- var key;
- var ret = {};
-
- for (key in this.types) {
- if (key in deftypes)
- continue;
- ret[key] = this.types[key];
- }
-
- return (ret);
-};
-
-/*
- * Given a type string that may have array types that aren't numbers, try and
- * fill them in from the values object. The object should be of the format where
- * indexing into it should return a number for that type.
- *
- * str The type string
- *
- * values An object that can be used to fulfill type information
- */
-function ctResolveArray(str, values)
-{
- var ret = '';
- var type = ctParseType(str);
-
- while (type['len'] !== undefined) {
- if (isNaN(parseInt(type['len'], 10))) {
- if (typeof (values[type['len']]) != 'number')
- throw (new Error('cannot sawp in non-number ' +
- 'for array value'));
- ret = '[' + values[type['len']] + ']' + ret;
- } else {
- ret = '[' + type['len'] + ']' + ret;
- }
- type = ctParseType(type['type']);
- }
-
- ret = type['type'] + ret;
-
- return (ret);
-}
-
-/*
- * [private] Either the typedef resolves to another type string or to a struct.
- * If it resolves to a struct, we just pass it off to read struct. If not, we
- * can just pass it off to read entry.
- */
-CTypeParser.prototype.resolveTypedef = function (type, dispatch, buffer,
- offset, value)
-{
- var pt;
-
- mod_assert.ok(type in this.types);
- if (typeof (this.types[type]) == 'string') {
- pt = ctParseType(this.types[type]);
- if (dispatch == 'read')
- return (this.readEntry(pt, buffer, offset));
- else if (dispatch == 'write')
- return (this.writeEntry(value, pt, buffer, offset));
- else
- throw (new Error('invalid dispatch type to ' +
- 'resolveTypedef'));
- } else {
- if (dispatch == 'read')
- return (this.readStruct(this.types[type], buffer,
- offset));
- else if (dispatch == 'write')
- return (this.writeStruct(value, this.types[type],
- buffer, offset));
- else
- throw (new Error('invalid dispatch type to ' +
- 'resolveTypedef'));
- }
-
-};
-
-/*
- * [private] Try and read in the specific entry.
- */
-CTypeParser.prototype.readEntry = function (type, buffer, offset)
-{
- var parse, len;
-
- /*
- * Because we want to special case char[]s this is unfortunately
- * a bit uglier than it really should be. We want to special
- * case char[]s so that we return a node buffer, thus they are a
- * first class type where as all other arrays just call into a
- * generic array routine which calls their data-specific routine
- * the specified number of times.
- *
- * The valid dispatch options we have are:
- * - Array and char => char[] handler
- * - Generic array handler
- * - Generic typedef handler
- * - Basic type handler
- */
- if (type['len'] !== undefined) {
- len = parseInt(type['len'], 10);
- if (isNaN(len))
- throw (new Error('somehow got a non-numeric length'));
-
- if (type['type'] == 'char')
- parse = this.types['char[]']['read'](len,
- this.endian, buffer, offset);
- else
- parse = this.readArray(type['type'],
- len, buffer, offset);
- } else {
- if (type['type'] in deftypes)
- parse = this.types[type['type']]['read'](this.endian,
- buffer, offset);
- else
- parse = this.resolveTypedef(type['type'], 'read',
- buffer, offset);
- }
-
- return (parse);
-};
-
-/*
- * [private] Read an array of data
- */
-CTypeParser.prototype.readArray = function (type, length, buffer, offset)
-{
- var ii, ent, pt;
- var baseOffset = offset;
- var ret = new Array(length);
- pt = ctParseType(type);
-
- for (ii = 0; ii < length; ii++) {
- ent = this.readEntry(pt, buffer, offset);
- offset += ent['size'];
- ret[ii] = ent['value'];
- }
-
- return ({ value: ret, size: offset - baseOffset });
-};
-
-/*
- * [private] Read a single struct in.
- */
-CTypeParser.prototype.readStruct = function (def, buffer, offset)
-{
- var parse, ii, type, entry, key;
- var baseOffset = offset;
- var ret = {};
-
- /* Walk it and handle doing what's necessary */
- for (ii = 0; ii < def.length; ii++) {
- key = Object.keys(def[ii])[0];
- entry = def[ii][key];
-
- /* Resolve all array values */
- type = ctParseType(ctResolveArray(entry['type'], ret));
-
- if ('offset' in entry)
- offset = baseOffset + entry['offset'];
-
- parse = this.readEntry(type, buffer, offset);
-
- offset += parse['size'];
- ret[key] = parse['value'];
- }
-
- return ({ value: ret, size: (offset-baseOffset)});
-};
-
-/*
- * This is what we were born to do. We read the data from a buffer and return it
- * in an object whose keys match the values from the object.
- *
- * def The array definition of the data to read in
- *
- * buffer The buffer to read data from
- *
- * offset The offset to start writing to
- *
- * Returns an object where each key corresponds to an entry in def and the value
- * is the read value.
- */
-CTypeParser.prototype.readData = function (def, buffer, offset)
-{
- /* Sanity check for arguments */
- if (def === undefined)
- throw (new Error('missing definition for what we should be' +
- 'parsing'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer for what we should be ' +
- 'parsing'));
-
- if (offset === undefined)
- throw (new Error('missing offset for what we should be ' +
- 'parsing'));
-
- /* Sanity check the object definition */
- ctCheckReq(def, this.types);
-
- return (this.readStruct(def, buffer, offset)['value']);
-};
-
-/*
- * [private] Write out an array of data
- */
-CTypeParser.prototype.writeArray = function (value, type, length, buffer,
- offset)
-{
- var ii, pt;
- var baseOffset = offset;
- if (!(value instanceof Array))
- throw (new Error('asked to write an array, but value is not ' +
- 'an array'));
-
- if (value.length != length)
- throw (new Error('asked to write array of length ' + length +
- ' but that does not match value length: ' + value.length));
-
- pt = ctParseType(type);
- for (ii = 0; ii < length; ii++)
- offset += this.writeEntry(value[ii], pt, buffer, offset);
-
- return (offset - baseOffset);
-};
-
-/*
- * [private] Write the specific entry
- */
-CTypeParser.prototype.writeEntry = function (value, type, buffer, offset)
-{
- var len, ret;
-
- if (type['len'] !== undefined) {
- len = parseInt(type['len'], 10);
- if (isNaN(len))
- throw (new Error('somehow got a non-numeric length'));
-
- if (type['type'] == 'char')
- ret = this.types['char[]']['write'](value, len,
- this.endian, buffer, offset);
- else
- ret = this.writeArray(value, type['type'],
- len, buffer, offset);
- } else {
- if (type['type'] in deftypes)
- ret = this.types[type['type']]['write'](value,
- this.endian, buffer, offset);
- else
- ret = this.resolveTypedef(type['type'], 'write',
- buffer, offset, value);
- }
-
- return (ret);
-};
-
-/*
- * [private] Write a single struct out.
- */
-CTypeParser.prototype.writeStruct = function (value, def, buffer, offset)
-{
- var ii, entry, type, key;
- var baseOffset = offset;
- var vals = {};
-
- for (ii = 0; ii < def.length; ii++) {
- key = Object.keys(def[ii])[0];
- entry = def[ii][key];
-
- type = ctParseType(ctResolveArray(entry['type'], vals));
-
- if ('offset' in entry)
- offset = baseOffset + entry['offset'];
-
- offset += this.writeEntry(value[ii], type, buffer, offset);
- /* Now that we've written it out, we can use it for arrays */
- vals[key] = value[ii];
- }
-
- return (offset);
-};
-
-/*
- * Unfortunately, we're stuck with the sins of an initial poor design. Because
- * of that, we are going to have to support the old way of writing data via
- * writeData. There we insert the values that you want to write into the
- * definition. A little baroque. Internally, we use the new model. So we need to
- * just get those values out of there. But to maintain the principle of least
- * surprise, we're not going to modify the input data.
- */
-function getValues(def)
-{
- var ii, out, key;
- out = [];
- for (ii = 0; ii < def.length; ii++) {
- key = Object.keys(def[ii])[0];
- mod_assert.ok('value' in def[ii][key]);
- out.push(def[ii][key]['value']);
- }
-
- return (out);
-}
-
-/*
- * This is the second half of what we were born to do, write out the data
- * itself. Historically this function required you to put your values in the
- * definition section. This was not the smartest thing to do and a bit of an
- * oversight to be honest. As such, this function now takes a values argument.
- * If values is non-null and non-undefined, it will be used to determine the
- * values. This means that the old method is still supported, but is no longer
- * acceptable.
- *
- * def The array definition of the data to write out with
- * values
- *
- * buffer The buffer to write to
- *
- * offset The offset in the buffer to write to
- *
- * values An array of values to write.
- */
-CTypeParser.prototype.writeData = function (def, buffer, offset, values)
-{
- var hv;
-
- if (def === undefined)
- throw (new Error('missing definition for what we should be' +
- 'parsing'));
-
- if (buffer === undefined)
- throw (new Error('missing buffer for what we should be ' +
- 'parsing'));
-
- if (offset === undefined)
- throw (new Error('missing offset for what we should be ' +
- 'parsing'));
-
- hv = (values != null && values != undefined);
- if (hv) {
- if (!Array.isArray(values))
- throw (new Error('missing values for writing'));
- ctCheckReq(def, this.types);
- } else {
- ctCheckReq(def, this.types, [ 'value' ]);
- }
-
- this.writeStruct(hv ? values : getValues(def), def, buffer, offset);
-};
-
-/*
- * Functions to go to and from 64 bit numbers in a way that is compatible with
- * Javascript limitations. There are two sets. One where the user is okay with
- * an approximation and one where they are definitely not okay with an
- * approximation.
- */
-
-/*
- * Attempts to convert an array of two integers returned from rsint64 / ruint64
- * into an absolute 64 bit number. If however the value would exceed 2^52 this
- * will instead throw an error. The mantissa in a double is a 52 bit number and
- * rather than potentially give you a value that is an approximation this will
- * error. If you would rather an approximation, please see toApprox64.
- *
- * val An array of two 32-bit integers
- */
-function toAbs64(val)
-{
- if (val === undefined)
- throw (new Error('missing required arg: value'));
-
- if (!Array.isArray(val))
- throw (new Error('value must be an array'));
-
- if (val.length != 2)
- throw (new Error('value must be an array of length 2'));
-
- /* We have 20 bits worth of precision in this range */
- if (val[0] >= 0x100000)
- throw (new Error('value would become approximated'));
-
- return (val[0] * Math.pow(2, 32) + val[1]);
-}
-
-/*
- * Will return the 64 bit value as returned in an array from rsint64 / ruint64
- * to a value as close as it can. Note that Javascript stores all numbers as a
- * double and the mantissa only has 52 bits. Thus this version may approximate
- * the value.
- *
- * val An array of two 32-bit integers
- */
-function toApprox64(val)
-{
- if (val === undefined)
- throw (new Error('missing required arg: value'));
-
- if (!Array.isArray(val))
- throw (new Error('value must be an array'));
-
- if (val.length != 2)
- throw (new Error('value must be an array of length 2'));
-
- return (Math.pow(2, 32) * val[0] + val[1]);
-}
-
-function parseCTF(json, conf)
-{
- var ctype = new CTypeParser(conf);
- mod_ctf.ctfParseJson(json, ctype);
-
- return (ctype);
-}
-
-/*
- * Export the few things we actually want to. Currently this is just the CType
- * Parser and ctio.
- */
-exports.Parser = CTypeParser;
-exports.toAbs64 = toAbs64;
-exports.toApprox64 = toApprox64;
-
-exports.parseCTF = parseCTF;
-
-exports.ruint8 = mod_ctio.ruint8;
-exports.ruint16 = mod_ctio.ruint16;
-exports.ruint32 = mod_ctio.ruint32;
-exports.ruint64 = mod_ctio.ruint64;
-exports.wuint8 = mod_ctio.wuint8;
-exports.wuint16 = mod_ctio.wuint16;
-exports.wuint32 = mod_ctio.wuint32;
-exports.wuint64 = mod_ctio.wuint64;
-
-exports.rsint8 = mod_ctio.rsint8;
-exports.rsint16 = mod_ctio.rsint16;
-exports.rsint32 = mod_ctio.rsint32;
-exports.rsint64 = mod_ctio.rsint64;
-exports.wsint8 = mod_ctio.wsint8;
-exports.wsint16 = mod_ctio.wsint16;
-exports.wsint32 = mod_ctio.wsint32;
-exports.wsint64 = mod_ctio.wsint64;
-
-exports.rfloat = mod_ctio.rfloat;
-exports.rdouble = mod_ctio.rdouble;
-exports.wfloat = mod_ctio.wfloat;
-exports.wdouble = mod_ctio.wdouble;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype b/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype
deleted file mode 100644
index 3f94986a1..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype
+++ /dev/null
@@ -1,241 +0,0 @@
-'\" te
-.\" Copyright (c) 2011, Robert Mustacchi. All Rights Reserved.
-.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved.
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining a copy
-.\" of this software and associated documentation files (the "Software"), to
-.\" deal in the Software without restriction, including without limitation the
-.\" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-.\" sell copies of the Software, and to permit persons to whom the Software is
-.\" furnished to do so, subject to the following conditions:
-.\"
-.\" The above copyright notice and this permission notice shall be included in
-.\" all copies or substantial portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-.\" IN THE SOFTWARE.
-.TH CTIO 3CTYPE "December 12, 2011"
-.SH NAME
-ctio, ruint8, ruint16, ruint32, ruint64, wuint8, wuint16, wuint32, wuint64,
-rsint8, rsint16, rsint32, rsint64, wsint8, wsint16, wsint32, wsint64, rfloat,
-rdouble, wfloat, wdouble \- integer and float operations
-.SH SYNOPSIS
-.LP
-.nf
-var mod_ctype = require('ctype');
-
-\fBNumber\fR \fBmod_ctype.ruint8\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber\fR \fBmod_ctype.ruint16\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber\fR \fBmod_ctype.ruint32\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber[2]\fR \fBmod_ctype.ruint64\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber\fR \fBmod_ctype.rsint8\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber\fR \fBmod_ctype.rsint16\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber\fR \fBmod_ctype.rsint32\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber[2]\fR \fBmod_ctype.rsint64\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber\fR \fBmod_ctype.rfloat\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBNumber\fR \fBmod_ctype.rdouble\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wuint8\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wuint16\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wuint32\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wuint64\fR(\fBNumber[2]\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wsint8\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wsint16\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wsint32\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wsint64\fR(\fBNumber[2]\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wfloat\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBmod_ctype.wdouble\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The argument \fIbuf\fR refers to a valid buffer (from calling new Buffer()). The
-argument \fIendian\fR is either the string 'big' or 'little' and controls
-whether the data in the buffer is interpreted as big or little endian. The argument
-\fIoffset\fR indicates the starting index into the buffer to read or write. All
-functions ensure that starting at \fIoffset\fR does not overflow the end of the
-buffer. The argument \fIvalue\fR is a Number that is the valid type for the
-specific function. All functions that take \fIvalue\fR as an argument, verify
-that the passed value is valid.
-
-.SS "\fBruint8()\fR, \fBruint16()\fR, \fBruint32()\fR"
-.sp
-.LP
-The \fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR functions read an 8,
-16, and 32-bit unsigned value from \fIbuf\fR and return it. The value read is
-influenced by the values of \fIoffset\fR and \fRendian\fI.
-
-
-.SS "\fBrsint8()\fR, \fBrsint16()\fR, \fBrsint32()\fR"
-.sp
-.LP
-The \fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR functions work just as
-\fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR, except they return signed
-integers.
-
-.SS "\fBruint64()\fR, \fBrsint64()\fR"
-.sp
-.LP
-The \fBruint64()\fR and \fBrsint64()\fR functions read unsigned and signed 64
-bit integers respectively from \fBbuf\fR. Due to the limitations of ECMAScript's
-\fBNumber\fR type, they cannot be stored as one value without a loss of
-precision. Instead of returning the values as a single \fBNumber\fR, the
-functions return an array of two numbers. The first entry always contains the
-upper 32-bits and the second value contains the lower 32-bits. The lossy
-transformation into a number would be \fIres[0]*Math.pow(2,32)+res[1]\fR.
-Note that, unless an entry is zero, both array entries are guaranteed to have
-the same sign.
-
-.SS "\fBwuint8()\fR, \fBwuint16()\fR, \fBwuint32()\fR"
-.sp
-.LP
-The functions \fBwuint8()\fR, \fBwuint16()\fR, and \fBwuint32()\fR modify the
-contents of \fBbuf\fR by writing an 8, 16, and 32-bit unsigned integer
-respectively to \fBbuf\fR. It is illegal to pass a number that is not an integer
-within the domain of the integer size, for example, for \fBwuint8()\fR the valid
-range is \fB[0, 255]\fR. The value will be written in either big or little
-endian format based upon the value of \fBendian\fR.
-
-
-.SS "\fBwsint8()\fR, \fBwsint16()\fR, \fBwsint32()\fR"
-.sp
-.LP
-The functions \fBwsint8()\fR, \fBwsint16()\fR, and \fBwsint32()\fR function
-identically to the functions \fBwuint8()\fR, \fBwuint16()\fR, and
-\fBwuint32()\fR except that they the valid domain for \fBvalue\fR is that of a
-signed number instead of an unsigned number. For example the \fBwsint8()\fR has
-a domain of \fB[-128, 127]\fR.
-
-.SS "\fBwuint64()\fR, \fBwsint64()\fR"
-.sp
-.LP
-The functions \fBwuint64()\fR and \fBswint64()\fR write out 64-bit unsigned and
-signed integers to \fBbuf\fR. The \fBvalue\fR argument must be in the same
-format as described in \fBruint64()\fR and \fBrsint64()\fR.
-
-.SS "\fBrfloat()\fR, \fBrdouble()\fR"
-.sp
-.LP
-The functions "\fBrfloat()\fR and \fBrdouble()\fR" work like the other read
-functions, except that they read a single precision and double precision
-IEEE-754 floating point value instead.
-
-.SS "\fBwfloat()\fR, \fBwdouble()\fR"
-.sp
-.LP
-The functions "\fBrfloat()\fR and \fBrdouble()\fR" work like the other write
-functions, except that the domain for a float is that of a single precision 4
-byte value. The domain for a double is any \fBNumber\fR in ECMAScript, which is
-defined to be represented by a double.
-
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability Committed
-_
-MT-Level See below.
-_
-Standard Not standardized.
-.TE
-
-.sp
-.LP
-
-All functions are MT-safe in so far as there aren't shared memory MT concerns in
-most node programs. If one where to concoct such an environment, these functions
-wouldn't be MT-safe.
-
-.SH SEE ALSO
-.sp
-.LP
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json b/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json
deleted file mode 100644
index c33f8a574..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "name": "ctype",
- "version": "0.5.3",
- "description": "read and write binary structures and data types",
- "homepage": "https://github.com/rmustacc/node-ctype",
- "author": {
- "name": "Robert Mustacchi",
- "email": "rm@fingolfin.org"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "main": "ctype.js",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/rmustacc/node-ctype.git"
- },
- "_id": "ctype@0.5.3",
- "dist": {
- "shasum": "82c18c2461f74114ef16c135224ad0b9144ca12f",
- "tarball": "http://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz"
- },
- "_npmVersion": "1.1.59",
- "_npmUser": {
- "name": "rm",
- "email": "rm@fingolfin.org"
- },
- "maintainers": [
- {
- "name": "rm",
- "email": "rm@fingolfin.org"
- }
- ],
- "directories": {},
- "_shasum": "82c18c2461f74114ef16c135224ad0b9144ca12f",
- "_resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz",
- "_from": "ctype@0.5.3",
- "bugs": {
- "url": "https://github.com/rmustacc/node-ctype/issues"
- },
- "readme": "ERROR: No README data found!"
-}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle b/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle
deleted file mode 100755
index 96c72b6d7..000000000
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle
+++ /dev/null
@@ -1,839 +0,0 @@
-#!/usr/bin/env perl
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright 2011 Joyent, Inc. All rights reserved.
-#
-# jsstyle - check for some common stylistic errors.
-#
-# jsstyle is a sort of "lint" for Javascript coding style. This tool is
-# derived from the cstyle tool, used to check for the style used in the
-# Solaris kernel, sometimes known as "Bill Joy Normal Form".
-#
-# There's a lot this can't check for, like proper indentation of code
-# blocks. There's also a lot more this could check for.
-#
-# A note to the non perl literate:
-#
-# perl regular expressions are pretty much like egrep
-# regular expressions, with the following special symbols
-#
-# \s any space character
-# \S any non-space character
-# \w any "word" character [a-zA-Z0-9_]
-# \W any non-word character
-# \d a digit [0-9]
-# \D a non-digit
-# \b word boundary (between \w and \W)
-# \B non-word boundary
-#
-
-require 5.0;
-use IO::File;
-use Getopt::Std;
-use strict;
-
-my $usage =
-"usage: jsstyle [-chvC] [-o constructs] file ...
- -c check continuation indentation inside functions
- -h perform heuristic checks that are sometimes wrong
- -v verbose
- -C don't check anything in header block comments
- -o constructs
- allow a comma-seperated list of optional constructs:
- doxygen allow doxygen-style block comments (/** /*!)
- splint allow splint-style lint comments (/*@ ... @*/)
-";
-
-my %opts;
-
-if (!getopts("cho:vC", \%opts)) {
- print $usage;
- exit 2;
-}
-
-my $check_continuation = $opts{'c'};
-my $heuristic = $opts{'h'};
-my $verbose = $opts{'v'};
-my $ignore_hdr_comment = $opts{'C'};
-
-my $doxygen_comments = 0;
-my $splint_comments = 0;
-
-if (defined($opts{'o'})) {
- for my $x (split /,/, $opts{'o'}) {
- if ($x eq "doxygen") {
- $doxygen_comments = 1;
- } elsif ($x eq "splint") {
- $splint_comments = 1;
- } else {
- print "jsstyle: unrecognized construct \"$x\"\n";
- print $usage;
- exit 2;
- }
- }
-}
-
-my ($filename, $line, $prev); # shared globals
-
-my $fmt;
-my $hdr_comment_start;
-
-if ($verbose) {
- $fmt = "%s: %d: %s\n%s\n";
-} else {
- $fmt = "%s: %d: %s\n";
-}
-
-if ($doxygen_comments) {
- # doxygen comments look like "/*!" or "/**"; allow them.
- $hdr_comment_start = qr/^\s*\/\*[\!\*]?$/;
-} else {
- $hdr_comment_start = qr/^\s*\/\*$/;
-}
-
-# Note, following must be in single quotes so that \s and \w work right.
-my $lint_re = qr/\/\*(?:
- jsl:\w+?|ARGSUSED[0-9]*|NOTREACHED|LINTLIBRARY|VARARGS[0-9]*|
- CONSTCOND|CONSTANTCOND|CONSTANTCONDITION|EMPTY|
- FALLTHRU|FALLTHROUGH|LINTED.*?|PRINTFLIKE[0-9]*|
- PROTOLIB[0-9]*|SCANFLIKE[0-9]*|JSSTYLED.*?
- )\*\//x;
-
-my $splint_re = qr/\/\*@.*?@\*\//x;
-
-my $err_stat = 0; # exit status
-
-if ($#ARGV >= 0) {
- foreach my $arg (@ARGV) {
- my $fh = new IO::File $arg, "r";
- if (!defined($fh)) {
- printf "%s: cannot open\n", $arg;
- } else {
- &jsstyle($arg, $fh);
- close $fh;
- }
- }
-} else {
- &jsstyle("<stdin>", *STDIN);
-}
-exit $err_stat;
-
-my $no_errs = 0; # set for JSSTYLED-protected lines
-
-sub err($) {
- my ($error) = @_;
- unless ($no_errs) {
- printf $fmt, $filename, $., $error, $line;
- $err_stat = 1;
- }
-}
-
-sub err_prefix($$) {
- my ($prevline, $error) = @_;
- my $out = $prevline."\n".$line;
- unless ($no_errs) {
- printf $fmt, $filename, $., $error, $out;
- $err_stat = 1;
- }
-}
-
-sub err_prev($) {
- my ($error) = @_;
- unless ($no_errs) {
- printf $fmt, $filename, $. - 1, $error, $prev;
- $err_stat = 1;
- }
-}
-
-sub jsstyle($$) {
-
-my ($fn, $filehandle) = @_;
-$filename = $fn; # share it globally
-
-my $in_cpp = 0;
-my $next_in_cpp = 0;
-
-my $in_comment = 0;
-my $in_header_comment = 0;
-my $comment_done = 0;
-my $in_function = 0;
-my $in_function_header = 0;
-my $in_declaration = 0;
-my $note_level = 0;
-my $nextok = 0;
-my $nocheck = 0;
-
-my $in_string = 0;
-
-my ($okmsg, $comment_prefix);
-
-$line = '';
-$prev = '';
-reset_indent();
-
-line: while (<$filehandle>) {
- s/\r?\n$//; # strip return and newline
-
- # save the original line, then remove all text from within
- # double or single quotes, we do not want to check such text.
-
- $line = $_;
-
- #
- # C allows strings to be continued with a backslash at the end of
- # the line. We translate that into a quoted string on the previous
- # line followed by an initial quote on the next line.
- #
- # (we assume that no-one will use backslash-continuation with character
- # constants)
- #
- $_ = '"' . $_ if ($in_string && !$nocheck && !$in_comment);
-
- #
- # normal strings and characters
- #
- s/'([^\\']|\\.)*'/\'\'/g;
- s/"([^\\"]|\\.)*"/\"\"/g;
-
- #
- # detect string continuation
- #
- if ($nocheck || $in_comment) {
- $in_string = 0;
- } else {
- #
- # Now that all full strings are replaced with "", we check
- # for unfinished strings continuing onto the next line.
- #
- $in_string =
- (s/([^"](?:"")*)"([^\\"]|\\.)*\\$/$1""/ ||
- s/^("")*"([^\\"]|\\.)*\\$/""/);
- }
-
- #
- # figure out if we are in a cpp directive
- #
- $in_cpp = $next_in_cpp || /^\s*#/; # continued or started
- $next_in_cpp = $in_cpp && /\\$/; # only if continued
-
- # strip off trailing backslashes, which appear in long macros
- s/\s*\\$//;
-
- # an /* END JSSTYLED */ comment ends a no-check block.
- if ($nocheck) {
- if (/\/\* *END *JSSTYLED *\*\//) {
- $nocheck = 0;
- } else {
- reset_indent();
- next line;
- }
- }
-
- # a /*JSSTYLED*/ comment indicates that the next line is ok.
- if ($nextok) {
- if ($okmsg) {
- err($okmsg);
- }
- $nextok = 0;
- $okmsg = 0;
- if (/\/\* *JSSTYLED.*\*\//) {
- /^.*\/\* *JSSTYLED *(.*) *\*\/.*$/;
- $okmsg = $1;
- $nextok = 1;
- }
- $no_errs = 1;
- } elsif ($no_errs) {
- $no_errs = 0;
- }
-
- # check length of line.
- # first, a quick check to see if there is any chance of being too long.
- if (($line =~ tr/\t/\t/) * 7 + length($line) > 80) {
- # yes, there is a chance.
- # replace tabs with spaces and check again.
- my $eline = $line;
- 1 while $eline =~
- s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
- if (length($eline) > 80) {
- err("line > 80 characters");
- }
- }
-
- # ignore NOTE(...) annotations (assumes NOTE is on lines by itself).
- if ($note_level || /\b_?NOTE\s*\(/) { # if in NOTE or this is NOTE
- s/[^()]//g; # eliminate all non-parens
- $note_level += s/\(//g - length; # update paren nest level
- next;
- }
-
- # a /* BEGIN JSSTYLED */ comment starts a no-check block.
- if (/\/\* *BEGIN *JSSTYLED *\*\//) {
- $nocheck = 1;
- }
-
- # a /*JSSTYLED*/ comment indicates that the next line is ok.
- if (/\/\* *JSSTYLED.*\*\//) {
- /^.*\/\* *JSSTYLED *(.*) *\*\/.*$/;
- $okmsg = $1;
- $nextok = 1;
- }
- if (/\/\/ *JSSTYLED/) {
- /^.*\/\/ *JSSTYLED *(.*)$/;
- $okmsg = $1;
- $nextok = 1;
- }
-
- # universal checks; apply to everything
- if (/\t +\t/) {
- err("spaces between tabs");
- }
- if (/ \t+ /) {
- err("tabs between spaces");
- }
- if (/\s$/) {
- err("space or tab at end of line");
- }
- if (/[^ \t(]\/\*/ && !/\w\(\/\*.*\*\/\);/) {
- err("comment preceded by non-blank");
- }
-
- # is this the beginning or ending of a function?
- # (not if "struct foo\n{\n")
- if (/^{$/ && $prev =~ /\)\s*(const\s*)?(\/\*.*\*\/\s*)?\\?$/) {
- $in_function = 1;
- $in_declaration = 1;
- $in_function_header = 0;
- $prev = $line;
- next line;
- }
- if (/^}\s*(\/\*.*\*\/\s*)*$/) {
- if ($prev =~ /^\s*return\s*;/) {
- err_prev("unneeded return at end of function");
- }
- $in_function = 0;
- reset_indent(); # we don't check between functions
- $prev = $line;
- next line;
- }
- if (/^\w*\($/) {
- $in_function_header = 1;
- }
-
- # a blank line terminates the declarations within a function.
- # XXX - but still a problem in sub-blocks.
- if ($in_declaration && /^$/) {
- $in_declaration = 0;
- }
-
- if ($comment_done) {
- $in_comment = 0;
- $in_header_comment = 0;
- $comment_done = 0;
- }
- # does this looks like the start of a block comment?
- if (/$hdr_comment_start/) {
- if (!/^\t*\/\*/) {
- err("block comment not indented by tabs");
- }
- $in_comment = 1;
- /^(\s*)\//;
- $comment_prefix = $1;
- if ($comment_prefix eq "") {
- $in_header_comment = 1;
- }
- $prev = $line;
- next line;
- }
- # are we still in the block comment?
- if ($in_comment) {
- if (/^$comment_prefix \*\/$/) {
- $comment_done = 1;
- } elsif (/\*\//) {
- $comment_done = 1;
- err("improper block comment close")
- unless ($ignore_hdr_comment && $in_header_comment);
- } elsif (!/^$comment_prefix \*[ \t]/ &&
- !/^$comment_prefix \*$/) {
- err("improper block comment")
- unless ($ignore_hdr_comment && $in_header_comment);
- }
- }
-
- if ($in_header_comment && $ignore_hdr_comment) {
- $prev = $line;
- next line;
- }
-
- # check for errors that might occur in comments and in code.
-
- # allow spaces to be used to draw pictures in header comments.
- #if (/[^ ] / && !/".* .*"/ && !$in_header_comment) {
- # err("spaces instead of tabs");
- #}
- #if (/^ / && !/^ \*[ \t\/]/ && !/^ \*$/ &&
- # (!/^ \w/ || $in_function != 0)) {
- # err("indent by spaces instead of tabs");
- #}
- if (/^ {2,}/ && !/^ [^ ]/) {
- err("indent by spaces instead of tabs");
- }
- if (/^\t+ [^ \t\*]/ || /^\t+ \S/ || /^\t+ \S/) {
- err("continuation line not indented by 4 spaces");
- }
-
- if (/^\s*\/\*./ && !/^\s*\/\*.*\*\// && !/$hdr_comment_start/) {
- err("improper first line of block comment");
- }
-
- if ($in_comment) { # still in comment, don't do further checks
- $prev = $line;
- next line;
- }
-
- if ((/[^(]\/\*\S/ || /^\/\*\S/) &&
- !(/$lint_re/ || ($splint_comments && /$splint_re/))) {
- err("missing blank after open comment");
- }
- if (/\S\*\/[^)]|\S\*\/$/ &&
- !(/$lint_re/ || ($splint_comments && /$splint_re/))) {
- err("missing blank before close comment");
- }
- if (/\/\/\S/) { # C++ comments
- err("missing blank after start comment");
- }
- # check for unterminated single line comments, but allow them when
- # they are used to comment out the argument list of a function
- # declaration.
- if (/\S.*\/\*/ && !/\S.*\/\*.*\*\// && !/\(\/\*/) {
- err("unterminated single line comment");
- }
-
- if (/^(#else|#endif|#include)(.*)$/) {
- $prev = $line;
- next line;
- }
-
- #
- # delete any comments and check everything else. Note that
- # ".*?" is a non-greedy match, so that we don't get confused by
- # multiple comments on the same line.
- #
- s/\/\*.*?\*\///g;
- s/\/\/.*$//; # C++ comments
-
- # delete any trailing whitespace; we have already checked for that.
- s/\s*$//;
-
- # following checks do not apply to text in comments.
- if (/"/) {
- err("literal string using double-quote instead of single");
- }
-
- if (/[^=!<>\s][!<>=]=/ || /[^<>!=][!<>=]==?[^\s,=]/ ||
- (/[^->]>[^,=>\s]/ && !/[^->]>$/) ||
- (/[^<]<[^,=<\s]/ && !/[^<]<$/) ||
- /[^<\s]<[^<]/ || /[^->\s]>[^>]/) {
- err("missing space around relational operator");
- }
- if (/\S>>=/ || /\S<<=/ || />>=\S/ || /<<=\S/ || /\S[-+*\/&|^%]=/ ||
- (/[^-+*\/&|^%!<>=\s]=[^=]/ && !/[^-+*\/&|^%!<>=\s]=$/) ||
- (/[^!<>=]=[^=\s]/ && !/[^!<>=]=$/)) {
- # XXX - should only check this for C++ code
- # XXX - there are probably other forms that should be allowed
- if (!/\soperator=/) {
- err("missing space around assignment operator");
- }
- }
- if (/[,;]\S/ && !/\bfor \(;;\)/) {
- err("comma or semicolon followed by non-blank");
- }
- # allow "for" statements to have empty "while" clauses
- if (/\s[,;]/ && !/^[\t]+;$/ && !/^\s*for \([^;]*; ;[^;]*\)/) {
- err("comma or semicolon preceded by blank");
- }
- if (/^\s*(&&|\|\|)/) {
- err("improper boolean continuation");
- }
- if (/\S *(&&|\|\|)/ || /(&&|\|\|) *\S/) {
- err("more than one space around boolean operator");
- }
- if (/\b(delete|typeof|instanceOf|throw|with|catch|new|function|in|for|if|while|switch|return|case)\(/) {
- err("missing space between keyword and paren");
- }
- if (/(\b(catch|for|if|with|while|switch|return)\b.*){2,}/) {
- # multiple "case" and "sizeof" allowed
- err("more than one keyword on line");
- }
- if (/\b(delete|typeof|instanceOf|with|throw|catch|new|function|in|for|if|while|switch|return|case)\s\s+\(/ &&
- !/^#if\s+\(/) {
- err("extra space between keyword and paren");
- }
- # try to detect "func (x)" but not "if (x)" or
- # "#define foo (x)" or "int (*func)();"
- if (/\w\s\(/) {
- my $s = $_;
- # strip off all keywords on the line
- s/\b(delete|typeof|instanceOf|throw|with|catch|new|function|in|for|if|while|switch|return|case)\s\(/XXX(/g;
- s/#elif\s\(/XXX(/g;
- s/^#define\s+\w+\s+\(/XXX(/;
- # do not match things like "void (*f)();"
- # or "typedef void (func_t)();"
- s/\w\s\(+\*/XXX(*/g;
- s/\b(void)\s+\(+/XXX(/og;
- if (/\w\s\(/) {
- err("extra space between function name and left paren");
- }
- $_ = $s;
- }
-
- if (/^\s*return\W[^;]*;/ && !/^\s*return\s*\(.*\);/) {
- err("unparenthesized return expression");
- }
- if (/\btypeof\b/ && !/\btypeof\s*\(.*\)/) {
- err("unparenthesized typeof expression");
- }
- if (/\(\s/) {
- err("whitespace after left paren");
- }
- # allow "for" statements to have empty "continue" clauses
- if (/\s\)/ && !/^\s*for \([^;]*;[^;]*; \)/) {
- err("whitespace before right paren");
- }
- if (/^\s*\(void\)[^ ]/) {
- err("missing space after (void) cast");
- }
- if (/\S{/ && !/({|\(){/) {
- err("missing space before left brace");
- }
- if ($in_function && /^\s+{/ &&
- ($prev =~ /\)\s*$/ || $prev =~ /\bstruct\s+\w+$/)) {
- err("left brace starting a line");
- }
- if (/}(else|while)/) {
- err("missing space after right brace");
- }
- if (/}\s\s+(else|while)/) {
- err("extra space after right brace");
- }
- if (/^\s+#/) {
- err("preprocessor statement not in column 1");
- }
- if (/^#\s/) {
- err("blank after preprocessor #");
- }
-
- #
- # We completely ignore, for purposes of indentation:
- # * lines outside of functions
- # * preprocessor lines
- #
- if ($check_continuation && $in_function && !$in_cpp) {
- process_indent($_);
- }
-
- if ($heuristic) {
- # cannot check this everywhere due to "struct {\n...\n} foo;"
- if ($in_function && !$in_declaration &&
- /}./ && !/}\s+=/ && !/{.*}[;,]$/ && !/}(\s|)*$/ &&
- !/} (else|while)/ && !/}}/) {
- err("possible bad text following right brace");
- }
- # cannot check this because sub-blocks in
- # the middle of code are ok
- if ($in_function && /^\s+{/) {
- err("possible left brace starting a line");
- }
- }
- if (/^\s*else\W/) {
- if ($prev =~ /^\s*}$/) {
- err_prefix($prev,
- "else and right brace should be on same line");
- }
- }
- $prev = $line;
-}
-
-if ($prev eq "") {
- err("last line in file is blank");
-}
-
-}
-
-#
-# Continuation-line checking
-#
-# The rest of this file contains the code for the continuation checking
-# engine. It's a pretty simple state machine which tracks the expression
-# depth (unmatched '('s and '['s).
-#
-# Keep in mind that the argument to process_indent() has already been heavily
-# processed; all comments have been replaced by control-A, and the contents of
-# strings and character constants have been elided.
-#
-
-my $cont_in; # currently inside of a continuation
-my $cont_off; # skipping an initializer or definition
-my $cont_noerr; # suppress cascading errors
-my $cont_start; # the line being continued
-my $cont_base; # the base indentation
-my $cont_first; # this is the first line of a statement
-my $cont_multiseg; # this continuation has multiple segments
-
-my $cont_special; # this is a C statement (if, for, etc.)
-my $cont_macro; # this is a macro
-my $cont_case; # this is a multi-line case
-
-my @cont_paren; # the stack of unmatched ( and [s we've seen
-
-sub
-reset_indent()
-{
- $cont_in = 0;
- $cont_off = 0;
-}
-
-sub
-delabel($)
-{
- #
- # replace labels with tabs. Note that there may be multiple
- # labels on a line.
- #
- local $_ = $_[0];
-
- while (/^(\t*)( *(?:(?:\w+\s*)|(?:case\b[^:]*)): *)(.*)$/) {
- my ($pre_tabs, $label, $rest) = ($1, $2, $3);
- $_ = $pre_tabs;
- while ($label =~ s/^([^\t]*)(\t+)//) {
- $_ .= "\t" x (length($2) + length($1) / 8);
- }
- $_ .= ("\t" x (length($label) / 8)).$rest;
- }
-
- return ($_);
-}
-
-sub
-process_indent($)
-{
- require strict;
- local $_ = $_[0]; # preserve the global $_
-
- s///g; # No comments
- s/\s+$//; # Strip trailing whitespace
-
- return if (/^$/); # skip empty lines
-
- # regexps used below; keywords taking (), macros, and continued cases
- my $special = '(?:(?:\}\s*)?else\s+)?(?:if|for|while|switch)\b';
- my $macro = '[A-Z_][A-Z_0-9]*\(';
- my $case = 'case\b[^:]*$';
-
- # skip over enumerations, array definitions, initializers, etc.
- if ($cont_off <= 0 && !/^\s*$special/ &&
- (/(?:(?:\b(?:enum|struct|union)\s*[^\{]*)|(?:\s+=\s*)){/ ||
- (/^\s*{/ && $prev =~ /=\s*(?:\/\*.*\*\/\s*)*$/))) {
- $cont_in = 0;
- $cont_off = tr/{/{/ - tr/}/}/;
- return;
- }
- if ($cont_off) {
- $cont_off += tr/{/{/ - tr/}/}/;
- return;
- }
-
- if (!$cont_in) {
- $cont_start = $line;
-
- if (/^\t* /) {
- err("non-continuation indented 4 spaces");
- $cont_noerr = 1; # stop reporting
- }
- $_ = delabel($_); # replace labels with tabs
-
- # check if the statement is complete
- return if (/^\s*\}?$/);
- return if (/^\s*\}?\s*else\s*\{?$/);
- return if (/^\s*do\s*\{?$/);
- return if (/{$/);
- return if (/}[,;]?$/);
-
- # Allow macros on their own lines
- return if (/^\s*[A-Z_][A-Z_0-9]*$/);
-
- # cases we don't deal with, generally non-kosher
- if (/{/) {
- err("stuff after {");
- return;
- }
-
- # Get the base line, and set up the state machine
- /^(\t*)/;
- $cont_base = $1;
- $cont_in = 1;
- @cont_paren = ();
- $cont_first = 1;
- $cont_multiseg = 0;
-
- # certain things need special processing
- $cont_special = /^\s*$special/? 1 : 0;
- $cont_macro = /^\s*$macro/? 1 : 0;
- $cont_case = /^\s*$case/? 1 : 0;
- } else {
- $cont_first = 0;
-
- # Strings may be pulled back to an earlier (half-)tabstop
- unless ($cont_noerr || /^$cont_base / ||
- (/^\t*(?: )?(?:gettext\()?\"/ && !/^$cont_base\t/)) {
- err_prefix($cont_start,
- "continuation should be indented 4 spaces");
- }
- }
-
- my $rest = $_; # keeps the remainder of the line
-
- #
- # The split matches 0 characters, so that each 'special' character
- # is processed separately. Parens and brackets are pushed and
- # popped off the @cont_paren stack. For normal processing, we wait
- # until a ; or { terminates the statement. "special" processing
- # (if/for/while/switch) is allowed to stop when the stack empties,
- # as is macro processing. Case statements are terminated with a :
- # and an empty paren stack.
- #
- foreach $_ (split /[^\(\)\[\]\{\}\;\:]*/) {
- next if (length($_) == 0);
-
- # rest contains the remainder of the line
- my $rxp = "[^\Q$_\E]*\Q$_\E";
- $rest =~ s/^$rxp//;
-
- if (/\(/ || /\[/) {
- push @cont_paren, $_;
- } elsif (/\)/ || /\]/) {
- my $cur = $_;
- tr/\)\]/\(\[/;
-
- my $old = (pop @cont_paren);
- if (!defined($old)) {
- err("unexpected '$cur'");
- $cont_in = 0;
- last;
- } elsif ($old ne $_) {
- err("'$cur' mismatched with '$old'");
- $cont_in = 0;
- last;
- }
-
- #
- # If the stack is now empty, do special processing
- # for if/for/while/switch and macro statements.
- #
- next if (@cont_paren != 0);
- if ($cont_special) {
- if ($rest =~ /^\s*{?$/) {
- $cont_in = 0;
- last;
- }
- if ($rest =~ /^\s*;$/) {
- err("empty if/for/while body ".
- "not on its own line");
- $cont_in = 0;
- last;
- }
- if (!$cont_first && $cont_multiseg == 1) {
- err_prefix($cont_start,
- "multiple statements continued ".
- "over multiple lines");
- $cont_multiseg = 2;
- } elsif ($cont_multiseg == 0) {
- $cont_multiseg = 1;
- }
- # We've finished this section, start
- # processing the next.
- goto section_ended;
- }
- if ($cont_macro) {
- if ($rest =~ /^$/) {
- $cont_in = 0;
- last;
- }
- }
- } elsif (/\;/) {
- if ($cont_case) {
- err("unexpected ;");
- } elsif (!$cont_special) {
- err("unexpected ;") if (@cont_paren != 0);
- if (!$cont_first && $cont_multiseg == 1) {
- err_prefix($cont_start,
- "multiple statements continued ".
- "over multiple lines");
- $cont_multiseg = 2;
- } elsif ($cont_multiseg == 0) {
- $cont_multiseg = 1;
- }
- if ($rest =~ /^$/) {
- $cont_in = 0;
- last;
- }
- if ($rest =~ /^\s*special/) {
- err("if/for/while/switch not started ".
- "on its own line");
- }
- goto section_ended;
- }
- } elsif (/\{/) {
- err("{ while in parens/brackets") if (@cont_paren != 0);
- err("stuff after {") if ($rest =~ /[^\s}]/);
- $cont_in = 0;
- last;
- } elsif (/\}/) {
- err("} while in parens/brackets") if (@cont_paren != 0);
- if (!$cont_special && $rest !~ /^\s*(while|else)\b/) {
- if ($rest =~ /^$/) {
- err("unexpected }");
- } else {
- err("stuff after }");
- }
- $cont_in = 0;
- last;
- }
- } elsif (/\:/ && $cont_case && @cont_paren == 0) {
- err("stuff after multi-line case") if ($rest !~ /$^/);
- $cont_in = 0;
- last;
- }
- next;
-section_ended:
- # End of a statement or if/while/for loop. Reset
- # cont_special and cont_macro based on the rest of the
- # line.
- $cont_special = ($rest =~ /^\s*$special/)? 1 : 0;
- $cont_macro = ($rest =~ /^\s*$macro/)? 1 : 0;
- $cont_case = 0;
- next;
- }
- $cont_noerr = 0 if (!$cont_in);
-}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/CHANGES.md b/node_modules/request/node_modules/http-signature/node_modules/jsprim/CHANGES.md
new file mode 100644
index 000000000..75bc4f025
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/CHANGES.md
@@ -0,0 +1,30 @@
+# Changelog
+
+## not yet released
+
+None yet.
+
+## v1.2.2 (2015-10-15)
+
+* #11 NPM package shouldn't include any code that does `require('JSV')`
+* #12 jsl.node.conf missing definition for "module"
+
+## v1.2.1 (2015-10-14)
+
+* #8 odd date parsing behaviour
+
+## v1.2.0 (2015-10-13)
+
+* #9 want function for returning RFC1123 dates
+
+## v1.1.0 (2015-09-02)
+
+* #6 a new suite of hrtime manipulation routines: `hrtimeAdd()`,
+ `hrtimeAccum()`, `hrtimeNanosec()`, `hrtimeMicrosec()` and
+ `hrtimeMillisec()`.
+
+## v1.0.0 (2015-09-01)
+
+First tracked release. Includes everything in previous releases, plus:
+
+* #4 want function for merging objects
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/jsprim/LICENSE
index 22ced3e63..cbc0bb3ba 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/LICENSE
@@ -1,15 +1,10 @@
-The following license applies to all files unless the file is specified below.
-Each file specified below has its license information embedded in it:
+Copyright (c) 2012, Joyent, Inc. All rights reserved.
-tools/jsstyle
-
-Copyright 2011, Robert Mustacchi. All rights reserved.
-Copyright 2011, Joyent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@@ -19,6 +14,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/README.md b/node_modules/request/node_modules/http-signature/node_modules/jsprim/README.md
new file mode 100644
index 000000000..b502b2d3a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/README.md
@@ -0,0 +1,228 @@
+# jsprim: utilities for primitive JavaScript types
+
+This module provides miscellaneous facilities for working with strings,
+numbers, dates, and objects and arrays of these basic types.
+
+
+### deepCopy(obj)
+
+Creates a deep copy of a primitive type, object, or array of primitive types.
+
+
+### deepEqual(obj1, obj2)
+
+Returns whether two objects are equal.
+
+
+### isEmpty(obj)
+
+Returns true if the given object has no properties and false otherwise. This
+is O(1) (unlike `Object.keys(obj).length === 0`, which is O(N)).
+
+
+### forEachKey(obj, callback)
+
+Like Array.forEach, but iterates properties of an object rather than elements
+of an array. Equivalent to:
+
+ for (var key in obj)
+ callback(key, obj[key]);
+
+
+### flattenObject(obj, depth)
+
+Flattens an object up to a given level of nesting, returning an array of arrays
+of length "depth + 1", where the first "depth" elements correspond to flattened
+columns and the last element contains the remaining object . For example:
+
+ flattenObject({
+ 'I': {
+ 'A': {
+ 'i': {
+ 'datum1': [ 1, 2 ],
+ 'datum2': [ 3, 4 ]
+ },
+ 'ii': {
+ 'datum1': [ 3, 4 ]
+ }
+ },
+ 'B': {
+ 'i': {
+ 'datum1': [ 5, 6 ]
+ },
+ 'ii': {
+ 'datum1': [ 7, 8 ],
+ 'datum2': [ 3, 4 ],
+ },
+ 'iii': {
+ }
+ }
+ },
+ 'II': {
+ 'A': {
+ 'i': {
+ 'datum1': [ 1, 2 ],
+ 'datum2': [ 3, 4 ]
+ }
+ }
+ }
+ }, 3)
+
+becomes:
+
+ [
+ [ 'I', 'A', 'i', { 'datum1': [ 1, 2 ], 'datum2': [ 3, 4 ] } ],
+ [ 'I', 'A', 'ii', { 'datum1': [ 3, 4 ] } ],
+ [ 'I', 'B', 'i', { 'datum1': [ 5, 6 ] } ],
+ [ 'I', 'B', 'ii', { 'datum1': [ 7, 8 ], 'datum2': [ 3, 4 ] } ],
+ [ 'I', 'B', 'iii', {} ],
+ [ 'II', 'A', 'i', { 'datum1': [ 1, 2 ], 'datum2': [ 3, 4 ] } ]
+ ]
+
+This function is strict: "depth" must be a non-negative integer and "obj" must
+be a non-null object with at least "depth" levels of nesting under all keys.
+
+
+### flattenIter(obj, depth, func)
+
+This is similar to `flattenObject` except that instead of returning an array,
+this function invokes `func(entry)` for each `entry` in the array that
+`flattenObject` would return. `flattenIter(obj, depth, func)` is logically
+equivalent to `flattenObject(obj, depth).forEach(func)`. Importantly, this
+version never constructs the full array. Its memory usage is O(depth) rather
+than O(n) (where `n` is the number of flattened elements).
+
+There's another difference between `flattenObject` and `flattenIter` that's
+related to the special case where `depth === 0`. In this case, `flattenObject`
+omits the array wrapping `obj` (which is regrettable).
+
+
+### pluck(obj, key)
+
+Fetch nested property "key" from object "obj", traversing objects as needed.
+For example, `pluck(obj, "foo.bar.baz")` is roughly equivalent to
+`obj.foo.bar.baz`, except that:
+
+1. If traversal fails, the resulting value is undefined, and no error is
+ thrown. For example, `pluck({}, "foo.bar")` is just undefined.
+2. If "obj" has property "key" directly (without traversing), the
+ corresponding property is returned. For example,
+ `pluck({ 'foo.bar': 1 }, 'foo.bar')` is 1, not undefined. This is also
+ true recursively, so `pluck({ 'a': { 'foo.bar': 1 } }, 'a.foo.bar')` is
+ also 1, not undefined.
+
+
+### randElt(array)
+
+Returns an element from "array" selected uniformly at random. If "array" is
+empty, throws an Error.
+
+
+### startsWith(str, prefix)
+
+Returns true if the given string starts with the given prefix and false
+otherwise.
+
+
+### endsWith(str, suffix)
+
+Returns true if the given string ends with the given suffix and false
+otherwise.
+
+
+### iso8601(date)
+
+Converts a Date object to an ISO8601 date string of the form
+"YYYY-MM-DDTHH:MM:SS.sssZ". This format is not customizable.
+
+
+### parseDateTime(str)
+
+Parses a date expressed as a string, as either a number of milliseconds since
+the epoch or any string format that Date accepts, giving preference to the
+former where these two sets overlap (e.g., strings containing small numbers).
+
+
+### hrtimeDiff(timeA, timeB)
+
+Given two hrtime readings (as from Node's `process.hrtime()`), where timeA is
+later than timeB, compute the difference and return that as an hrtime. It is
+illegal to invoke this for a pair of times where timeB is newer than timeA.
+
+### hrtimeAdd(timeA, timeB)
+
+Add two hrtime intervals (as from Node's `process.hrtime()`), returning a new
+hrtime interval array. This function does not modify either input argument.
+
+
+### hrtimeAccum(timeA, timeB)
+
+Add two hrtime intervals (as from Node's `process.hrtime()`), storing the
+result in `timeA`. This function overwrites (and returns) the first argument
+passed in.
+
+
+### hrtimeNanosec(timeA), hrtimeMicrosec(timeA), hrtimeMillisec(timeA)
+
+This suite of functions converts a hrtime interval (as from Node's
+`process.hrtime()`) into a scalar number of nanoseconds, microseconds or
+milliseconds. Results are truncated, as with `Math.floor()`.
+
+
+### validateJsonObject(schema, object)
+
+Uses JSON validation (via JSV) to validate the given object against the given
+schema. On success, returns null. On failure, *returns* (does not throw) a
+useful Error object.
+
+
+### extraProperties(object, allowed)
+
+Check an object for unexpected properties. Accepts the object to check, and an
+array of allowed property name strings. If extra properties are detected, an
+array of extra property names is returned. If no properties other than those
+in the allowed list are present on the object, the returned array will be of
+zero length.
+
+### mergeObjects(provided, overrides, defaults)
+
+Merge properties from objects "provided", "overrides", and "defaults". The
+intended use case is for functions that accept named arguments in an "args"
+object, but want to provide some default values and override other values. In
+that case, "provided" is what the caller specified, "overrides" are what the
+function wants to override, and "defaults" contains default values.
+
+The function starts with the values in "defaults", overrides them with the
+values in "provided", and then overrides those with the values in "overrides".
+For convenience, any of these objects may be falsey, in which case they will be
+ignored. The input objects are never modified, but properties in the returned
+object are not deep-copied.
+
+For example:
+
+ mergeObjects(undefined, { 'objectMode': true }, { 'highWaterMark': 0 })
+
+returns:
+
+ { 'objectMode': true, 'highWaterMark': 0 }
+
+For another example:
+
+ mergeObjects(
+ { 'highWaterMark': 16, 'objectMode': 7 }, /* from caller */
+ { 'objectMode': true }, /* overrides */
+ { 'highWaterMark': 0 }); /* default */
+
+returns:
+
+ { 'objectMode': true, 'highWaterMark': 16 }
+
+
+# Contributing
+
+Code should be "make check" clean. This target assumes that
+[jsl](http://github.com/davepacheco/javascriptlint) and
+[jsstyle](http://github.com/davepacheco/jsstyle) are on your path.
+
+New tests should generally accompany new functions and bug fixes. The tests
+should pass cleanly (run tests/basic.js).
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/lib/jsprim.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/lib/jsprim.js
new file mode 100644
index 000000000..5ee468892
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/lib/jsprim.js
@@ -0,0 +1,478 @@
+/*
+ * lib/jsprim.js: utilities for primitive JavaScript types
+ */
+
+var mod_assert = require('assert');
+var mod_util = require('util');
+
+var mod_extsprintf = require('extsprintf');
+var mod_verror = require('verror');
+var mod_jsonschema = require('json-schema');
+
+/*
+ * Public interface
+ */
+exports.deepCopy = deepCopy;
+exports.deepEqual = deepEqual;
+exports.isEmpty = isEmpty;
+exports.forEachKey = forEachKey;
+exports.pluck = pluck;
+exports.flattenObject = flattenObject;
+exports.flattenIter = flattenIter;
+exports.validateJsonObject = validateJsonObjectJS;
+exports.validateJsonObjectJS = validateJsonObjectJS;
+exports.randElt = randElt;
+exports.extraProperties = extraProperties;
+exports.mergeObjects = mergeObjects;
+
+exports.startsWith = startsWith;
+exports.endsWith = endsWith;
+
+exports.iso8601 = iso8601;
+exports.rfc1123 = rfc1123;
+exports.parseDateTime = parseDateTime;
+
+exports.hrtimediff = hrtimeDiff;
+exports.hrtimeDiff = hrtimeDiff;
+exports.hrtimeAccum = hrtimeAccum;
+exports.hrtimeAdd = hrtimeAdd;
+exports.hrtimeNanosec = hrtimeNanosec;
+exports.hrtimeMicrosec = hrtimeMicrosec;
+exports.hrtimeMillisec = hrtimeMillisec;
+
+
+/*
+ * Deep copy an acyclic *basic* Javascript object. This only handles basic
+ * scalars (strings, numbers, booleans) and arbitrarily deep arrays and objects
+ * containing these. This does *not* handle instances of other classes.
+ */
+function deepCopy(obj)
+{
+ var ret, key;
+ var marker = '__deepCopy';
+
+ if (obj && obj[marker])
+ throw (new Error('attempted deep copy of cyclic object'));
+
+ if (obj && obj.constructor == Object) {
+ ret = {};
+ obj[marker] = true;
+
+ for (key in obj) {
+ if (key == marker)
+ continue;
+
+ ret[key] = deepCopy(obj[key]);
+ }
+
+ delete (obj[marker]);
+ return (ret);
+ }
+
+ if (obj && obj.constructor == Array) {
+ ret = [];
+ obj[marker] = true;
+
+ for (key = 0; key < obj.length; key++)
+ ret.push(deepCopy(obj[key]));
+
+ delete (obj[marker]);
+ return (ret);
+ }
+
+ /*
+ * It must be a primitive type -- just return it.
+ */
+ return (obj);
+}
+
+function deepEqual(obj1, obj2)
+{
+ if (typeof (obj1) != typeof (obj2))
+ return (false);
+
+ if (obj1 === null || obj2 === null || typeof (obj1) != 'object')
+ return (obj1 === obj2);
+
+ if (obj1.constructor != obj2.constructor)
+ return (false);
+
+ var k;
+ for (k in obj1) {
+ if (!obj2.hasOwnProperty(k))
+ return (false);
+
+ if (!deepEqual(obj1[k], obj2[k]))
+ return (false);
+ }
+
+ for (k in obj2) {
+ if (!obj1.hasOwnProperty(k))
+ return (false);
+ }
+
+ return (true);
+}
+
+function isEmpty(obj)
+{
+ var key;
+ for (key in obj)
+ return (false);
+ return (true);
+}
+
+function forEachKey(obj, callback)
+{
+ for (var key in obj)
+ callback(key, obj[key]);
+}
+
+function pluck(obj, key)
+{
+ mod_assert.equal(typeof (key), 'string');
+ return (pluckv(obj, key));
+}
+
+function pluckv(obj, key)
+{
+ if (obj === null || typeof (obj) !== 'object')
+ return (undefined);
+
+ if (obj.hasOwnProperty(key))
+ return (obj[key]);
+
+ var i = key.indexOf('.');
+ if (i == -1)
+ return (undefined);
+
+ var key1 = key.substr(0, i);
+ if (!obj.hasOwnProperty(key1))
+ return (undefined);
+
+ return (pluckv(obj[key1], key.substr(i + 1)));
+}
+
+/*
+ * Invoke callback(row) for each entry in the array that would be returned by
+ * flattenObject(data, depth). This is just like flattenObject(data,
+ * depth).forEach(callback), except that the intermediate array is never
+ * created.
+ */
+function flattenIter(data, depth, callback)
+{
+ doFlattenIter(data, depth, [], callback);
+}
+
+function doFlattenIter(data, depth, accum, callback)
+{
+ var each;
+ var key;
+
+ if (depth === 0) {
+ each = accum.slice(0);
+ each.push(data);
+ callback(each);
+ return;
+ }
+
+ mod_assert.ok(data !== null);
+ mod_assert.equal(typeof (data), 'object');
+ mod_assert.equal(typeof (depth), 'number');
+ mod_assert.ok(depth >= 0);
+
+ for (key in data) {
+ each = accum.slice(0);
+ each.push(key);
+ doFlattenIter(data[key], depth - 1, each, callback);
+ }
+}
+
+function flattenObject(data, depth)
+{
+ if (depth === 0)
+ return ([ data ]);
+
+ mod_assert.ok(data !== null);
+ mod_assert.equal(typeof (data), 'object');
+ mod_assert.equal(typeof (depth), 'number');
+ mod_assert.ok(depth >= 0);
+
+ var rv = [];
+ var key;
+
+ for (key in data) {
+ flattenObject(data[key], depth - 1).forEach(function (p) {
+ rv.push([ key ].concat(p));
+ });
+ }
+
+ return (rv);
+}
+
+function startsWith(str, prefix)
+{
+ return (str.substr(0, prefix.length) == prefix);
+}
+
+function endsWith(str, suffix)
+{
+ return (str.substr(
+ str.length - suffix.length, suffix.length) == suffix);
+}
+
+function iso8601(d)
+{
+ if (typeof (d) == 'number')
+ d = new Date(d);
+ mod_assert.ok(d.constructor === Date);
+ return (mod_extsprintf.sprintf('%4d-%02d-%02dT%02d:%02d:%02d.%03dZ',
+ d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate(),
+ d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(),
+ d.getUTCMilliseconds()));
+}
+
+var RFC1123_MONTHS = [
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+var RFC1123_DAYS = [
+ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+
+function rfc1123(date) {
+ return (mod_extsprintf.sprintf('%s, %02d %s %04d %02d:%02d:%02d GMT',
+ RFC1123_DAYS[date.getUTCDay()], date.getUTCDate(),
+ RFC1123_MONTHS[date.getUTCMonth()], date.getUTCFullYear(),
+ date.getUTCHours(), date.getUTCMinutes(),
+ date.getUTCSeconds()));
+}
+
+/*
+ * Parses a date expressed as a string, as either a number of milliseconds since
+ * the epoch or any string format that Date accepts, giving preference to the
+ * former where these two sets overlap (e.g., small numbers).
+ */
+function parseDateTime(str)
+{
+ /*
+ * This is irritatingly implicit, but significantly more concise than
+ * alternatives. The "+str" will convert a string containing only a
+ * number directly to a Number, or NaN for other strings. Thus, if the
+ * conversion succeeds, we use it (this is the milliseconds-since-epoch
+ * case). Otherwise, we pass the string directly to the Date
+ * constructor to parse.
+ */
+ var numeric = +str;
+ if (!isNaN(numeric)) {
+ return (new Date(numeric));
+ } else {
+ return (new Date(str));
+ }
+}
+
+function validateJsonObjectJS(schema, input)
+{
+ var report = mod_jsonschema.validate(input, schema);
+
+ if (report.errors.length === 0)
+ return (null);
+
+ /* Currently, we only do anything useful with the first error. */
+ var error = report.errors[0];
+
+ /* The failed property is given by a URI with an irrelevant prefix. */
+ var propname = error['property'];
+ var reason = error['message'].toLowerCase();
+ var i, j;
+
+ /*
+ * There's at least one case where the property error message is
+ * confusing at best. We work around this here.
+ */
+ if ((i = reason.indexOf('the property ')) != -1 &&
+ (j = reason.indexOf(' is not defined in the schema and the ' +
+ 'schema does not allow additional properties')) != -1) {
+ i += 'the property '.length;
+ if (propname === '')
+ propname = reason.substr(i, j - i);
+ else
+ propname = propname + '.' + reason.substr(i, j - i);
+
+ reason = 'unsupported property';
+ }
+
+ var rv = new mod_verror.VError('property "%s": %s', propname, reason);
+ rv.jsv_details = error;
+ return (rv);
+}
+
+function randElt(arr)
+{
+ mod_assert.ok(Array.isArray(arr) && arr.length > 0,
+ 'randElt argument must be a non-empty array');
+
+ return (arr[Math.floor(Math.random() * arr.length)]);
+}
+
+function assertHrtime(a)
+{
+ mod_assert.ok(a[0] >= 0 && a[1] >= 0,
+ 'negative numbers not allowed in hrtimes');
+ mod_assert.ok(a[1] < 1e9, 'nanoseconds column overflow');
+}
+
+/*
+ * Compute the time elapsed between hrtime readings A and B, where A is later
+ * than B. hrtime readings come from Node's process.hrtime(). There is no
+ * defined way to represent negative deltas, so it's illegal to diff B from A
+ * where the time denoted by B is later than the time denoted by A. If this
+ * becomes valuable, we can define a representation and extend the
+ * implementation to support it.
+ */
+function hrtimeDiff(a, b)
+{
+ assertHrtime(a);
+ assertHrtime(b);
+ mod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),
+ 'negative differences not allowed');
+
+ var rv = [ a[0] - b[0], 0 ];
+
+ if (a[1] >= b[1]) {
+ rv[1] = a[1] - b[1];
+ } else {
+ rv[0]--;
+ rv[1] = 1e9 - (b[1] - a[1]);
+ }
+
+ return (rv);
+}
+
+/*
+ * Convert a hrtime reading from the array format returned by Node's
+ * process.hrtime() into a scalar number of nanoseconds.
+ */
+function hrtimeNanosec(a)
+{
+ assertHrtime(a);
+
+ return (Math.floor(a[0] * 1e9 + a[1]));
+}
+
+/*
+ * Convert a hrtime reading from the array format returned by Node's
+ * process.hrtime() into a scalar number of microseconds.
+ */
+function hrtimeMicrosec(a)
+{
+ assertHrtime(a);
+
+ return (Math.floor(a[0] * 1e6 + a[1] / 1e3));
+}
+
+/*
+ * Convert a hrtime reading from the array format returned by Node's
+ * process.hrtime() into a scalar number of milliseconds.
+ */
+function hrtimeMillisec(a)
+{
+ assertHrtime(a);
+
+ return (Math.floor(a[0] * 1e3 + a[1] / 1e6));
+}
+
+/*
+ * Add two hrtime readings A and B, overwriting A with the result of the
+ * addition. This function is useful for accumulating several hrtime intervals
+ * into a counter. Returns A.
+ */
+function hrtimeAccum(a, b)
+{
+ assertHrtime(a);
+ assertHrtime(b);
+
+ /*
+ * Accumulate the nanosecond component.
+ */
+ a[1] += b[1];
+ if (a[1] >= 1e9) {
+ /*
+ * The nanosecond component overflowed, so carry to the seconds
+ * field.
+ */
+ a[0]++;
+ a[1] -= 1e9;
+ }
+
+ /*
+ * Accumulate the seconds component.
+ */
+ a[0] += b[0];
+
+ return (a);
+}
+
+/*
+ * Add two hrtime readings A and B, returning the result as a new hrtime array.
+ * Does not modify either input argument.
+ */
+function hrtimeAdd(a, b)
+{
+ assertHrtime(a);
+
+ var rv = [ a[0], a[1] ];
+
+ return (hrtimeAccum(rv, b));
+}
+
+
+/*
+ * Check an object for unexpected properties. Accepts the object to check, and
+ * an array of allowed property names (strings). Returns an array of key names
+ * that were found on the object, but did not appear in the list of allowed
+ * properties. If no properties were found, the returned array will be of
+ * zero length.
+ */
+function extraProperties(obj, allowed)
+{
+ mod_assert.ok(typeof (obj) === 'object' && obj !== null,
+ 'obj argument must be a non-null object');
+ mod_assert.ok(Array.isArray(allowed),
+ 'allowed argument must be an array of strings');
+ for (var i = 0; i < allowed.length; i++) {
+ mod_assert.ok(typeof (allowed[i]) === 'string',
+ 'allowed argument must be an array of strings');
+ }
+
+ return (Object.keys(obj).filter(function (key) {
+ return (allowed.indexOf(key) === -1);
+ }));
+}
+
+/*
+ * Given three sets of properties "provided" (may be undefined), "overrides"
+ * (required), and "defaults" (may be undefined), construct an object containing
+ * the union of these sets with "overrides" overriding "provided", and
+ * "provided" overriding "defaults". None of the input objects are modified.
+ */
+function mergeObjects(provided, overrides, defaults)
+{
+ var rv, k;
+
+ rv = {};
+ if (defaults) {
+ for (k in defaults)
+ rv[k] = defaults[k];
+ }
+
+ if (provided) {
+ for (k in provided)
+ rv[k] = provided[k];
+ }
+
+ if (overrides) {
+ for (k in overrides)
+ rv[k] = overrides[k];
+ }
+
+ return (rv);
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/.gitmodules b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/.gitmodules
new file mode 100644
index 000000000..4e0f5e29d
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "deps/jsstyle"]
+ path = deps/jsstyle
+ url = git://github.com/davepacheco/jsstyle
+[submodule "deps/javascriptlint"]
+ path = deps/javascriptlint
+ url = git://github.com/davepacheco/javascriptlint
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/LICENSE
new file mode 100644
index 000000000..cbc0bb3ba
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012, Joyent, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile
new file mode 100644
index 000000000..1deeb5fdf
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+# Makefile: top-level Makefile
+#
+# This Makefile contains only repo-specific logic and uses included makefiles
+# to supply common targets (javascriptlint, jsstyle, restdown, etc.), which are
+# used by other repos as well.
+#
+
+#
+# Files
+#
+JS_FILES := $(shell find lib -name '*.js')
+JSL_FILES_NODE = $(JS_FILES)
+JSSTYLE_FILES = $(JS_FILES)
+JSL_CONF_NODE = jsl.node.conf
+
+# Default target is "check"
+check:
+
+include ./Makefile.deps
+include ./Makefile.targ
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.deps b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.deps
new file mode 100644
index 000000000..2811bde17
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.deps
@@ -0,0 +1,39 @@
+# -*- mode: makefile -*-
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+# Makefile.deps: Makefile for including common tools as dependencies
+#
+# NOTE: This makefile comes from the "eng" repo. It's designed to be dropped
+# into other repos as-is without requiring any modifications. If you find
+# yourself changing this file, you should instead update the original copy in
+# eng.git and then update your repo to use the new version.
+#
+# This file is separate from Makefile.targ so that teams can choose
+# independently whether to use the common targets in Makefile.targ and the
+# common tools here.
+#
+
+#
+# javascriptlint
+#
+JSL_EXEC ?= deps/javascriptlint/build/install/jsl
+JSL ?= python2.6 $(JSL_EXEC)
+
+$(JSL_EXEC): | deps/javascriptlint/.git
+ cd deps/javascriptlint && make install
+
+#
+# jsstyle
+#
+JSSTYLE_EXEC ?= deps/jsstyle/jsstyle
+JSSTYLE ?= $(JSSTYLE_EXEC)
+
+$(JSSTYLE_EXEC): | deps/jsstyle/.git
+
+#
+# restdown
+#
+RESTDOWN_EXEC ?= deps/restdown/bin/restdown
+RESTDOWN ?= python2.6 $(RESTDOWN_EXEC)
+$(RESTDOWN_EXEC): | deps/restdown/.git
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.targ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.targ
new file mode 100644
index 000000000..2a64fe7e9
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.targ
@@ -0,0 +1,285 @@
+# -*- mode: makefile -*-
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+# Makefile.targ: common targets.
+#
+# NOTE: This makefile comes from the "eng" repo. It's designed to be dropped
+# into other repos as-is without requiring any modifications. If you find
+# yourself changing this file, you should instead update the original copy in
+# eng.git and then update your repo to use the new version.
+#
+# This Makefile defines several useful targets and rules. You can use it by
+# including it from a Makefile that specifies some of the variables below.
+#
+# Targets defined in this Makefile:
+#
+# check Checks JavaScript files for lint and style
+# Checks bash scripts for syntax
+# Checks SMF manifests for validity against the SMF DTD
+#
+# clean Removes built files
+#
+# docs Builds restdown documentation in docs/
+#
+# prepush Depends on "check" and "test"
+#
+# test Does nothing (you should override this)
+#
+# xref Generates cscope (source cross-reference index)
+#
+# For details on what these targets are supposed to do, see the Joyent
+# Engineering Guide.
+#
+# To make use of these targets, you'll need to set some of these variables. Any
+# variables left unset will simply not be used.
+#
+# BASH_FILES Bash scripts to check for syntax
+# (paths relative to top-level Makefile)
+#
+# CLEAN_FILES Files to remove as part of the "clean" target. Note
+# that files generated by targets in this Makefile are
+# automatically included in CLEAN_FILES. These include
+# restdown-generated HTML and JSON files.
+#
+# DOC_FILES Restdown (documentation source) files. These are
+# assumed to be contained in "docs/", and must NOT
+# contain the "docs/" prefix.
+#
+# JSL_CONF_NODE Specify JavaScriptLint configuration files
+# JSL_CONF_WEB (paths relative to top-level Makefile)
+#
+# Node.js and Web configuration files are separate
+# because you'll usually want different global variable
+# configurations. If no file is specified, none is given
+# to jsl, which causes it to use a default configuration,
+# which probably isn't what you want.
+#
+# JSL_FILES_NODE JavaScript files to check with Node config file.
+# JSL_FILES_WEB JavaScript files to check with Web config file.
+#
+# You can also override these variables:
+#
+# BASH Path to bash (default: bash)
+#
+# CSCOPE_DIRS Directories to search for source files for the cscope
+# index. (default: ".")
+#
+# JSL Path to JavaScriptLint (default: "jsl")
+#
+# JSL_FLAGS_NODE Additional flags to pass through to JSL
+# JSL_FLAGS_WEB
+# JSL_FLAGS
+#
+# JSSTYLE Path to jsstyle (default: jsstyle)
+#
+# JSSTYLE_FLAGS Additional flags to pass through to jsstyle
+#
+
+#
+# Defaults for the various tools we use.
+#
+BASH ?= bash
+BASHSTYLE ?= tools/bashstyle
+CP ?= cp
+CSCOPE ?= cscope
+CSCOPE_DIRS ?= .
+JSL ?= jsl
+JSSTYLE ?= jsstyle
+MKDIR ?= mkdir -p
+MV ?= mv
+RESTDOWN_FLAGS ?=
+RMTREE ?= rm -rf
+JSL_FLAGS ?= --nologo --nosummary
+
+ifeq ($(shell uname -s),SunOS)
+ TAR ?= gtar
+else
+ TAR ?= tar
+endif
+
+
+#
+# Defaults for other fixed values.
+#
+BUILD = build
+DISTCLEAN_FILES += $(BUILD)
+DOC_BUILD = $(BUILD)/docs/public
+
+#
+# Configure JSL_FLAGS_{NODE,WEB} based on JSL_CONF_{NODE,WEB}.
+#
+ifneq ($(origin JSL_CONF_NODE), undefined)
+ JSL_FLAGS_NODE += --conf=$(JSL_CONF_NODE)
+endif
+
+ifneq ($(origin JSL_CONF_WEB), undefined)
+ JSL_FLAGS_WEB += --conf=$(JSL_CONF_WEB)
+endif
+
+#
+# Targets. For descriptions on what these are supposed to do, see the
+# Joyent Engineering Guide.
+#
+
+#
+# Instruct make to keep around temporary files. We have rules below that
+# automatically update git submodules as needed, but they employ a deps/*/.git
+# temporary file. Without this directive, make tries to remove these .git
+# directories after the build has completed.
+#
+.SECONDARY: $($(wildcard deps/*):%=%/.git)
+
+#
+# This rule enables other rules that use files from a git submodule to have
+# those files depend on deps/module/.git and have "make" automatically check
+# out the submodule as needed.
+#
+deps/%/.git:
+ git submodule update --init deps/$*
+
+#
+# These recipes make heavy use of dynamically-created phony targets. The parent
+# Makefile defines a list of input files like BASH_FILES. We then say that each
+# of these files depends on a fake target called filename.bashchk, and then we
+# define a pattern rule for those targets that runs bash in check-syntax-only
+# mode. This mechanism has the nice properties that if you specify zero files,
+# the rule becomes a noop (unlike a single rule to check all bash files, which
+# would invoke bash with zero files), and you can check individual files from
+# the command line with "make filename.bashchk".
+#
+.PHONY: check-bash
+check-bash: $(BASH_FILES:%=%.bashchk) $(BASH_FILES:%=%.bashstyle)
+
+%.bashchk: %
+ $(BASH) -n $^
+
+%.bashstyle: %
+ $(BASHSTYLE) $^
+
+.PHONY: check-jsl check-jsl-node check-jsl-web
+check-jsl: check-jsl-node check-jsl-web
+
+check-jsl-node: $(JSL_FILES_NODE:%=%.jslnodechk)
+
+check-jsl-web: $(JSL_FILES_WEB:%=%.jslwebchk)
+
+%.jslnodechk: % $(JSL_EXEC)
+ $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_NODE) $<
+
+%.jslwebchk: % $(JSL_EXEC)
+ $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_WEB) $<
+
+.PHONY: check-jsstyle
+check-jsstyle: $(JSSTYLE_FILES:%=%.jsstylechk)
+
+%.jsstylechk: % $(JSSTYLE_EXEC)
+ $(JSSTYLE) $(JSSTYLE_FLAGS) $<
+
+.PHONY: check
+check: check-jsl check-jsstyle check-bash
+ @echo check ok
+
+.PHONY: clean
+clean::
+ -$(RMTREE) $(CLEAN_FILES)
+
+.PHONY: distclean
+distclean:: clean
+ -$(RMTREE) $(DISTCLEAN_FILES)
+
+CSCOPE_FILES = cscope.in.out cscope.out cscope.po.out
+CLEAN_FILES += $(CSCOPE_FILES)
+
+.PHONY: xref
+xref: cscope.files
+ $(CSCOPE) -bqR
+
+.PHONY: cscope.files
+cscope.files:
+ find $(CSCOPE_DIRS) -name '*.c' -o -name '*.h' -o -name '*.cc' \
+ -o -name '*.js' -o -name '*.s' -o -name '*.cpp' > $@
+
+#
+# The "docs" target is complicated because we do several things here:
+#
+# (1) Use restdown to build HTML and JSON files from each of DOC_FILES.
+#
+# (2) Copy these files into $(DOC_BUILD) (build/docs/public), which
+# functions as a complete copy of the documentation that could be
+# mirrored or served over HTTP.
+#
+# (3) Then copy any directories and media from docs/media into
+# $(DOC_BUILD)/media. This allows projects to include their own media,
+# including files that will override same-named files provided by
+# restdown.
+#
+# Step (3) is the surprisingly complex part: in order to do this, we need to
+# identify the subdirectories in docs/media, recreate them in
+# $(DOC_BUILD)/media, then do the same with the files.
+#
+DOC_MEDIA_DIRS := $(shell find docs/media -type d 2>/dev/null | grep -v "^docs/media$$")
+DOC_MEDIA_DIRS := $(DOC_MEDIA_DIRS:docs/media/%=%)
+DOC_MEDIA_DIRS_BUILD := $(DOC_MEDIA_DIRS:%=$(DOC_BUILD)/media/%)
+
+DOC_MEDIA_FILES := $(shell find docs/media -type f 2>/dev/null)
+DOC_MEDIA_FILES := $(DOC_MEDIA_FILES:docs/media/%=%)
+DOC_MEDIA_FILES_BUILD := $(DOC_MEDIA_FILES:%=$(DOC_BUILD)/media/%)
+
+#
+# Like the other targets, "docs" just depends on the final files we want to
+# create in $(DOC_BUILD), leveraging other targets and recipes to define how
+# to get there.
+#
+.PHONY: docs
+docs: \
+ $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.html) \
+ $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.json) \
+ $(DOC_MEDIA_FILES_BUILD)
+
+#
+# We keep the intermediate files so that the next build can see whether the
+# files in DOC_BUILD are up to date.
+#
+.PRECIOUS: \
+ $(DOC_FILES:%.restdown=docs/%.html) \
+ $(DOC_FILES:%.restdown=docs/%json)
+
+#
+# We do clean those intermediate files, as well as all of DOC_BUILD.
+#
+CLEAN_FILES += \
+ $(DOC_BUILD) \
+ $(DOC_FILES:%.restdown=docs/%.html) \
+ $(DOC_FILES:%.restdown=docs/%.json)
+
+#
+# Before installing the files, we must make sure the directories exist. The |
+# syntax tells make that the dependency need only exist, not be up to date.
+# Otherwise, it might try to rebuild spuriously because the directory itself
+# appears out of date.
+#
+$(DOC_MEDIA_FILES_BUILD): | $(DOC_MEDIA_DIRS_BUILD)
+
+$(DOC_BUILD)/%: docs/% | $(DOC_BUILD)
+ $(CP) $< $@
+
+docs/%.json docs/%.html: docs/%.restdown | $(DOC_BUILD) $(RESTDOWN_EXEC)
+ $(RESTDOWN) $(RESTDOWN_FLAGS) -m $(DOC_BUILD) $<
+
+$(DOC_BUILD):
+ $(MKDIR) $@
+
+$(DOC_MEDIA_DIRS_BUILD):
+ $(MKDIR) $@
+
+#
+# The default "test" target does nothing. This should usually be overridden by
+# the parent Makefile. It's included here so we can define "prepush" without
+# requiring the repo to define "test".
+#
+.PHONY: test
+test:
+
+.PHONY: prepush
+prepush: check test
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/README.md b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/README.md
new file mode 100644
index 000000000..702e4e221
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/README.md
@@ -0,0 +1,39 @@
+# extsprintf: extended POSIX-style sprintf
+
+Stripped down version of s[n]printf(3c). We make a best effort to throw an
+exception when given a format string we don't understand, rather than ignoring
+it, so that we won't break existing programs if/when we go implement the rest
+of this.
+
+This implementation currently supports specifying
+
+* field alignment ('-' flag),
+* zero-pad ('0' flag)
+* always show numeric sign ('+' flag),
+* field width
+* conversions for strings, decimal integers, and floats (numbers).
+* argument size specifiers. These are all accepted but ignored, since
+ Javascript has no notion of the physical size of an argument.
+
+Everything else is currently unsupported, most notably: precision, unsigned
+numbers, non-decimal numbers, and characters.
+
+Besides the usual POSIX conversions, this implementation supports:
+
+* `%j`: pretty-print a JSON object (using node's "inspect")
+* `%r`: pretty-print an Error object
+
+# Example
+
+First, install it:
+
+ # npm install extsprintf
+
+Now, use it:
+
+ var mod_extsprintf = require('extsprintf');
+ console.log(mod_extsprintf.sprintf('hello %25s', 'world'));
+
+outputs:
+
+ hello world
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/examples/simple.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/examples/simple.js
new file mode 100644
index 000000000..9f342f5b1
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/examples/simple.js
@@ -0,0 +1,2 @@
+var mod_extsprintf = require('extsprintf');
+console.log(mod_extsprintf.sprintf('hello %25s', 'world'));
diff --git a/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/jsl.node.conf
index 845f367a2..03f787ffb 100755..100644
--- a/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/jsl.node.conf
@@ -1,6 +1,5 @@
#
-# Configuration File for JavaScript Lint 0.3.0
-# Developed by Matthias Miller (http://www.JavaScriptLint.com)
+# Configuration File for JavaScript Lint
#
# This configuration file can be used to lint a collection of scripts, or to enable
# or disable warnings for scripts that are linted via the command line.
@@ -10,56 +9,74 @@
# Enable or disable warnings based on requirements.
# Use "+WarningName" to display or "-WarningName" to suppress.
#
-+no_return_value # function {0} does not always return a value
-+duplicate_formal # duplicate formal argument {0}
-+equal_as_assign # test for equality (==) mistyped as assignment (=)?{0}
-+var_hides_arg # variable {0} hides argument
-+redeclared_var # redeclaration of {0} {1}
-+anon_no_return_value # anonymous function does not always return a value
-+missing_semicolon # missing semicolon
-+meaningless_block # meaningless block; curly braces have no impact
++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent
++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity
++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement
++anon_no_return_value # anonymous function does not always return value
++assign_to_function_call # assignment to a function call
+-block_without_braces # block statement without curly braces
+comma_separated_stmts # multiple statements separated by commas (use semicolons?)
-+unreachable_code # unreachable code
-+missing_break # missing break statement
-+missing_break_for_last_case # missing break statement for last case in switch
+comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
++default_not_at_end # the default case is not at the end of the switch statement
++dup_option_explicit # duplicate "option explicit" control comment
++duplicate_case_in_switch # duplicate case in switch statement
++duplicate_formal # duplicate formal argument {name}
++empty_statement # empty statement or extra semicolon
++identifier_hides_another # identifer {name} hides an identifier in a parent scope
-inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement
-+useless_void # use of the void type may be unnecessary (void is always undefined)
--useless_quotes # quotation marks are unnecessary
-+multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
-+use_of_label # use of label
--block_without_braces # block statement without curly braces
++incorrect_version # Expected /*jsl:content-type*/ control comment. The script was parsed with the wrong version.
++invalid_fallthru # unexpected "fallthru" control comment
++invalid_pass # unexpected "pass" control comment
++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax
+leading_decimal_point # leading decimal point may indicate a number or an object member
-+trailing_decimal_point # trailing decimal point may indicate a number or an object member
--octal_number # leading zeros make an octal number
-+nested_comment # nested comment
++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax
++meaningless_block # meaningless block; curly braces have no impact
++mismatch_ctrl_comments # mismatched control comment; "ignore" and "end" control comments must have a one-to-one correspondence
+misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
-+ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement
-+empty_statement # empty statement or extra semicolon
--missing_option_explicit # the "option explicit" control comment is missing
++missing_break # missing break statement
++missing_break_for_last_case # missing break statement for last case in switch
++missing_default_case # missing default case in switch statement
++missing_option_explicit # the "option explicit" control comment is missing
++missing_semicolon # missing semicolon
++missing_semicolon_for_lambda # missing semicolon for lambda assignment
++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
++nested_comment # nested comment
++no_return_value # function {name} does not always return a value
++octal_number # leading zeros make an octal number
++parseint_missing_radix # parseInt missing radix parameter
+partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag
-+dup_option_explicit # duplicate "option explicit" control comment
++redeclared_var # redeclaration of {name}
++trailing_comma_in_array # extra comma is not recommended in array initializers
++trailing_decimal_point # trailing decimal point may indicate a number or an object member
++undeclared_identifier # undeclared identifier: {name}
++unreachable_code # unreachable code
+-unreferenced_argument # argument declared but never referenced: {name}
+-unreferenced_function # function is declared but never referenced: {name}
++unreferenced_variable # variable is declared but never referenced: {name}
++unsupported_version # JavaScript {version} is not supported
++use_of_label # use of label
+useless_assign # useless assignment
-+ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity
-+ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent)
-+missing_default_case # missing default case in switch statement
-+duplicate_case_in_switch # duplicate case in switch statements
-+default_not_at_end # the default case is not at the end of the switch statement
-+legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax
-+jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax
+useless_comparison # useless comparison; comparing identical expressions
+-useless_quotes # the quotation marks are unnecessary
++useless_void # use of the void type may be unnecessary (void is always undefined)
++var_hides_arg # variable {name} hides argument
++want_assign_or_call # expected an assignment or function call
+with_statement # with statement hides undeclared variables; use temporary variable instead
-+trailing_comma_in_array # extra comma is not recommended in array initializers
-+assign_to_function_call # assignment to a function call
-+parseint_missing_radix # parseInt missing radix parameter
--unreferenced_argument # argument declared but never referenced: {name}
+
### Output format
# Customize the format of the error message.
# __FILE__ indicates current file path
# __FILENAME__ indicates current file name
# __LINE__ indicates current line
-# __ERROR__ indicates error message
+# __COL__ indicates current column
+# __ERROR__ indicates error message (__ERROR_PREFIX__: __ERROR_MSG__)
+# __ERROR_NAME__ indicates error name (used in configuration file)
+# __ERROR_PREFIX__ indicates error prefix
+# __ERROR_MSG__ indicates error message
+#
+# For machine-friendly output, the output format can be prefixed with
+# "encode:". If specified, all items will be encoded with C-slashes.
#
# Visual Studio syntax (default):
+output-format __FILE__(__LINE__): __ERROR__
@@ -74,33 +91,13 @@
+context
-### Semicolons
-# By default, assignments of an anonymous function to a variable or
-# property (such as a function prototype) must be followed by a semicolon.
-#
-#+lambda_assign_requires_semicolon # deprecated setting
-
-
### Control Comments
# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for
# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is
# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason,
# although legacy control comments are enabled by default for backward compatibility.
#
-+legacy_control_comments
-
-
-### JScript Function Extensions
-# JScript allows member functions to be defined like this:
-# function MyObj() { /*constructor*/ }
-# function MyObj.prototype.go() { /*member function*/ }
-#
-# It also allows events to be attached like this:
-# function window::onload() { /*init page*/ }
-#
-# This is a Microsoft-only JavaScript extension. Enable this setting to allow them.
-#
-#-jscript_function_extensions # deprecated setting
+-legacy_control_comments
### Defining identifiers
@@ -112,13 +109,24 @@
# (Use this in conjunction with the "undeclared identifier" warning.)
#
# Common uses for webpages might be:
-#+define window
-#+define document
-+define require
-+define exports
++define __dirname
++define clearInterval
++define clearTimeout
+define console
++define exports
++define global
++define process
++define require
++define setInterval
++define setTimeout
+define Buffer
+define JSON
++define Math
+
+### JavaScript Version
+# To change the default JavaScript version:
+#+default-type text/javascript;version=1.5
+#+default-type text/javascript;e4x=1
### Files
# Specify which files to lint
@@ -126,4 +134,4 @@
# To add a set of files, use "+process FileName", "+process Folder\Path\*.js",
# or "+process Folder\Path\*.htm".
#
-#+process jsl-test.js
+
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/lib/extsprintf.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/lib/extsprintf.js
new file mode 100644
index 000000000..61ff891de
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/lib/extsprintf.js
@@ -0,0 +1,166 @@
+/*
+ * extsprintf.js: extended POSIX-style sprintf
+ */
+
+var mod_assert = require('assert');
+var mod_util = require('util');
+
+/*
+ * Public interface
+ */
+exports.sprintf = jsSprintf;
+
+/*
+ * Stripped down version of s[n]printf(3c). We make a best effort to throw an
+ * exception when given a format string we don't understand, rather than
+ * ignoring it, so that we won't break existing programs if/when we go implement
+ * the rest of this.
+ *
+ * This implementation currently supports specifying
+ * - field alignment ('-' flag),
+ * - zero-pad ('0' flag)
+ * - always show numeric sign ('+' flag),
+ * - field width
+ * - conversions for strings, decimal integers, and floats (numbers).
+ * - argument size specifiers. These are all accepted but ignored, since
+ * Javascript has no notion of the physical size of an argument.
+ *
+ * Everything else is currently unsupported, most notably precision, unsigned
+ * numbers, non-decimal numbers, and characters.
+ */
+function jsSprintf(fmt)
+{
+ var regex = [
+ '([^%]*)', /* normal text */
+ '%', /* start of format */
+ '([\'\\-+ #0]*?)', /* flags (optional) */
+ '([1-9]\\d*)?', /* width (optional) */
+ '(\\.([1-9]\\d*))?', /* precision (optional) */
+ '[lhjztL]*?', /* length mods (ignored) */
+ '([diouxXfFeEgGaAcCsSp%jr])' /* conversion */
+ ].join('');
+
+ var re = new RegExp(regex);
+ var args = Array.prototype.slice.call(arguments, 1);
+ var flags, width, precision, conversion;
+ var left, pad, sign, arg, match;
+ var ret = '';
+ var argn = 1;
+
+ mod_assert.equal('string', typeof (fmt));
+
+ while ((match = re.exec(fmt)) !== null) {
+ ret += match[1];
+ fmt = fmt.substring(match[0].length);
+
+ flags = match[2] || '';
+ width = match[3] || 0;
+ precision = match[4] || '';
+ conversion = match[6];
+ left = false;
+ sign = false;
+ pad = ' ';
+
+ if (conversion == '%') {
+ ret += '%';
+ continue;
+ }
+
+ if (args.length === 0)
+ throw (new Error('too few args to sprintf'));
+
+ arg = args.shift();
+ argn++;
+
+ if (flags.match(/[\' #]/))
+ throw (new Error(
+ 'unsupported flags: ' + flags));
+
+ if (precision.length > 0)
+ throw (new Error(
+ 'non-zero precision not supported'));
+
+ if (flags.match(/-/))
+ left = true;
+
+ if (flags.match(/0/))
+ pad = '0';
+
+ if (flags.match(/\+/))
+ sign = true;
+
+ switch (conversion) {
+ case 's':
+ if (arg === undefined || arg === null)
+ throw (new Error('argument ' + argn +
+ ': attempted to print undefined or null ' +
+ 'as a string'));
+ ret += doPad(pad, width, left, arg.toString());
+ break;
+
+ case 'd':
+ arg = Math.floor(arg);
+ /*jsl:fallthru*/
+ case 'f':
+ sign = sign && arg > 0 ? '+' : '';
+ ret += sign + doPad(pad, width, left,
+ arg.toString());
+ break;
+
+ case 'j': /* non-standard */
+ if (width === 0)
+ width = 10;
+ ret += mod_util.inspect(arg, false, width);
+ break;
+
+ case 'r': /* non-standard */
+ ret += dumpException(arg);
+ break;
+
+ default:
+ throw (new Error('unsupported conversion: ' +
+ conversion));
+ }
+ }
+
+ ret += fmt;
+ return (ret);
+}
+
+function doPad(chr, width, left, str)
+{
+ var ret = str;
+
+ while (ret.length < width) {
+ if (left)
+ ret += chr;
+ else
+ ret = chr + ret;
+ }
+
+ return (ret);
+}
+
+/*
+ * This function dumps long stack traces for exceptions having a cause() method.
+ * See node-verror for an example.
+ */
+function dumpException(ex)
+{
+ var ret;
+
+ if (!(ex instanceof Error))
+ throw (new Error(jsSprintf('invalid type for %%r: %j', ex)));
+
+ /* Note that V8 prepends "ex.stack" with ex.toString(). */
+ ret = 'EXCEPTION: ' + ex.constructor.name + ': ' + ex.stack;
+
+ if (ex.cause && typeof (ex.cause) === 'function') {
+ var cex = ex.cause();
+ if (cex) {
+ ret += '\nCaused by: ' + dumpException(cex);
+ }
+ }
+
+ return (ret);
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/package.json b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/package.json
new file mode 100644
index 000000000..660308afc
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/package.json
@@ -0,0 +1,66 @@
+{
+ "_args": [
+ [
+ "extsprintf@1.0.2",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim"
+ ]
+ ],
+ "_from": "extsprintf@1.0.2",
+ "_id": "extsprintf@1.0.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/jsprim/extsprintf",
+ "_npmUser": {
+ "email": "dap@cs.brown.edu",
+ "name": "dap"
+ },
+ "_npmVersion": "1.1.65",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "extsprintf",
+ "raw": "extsprintf@1.0.2",
+ "rawSpec": "1.0.2",
+ "scope": null,
+ "spec": "1.0.2",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/request/http-signature/jsprim",
+ "/request/http-signature/jsprim/verror"
+ ],
+ "_resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz",
+ "_shasum": "e1080e0658e300b06294990cc70e1502235fd550",
+ "_shrinkwrap": null,
+ "_spec": "extsprintf@1.0.2",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim",
+ "bugs": {
+ "url": "https://github.com/davepacheco/node-extsprintf/issues"
+ },
+ "dependencies": {},
+ "description": "extended POSIX-style sprintf",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "e1080e0658e300b06294990cc70e1502235fd550",
+ "tarball": "http://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz"
+ },
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "homepage": "https://github.com/davepacheco/node-extsprintf#readme",
+ "main": "./lib/extsprintf.js",
+ "maintainers": [
+ {
+ "name": "dap",
+ "email": "dap@cs.brown.edu"
+ }
+ ],
+ "name": "extsprintf",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/davepacheco/node-extsprintf.git"
+ },
+ "version": "1.0.2"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/README.md b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/README.md
new file mode 100644
index 000000000..ccc591b68
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/README.md
@@ -0,0 +1,5 @@
+JSON Schema is a repository for the JSON Schema specification, reference schemas and a CommonJS implementation of JSON Schema (not the only JavaScript implementation of JSON Schema, JSV is another excellent JavaScript validator).
+
+Code is licensed under the AFL or BSD license as part of the Persevere
+project which is administered under the Dojo foundation,
+and all contributions require a Dojo CLA. \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/hyper-schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/hyper-schema
new file mode 100644
index 000000000..12fe26b62
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/hyper-schema
@@ -0,0 +1,68 @@
+{
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-00/links#"},
+ "optional" : true
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "optional" : true,
+ "default" : "dot-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "media-type"
+ },
+
+ "alternate" : {
+ "type" : "array",
+ "items" : {"$ref" : "#"},
+ "optional" : true
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited",
+ "extends" : {"$ref" : "http://json-schema.org/draft-00/schema#"}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/json-ref b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/json-ref
new file mode 100644
index 000000000..0c825bce4
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/json-ref
@@ -0,0 +1,26 @@
+{
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/json-ref#",
+
+ "items" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited"
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/links b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/links
new file mode 100644
index 000000000..c9b551772
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/links
@@ -0,0 +1,33 @@
+{
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string"
+ },
+
+ "rel" : {
+ "type" : "string"
+ },
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET",
+ "optional" : true
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method",
+ "optional" : true
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-00/hyper-schema#"},
+ "optional" : true
+ }
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/schema
new file mode 100644
index 000000000..a3a214436
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/schema
@@ -0,0 +1,155 @@
+{
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "optional" : true,
+ "default" : "any"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "optional" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "optional" : true,
+ "default" : {}
+ },
+
+ "requires" : {
+ "type" : ["string", {"$ref" : "#"}],
+ "optional" : true
+ },
+
+ "minimum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "maximum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "minimumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "minimum",
+ "default" : true
+ },
+
+ "maximumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "maximum",
+ "default" : true
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "pattern" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "regex"
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer",
+ "optional" : true
+ },
+
+ "enum" : {
+ "type" : "array",
+ "optional" : true,
+ "minItems" : 1
+ },
+
+ "title" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "description" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "format" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "contentEncoding" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "default" : {
+ "type" : "any",
+ "optional" : true
+ },
+
+ "maxDecimal" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {"type" : "string"},
+ "optional" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ }
+ },
+
+ "optional" : true,
+ "default" : {}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/hyper-schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/hyper-schema
new file mode 100644
index 000000000..66e835b65
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/hyper-schema
@@ -0,0 +1,68 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-01/links#"},
+ "optional" : true
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "optional" : true,
+ "default" : "dot-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "media-type"
+ },
+
+ "alternate" : {
+ "type" : "array",
+ "items" : {"$ref" : "#"},
+ "optional" : true
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited",
+ "extends" : {"$ref" : "http://json-schema.org/draft-01/schema#"}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/json-ref b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/json-ref
new file mode 100644
index 000000000..f2ad55b1e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/json-ref
@@ -0,0 +1,26 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/json-ref#",
+
+ "items" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited"
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/links b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/links
new file mode 100644
index 000000000..cb183c4d8
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/links
@@ -0,0 +1,33 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string"
+ },
+
+ "rel" : {
+ "type" : "string"
+ },
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET",
+ "optional" : true
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method",
+ "optional" : true
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-01/hyper-schema#"},
+ "optional" : true
+ }
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/schema
new file mode 100644
index 000000000..e6b6aea4e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/schema
@@ -0,0 +1,155 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "optional" : true,
+ "default" : "any"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "optional" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "optional" : true,
+ "default" : {}
+ },
+
+ "requires" : {
+ "type" : ["string", {"$ref" : "#"}],
+ "optional" : true
+ },
+
+ "minimum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "maximum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "minimumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "minimum",
+ "default" : true
+ },
+
+ "maximumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "maximum",
+ "default" : true
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "pattern" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "regex"
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer",
+ "optional" : true
+ },
+
+ "enum" : {
+ "type" : "array",
+ "optional" : true,
+ "minItems" : 1
+ },
+
+ "title" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "description" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "format" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "contentEncoding" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "default" : {
+ "type" : "any",
+ "optional" : true
+ },
+
+ "maxDecimal" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {"type" : "string"},
+ "optional" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ }
+ },
+
+ "optional" : true,
+ "default" : {}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/hyper-schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/hyper-schema
new file mode 100644
index 000000000..2d2bc6853
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/hyper-schema
@@ -0,0 +1,68 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-02/links#"},
+ "optional" : true
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "optional" : true,
+ "default" : "slash-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "media-type"
+ },
+
+ "alternate" : {
+ "type" : "array",
+ "items" : {"$ref" : "#"},
+ "optional" : true
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "slash-delimited",
+ "extends" : {"$ref" : "http://json-schema.org/draft-02/schema#"}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/json-ref b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/json-ref
new file mode 100644
index 000000000..2b23fcdc6
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/json-ref
@@ -0,0 +1,26 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/json-ref#",
+
+ "items" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited"
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/links b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/links
new file mode 100644
index 000000000..ab971b7c2
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/links
@@ -0,0 +1,35 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string"
+ },
+
+ "rel" : {
+ "type" : "string"
+ },
+
+ "targetSchema" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET",
+ "optional" : true
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method",
+ "optional" : true
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
+ "optional" : true
+ }
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/schema
new file mode 100644
index 000000000..cc2b6693b
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/schema
@@ -0,0 +1,166 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "optional" : true,
+ "uniqueItems" : true,
+ "default" : "any"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "optional" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "optional" : true,
+ "default" : {}
+ },
+
+ "requires" : {
+ "type" : ["string", {"$ref" : "#"}],
+ "optional" : true
+ },
+
+ "minimum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "maximum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "minimumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "minimum",
+ "default" : true
+ },
+
+ "maximumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "maximum",
+ "default" : true
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "uniqueItems" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pattern" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "regex"
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer",
+ "optional" : true
+ },
+
+ "enum" : {
+ "type" : "array",
+ "optional" : true,
+ "minItems" : 1,
+ "uniqueItems" : true
+ },
+
+ "title" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "description" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "format" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "contentEncoding" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "default" : {
+ "type" : "any",
+ "optional" : true
+ },
+
+ "divisibleBy" : {
+ "type" : "number",
+ "minimum" : 0,
+ "minimumCanEqual" : false,
+ "optional" : true,
+ "default" : 1
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {"type" : "string"},
+ "optional" : true,
+ "uniqueItems" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ }
+ },
+
+ "optional" : true,
+ "default" : {}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/address b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/address
new file mode 100644
index 000000000..401f20f1c
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/address
@@ -0,0 +1,20 @@
+{
+ "description" : "An Address following the convention of http://microformats.org/wiki/hcard",
+ "type" : "object",
+ "properties" : {
+ "post-office-box" : { "type" : "string" },
+ "extended-address" : { "type" : "string" },
+ "street-address" : { "type":"string" },
+ "locality" : { "type" : "string", "required" : true },
+ "region" : { "type" : "string", "required" : true },
+ "postal-code" : { "type" : "string" },
+ "country-name" : { "type" : "string", "required" : true }
+ },
+ "dependencies" : {
+ "post-office-box" : "street-address",
+ "extended-address" : "street-address",
+ "street-address" : "region",
+ "locality" : "region",
+ "region" : "country-name"
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/calendar b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/calendar
new file mode 100644
index 000000000..0ec47c23c
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/calendar
@@ -0,0 +1,53 @@
+{
+ "description" : "A representation of an event",
+ "type" : "object",
+ "properties" : {
+ "dtstart" : {
+ "format" : "date-time",
+ "type" : "string",
+ "description" : "Event starting time",
+ "required":true
+ },
+ "summary" : {
+ "type":"string",
+ "required":true
+ },
+ "location" : {
+ "type" : "string"
+ },
+ "url" : {
+ "type" : "string",
+ "format" : "url"
+ },
+ "dtend" : {
+ "format" : "date-time",
+ "type" : "string",
+ "description" : "Event ending time"
+ },
+ "duration" : {
+ "format" : "date",
+ "type" : "string",
+ "description" : "Event duration"
+ },
+ "rdate" : {
+ "format" : "date-time",
+ "type" : "string",
+ "description" : "Recurrence date"
+ },
+ "rrule" : {
+ "type" : "string",
+ "description" : "Recurrence rule"
+ },
+ "category" : {
+ "type" : "string"
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "geo" : { "$ref" : "http://json-schema.org/draft-03/geo" }
+ }
+}
+
+
+
+
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/card b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/card
new file mode 100644
index 000000000..a5667ffdd
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/card
@@ -0,0 +1,105 @@
+{
+ "description":"A representation of a person, company, organization, or place",
+ "type":"object",
+ "properties":{
+ "fn":{
+ "description":"Formatted Name",
+ "type":"string"
+ },
+ "familyName":{
+ "type":"string",
+ "required":true
+ },
+ "givenName":{
+ "type":"string",
+ "required":true
+ },
+ "additionalName":{
+ "type":"array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "honorificPrefix":{
+ "type":"array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "honorificSuffix":{
+ "type":"array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "nickname":{
+ "type":"string"
+ },
+ "url":{
+ "type":"string",
+ "format":"url"
+ },
+ "email":{
+ "type":"object",
+ "properties":{
+ "type":{
+ "type":"string"
+ },
+ "value":{
+ "type":"string",
+ "format":"email"
+ }
+ }
+ },
+ "tel":{
+ "type":"object",
+ "properties":{
+ "type":{
+ "type":"string"
+ },
+ "value":{
+ "type":"string",
+ "format":"phone"
+ }
+ }
+ },
+ "adr":{"$ref" : "http://json-schema.org/address"},
+ "geo":{"$ref" : "http://json-schema.org/geo"},
+ "tz":{
+ "type":"string"
+ },
+ "photo":{
+ "format":"image",
+ "type":"string"
+ },
+ "logo":{
+ "format":"image",
+ "type":"string"
+ },
+ "sound":{
+ "format":"attachment",
+ "type":"string"
+ },
+ "bday":{
+ "type":"string",
+ "format":"date"
+ },
+ "title":{
+ "type":"string"
+ },
+ "role":{
+ "type":"string"
+ },
+ "org":{
+ "type":"object",
+ "properties":{
+ "organizationName":{
+ "type":"string"
+ },
+ "organizationUnit":{
+ "type":"string"
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/geo b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/geo
new file mode 100644
index 000000000..4357a909a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/geo
@@ -0,0 +1,8 @@
+{
+ "description" : "A geographical coordinate",
+ "type" : "object",
+ "properties" : {
+ "latitude" : { "type" : "number" },
+ "longitude" : { "type" : "number" }
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/interfaces b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/interfaces
new file mode 100644
index 000000000..b8532f297
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/interfaces
@@ -0,0 +1,23 @@
+{
+ "extends":"http://json-schema.org/hyper-schema",
+ "description":"A schema for schema interface definitions that describe programmatic class structures using JSON schema syntax",
+ "properties":{
+ "methods":{
+ "type":"object",
+ "description":"This defines the set of methods available to the class instances",
+ "additionalProperties":{
+ "type":"object",
+ "description":"The definition of the method",
+ "properties":{
+ "parameters":{
+ "type":"array",
+ "description":"The set of parameters that should be passed to the method when it is called",
+ "items":{"$ref":"#"},
+ "required": true
+ },
+ "returns":{"$ref":"#"}
+ }
+ }
+ }
+ }
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/hyper-schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/hyper-schema
new file mode 100644
index 000000000..38ca2e103
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/hyper-schema
@@ -0,0 +1,60 @@
+{
+ "$schema" : "http://json-schema.org/draft-03/hyper-schema#",
+ "extends" : {"$ref" : "http://json-schema.org/draft-03/schema#"},
+ "id" : "http://json-schema.org/draft-03/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-03/links#"}
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "default" : "slash-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "contentEncoding" : {
+ "type" : "string"
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "format" : "media-type"
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ },
+
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ }
+ ],
+
+ "fragmentResolution" : "slash-delimited"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/json-ref b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/json-ref
new file mode 100644
index 000000000..66e08f260
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/json-ref
@@ -0,0 +1,26 @@
+{
+ "$schema" : "http://json-schema.org/draft-03/hyper-schema#",
+ "id" : "http://json-schema.org/draft-03/json-ref#",
+
+ "additionalItems" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
+
+ "links" : [
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ },
+
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited"
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/links b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/links
new file mode 100644
index 000000000..9fa63f987
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/links
@@ -0,0 +1,35 @@
+{
+ "$schema" : "http://json-schema.org/draft-03/hyper-schema#",
+ "id" : "http://json-schema.org/draft-03/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string",
+ "required" : true,
+ "format" : "link-description-object-template"
+ },
+
+ "rel" : {
+ "type" : "string",
+ "required" : true
+ },
+
+ "targetSchema" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"},
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET"
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"}
+ }
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/schema
new file mode 100644
index 000000000..29d9469f9
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/schema
@@ -0,0 +1,174 @@
+{
+ "$schema" : "http://json-schema.org/draft-03/schema#",
+ "id" : "http://json-schema.org/draft-03/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "uniqueItems" : true,
+ "default" : "any"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "patternProperties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "additionalItems" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "default" : {}
+ },
+
+ "required" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "dependencies" : {
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : ["string", "array", {"$ref" : "#"}],
+ "items" : {
+ "type" : "string"
+ }
+ },
+ "default" : {}
+ },
+
+ "minimum" : {
+ "type" : "number"
+ },
+
+ "maximum" : {
+ "type" : "number"
+ },
+
+ "exclusiveMinimum" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "exclusiveMaximum" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "minimum" : 0
+ },
+
+ "uniqueItems" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "pattern" : {
+ "type" : "string",
+ "format" : "regex"
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer"
+ },
+
+ "enum" : {
+ "type" : "array",
+ "minItems" : 1,
+ "uniqueItems" : true
+ },
+
+ "default" : {
+ "type" : "any"
+ },
+
+ "title" : {
+ "type" : "string"
+ },
+
+ "description" : {
+ "type" : "string"
+ },
+
+ "format" : {
+ "type" : "string"
+ },
+
+ "divisibleBy" : {
+ "type" : "number",
+ "minimum" : 0,
+ "exclusiveMinimum" : true,
+ "default" : 1
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "uniqueItems" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "id" : {
+ "type" : "string",
+ "format" : "uri"
+ },
+
+ "$ref" : {
+ "type" : "string",
+ "format" : "uri"
+ },
+
+ "$schema" : {
+ "type" : "string",
+ "format" : "uri"
+ }
+ },
+
+ "dependencies" : {
+ "exclusiveMinimum" : "minimum",
+ "exclusiveMaximum" : "maximum"
+ },
+
+ "default" : {}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/hyper-schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/hyper-schema
new file mode 100644
index 000000000..63fb34d93
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/hyper-schema
@@ -0,0 +1,60 @@
+{
+ "$schema" : "http://json-schema.org/draft-04/hyper-schema#",
+ "extends" : {"$ref" : "http://json-schema.org/draft-04/schema#"},
+ "id" : "http://json-schema.org/draft-04/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-04/links#"}
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "default" : "json-pointer"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "contentEncoding" : {
+ "type" : "string"
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "format" : "media-type"
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ },
+
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ }
+ ],
+
+ "fragmentResolution" : "json-pointer"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/links b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/links
new file mode 100644
index 000000000..6c06d2930
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/links
@@ -0,0 +1,41 @@
+{
+ "$schema" : "http://json-schema.org/draft-04/hyper-schema#",
+ "id" : "http://json-schema.org/draft-04/links#",
+ "type" : "object",
+
+ "properties" : {
+ "rel" : {
+ "type" : "string"
+ },
+
+ "href" : {
+ "type" : "string"
+ },
+
+ "template" : {
+ "type" : "string"
+ },
+
+ "targetSchema" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"},
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET"
+ },
+
+ "enctype" : {
+ "type" : "string"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-04/hyper-schema#"}
+ }
+ },
+
+ "required" : ["rel", "href"],
+
+ "dependencies" : {
+ "enctype" : "method"
+ }
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/schema b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/schema
new file mode 100644
index 000000000..4231b1692
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/schema
@@ -0,0 +1,189 @@
+{
+ "$schema" : "http://json-schema.org/draft-04/schema#",
+ "id" : "http://json-schema.org/draft-04/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : [
+ {
+ "id" : "#simple-type",
+ "type" : "string",
+ "enum" : ["object", "array", "string", "number", "boolean", "null", "any"]
+ },
+ "array"
+ ],
+ "items" : {
+ "type" : [
+ {"$ref" : "#simple-type"},
+ {"$ref" : "#"}
+ ]
+ },
+ "uniqueItems" : true,
+ "default" : "any"
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "uniqueItems" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "enum" : {
+ "type" : "array",
+ "minItems" : 1,
+ "uniqueItems" : true
+ },
+
+ "minimum" : {
+ "type" : "number"
+ },
+
+ "maximum" : {
+ "type" : "number"
+ },
+
+ "exclusiveMinimum" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "exclusiveMaximum" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "divisibleBy" : {
+ "type" : "number",
+ "minimum" : 0,
+ "exclusiveMinimum" : true,
+ "default" : 1
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer"
+ },
+
+ "pattern" : {
+ "type" : "string"
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "additionalItems" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "default" : {}
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "minimum" : 0
+ },
+
+ "uniqueItems" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "patternProperties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "default" : {}
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "default" : {}
+ },
+
+ "minProperties" : {
+ "type" : "integer",
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxProperties" : {
+ "type" : "integer",
+ "minimum" : 0
+ },
+
+ "required" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ },
+
+ "dependencies" : {
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : ["string", "array", {"$ref" : "#"}],
+ "items" : {
+ "type" : "string"
+ }
+ },
+ "default" : {}
+ },
+
+ "id" : {
+ "type" : "string"
+ },
+
+ "$ref" : {
+ "type" : "string"
+ },
+
+ "$schema" : {
+ "type" : "string"
+ },
+
+ "title" : {
+ "type" : "string"
+ },
+
+ "description" : {
+ "type" : "string"
+ },
+
+ "default" : {
+ "type" : "any"
+ }
+ },
+
+ "dependencies" : {
+ "exclusiveMinimum" : "minimum",
+ "exclusiveMaximum" : "maximum"
+ },
+
+ "default" : {}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-03.xml b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-03.xml
new file mode 100644
index 000000000..cf6062081
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-03.xml
@@ -0,0 +1,1120 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
+<!ENTITY rfc4627 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4627.xml">
+<!ENTITY rfc3986 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml">
+<!ENTITY rfc2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
+<!ENTITY rfc4287 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4287.xml">
+<!ENTITY rfc2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml">
+<!ENTITY rfc3339 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3339.xml">
+<!ENTITY rfc2045 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2045.xml">
+<!ENTITY rfc5226 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
+<!ENTITY rfc2396 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2396.xml">
+<!ENTITY iddiscovery SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.hammer-discovery.xml">
+<!ENTITY uritemplate SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.gregorio-uritemplate.xml">
+<!ENTITY linkheader SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.nottingham-http-link-header.xml">
+<!ENTITY html401 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.REC-html401-19991224.xml">
+<!ENTITY css21 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.CR-CSS21-20070719.xml">
+]>
+<?rfc toc="yes"?>
+<?rfc symrefs="yes"?>
+<?rfc compact="yes"?>
+<?rfc subcompact="no"?>
+<?rfc strict="no"?>
+<?rfc rfcedstyle="yes"?>
+<rfc category="info" docName="draft-zyp-json-schema-03" ipr="trust200902">
+ <front>
+ <title abbrev="JSON Schema Media Type">A JSON Media Type for Describing the Structure and Meaning of JSON Documents</title>
+
+ <author fullname="Kris Zyp" initials="K" role="editor" surname="Zyp">
+ <organization>SitePen (USA)</organization>
+ <address>
+ <postal>
+ <street>530 Lytton Avenue</street>
+ <city>Palo Alto, CA 94301</city>
+ <country>USA</country>
+ </postal>
+ <phone>+1 650 968 8787</phone>
+ <email>kris@sitepen.com</email>
+ </address>
+ </author>
+
+ <author fullname="Gary Court" initials="G" surname="Court">
+ <address>
+ <postal>
+ <street></street>
+ <city>Calgary, AB</city>
+ <country>Canada</country>
+ </postal>
+ <email>gary.court@gmail.com</email>
+ </address>
+ </author>
+
+ <date year="2011" />
+ <workgroup>Internet Engineering Task Force</workgroup>
+ <keyword>JSON</keyword>
+ <keyword>Schema</keyword>
+ <keyword>JavaScript</keyword>
+ <keyword>Object</keyword>
+ <keyword>Notation</keyword>
+ <keyword>Hyper Schema</keyword>
+ <keyword>Hypermedia</keyword>
+
+ <abstract>
+ <t>
+ JSON (JavaScript Object Notation) Schema defines the media type "application/schema+json",
+ a JSON based format for defining
+ the structure of JSON data. JSON Schema provides a contract for what JSON
+ data is required for a given application and how to interact with it. JSON
+ Schema is intended to define validation, documentation, hyperlink
+ navigation, and interaction control of JSON data.
+ </t>
+ </abstract>
+ </front>
+
+ <middle>
+ <section title="Introduction">
+ <t>
+ JSON (JavaScript Object Notation) Schema is a JSON media type for defining
+ the structure of JSON data. JSON Schema provides a contract for what JSON
+ data is required for a given application and how to interact with it. JSON
+ Schema is intended to define validation, documentation, hyperlink
+ navigation, and interaction control of JSON data.
+ </t>
+ </section>
+
+ <section title="Conventions">
+ <t>
+ <!-- The text in this section has been copied from the official boilerplate,
+ and should not be modified.-->
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
+ "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
+ interpreted as described in <xref target="RFC2119">RFC 2119</xref>.
+ </t>
+ </section>
+
+ <!-- ********************************************* -->
+
+ <section title="Overview">
+ <t>
+ JSON Schema defines the media type "application/schema+json" for
+ describing the structure of other
+ JSON documents. JSON Schema is JSON-based and includes facilities
+ for describing the structure of JSON documents in terms of
+ allowable values, descriptions, and interpreting relations with other resources.
+ </t>
+ <t>
+ JSON Schema format is organized into several separate definitions. The first
+ definition is the core schema specification. This definition is primary
+ concerned with describing a JSON structure and specifying valid elements
+ in the structure. The second definition is the Hyper Schema specification
+ which is intended define elements in a structure that can be interpreted as
+ hyperlinks.
+ Hyper Schema builds on JSON Schema to describe the hyperlink structure of
+ other JSON documents and elements of interaction. This allows user agents to be able to successfully navigate
+ JSON documents based on their schemas.
+ </t>
+ <t>
+ Cumulatively JSON Schema acts as a meta-document that can be used to define the required type and constraints on
+ property values, as well as define the meaning of the property values
+ for the purpose of describing a resource and determining hyperlinks
+ within the representation.
+ </t>
+ <figure>
+ <preamble>An example JSON Schema that describes products might look like:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "title": "Product",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "Product identifier",
+ "required": true
+ },
+ "name": {
+ "description": "Name of the product",
+ "type": "string",
+ "required": true
+ },
+ "price": {
+ "required": true,
+ "type": "number",
+ "minimum": 0,
+ "required": true
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "links": [{
+ "rel": "full",
+ "href": "{id}"
+ }, {
+ "rel": "comments",
+ "href": "comments/?id={id}"
+ }]
+}
+]]>
+ </artwork>
+ <postamble>
+ This schema defines the properties of the instance JSON documents,
+ the required properties (id, name, and price), as well as an optional
+ property (tags). This also defines the link relations of the instance
+ JSON documents.
+ </postamble>
+ </figure>
+
+ <section title="Terminology">
+ <t>
+ For this specification, <spanx style="strong">schema</spanx> will be used to denote a JSON Schema
+ definition, and an <spanx style="strong">instance</spanx> refers to a JSON value that the schema
+ will be describing and validating.
+ </t>
+ </section>
+
+ <section title="Design Considerations">
+ <t>
+ The JSON Schema media type does not attempt to dictate the structure of JSON
+ representations that contain data, but rather provides a separate format
+ for flexibly communicating how a JSON representation should be
+ interpreted and validated, such that user agents can properly understand
+ acceptable structures and extrapolate hyperlink information
+ with the JSON document. It is acknowledged that JSON documents come
+ in a variety of structures, and JSON is unique in that the structure
+ of stored data structures often prescribes a non-ambiguous definite
+ JSON representation. Attempting to force a specific structure is generally
+ not viable, and therefore JSON Schema allows for a great flexibility
+ in the structure of the JSON data that it describes.
+ </t>
+ <t>
+ This specification is protocol agnostic.
+ The underlying protocol (such as HTTP) should sufficiently define the
+ semantics of the client-server interface, the retrieval of resource
+ representations linked to by JSON representations, and modification of
+ those resources. The goal of this
+ format is to sufficiently describe JSON structures such that one can
+ utilize existing information available in existing JSON
+ representations from a large variety of services that leverage a representational state transfer
+ architecture using existing protocols.
+ </t>
+ </section>
+ </section>
+
+ <section title="Schema/Instance Association">
+ <t>
+ JSON Schema instances are correlated to their schema by the "describedby"
+ relation, where the schema is defined to be the target of the relation.
+ Instance representations may be of the "application/json" media type or
+ any other subtype. Consequently, dictating how an instance
+ representation should specify the relation to the schema is beyond the normative scope
+ of this document (since this document specifically defines the JSON
+ Schema media type, and no other), but it is recommended that instances
+ specify their schema so that user agents can interpret the instance
+ representation and messages may retain the self-descriptive
+ characteristic, avoiding the need for out-of-band information about
+ instance data. Two approaches are recommended for declaring the
+ relation to the schema that describes the meaning of a JSON instance's (or collection
+ of instances) structure. A MIME type parameter named
+ "profile" or a relation of "describedby" (which could be defined by a Link header) may be used:
+
+ <figure>
+ <artwork>
+<![CDATA[
+Content-Type: application/my-media-type+json;
+ profile=http://json.com/my-hyper-schema
+]]>
+ </artwork>
+ </figure>
+
+ or if the content is being transferred by a protocol (such as HTTP) that
+ provides headers, a Link header can be used:
+
+ <figure>
+ <artwork>
+<![CDATA[
+Link: <http://json.com/my-hyper-schema>; rel="describedby"
+]]>
+ </artwork>
+ </figure>
+
+ Instances MAY specify multiple schemas, to indicate all the schemas that
+ are applicable to the data, and the data SHOULD be valid by all the schemas.
+ The instance data MAY have multiple schemas
+ that it is defined by (the instance data SHOULD be valid for those schemas).
+ Or if the document is a collection of instances, the collection MAY contain
+ instances from different schemas. When collections contain heterogeneous
+ instances, the "pathStart" attribute MAY be specified in the
+ schema to disambiguate which schema should be applied for each item in the
+ collection. However, ultimately, the mechanism for referencing a schema is up to the
+ media type of the instance documents (if they choose to specify that schemas
+ can be referenced).
+ </t>
+
+ <section title="Self-Descriptive Schema">
+ <t>
+ JSON Schemas can themselves be described using JSON Schemas.
+ A self-describing JSON Schema for the core JSON Schema can
+ be found at <eref target="http://json-schema.org/schema">http://json-schema.org/schema</eref> for the latest version or
+ <eref target="http://json-schema.org/draft-03/schema">http://json-schema.org/draft-03/schema</eref> for the draft-03 version. The hyper schema
+ self-description can be found at <eref target="http://json-schema.org/hyper-schema">http://json-schema.org/hyper-schema</eref>
+ or <eref target="http://json-schema.org/draft-03/hyper-schema">http://json-schema.org/draft-03/hyper-schema</eref>. All schemas
+ used within a protocol with media type definitions
+ SHOULD include a MIME parameter that refers to the self-descriptive
+ hyper schema or another schema that extends this hyper schema:
+
+ <figure>
+ <artwork>
+<![CDATA[
+Content-Type: application/json;
+ profile=http://json-schema.org/draft-03/hyper-schema
+]]>
+ </artwork>
+ </figure>
+ </t>
+ </section>
+ </section>
+
+ <section title="Core Schema Definition">
+ <t>
+ A JSON Schema is a JSON Object that defines various attributes
+ (including usage and valid values) of a JSON value. JSON
+ Schema has recursive capabilities; there are a number of elements
+ in the structure that allow for nested JSON Schemas.
+ </t>
+
+ <figure>
+ <preamble>An example JSON Schema definition could look like:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "description": "A person",
+ "type": "object",
+
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "age": {
+ "type": "integer",
+ "maximum": 125
+ }
+ }
+}
+]]>
+ </artwork>
+ </figure>
+
+ <t>
+ A JSON Schema object may have any of the following properties, called schema
+ attributes (all attributes are optional):
+ </t>
+
+ <section title="type">
+ <t>
+ This attribute defines what the primitive type or the schema of the instance MUST be in order to validate.
+ This attribute can take one of two forms:
+
+ <list style="hanging">
+ <t hangText="Simple Types">
+ A string indicating a primitive or simple type. The following are acceptable string values:
+
+ <list style="hanging">
+ <t hangText="string">Value MUST be a string.</t>
+ <t hangText="number">Value MUST be a number, floating point numbers are allowed. </t>
+ <t hangText="integer">Value MUST be an integer, no floating point numbers are allowed. This is a subset of the number type.</t>
+ <t hangText="boolean">Value MUST be a boolean. </t>
+ <t hangText="object">Value MUST be an object.</t>
+ <t hangText="array">Value MUST be an array.</t>
+ <t hangText="null">Value MUST be null. Note this is mainly for purpose of being able use union types to define nullability. If this type is not included in a union, null values are not allowed (the primitives listed above do not allow nulls on their own).</t>
+ <t hangText="any">Value MAY be of any type including null.</t>
+ </list>
+
+ If the property is not defined or is not in this list, then any type of value is acceptable.
+ Other type values MAY be used for custom purposes, but minimal validators of the specification
+ implementation can allow any instance value on unknown type values.
+ </t>
+
+ <t hangText="Union Types">
+ An array of two or more simple type definitions. Each item in the array MUST be a simple type definition or a schema.
+ The instance value is valid if it is of the same type as one of the simple type definitions, or valid by one of the schemas, in the array.
+ </t>
+ </list>
+ </t>
+
+ <figure>
+ <preamble>For example, a schema that defines if an instance can be a string or a number would be:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "type": ["string", "number"]
+}
+]]></artwork>
+ </figure>
+ </section>
+
+ <section title="properties" anchor="properties">
+ <t>This attribute is an object with property definitions that define the valid values of instance object property values. When the instance value is an object, the property values of the instance object MUST conform to the property definitions in this object. In this object, each property definition's value MUST be a schema, and the property's name MUST be the name of the instance property that it defines. The instance property value MUST be valid according to the schema from the property definition. Properties are considered unordered, the order of the instance properties MAY be in any order.</t>
+ </section>
+
+ <section title="patternProperties">
+ <t>This attribute is an object that defines the schema for a set of property names of an object instance. The name of each property of this attribute's object is a regular expression pattern in the ECMA 262/Perl 5 format, while the value is a schema. If the pattern matches the name of a property on the instance object, the value of the instance's property MUST be valid against the pattern name's schema value.</t>
+ </section>
+
+ <section title="additionalProperties" anchor="additionalProperties">
+ <t>This attribute defines a schema for all properties that are not explicitly defined in an object type definition. If specified, the value MUST be a schema or a boolean. If false is provided, no additional properties are allowed beyond the properties defined in the schema. The default value is an empty schema which allows any value for additional properties.</t>
+ </section>
+
+ <section title="items">
+ <t>This attribute defines the allowed items in an instance array, and MUST be a schema or an array of schemas. The default value is an empty schema which allows any value for items in the instance array.</t>
+ <t>When this attribute value is a schema and the instance value is an array, then all the items in the array MUST be valid according to the schema.</t>
+ <t>When this attribute value is an array of schemas and the instance value is an array, each position in the instance array MUST conform to the schema in the corresponding position for this array. This called tuple typing. When tuple typing is used, additional items are allowed, disallowed, or constrained by the <xref target="additionalItems">"additionalItems"</xref> attribute using the same rules as <xref target="additionalProperties">"additionalProperties"</xref> for objects.</t>
+ </section>
+
+ <section title="additionalItems" anchor="additionalItems">
+ <t>This provides a definition for additional items in an array instance when tuple definitions of the items is provided. This can be false to indicate additional items in the array are not allowed, or it can be a schema that defines the schema of the additional items.</t>
+ </section>
+
+ <section title="required">
+ <t>This attribute indicates if the instance must have a value, and not be undefined. This is false by default, making the instance optional.</t>
+ </section>
+
+ <section title="dependencies">
+ <t>This attribute is an object that defines the requirements of a property on an instance object. If an object instance has a property with the same name as a property in this attribute's object, then the instance must be valid against the attribute's property value (hereafter referred to as the "dependency value").</t>
+ <t>
+ The dependency value can take one of two forms:
+
+ <list style="hanging">
+ <t hangText="Simple Dependency">
+ If the dependency value is a string, then the instance object MUST have a property with the same name as the dependency value.
+ If the dependency value is an array of strings, then the instance object MUST have a property with the same name as each string in the dependency value's array.
+ </t>
+ <t hangText="Schema Dependency">
+ If the dependency value is a schema, then the instance object MUST be valid against the schema.
+ </t>
+ </list>
+ </t>
+ </section>
+
+ <section title="minimum">
+ <t>This attribute defines the minimum value of the instance property when the type of the instance value is a number.</t>
+ </section>
+
+ <section title="maximum">
+ <t>This attribute defines the maximum value of the instance property when the type of the instance value is a number.</t>
+ </section>
+
+ <section title="exclusiveMinimum">
+ <t>This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "minimum" attribute. This is false by default, meaning the instance value can be greater then or equal to the minimum value.</t>
+ </section>
+
+ <section title="exclusiveMaximum">
+ <t>This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "maximum" attribute. This is false by default, meaning the instance value can be less then or equal to the maximum value.</t>
+ </section>
+
+ <section title="minItems">
+ <t>This attribute defines the minimum number of values in an array when the array is the instance value.</t>
+ </section>
+
+ <section title="maxItems">
+ <t>This attribute defines the maximum number of values in an array when the array is the instance value.</t>
+ </section>
+
+ <section title="uniqueItems" anchor="uniqueItems">
+ <t>This attribute indicates that all items in an array instance MUST be unique (contains no two identical values).</t>
+ <t>
+ Two instance are consider equal if they are both of the same type and:
+
+ <list>
+ <t>are null; or</t>
+ <t>are booleans/numbers/strings and have the same value; or</t>
+ <t>are arrays, contains the same number of items, and each item in the array is equal to the corresponding item in the other array; or</t>
+ <t>are objects, contains the same property names, and each property in the object is equal to the corresponding property in the other object.</t>
+ </list>
+ </t>
+ </section>
+
+ <section title="pattern">
+ <t>When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid. Regular expressions SHOULD follow the regular expression specification from ECMA 262/Perl 5</t>
+ </section>
+
+ <section title="minLength">
+ <t>When the instance value is a string, this defines the minimum length of the string.</t>
+ </section>
+
+ <section title="maxLength">
+ <t>When the instance value is a string, this defines the maximum length of the string.</t>
+ </section>
+
+ <section title="enum">
+ <t>This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value. If this attribute is defined, the instance value MUST be one of the values in the array in order for the schema to be valid. Comparison of enum values uses the same algorithm as defined in <xref target="uniqueItems">"uniqueItems"</xref>.</t>
+ </section>
+
+ <section title="default">
+ <t>This attribute defines the default value of the instance when the instance is undefined.</t>
+ </section>
+
+ <section title="title">
+ <t>This attribute is a string that provides a short description of the instance property.</t>
+ </section>
+
+ <section title="description">
+ <t>This attribute is a string that provides a full description of the of purpose the instance property.</t>
+ </section>
+
+ <section title="format">
+ <t>This property defines the type of data, content type, or microformat to be expected in the instance property values. A format attribute MAY be one of the values listed below, and if so, SHOULD adhere to the semantics describing for the format. A format SHOULD only be used to give meaning to primitive types (string, integer, number, or boolean). Validators MAY (but are not required to) validate that the instance values conform to a format.</t>
+
+ <t>
+ The following formats are predefined:
+
+ <list style="hanging">
+ <t hangText="date-time">This SHOULD be a date in ISO 8601 format of YYYY-MM-DDThh:mm:ssZ in UTC time. This is the recommended form of date/timestamp.</t>
+ <t hangText="date">This SHOULD be a date in the format of YYYY-MM-DD. It is recommended that you use the "date-time" format instead of "date" unless you need to transfer only the date part.</t>
+ <t hangText="time">This SHOULD be a time in the format of hh:mm:ss. It is recommended that you use the "date-time" format instead of "time" unless you need to transfer only the time part.</t>
+ <t hangText="utc-millisec">This SHOULD be the difference, measured in milliseconds, between the specified time and midnight, 00:00 of January 1, 1970 UTC. The value SHOULD be a number (integer or float).</t>
+ <t hangText="regex">A regular expression, following the regular expression specification from ECMA 262/Perl 5.</t>
+ <t hangText="color">This is a CSS color (like "#FF0000" or "red"), based on <xref target="W3C.CR-CSS21-20070719">CSS 2.1</xref>.</t>
+ <t hangText="style">This is a CSS style definition (like "color: red; background-color:#FFF"), based on <xref target="W3C.CR-CSS21-20070719">CSS 2.1</xref>.</t>
+ <t hangText="phone">This SHOULD be a phone number (format MAY follow E.123).</t>
+ <t hangText="uri">This value SHOULD be a URI.</t>
+ <t hangText="email">This SHOULD be an email address.</t>
+ <t hangText="ip-address">This SHOULD be an ip version 4 address.</t>
+ <t hangText="ipv6">This SHOULD be an ip version 6 address.</t>
+ <t hangText="host-name">This SHOULD be a host-name.</t>
+ </list>
+ </t>
+
+ <t>Additional custom formats MAY be created. These custom formats MAY be expressed as an URI, and this URI MAY reference a schema of that format.</t>
+ </section>
+
+ <section title="divisibleBy">
+ <t>This attribute defines what value the number instance must be divisible by with no remainder (the result of the division must be an integer.) The value of this attribute SHOULD NOT be 0.</t>
+ </section>
+
+ <section title="disallow">
+ <t>This attribute takes the same values as the "type" attribute, however if the instance matches the type or if this value is an array and the instance matches any type or schema in the array, then this instance is not valid.</t>
+ </section>
+
+ <section title="extends">
+ <t>The value of this property MUST be another schema which will provide a base schema which the current schema will inherit from. The inheritance rules are such that any instance that is valid according to the current schema MUST be valid according to the referenced schema. This MAY also be an array, in which case, the instance MUST be valid for all the schemas in the array. A schema that extends another schema MAY define additional attributes, constrain existing attributes, or add other constraints.</t>
+ <t>
+ Conceptually, the behavior of extends can be seen as validating an
+ instance against all constraints in the extending schema as well as
+ the extended schema(s). More optimized implementations that merge
+ schemas are possible, but are not required. Some examples of using "extends":
+
+ <figure>
+ <artwork>
+<![CDATA[
+{
+ "description": "An adult",
+ "properties": {
+ "age": {
+ "minimum": 21
+ }
+ },
+ "extends": {"$ref": "person"}
+}
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <artwork>
+<![CDATA[
+{
+ "description": "Extended schema",
+ "properties": {
+ "deprecated": {
+ "type": "boolean"
+ }
+ },
+ "extends": {"$ref": "http://json-schema.org/draft-03/schema"}
+}
+]]>
+ </artwork>
+ </figure>
+ </t>
+ </section>
+
+ <section title="id">
+ <t>
+ This attribute defines the current URI of this schema (this attribute is
+ effectively a "self" link). This URI MAY be relative or absolute. If
+ the URI is relative it is resolved against the current URI of the parent
+ schema it is contained in. If this schema is not contained in any
+ parent schema, the current URI of the parent schema is held to be the
+ URI under which this schema was addressed. If id is missing, the current URI of a schema is
+ defined to be that of the parent schema. The current URI of the schema
+ is also used to construct relative references such as for $ref.
+ </t>
+ </section>
+
+ <section title="$ref">
+ <t>
+ This attribute defines a URI of a schema that contains the full representation of this schema.
+ When a validator encounters this attribute, it SHOULD replace the current schema with the schema referenced by the value's URI (if known and available) and re-validate the instance.
+ This URI MAY be relative or absolute, and relative URIs SHOULD be resolved against the URI of the current schema.
+ </t>
+ </section>
+
+ <section title="$schema">
+ <t>
+ This attribute defines a URI of a JSON Schema that is the schema of the current schema.
+ When this attribute is defined, a validator SHOULD use the schema referenced by the value's URI (if known and available) when resolving <xref target="hyper-schema">Hyper Schema</xref><xref target="links">links</xref>.
+ </t>
+
+ <t>
+ A validator MAY use this attribute's value to determine which version of JSON Schema the current schema is written in, and provide the appropriate validation features and behavior.
+ Therefore, it is RECOMMENDED that all schema authors include this attribute in their schemas to prevent conflicts with future JSON Schema specification changes.
+ </t>
+ </section>
+ </section>
+
+ <section title="Hyper Schema" anchor="hyper-schema">
+ <t>
+ The following attributes are specified in addition to those
+ attributes that already provided by the core schema with the specific
+ purpose of informing user agents of relations between resources based
+ on JSON data. Just as with JSON
+ schema attributes, all the attributes in hyper schemas are optional.
+ Therefore, an empty object is a valid (non-informative) schema, and
+ essentially describes plain JSON (no constraints on the structures).
+ Addition of attributes provides additive information for user agents.
+ </t>
+
+ <section title="links" anchor="links">
+ <t>
+ The value of the links property MUST be an array, where each item
+ in the array is a link description object which describes the link
+ relations of the instances.
+ </t>
+
+ <section title="Link Description Object">
+ <t>
+ A link description object is used to describe link relations. In
+ the context of a schema, it defines the link relations of the
+ instances of the schema, and can be parameterized by the instance
+ values. The link description format can be used on its own in
+ regular (non-schema documents), and use of this format can
+ be declared by referencing the normative link description
+ schema as the the schema for the data structure that uses the
+ links. The URI of the normative link description schema is:
+ <eref target="http://json-schema.org/links">http://json-schema.org/links</eref> (latest version) or
+ <eref target="http://json-schema.org/draft-03/links">http://json-schema.org/draft-03/links</eref> (draft-03 version).
+ </t>
+
+ <section title="href">
+ <t>
+ The value of the "href" link description property
+ indicates the target URI of the related resource. The value
+ of the instance property SHOULD be resolved as a URI-Reference per <xref target="RFC3986">RFC 3986</xref>
+ and MAY be a relative URI. The base URI to be used for relative resolution
+ SHOULD be the URI used to retrieve the instance object (not the schema)
+ when used within a schema. Also, when links are used within a schema, the URI
+ SHOULD be parametrized by the property values of the instance
+ object, if property values exist for the corresponding variables
+ in the template (otherwise they MAY be provided from alternate sources, like user input).
+ </t>
+
+ <t>
+ Instance property values SHOULD be substituted into the URIs where
+ matching braces ('{', '}') are found surrounding zero or more characters,
+ creating an expanded URI. Instance property value substitutions are resolved
+ by using the text between the braces to denote the property name
+ from the instance to get the value to substitute.
+
+ <figure>
+ <preamble>For example, if an href value is defined:</preamble>
+ <artwork>
+<![CDATA[
+http://somesite.com/{id}
+]]>
+ </artwork>
+ <postamble>Then it would be resolved by replace the value of the "id" property value from the instance object.</postamble>
+ </figure>
+
+ <figure>
+ <preamble>If the value of the "id" property was "45", the expanded URI would be:</preamble>
+ <artwork>
+<![CDATA[
+http://somesite.com/45
+]]>
+ </artwork>
+ </figure>
+
+ If matching braces are found with the string "@" (no quotes) between the braces, then the
+ actual instance value SHOULD be used to replace the braces, rather than a property value.
+ This should only be used in situations where the instance is a scalar (string,
+ boolean, or number), and not for objects or arrays.
+ </t>
+ </section>
+
+ <section title="rel">
+ <t>
+ The value of the "rel" property indicates the name of the
+ relation to the target resource. The relation to the target SHOULD be interpreted as specifically from the instance object that the schema (or sub-schema) applies to, not just the top level resource that contains the object within its hierarchy. If a resource JSON representation contains a sub object with a property interpreted as a link, that sub-object holds the relation with the target. A relation to target from the top level resource MUST be indicated with the schema describing the top level JSON representation.
+ </t>
+
+ <t>
+ Relationship definitions SHOULD NOT be media type dependent, and users are encouraged to utilize existing accepted relation definitions, including those in existing relation registries (see <xref target="RFC4287">RFC 4287</xref>). However, we define these relations here for clarity of normative interpretation within the context of JSON hyper schema defined relations:
+
+ <list style="hanging">
+ <t hangText="self">
+ If the relation value is "self", when this property is encountered in
+ the instance object, the object represents a resource and the instance object is
+ treated as a full representation of the target resource identified by
+ the specified URI.
+ </t>
+
+ <t hangText="full">
+ This indicates that the target of the link is the full representation for the instance object. The object that contains this link possibly may not be the full representation.
+ </t>
+
+ <t hangText="describedby">
+ This indicates the target of the link is the schema for the instance object. This MAY be used to specifically denote the schemas of objects within a JSON object hierarchy, facilitating polymorphic type data structures.
+ </t>
+
+ <t hangText="root">
+ This relation indicates that the target of the link
+ SHOULD be treated as the root or the body of the representation for the
+ purposes of user agent interaction or fragment resolution. All other
+ properties of the instance objects can be regarded as meta-data
+ descriptions for the data.
+ </t>
+ </list>
+ </t>
+
+ <t>
+ The following relations are applicable for schemas (the schema as the "from" resource in the relation):
+
+ <list style="hanging">
+ <t hangText="instances">This indicates the target resource that represents collection of instances of a schema.</t>
+ <t hangText="create">This indicates a target to use for creating new instances of a schema. This link definition SHOULD be a submission link with a non-safe method (like POST).</t>
+ </list>
+ </t>
+
+ <t>
+ <figure>
+ <preamble>For example, if a schema is defined:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "links": [{
+ "rel": "self",
+ "href": "{id}"
+ }, {
+ "rel": "up",
+ "href": "{upId}"
+ }, {
+ "rel": "children",
+ "href": "?upId={id}"
+ }]
+}
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <preamble>And if a collection of instance resource's JSON representation was retrieved:</preamble>
+ <artwork>
+<![CDATA[
+GET /Resource/
+
+[{
+ "id": "thing",
+ "upId": "parent"
+}, {
+ "id": "thing2",
+ "upId": "parent"
+}]
+]]>
+ </artwork>
+ </figure>
+
+ This would indicate that for the first item in the collection, its own
+ (self) URI would resolve to "/Resource/thing" and the first item's "up"
+ relation SHOULD be resolved to the resource at "/Resource/parent".
+ The "children" collection would be located at "/Resource/?upId=thing".
+ </t>
+ </section>
+
+ <section title="targetSchema">
+ <t>This property value is a schema that defines the expected structure of the JSON representation of the target of the link.</t>
+ </section>
+
+ <section title="Submission Link Properties">
+ <t>
+ The following properties also apply to link definition objects, and
+ provide functionality analogous to HTML forms, in providing a
+ means for submitting extra (often user supplied) information to send to a server.
+ </t>
+
+ <section title="method">
+ <t>
+ This attribute defines which method can be used to access the target resource.
+ In an HTTP environment, this would be "GET" or "POST" (other HTTP methods
+ such as "PUT" and "DELETE" have semantics that are clearly implied by
+ accessed resources, and do not need to be defined here).
+ This defaults to "GET".
+ </t>
+ </section>
+
+ <section title="enctype">
+ <t>
+ If present, this property indicates a query media type format that the server
+ supports for querying or posting to the collection of instances at the target
+ resource. The query can be
+ suffixed to the target URI to query the collection with
+ property-based constraints on the resources that SHOULD be returned from
+ the server or used to post data to the resource (depending on the method).
+
+ <figure>
+ <preamble>For example, with the following schema:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "links": [{
+ "enctype": "application/x-www-form-urlencoded",
+ "method": "GET",
+ "href": "/Product/",
+ "properties": {
+ "name": {
+ "description": "name of the product"
+ }
+ }
+ }]
+}
+]]>
+ </artwork>
+ <postamble>This indicates that the client can query the server for instances that have a specific name.</postamble>
+ </figure>
+
+ <figure>
+ <preamble>For example:</preamble>
+ <artwork>
+<![CDATA[
+/Product/?name=Slinky
+]]>
+ </artwork>
+ </figure>
+
+ If no enctype or method is specified, only the single URI specified by
+ the href property is defined. If the method is POST, "application/json" is
+ the default media type.
+ </t>
+ </section>
+
+ <section title="schema">
+ <t>
+ This attribute contains a schema which defines the acceptable structure of the submitted
+ request (for a GET request, this schema would define the properties for the query string
+ and for a POST request, this would define the body).
+ </t>
+ </section>
+ </section>
+ </section>
+ </section>
+
+ <section title="fragmentResolution">
+ <t>
+ This property indicates the fragment resolution protocol to use for
+ resolving fragment identifiers in URIs within the instance
+ representations. This applies to the instance object URIs and all
+ children of the instance object's URIs. The default fragment resolution
+ protocol is "slash-delimited", which is defined below. Other fragment
+ resolution protocols MAY be used, but are not defined in this document.
+ </t>
+
+ <t>
+ The fragment identifier is based on <xref target="RFC2396">RFC 2396, Sec 5</xref>, and defines the
+ mechanism for resolving references to entities within a document.
+ </t>
+
+ <section title="slash-delimited fragment resolution">
+ <t>
+ With the slash-delimited fragment resolution protocol, the fragment
+ identifier is interpreted as a series of property reference tokens that start with and
+ are delimited by the "/" character (\x2F). Each property reference token
+ is a series of unreserved or escaped URI characters. Each property
+ reference token SHOULD be interpreted, starting from the beginning of
+ the fragment identifier, as a path reference in the target JSON
+ structure. The final target value of the fragment can be determined by
+ starting with the root of the JSON structure from the representation of
+ the resource identified by the pre-fragment URI. If the target is a JSON
+ object, then the new target is the value of the property with the name
+ identified by the next property reference token in the fragment. If the
+ target is a JSON array, then the target is determined by finding the
+ item in array the array with the index defined by the next property
+ reference token (which MUST be a number). The target is successively
+ updated for each property reference token, until the entire fragment has
+ been traversed.
+ </t>
+
+ <t>
+ Property names SHOULD be URI-encoded. In particular, any "/" in a
+ property name MUST be encoded to avoid being interpreted as a property
+ delimiter.
+ </t>
+
+ <t>
+ <figure>
+ <preamble>For example, for the following JSON representation:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "foo": {
+ "anArray": [{
+ "prop": 44
+ }],
+ "another prop": {
+ "baz": "A string"
+ }
+ }
+}
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <preamble>The following fragment identifiers would be resolved:</preamble>
+ <artwork>
+<![CDATA[
+fragment identifier resolution
+------------------- ----------
+# self, the root of the resource itself
+#/foo the object referred to by the foo property
+#/foo/another%20prop the object referred to by the "another prop"
+ property of the object referred to by the
+ "foo" property
+#/foo/another%20prop/baz the string referred to by the value of "baz"
+ property of the "another prop" property of
+ the object referred to by the "foo" property
+#/foo/anArray/0 the first object in the "anArray" array
+]]>
+ </artwork>
+ </figure>
+ </t>
+ </section>
+
+ <section title="dot-delimited fragment resolution">
+ <t>
+ The dot-delimited fragment resolution protocol is the same as
+ slash-delimited fragment resolution protocol except that the "." character
+ (\x2E) is used as the delimiter between property names (instead of "/") and
+ the path does not need to start with a ".". For example, #.foo and #foo are a valid fragment
+ identifiers for referencing the value of the foo propery.
+ </t>
+ </section>
+ </section>
+
+ <section title="readonly">
+ <t>This attribute indicates that the instance property SHOULD NOT be changed. Attempts by a user agent to modify the value of this property are expected to be rejected by a server.</t>
+ </section>
+
+ <section title="contentEncoding">
+ <t>If the instance property value is a string, this attribute defines that the string SHOULD be interpreted as binary data and decoded using the encoding named by this schema property. <xref target="RFC2045">RFC 2045, Sec 6.1</xref> lists the possible values for this property.</t>
+ </section>
+
+ <section title="pathStart">
+ <t>
+ This attribute is a URI that defines what the instance's URI MUST start with in order to validate.
+ The value of the "pathStart" attribute MUST be resolved as per <xref target="RFC3986">RFC 3986, Sec 5</xref>,
+ and is relative to the instance's URI.
+ </t>
+
+ <t>
+ When multiple schemas have been referenced for an instance, the user agent
+ can determine if this schema is applicable for a particular instance by
+ determining if the URI of the instance begins with the the value of the "pathStart"
+ attribute. If the URI of the instance does not start with this URI,
+ or if another schema specifies a starting URI that is longer and also matches the
+ instance, this schema SHOULD NOT be applied to the instance. Any schema
+ that does not have a pathStart attribute SHOULD be considered applicable
+ to all the instances for which it is referenced.
+ </t>
+ </section>
+
+ <section title="mediaType">
+ <t>This attribute defines the media type of the instance representations that this schema is defining.</t>
+ </section>
+ </section>
+
+ <section title="Security Considerations">
+ <t>
+ This specification is a sub-type of the JSON format, and
+ consequently the security considerations are generally the same as <xref target="RFC4627">RFC 4627</xref>.
+ However, an additional issue is that when link relation of "self"
+ is used to denote a full representation of an object, the user agent
+ SHOULD NOT consider the representation to be the authoritative representation
+ of the resource denoted by the target URI if the target URI is not
+ equivalent to or a sub-path of the the URI used to request the resource
+ representation which contains the target URI with the "self" link.
+
+ <figure>
+ <preamble>For example, if a hyper schema was defined:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "links": [{
+ "rel": "self",
+ "href": "{id}"
+ }]
+}
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <preamble>And a resource was requested from somesite.com:</preamble>
+ <artwork>
+<![CDATA[
+GET /foo/
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <preamble>With a response of:</preamble>
+ <artwork>
+<![CDATA[
+Content-Type: application/json; profile=/schema-for-this-data
+
+[{
+ "id": "bar",
+ "name": "This representation can be safely treated \
+ as authoritative "
+}, {
+ "id": "/baz",
+ "name": "This representation should not be treated as \
+ authoritative the user agent should make request the resource\
+ from '/baz' to ensure it has the authoritative representation"
+}, {
+ "id": "http://othersite.com/something",
+ "name": "This representation\
+ should also not be treated as authoritative and the target\
+ resource representation should be retrieved for the\
+ authoritative representation"
+}]
+]]>
+ </artwork>
+ </figure>
+ </t>
+ </section>
+
+ <section title="IANA Considerations">
+ <t>The proposed MIME media type for JSON Schema is "application/schema+json".</t>
+ <t>Type name: application</t>
+ <t>Subtype name: schema+json</t>
+ <t>Required parameters: profile</t>
+ <t>
+ The value of the profile parameter SHOULD be a URI (relative or absolute) that
+ refers to the schema used to define the structure of this structure (the
+ meta-schema). Normally the value would be http://json-schema.org/draft-03/hyper-schema,
+ but it is allowable to use other schemas that extend the hyper schema's meta-
+ schema.
+ </t>
+ <t>Optional parameters: pretty</t>
+ <t>The value of the pretty parameter MAY be true or false to indicate if additional whitespace has been included to make the JSON representation easier to read.</t>
+
+ <section title="Registry of Link Relations">
+ <t>
+ This registry is maintained by IANA per <xref target="RFC4287">RFC 4287</xref> and this specification adds
+ four values: "full", "create", "instances", "root". New
+ assignments are subject to IESG Approval, as outlined in <xref target="RFC5226">RFC 5226</xref>.
+ Requests should be made by email to IANA, which will then forward the
+ request to the IESG, requesting approval.
+ </t>
+ </section>
+ </section>
+ </middle>
+
+ <back>
+ <!-- References Section -->
+ <references title="Normative References">
+ &rfc2045;
+ &rfc2119;
+ &rfc2396;
+ &rfc3339;
+ &rfc3986;
+ &rfc4287;
+ </references>
+ <references title="Informative References">
+ &rfc2616;
+ &rfc4627;
+ &rfc5226;
+ &iddiscovery;
+ &uritemplate;
+ &linkheader;
+ &html401;
+ &css21;
+ </references>
+
+ <section title="Change Log">
+ <t>
+ <list style="hanging">
+ <t hangText="draft-03">
+ <list style="symbols">
+ <t>Added example and verbiage to "extends" attribute.</t>
+ <t>Defined slash-delimited to use a leading slash.</t>
+ <t>Made "root" a relation instead of an attribute.</t>
+ <t>Removed address values, and MIME media type from format to reduce confusion (mediaType already exists, so it can be used for MIME types).</t>
+ <t>Added more explanation of nullability.</t>
+ <t>Removed "alternate" attribute.</t>
+ <t>Upper cased many normative usages of must, may, and should.</t>
+ <t>Replaced the link submission "properties" attribute to "schema" attribute.</t>
+ <t>Replaced "optional" attribute with "required" attribute.</t>
+ <t>Replaced "maximumCanEqual" attribute with "exclusiveMaximum" attribute.</t>
+ <t>Replaced "minimumCanEqual" attribute with "exclusiveMinimum" attribute.</t>
+ <t>Replaced "requires" attribute with "dependencies" attribute.</t>
+ <t>Moved "contentEncoding" attribute to hyper schema.</t>
+ <t>Added "additionalItems" attribute.</t>
+ <t>Added "id" attribute.</t>
+ <t>Switched self-referencing variable substitution from "-this" to "@" to align with reserved characters in URI template.</t>
+ <t>Added "patternProperties" attribute.</t>
+ <t>Schema URIs are now namespace versioned.</t>
+ <t>Added "$ref" and "$schema" attributes.</t>
+ </list>
+ </t>
+
+ <t hangText="draft-02">
+ <list style="symbols">
+ <t>Replaced "maxDecimal" attribute with "divisibleBy" attribute.</t>
+ <t>Added slash-delimited fragment resolution protocol and made it the default.</t>
+ <t>Added language about using links outside of schemas by referencing its normative URI.</t>
+ <t>Added "uniqueItems" attribute.</t>
+ <t>Added "targetSchema" attribute to link description object.</t>
+ </list>
+ </t>
+
+ <t hangText="draft-01">
+ <list style="symbols">
+ <t>Fixed category and updates from template.</t>
+ </list>
+ </t>
+
+ <t hangText="draft-00">
+ <list style="symbols">
+ <t>Initial draft.</t>
+ </list>
+ </t>
+ </list>
+ </t>
+ </section>
+
+ <section title="Open Issues">
+ <t>
+ <list>
+ <t>Should we give a preference to MIME headers over Link headers (or only use one)?</t>
+ <t>Should "root" be a MIME parameter?</t>
+ <t>Should "format" be renamed to "mediaType" or "contentType" to reflect the usage MIME media types that are allowed?</t>
+ <t>How should dates be handled?</t>
+ </list>
+ </t>
+ </section>
+ </back>
+</rfc>
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-04.xml b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-04.xml
new file mode 100644
index 000000000..8ede6bf9e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-04.xml
@@ -0,0 +1,1072 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
+<!ENTITY rfc4627 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4627.xml">
+<!ENTITY rfc3986 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml">
+<!ENTITY rfc2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
+<!ENTITY rfc4287 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4287.xml">
+<!ENTITY rfc2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml">
+<!ENTITY rfc3339 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3339.xml">
+<!ENTITY rfc2045 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2045.xml">
+<!ENTITY rfc5226 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
+<!ENTITY iddiscovery SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.hammer-discovery.xml">
+<!ENTITY uritemplate SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.gregorio-uritemplate.xml">
+<!ENTITY linkheader SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.nottingham-http-link-header.xml">
+<!ENTITY html401 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.REC-html401-19991224.xml">
+<!ENTITY css21 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.CR-CSS21-20070719.xml">
+]>
+<?rfc toc="yes"?>
+<?rfc symrefs="yes"?>
+<?rfc compact="yes"?>
+<?rfc subcompact="no"?>
+<?rfc strict="no"?>
+<?rfc rfcedstyle="yes"?>
+<rfc category="info" docName="draft-zyp-json-schema-04" ipr="trust200902">
+ <front>
+ <title abbrev="JSON Schema Media Type">A JSON Media Type for Describing the Structure and Meaning of JSON Documents</title>
+
+ <author fullname="Kris Zyp" initials="K" role="editor" surname="Zyp">
+ <organization>SitePen (USA)</organization>
+ <address>
+ <postal>
+ <street>530 Lytton Avenue</street>
+ <city>Palo Alto, CA 94301</city>
+ <country>USA</country>
+ </postal>
+ <phone>+1 650 968 8787</phone>
+ <email>kris@sitepen.com</email>
+ </address>
+ </author>
+
+ <author fullname="Gary Court" initials="G" surname="Court">
+ <address>
+ <postal>
+ <street></street>
+ <city>Calgary, AB</city>
+ <country>Canada</country>
+ </postal>
+ <email>gary.court@gmail.com</email>
+ </address>
+ </author>
+
+ <date year="2011" />
+ <workgroup>Internet Engineering Task Force</workgroup>
+ <keyword>JSON</keyword>
+ <keyword>Schema</keyword>
+ <keyword>JavaScript</keyword>
+ <keyword>Object</keyword>
+ <keyword>Notation</keyword>
+ <keyword>Hyper Schema</keyword>
+ <keyword>Hypermedia</keyword>
+
+ <abstract>
+ <t>
+ JSON (JavaScript Object Notation) Schema defines the media type "application/schema+json",
+ a JSON based format for defining the structure of JSON data. JSON Schema provides a contract for what JSON
+ data is required for a given application and how to interact with it. JSON
+ Schema is intended to define validation, documentation, hyperlink
+ navigation, and interaction control of JSON data.
+ </t>
+ </abstract>
+ </front>
+
+ <middle>
+ <section title="Introduction">
+ <t>
+ JSON (JavaScript Object Notation) Schema is a JSON media type for defining
+ the structure of JSON data. JSON Schema provides a contract for what JSON
+ data is required for a given application and how to interact with it. JSON
+ Schema is intended to define validation, documentation, hyperlink
+ navigation, and interaction control of JSON data.
+ </t>
+ </section>
+
+ <section title="Conventions and Terminology">
+ <t>
+ <!-- The text in this section has been copied from the official boilerplate,
+ and should not be modified.-->
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
+ "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
+ interpreted as described in <xref target="RFC2119">RFC 2119</xref>.
+ </t>
+
+ <t>
+ The terms "JSON", "JSON text", "JSON value", "member", "element", "object",
+ "array", "number", "string", "boolean", "true", "false", and "null" in this
+ document are to be interpreted as defined in <xref target="RFC4627">RFC 4627</xref>.
+ </t>
+
+ <t>
+ This specification also uses the following defined terms:
+
+ <list style="hanging">
+ <t hangText="schema">A JSON Schema object.</t>
+ <t hangText="instance">Equivalent to "JSON value" as defined in <xref target="RFC4627">RFC 4627</xref>.</t>
+ <t hangText="property">Equivalent to "member" as defined in <xref target="RFC4627">RFC 4627</xref>.</t>
+ <t hangText="item">Equivalent to "element" as defined in <xref target="RFC4627">RFC 4627</xref>.</t>
+ <t hangText="attribute">A property of a JSON Schema object.</t>
+ </list>
+ </t>
+ </section>
+
+ <section title="Overview">
+ <t>
+ JSON Schema defines the media type "application/schema+json" for
+ describing the structure of JSON text. JSON Schemas are also written in JSON and includes facilities
+ for describing the structure of JSON in terms of
+ allowable values, descriptions, and interpreting relations with other resources.
+ </t>
+ <t>
+ This document is organized into several separate definitions. The first
+ definition is the core schema specification. This definition is primary
+ concerned with describing a JSON structure and specifying valid elements
+ in the structure. The second definition is the Hyper Schema specification
+ which is intended to define elements in a structure that can be interpreted as
+ hyperlinks.
+ Hyper Schema builds on JSON Schema to describe the hyperlink structure of
+ JSON values. This allows user agents to be able to successfully navigate
+ documents containing JSON based on their schemas.
+ </t>
+ <t>
+ Cumulatively JSON Schema acts as meta-JSON that can be used to define the
+ required type and constraints on JSON values, as well as define the meaning
+ of the JSON values for the purpose of describing a resource and determining
+ hyperlinks within the representation.
+ </t>
+ <figure>
+ <preamble>An example JSON Schema that describes products might look like:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "title": "Product",
+ "properties": {
+ "id": {
+ "title": "Product Identifier",
+ "type": "number"
+ },
+ "name": {
+ "title": "Product Name",
+ "type": "string"
+ },
+ "price": {
+ "type": "number",
+ "minimum": 0
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required" : ["id", "name", "price"],
+ "links": [{
+ "rel": "full",
+ "href": "{id}"
+ }, {
+ "rel": "comments",
+ "href": "comments/?id={id}"
+ }]
+}
+]]>
+ </artwork>
+ <postamble>
+ This schema defines the properties of the instance,
+ the required properties (id, name, and price), as well as an optional
+ property (tags). This also defines the link relations of the instance.
+ </postamble>
+ </figure>
+
+ <section title="Design Considerations">
+ <t>
+ The JSON Schema media type does not attempt to dictate the structure of JSON
+ values that contain data, but rather provides a separate format
+ for flexibly communicating how a JSON value should be
+ interpreted and validated, such that user agents can properly understand
+ acceptable structures and extrapolate hyperlink information
+ from the JSON. It is acknowledged that JSON values come
+ in a variety of structures, and JSON is unique in that the structure
+ of stored data structures often prescribes a non-ambiguous definite
+ JSON representation. Attempting to force a specific structure is generally
+ not viable, and therefore JSON Schema allows for a great flexibility
+ in the structure of the JSON data that it describes.
+ </t>
+ <t>
+ This specification is protocol agnostic.
+ The underlying protocol (such as HTTP) should sufficiently define the
+ semantics of the client-server interface, the retrieval of resource
+ representations linked to by JSON representations, and modification of
+ those resources. The goal of this
+ format is to sufficiently describe JSON structures such that one can
+ utilize existing information available in existing JSON
+ representations from a large variety of services that leverage a representational state transfer
+ architecture using existing protocols.
+ </t>
+ </section>
+ </section>
+
+ <section title="Schema/Instance Association">
+ <t>
+ JSON values are correlated to their schema by the "describedby"
+ relation, where the schema is the target of the relation.
+ JSON values MUST be of the "application/json" media type or
+ any other subtype. Consequently, dictating how a JSON value should
+ specify the relation to the schema is beyond the normative scope
+ of this document since this document specifically defines the JSON
+ Schema media type, and no other. It is RECOMMNENDED that JSON values
+ specify their schema so that user agents can interpret the instance
+ and retain the self-descriptive characteristics. This avoides the need for out-of-band information about
+ instance data. Two approaches are recommended for declaring the
+ relation to the schema that describes the meaning of a JSON instance's (or collection
+ of instances) structure. A MIME type parameter named
+ "profile" or a relation of "describedby" (which could be specified by a Link header) may be used:
+
+ <figure>
+ <artwork>
+<![CDATA[
+Content-Type: application/my-media-type+json;
+ profile=http://example.com/my-hyper-schema
+]]>
+ </artwork>
+ </figure>
+
+ or if the content is being transferred by a protocol (such as HTTP) that
+ provides headers, a Link header can be used:
+
+ <figure>
+ <artwork>
+<![CDATA[
+Link: <http://example.com/my-hyper-schema>; rel="describedby"
+]]>
+ </artwork>
+ </figure>
+
+ Instances MAY specify multiple schemas, to indicate all the schemas that
+ are applicable to the data, and the data SHOULD be valid by all the schemas.
+ The instance data MAY have multiple schemas
+ that it is described by (the instance data SHOULD be valid for those schemas).
+ Or if the document is a collection of instances, the collection MAY contain
+ instances from different schemas. The mechanism for referencing a schema is
+ determined by the media type of the instance (if it provides a method for
+ referencing schemas).
+ </t>
+
+ <section title="Self-Descriptive Schema">
+ <t>
+ JSON Schemas can themselves be described using JSON Schemas.
+ A self-describing JSON Schema for the core JSON Schema can
+ be found at <eref target="http://json-schema.org/schema">http://json-schema.org/schema</eref> for the latest version or
+ <eref target="http://json-schema.org/draft-04/schema">http://json-schema.org/draft-04/schema</eref> for the draft-04 version. The hyper schema
+ self-description can be found at <eref target="http://json-schema.org/hyper-schema">http://json-schema.org/hyper-schema</eref>
+ or <eref target="http://json-schema.org/draft-04/hyper-schema">http://json-schema.org/draft-04/hyper-schema</eref>. All schemas
+ used within a protocol with a media type specified SHOULD include a MIME parameter that refers to the self-descriptive
+ hyper schema or another schema that extends this hyper schema:
+
+ <figure>
+ <artwork>
+<![CDATA[
+Content-Type: application/json;
+ profile=http://json-schema.org/draft-04/hyper-schema
+]]>
+ </artwork>
+ </figure>
+ </t>
+ </section>
+ </section>
+
+ <section title="Core Schema Definition">
+ <t>
+ A JSON Schema is a JSON object that defines various attributes
+ (including usage and valid values) of a JSON value. JSON
+ Schema has recursive capabilities; there are a number of elements
+ in the structure that allow for nested JSON Schemas.
+ </t>
+
+ <figure>
+ <preamble>An example JSON Schema could look like:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "description": "A person",
+ "type": "object",
+
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "age": {
+ "type": "number",
+ "divisibleBy": 1,
+ "minimum": 0,
+ "maximum": 125
+ }
+ }
+}
+]]>
+ </artwork>
+ </figure>
+
+ <t>
+ A JSON Schema object MAY have any of the following optional properties:
+ </t>
+
+ <!-- TODO: Break attributes up into type sections -->
+ <!-- TODO: Add examples for (almost) every attribute -->
+
+ <section title="type" anchor="type">
+ <t>
+ This attribute defines what the primitive type or the schema of the instance MUST be in order to validate.
+ This attribute can take one of two forms:
+
+ <list style="hanging">
+ <t hangText="Simple Types">
+ A string indicating a primitive or simple type. The string MUST be one of the following values:
+
+ <list style="hanging">
+ <t hangText="object">Instance MUST be an object.</t>
+ <t hangText="array">Instance MUST be an array.</t>
+ <t hangText="string">Instance MUST be a string.</t>
+ <t hangText="number">Instance MUST be a number, including floating point numbers.</t>
+ <t hangText="boolean">Instance MUST be the JSON literal "true" or "false".</t>
+ <t hangText="null">Instance MUST be the JSON literal "null". Note that without this type, null values are not allowed.</t>
+ <t hangText="any">Instance MAY be of any type, including null.</t>
+ </list>
+ </t>
+
+ <t hangText="Union Types">
+ An array of one or more simple or schema types.
+ The instance value is valid if it is of the same type as one of the simple types, or valid by one of the schemas, in the array.
+ </t>
+ </list>
+
+ If this attribute is not specified, then all value types are accepted.
+ </t>
+
+ <figure>
+ <preamble>For example, a schema that defines if an instance can be a string or a number would be:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "type": ["string", "number"]
+}
+]]></artwork>
+ </figure>
+ </section>
+
+ <section title="properties" anchor="properties">
+ <t>
+ This attribute is an object with properties that specify the schemas for the properties of the instance object.
+ In this attribute's object, each property value MUST be a schema.
+ When the instance value is an object, the value of the instance's properties MUST be valid according to the schemas with the same property names specified in this attribute.
+ Objects are unordered, so therefore the order of the instance properties or attribute properties MUST NOT determine validation success.
+ </t>
+ </section>
+
+ <section title="patternProperties" anchor="patternProperties">
+ <t>
+ This attribute is an object that defines the schema for a set of property names of an object instance.
+ The name of each property of this attribute's object is a regular expression pattern in the ECMA 262/Perl 5 format, while the value is a schema.
+ If the pattern matches the name of a property on the instance object, the value of the instance's property MUST be valid against the pattern name's schema value.
+ </t>
+ </section>
+
+ <section title="additionalProperties" anchor="additionalProperties">
+ <t>This attribute specifies how any instance property that is not explicitly defined by either the <xref target="properties">"properties"</xref> or <xref target="patternProperties">"patternProperties"</xref> attributes (hereafter referred to as "additional properties") is handled. If specified, the value MUST be a schema or a boolean.</t>
+ <t>If a schema is provided, then all additional properties MUST be valid according to the schema.</t>
+ <t>If false is provided, then no additional properties are allowed.</t>
+ <t>The default value is an empty schema, which allows any value for additional properties.</t>
+ </section>
+
+ <section title="items" anchor="items">
+ <t>This attribute provides the allowed items in an array instance. If specified, this attribute MUST be a schema or an array of schemas.</t>
+ <t>When this attribute value is a schema and the instance value is an array, then all the items in the array MUST be valid according to the schema.</t>
+ <t>When this attribute value is an array of schemas and the instance value is an array, each position in the instance array MUST be valid according to the schema in the corresponding position for this array. This called tuple typing. When tuple typing is used, additional items are allowed, disallowed, or constrained by the <xref target="additionalItems">"additionalItems"</xref> attribute the same way as <xref target="additionalProperties">"additionalProperties"</xref> for objects is.</t>
+ </section>
+
+ <section title="additionalItems" anchor="additionalItems">
+ <t>This attribute specifies how any item in the array instance that is not explicitly defined by <xref target="items">"items"</xref> (hereafter referred to as "additional items") is handled. If specified, the value MUST be a schema or a boolean.</t>
+ <t>If a schema is provided:
+ <list>
+ <t>If the <xref target="items">"items"</xref> attribute is unspecified, then all items in the array instance must be valid against this schema.</t>
+ <t>If the <xref target="items">"items"</xref> attribute is a schema, then this attribute is ignored.</t>
+ <t>If the <xref target="items">"items"</xref> attribute is an array (during tuple typing), then any additional items MUST be valid against this schema.</t>
+ </list>
+ </t>
+ <t>If false is provided, then any additional items in the array are not allowed.</t>
+ <t>The default value is an empty schema, which allows any value for additional items.</t>
+ </section>
+
+ <section title="required" anchor="required">
+ <t>This attribute is an array of strings that defines all the property names that must exist on the object instance.</t>
+ </section>
+
+ <section title="dependencies" anchor="dependencies">
+ <t>This attribute is an object that specifies the requirements of a property on an object instance. If an object instance has a property with the same name as a property in this attribute's object, then the instance must be valid against the attribute's property value (hereafter referred to as the "dependency value").</t>
+ <t>
+ The dependency value can take one of two forms:
+
+ <list style="hanging">
+ <t hangText="Simple Dependency">
+ If the dependency value is a string, then the instance object MUST have a property with the same name as the dependency value.
+ If the dependency value is an array of strings, then the instance object MUST have a property with the same name as each string in the dependency value's array.
+ </t>
+ <t hangText="Schema Dependency">
+ If the dependency value is a schema, then the instance object MUST be valid against the schema.
+ </t>
+ </list>
+ </t>
+ </section>
+
+ <section title="minimum" anchor="minimum">
+ <t>This attribute defines the minimum value of the instance property when the type of the instance value is a number.</t>
+ </section>
+
+ <section title="maximum" anchor="maximum">
+ <t>This attribute defines the maximum value of the instance property when the type of the instance value is a number.</t>
+ </section>
+
+ <section title="exclusiveMinimum" anchor="exclusiveMinimum">
+ <t>This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "minimum" attribute. This is false by default, meaning the instance value can be greater then or equal to the minimum value.</t>
+ </section>
+
+ <section title="exclusiveMaximum" anchor="exclusiveMaximum">
+ <t>This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "maximum" attribute. This is false by default, meaning the instance value can be less then or equal to the maximum value.</t>
+ </section>
+
+ <section title="minItems" anchor="minItems">
+ <t>This attribute defines the minimum number of values in an array when the array is the instance value.</t>
+ </section>
+
+ <section title="maxItems" anchor="maxItems">
+ <t>This attribute defines the maximum number of values in an array when the array is the instance value.</t>
+ </section>
+
+ <section title="minProperties" anchor="minProperties">
+ <t>This attribute defines the minimum number of properties required on an object instance.</t>
+ </section>
+
+ <section title="maxProperties" anchor="maxProperties">
+ <t>This attribute defines the maximum number of properties the object instance can have.</t>
+ </section>
+
+ <section title="uniqueItems" anchor="uniqueItems">
+ <t>This attribute indicates that all items in an array instance MUST be unique (contains no two identical values).</t>
+ <t>
+ Two instance are consider equal if they are both of the same type and:
+
+ <list>
+ <t>are null; or</t>
+ <t>are booleans/numbers/strings and have the same value; or</t>
+ <t>are arrays, contains the same number of items, and each item in the array is equal to the item at the corresponding index in the other array; or</t>
+ <t>are objects, contains the same property names, and each property in the object is equal to the corresponding property in the other object.</t>
+ </list>
+ </t>
+ </section>
+
+ <section title="pattern" anchor="pattern">
+ <t>When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid. Regular expressions SHOULD follow the regular expression specification from ECMA 262/Perl 5</t>
+ </section>
+
+ <section title="minLength" anchor="minLength">
+ <t>When the instance value is a string, this defines the minimum length of the string.</t>
+ </section>
+
+ <section title="maxLength" anchor="maxLength">
+ <t>When the instance value is a string, this defines the maximum length of the string.</t>
+ </section>
+
+ <section title="enum" anchor="enum">
+ <t>This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value. If this attribute is defined, the instance value MUST be one of the values in the array in order for the schema to be valid. Comparison of enum values uses the same algorithm as defined in <xref target="uniqueItems">"uniqueItems"</xref>.</t>
+ </section>
+
+ <section title="default" anchor="default">
+ <t>This attribute defines the default value of the instance when the instance is undefined.</t>
+ </section>
+
+ <section title="title" anchor="title">
+ <t>This attribute is a string that provides a short description of the instance property.</t>
+ </section>
+
+ <section title="description" anchor="description">
+ <t>This attribute is a string that provides a full description of the of purpose the instance property.</t>
+ </section>
+
+ <section title="divisibleBy" anchor="divisibleBy">
+ <t>This attribute defines what value the number instance must be divisible by with no remainder (the result of the division must be an integer.) The value of this attribute SHOULD NOT be 0.</t>
+ </section>
+
+ <section title="disallow" anchor="disallow">
+ <t>This attribute takes the same values as the "type" attribute, however if the instance matches the type or if this value is an array and the instance matches any type or schema in the array, then this instance is not valid.</t>
+ </section>
+
+ <section title="extends" anchor="extends">
+ <t>The value of this property MUST be another schema which will provide a base schema which the current schema will inherit from. The inheritance rules are such that any instance that is valid according to the current schema MUST be valid according to the referenced schema. This MAY also be an array, in which case, the instance MUST be valid for all the schemas in the array. A schema that extends another schema MAY define additional attributes, constrain existing attributes, or add other constraints.</t>
+ <t>
+ Conceptually, the behavior of extends can be seen as validating an
+ instance against all constraints in the extending schema as well as
+ the extended schema(s). More optimized implementations that merge
+ schemas are possible, but are not required. Some examples of using "extends":
+
+ <figure>
+ <artwork>
+<![CDATA[
+{
+ "description": "An adult",
+ "properties": {
+ "age": {
+ "minimum": 21
+ }
+ },
+ "extends": {"$ref": "person"}
+}
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <artwork>
+<![CDATA[
+{
+ "description": "Extended schema",
+ "properties": {
+ "deprecated": {
+ "type": "boolean"
+ }
+ },
+ "extends": {"$ref": "http://json-schema.org/draft-04/schema"}
+}
+]]>
+ </artwork>
+ </figure>
+ </t>
+ </section>
+
+ <section title="id" anchor="id">
+ <t>
+ This attribute defines the current URI of this schema (this attribute is
+ effectively a "self" link). This URI MAY be relative or absolute. If
+ the URI is relative it is resolved against the current URI of the parent
+ schema it is contained in. If this schema is not contained in any
+ parent schema, the current URI of the parent schema is held to be the
+ URI under which this schema was addressed. If id is missing, the current URI of a schema is
+ defined to be that of the parent schema. The current URI of the schema
+ is also used to construct relative references such as for $ref.
+ </t>
+ </section>
+
+ <section title="$ref" anchor="ref">
+ <t>
+ This attribute defines a URI of a schema that contains the full representation of this schema.
+ When a validator encounters this attribute, it SHOULD replace the current schema with the schema referenced by the value's URI (if known and available) and re-validate the instance.
+ This URI MAY be relative or absolute, and relative URIs SHOULD be resolved against the URI of the current schema.
+ </t>
+ </section>
+
+ <section title="$schema" anchor="schema">
+ <t>
+ This attribute defines a URI of a JSON Schema that is the schema of the current schema.
+ When this attribute is defined, a validator SHOULD use the schema referenced by the value's URI (if known and available) when resolving <xref target="hyper-schema">Hyper Schema</xref><xref target="links">links</xref>.
+ </t>
+
+ <t>
+ A validator MAY use this attribute's value to determine which version of JSON Schema the current schema is written in, and provide the appropriate validation features and behavior.
+ Therefore, it is RECOMMENDED that all schema authors include this attribute in their schemas to prevent conflicts with future JSON Schema specification changes.
+ </t>
+ </section>
+ </section>
+
+ <section title="Hyper Schema" anchor="hyper-schema">
+ <t>
+ The following attributes are specified in addition to those
+ attributes that already provided by the core schema with the specific
+ purpose of informing user agents of relations between resources based
+ on JSON data. Just as with JSON
+ schema attributes, all the attributes in hyper schemas are optional.
+ Therefore, an empty object is a valid (non-informative) schema, and
+ essentially describes plain JSON (no constraints on the structures).
+ Addition of attributes provides additive information for user agents.
+ </t>
+
+ <section title="links" anchor="links">
+ <t>
+ The value of the links property MUST be an array, where each item
+ in the array is a link description object which describes the link
+ relations of the instances.
+ </t>
+
+ <!-- TODO: Needs more clarification and examples -->
+
+ <section title="Link Description Object">
+ <t>
+ A link description object is used to describe link relations. In
+ the context of a schema, it defines the link relations of the
+ instances of the schema, and can be parameterized by the instance
+ values. The link description format can be used without JSON Schema,
+ and use of this format can
+ be declared by referencing the normative link description
+ schema as the the schema for the data structure that uses the
+ links. The URI of the normative link description schema is:
+ <eref target="http://json-schema.org/links">http://json-schema.org/links</eref> (latest version) or
+ <eref target="http://json-schema.org/draft-04/links">http://json-schema.org/draft-04/links</eref> (draft-04 version).
+ </t>
+
+ <section title="href" anchor="href">
+ <t>
+ The value of the "href" link description property
+ indicates the target URI of the related resource. The value
+ of the instance property SHOULD be resolved as a URI-Reference per <xref target="RFC3986">RFC 3986</xref>
+ and MAY be a relative URI. The base URI to be used for relative resolution
+ SHOULD be the URI used to retrieve the instance object (not the schema)
+ when used within a schema. Also, when links are used within a schema, the URI
+ SHOULD be parametrized by the property values of the instance
+ object, if property values exist for the corresponding variables
+ in the template (otherwise they MAY be provided from alternate sources, like user input).
+ </t>
+
+ <t>
+ Instance property values SHOULD be substituted into the URIs where
+ matching braces ('{', '}') are found surrounding zero or more characters,
+ creating an expanded URI. Instance property value substitutions are resolved
+ by using the text between the braces to denote the property name
+ from the instance to get the value to substitute.
+
+ <figure>
+ <preamble>For example, if an href value is defined:</preamble>
+ <artwork>
+<![CDATA[
+http://somesite.com/{id}
+]]>
+ </artwork>
+ <postamble>Then it would be resolved by replace the value of the "id" property value from the instance object.</postamble>
+ </figure>
+
+ <figure>
+ <preamble>If the value of the "id" property was "45", the expanded URI would be:</preamble>
+ <artwork>
+<![CDATA[
+http://somesite.com/45
+]]>
+ </artwork>
+ </figure>
+
+ If matching braces are found with the string "@" (no quotes) between the braces, then the
+ actual instance value SHOULD be used to replace the braces, rather than a property value.
+ This should only be used in situations where the instance is a scalar (string,
+ boolean, or number), and not for objects or arrays.
+ </t>
+ </section>
+
+ <section title="rel">
+ <t>
+ The value of the "rel" property indicates the name of the
+ relation to the target resource. The relation to the target SHOULD be interpreted as specifically from the instance object that the schema (or sub-schema) applies to, not just the top level resource that contains the object within its hierarchy. If a resource JSON representation contains a sub object with a property interpreted as a link, that sub-object holds the relation with the target. A relation to target from the top level resource MUST be indicated with the schema describing the top level JSON representation.
+ </t>
+
+ <t>
+ Relationship definitions SHOULD NOT be media type dependent, and users are encouraged to utilize existing accepted relation definitions, including those in existing relation registries (see <xref target="RFC4287">RFC 4287</xref>). However, we define these relations here for clarity of normative interpretation within the context of JSON hyper schema defined relations:
+
+ <list style="hanging">
+ <t hangText="self">
+ If the relation value is "self", when this property is encountered in
+ the instance object, the object represents a resource and the instance object is
+ treated as a full representation of the target resource identified by
+ the specified URI.
+ </t>
+
+ <t hangText="full">
+ This indicates that the target of the link is the full representation for the instance object. The object that contains this link possibly may not be the full representation.
+ </t>
+
+ <t hangText="describedby">
+ This indicates the target of the link is the schema for the instance object. This MAY be used to specifically denote the schemas of objects within a JSON object hierarchy, facilitating polymorphic type data structures.
+ </t>
+
+ <t hangText="root">
+ This relation indicates that the target of the link
+ SHOULD be treated as the root or the body of the representation for the
+ purposes of user agent interaction or fragment resolution. All other
+ properties of the instance objects can be regarded as meta-data
+ descriptions for the data.
+ </t>
+ </list>
+ </t>
+
+ <t>
+ The following relations are applicable for schemas (the schema as the "from" resource in the relation):
+
+ <list style="hanging">
+ <t hangText="instances">This indicates the target resource that represents collection of instances of a schema.</t>
+ <t hangText="create">This indicates a target to use for creating new instances of a schema. This link definition SHOULD be a submission link with a non-safe method (like POST).</t>
+ </list>
+ </t>
+
+ <t>
+ <figure>
+ <preamble>For example, if a schema is defined:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "links": [{
+ "rel": "self",
+ "href": "{id}"
+ }, {
+ "rel": "up",
+ "href": "{upId}"
+ }, {
+ "rel": "children",
+ "href": "?upId={id}"
+ }]
+}
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <preamble>And if a collection of instance resource's JSON representation was retrieved:</preamble>
+ <artwork>
+<![CDATA[
+GET /Resource/
+
+[{
+ "id": "thing",
+ "upId": "parent"
+}, {
+ "id": "thing2",
+ "upId": "parent"
+}]
+]]>
+ </artwork>
+ </figure>
+
+ This would indicate that for the first item in the collection, its own
+ (self) URI would resolve to "/Resource/thing" and the first item's "up"
+ relation SHOULD be resolved to the resource at "/Resource/parent".
+ The "children" collection would be located at "/Resource/?upId=thing".
+ </t>
+ </section>
+
+ <section title="template">
+ <t>This property value is a string that defines the templating language used in the <xref target="href">"href"</xref> attribute. If no templating language is defined, then the default <xref target="href">Link Description Object templating langauge</xref> is used.</t>
+ </section>
+
+ <section title="targetSchema">
+ <t>This property value is a schema that defines the expected structure of the JSON representation of the target of the link.</t>
+ </section>
+
+ <section title="Submission Link Properties">
+ <t>
+ The following properties also apply to link definition objects, and
+ provide functionality analogous to HTML forms, in providing a
+ means for submitting extra (often user supplied) information to send to a server.
+ </t>
+
+ <section title="method">
+ <t>
+ This attribute defines which method can be used to access the target resource.
+ In an HTTP environment, this would be "GET" or "POST" (other HTTP methods
+ such as "PUT" and "DELETE" have semantics that are clearly implied by
+ accessed resources, and do not need to be defined here).
+ This defaults to "GET".
+ </t>
+ </section>
+
+ <section title="enctype">
+ <t>
+ If present, this property indicates a query media type format that the server
+ supports for querying or posting to the collection of instances at the target
+ resource. The query can be
+ suffixed to the target URI to query the collection with
+ property-based constraints on the resources that SHOULD be returned from
+ the server or used to post data to the resource (depending on the method).
+
+ <figure>
+ <preamble>For example, with the following schema:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "links": [{
+ "enctype": "application/x-www-form-urlencoded",
+ "method": "GET",
+ "href": "/Product/",
+ "properties": {
+ "name": {
+ "description": "name of the product"
+ }
+ }
+ }]
+}
+]]>
+ </artwork>
+ <postamble>This indicates that the client can query the server for instances that have a specific name.</postamble>
+ </figure>
+
+ <figure>
+ <preamble>For example:</preamble>
+ <artwork>
+<![CDATA[
+/Product/?name=Slinky
+]]>
+ </artwork>
+ </figure>
+
+ If no enctype or method is specified, only the single URI specified by
+ the href property is defined. If the method is POST, "application/json" is
+ the default media type.
+ </t>
+ </section>
+
+ <section title="schema">
+ <t>
+ This attribute contains a schema which defines the acceptable structure of the submitted
+ request (for a GET request, this schema would define the properties for the query string
+ and for a POST request, this would define the body).
+ </t>
+ </section>
+ </section>
+ </section>
+ </section>
+
+ <section title="fragmentResolution">
+ <t>
+ This property indicates the fragment resolution protocol to use for
+ resolving fragment identifiers in URIs within the instance
+ representations. This applies to the instance object URIs and all
+ children of the instance object's URIs. The default fragment resolution
+ protocol is "json-pointer", which is defined below. Other fragment
+ resolution protocols MAY be used, but are not defined in this document.
+ </t>
+
+ <t>
+ The fragment identifier is based on <xref target="RFC3986">RFC 3986, Sec 5</xref>, and defines the
+ mechanism for resolving references to entities within a document.
+ </t>
+
+ <section title="json-pointer fragment resolution">
+ <t>The "json-pointer" fragment resolution protocol uses a <xref target="json-pointer">JSON Pointer</xref> to resolve fragment identifiers in URIs within instance representations.</t>
+ </section>
+ </section>
+
+ <!-- TODO: Remove this? -->
+
+ <section title="readonly">
+ <t>This attribute indicates that the instance value SHOULD NOT be changed. Attempts by a user agent to modify the value of this property are expected to be rejected by a server.</t>
+ </section>
+
+ <section title="contentEncoding">
+ <t>If the instance property value is a string, this attribute defines that the string SHOULD be interpreted as binary data and decoded using the encoding named by this schema property. <xref target="RFC2045">RFC 2045, Sec 6.1</xref> lists the possible values for this property.</t>
+ </section>
+
+ <section title="pathStart">
+ <t>
+ This attribute is a URI that defines what the instance's URI MUST start with in order to validate.
+ The value of the "pathStart" attribute MUST be resolved as per <xref target="RFC3986">RFC 3986, Sec 5</xref>,
+ and is relative to the instance's URI.
+ </t>
+
+ <t>
+ When multiple schemas have been referenced for an instance, the user agent
+ can determine if this schema is applicable for a particular instance by
+ determining if the URI of the instance begins with the the value of the "pathStart"
+ attribute. If the URI of the instance does not start with this URI,
+ or if another schema specifies a starting URI that is longer and also matches the
+ instance, this schema SHOULD NOT be applied to the instance. Any schema
+ that does not have a pathStart attribute SHOULD be considered applicable
+ to all the instances for which it is referenced.
+ </t>
+ </section>
+
+ <section title="mediaType">
+ <t>This attribute defines the media type of the instance representations that this schema is defining.</t>
+ </section>
+ </section>
+
+ <section title="Security Considerations">
+ <t>
+ This specification is a sub-type of the JSON format, and
+ consequently the security considerations are generally the same as <xref target="RFC4627">RFC 4627</xref>.
+ However, an additional issue is that when link relation of "self"
+ is used to denote a full representation of an object, the user agent
+ SHOULD NOT consider the representation to be the authoritative representation
+ of the resource denoted by the target URI if the target URI is not
+ equivalent to or a sub-path of the the URI used to request the resource
+ representation which contains the target URI with the "self" link.
+
+ <figure>
+ <preamble>For example, if a hyper schema was defined:</preamble>
+ <artwork>
+<![CDATA[
+{
+ "links": [{
+ "rel": "self",
+ "href": "{id}"
+ }]
+}
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <preamble>And a resource was requested from somesite.com:</preamble>
+ <artwork>
+<![CDATA[
+GET /foo/
+]]>
+ </artwork>
+ </figure>
+
+ <figure>
+ <preamble>With a response of:</preamble>
+ <artwork>
+<![CDATA[
+Content-Type: application/json; profile=/schema-for-this-data
+
+[{
+ "id": "bar",
+ "name": "This representation can be safely treated \
+ as authoritative "
+}, {
+ "id": "/baz",
+ "name": "This representation should not be treated as \
+ authoritative the user agent should make request the resource\
+ from '/baz' to ensure it has the authoritative representation"
+}, {
+ "id": "http://othersite.com/something",
+ "name": "This representation\
+ should also not be treated as authoritative and the target\
+ resource representation should be retrieved for the\
+ authoritative representation"
+}]
+]]>
+ </artwork>
+ </figure>
+ </t>
+ </section>
+
+ <section title="IANA Considerations">
+ <t>The proposed MIME media type for JSON Schema is "application/schema+json".</t>
+ <t>Type name: application</t>
+ <t>Subtype name: schema+json</t>
+ <t>Required parameters: profile</t>
+ <t>
+ The value of the profile parameter SHOULD be a URI (relative or absolute) that
+ refers to the schema used to define the structure of this structure (the
+ meta-schema). Normally the value would be http://json-schema.org/draft-04/hyper-schema,
+ but it is allowable to use other schemas that extend the hyper schema's meta-
+ schema.
+ </t>
+ <t>Optional parameters: pretty</t>
+ <t>The value of the pretty parameter MAY be true or false to indicate if additional whitespace has been included to make the JSON representation easier to read.</t>
+
+ <section title="Registry of Link Relations">
+ <t>
+ This registry is maintained by IANA per <xref target="RFC4287">RFC 4287</xref> and this specification adds
+ four values: "full", "create", "instances", "root". New
+ assignments are subject to IESG Approval, as outlined in <xref target="RFC5226">RFC 5226</xref>.
+ Requests should be made by email to IANA, which will then forward the
+ request to the IESG, requesting approval.
+ </t>
+ </section>
+ </section>
+ </middle>
+
+ <back>
+ <!-- References Section -->
+ <references title="Normative References">
+ &rfc2045;
+ &rfc2119;
+ &rfc3339;
+ &rfc3986;
+ &rfc4287;
+ <reference anchor="json-pointer" target="http://tools.ietf.org/html/draft-pbryan-zyp-json-pointer-02">
+ <front>
+ <title>JSON Pointer</title>
+ <author initials="P." surname="Bryan">
+ <organization>ForgeRock US, Inc.</organization>
+ </author>
+ <author initials="K." surname="Zyp">
+ <organization>SitePen (USA)</organization>
+ </author>
+ <date year="2011" month="October" />
+ </front>
+ </reference>
+ </references>
+ <references title="Informative References">
+ &rfc2616;
+ &rfc4627;
+ &rfc5226;
+ &iddiscovery;
+ &uritemplate;
+ &linkheader;
+ &html401;
+ &css21;
+ </references>
+
+ <section title="Change Log">
+ <t>
+ <list style="hanging">
+ <t hangText="draft-04">
+ <list style="symbols">
+ <t>Changed "required" attribute to an array of strings.</t>
+ <t>Removed "format" attribute.</t>
+ <t>Added "minProperties" and "maxProperties" attributes.</t>
+ <t>Replaced "slash-delimited" fragment resolution with "json-pointer".</t>
+ <t>Added "template" LDO attribute.</t>
+ <t>Removed irrelevant "Open Issues" section.</t>
+ <t>Merged Conventions and Terminology sections.</t>
+ <t>Defined terms used in specification.</t>
+ <t>Removed "integer" type in favor of {"type":"number", "divisibleBy":1}.</t>
+ <t>Restricted "type" to only the core JSON types.</t>
+ <t>Improved wording of many sections.</t>
+ </list>
+ </t>
+
+ <t hangText="draft-03">
+ <list style="symbols">
+ <t>Added example and verbiage to "extends" attribute.</t>
+ <t>Defined slash-delimited to use a leading slash.</t>
+ <t>Made "root" a relation instead of an attribute.</t>
+ <t>Removed address values, and MIME media type from format to reduce confusion (mediaType already exists, so it can be used for MIME types).</t>
+ <t>Added more explanation of nullability.</t>
+ <t>Removed "alternate" attribute.</t>
+ <t>Upper cased many normative usages of must, may, and should.</t>
+ <t>Replaced the link submission "properties" attribute to "schema" attribute.</t>
+ <t>Replaced "optional" attribute with "required" attribute.</t>
+ <t>Replaced "maximumCanEqual" attribute with "exclusiveMaximum" attribute.</t>
+ <t>Replaced "minimumCanEqual" attribute with "exclusiveMinimum" attribute.</t>
+ <t>Replaced "requires" attribute with "dependencies" attribute.</t>
+ <t>Moved "contentEncoding" attribute to hyper schema.</t>
+ <t>Added "additionalItems" attribute.</t>
+ <t>Added "id" attribute.</t>
+ <t>Switched self-referencing variable substitution from "-this" to "@" to align with reserved characters in URI template.</t>
+ <t>Added "patternProperties" attribute.</t>
+ <t>Schema URIs are now namespace versioned.</t>
+ <t>Added "$ref" and "$schema" attributes.</t>
+ </list>
+ </t>
+
+ <t hangText="draft-02">
+ <list style="symbols">
+ <t>Replaced "maxDecimal" attribute with "divisibleBy" attribute.</t>
+ <t>Added slash-delimited fragment resolution protocol and made it the default.</t>
+ <t>Added language about using links outside of schemas by referencing its normative URI.</t>
+ <t>Added "uniqueItems" attribute.</t>
+ <t>Added "targetSchema" attribute to link description object.</t>
+ </list>
+ </t>
+
+ <t hangText="draft-01">
+ <list style="symbols">
+ <t>Fixed category and updates from template.</t>
+ </list>
+ </t>
+
+ <t hangText="draft-00">
+ <list style="symbols">
+ <t>Initial draft.</t>
+ </list>
+ </t>
+ </list>
+ </t>
+ </section>
+ </back>
+</rfc>
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js
new file mode 100644
index 000000000..1bea0aa36
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js
@@ -0,0 +1,52 @@
+/**
+ * JSON Schema link handler
+ * Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
+ * Licensed under the MIT (MIT-LICENSE.txt) license.
+ */
+({define:typeof define!="undefined"?define:function(deps, factory){module.exports = factory();}}).
+define([], function(){
+var exports = {};
+exports.cacheLinks = true;
+exports.getLink = function(relation, instance, schema){
+ // gets the URI of the link for the given relation based on the instance and schema
+ // for example:
+ // getLink(
+ // "brother",
+ // {"brother_id":33},
+ // {links:[{rel:"brother", href:"Brother/{brother_id}"}]}) ->
+ // "Brother/33"
+ var links = schema.__linkTemplates;
+ if(!links){
+ links = {};
+ var schemaLinks = schema.links;
+ if(schemaLinks && schemaLinks instanceof Array){
+ schemaLinks.forEach(function(link){
+ /* // TODO: allow for multiple same-name relations
+ if(links[link.rel]){
+ if(!(links[link.rel] instanceof Array)){
+ links[link.rel] = [links[link.rel]];
+ }
+ }*/
+ links[link.rel] = link.href;
+ });
+ }
+ if(exports.cacheLinks){
+ schema.__linkTemplates = links;
+ }
+ }
+ var linkTemplate = links[relation];
+ return linkTemplate && exports.substitute(linkTemplate, instance);
+};
+
+exports.substitute = function(linkTemplate, instance){
+ return linkTemplate.replace(/\{([^\}]*)\}/g, function(t, property){
+ var value = instance[decodeURIComponent(property)];
+ if(value instanceof Array){
+ // the value is an array, it should produce a URI like /Table/(4,5,8) and store.get() should handle that as an array of values
+ return '(' + value.join(',') + ')';
+ }
+ return value;
+ });
+};
+return exports;
+}); \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js
new file mode 100644
index 000000000..55d4c3aee
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js
@@ -0,0 +1,260 @@
+/**
+ * JSONSchema Validator - Validates JavaScript objects using JSON Schemas
+ * (http://www.json.com/json-schema-proposal/)
+ *
+ * Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
+ * Licensed under the MIT (MIT-LICENSE.txt) license.
+To use the validator call the validate function with an instance object and an optional schema object.
+If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
+that schema will be used to validate and the schema parameter is not necessary (if both exist,
+both validations will occur).
+The validate method will return an array of validation errors. If there are no errors, then an
+empty list will be returned. A validation error will have two properties:
+"property" which indicates which property had the error
+"message" which indicates what the error was
+ */
+({define:typeof define!="undefined"?define:function(deps, factory){module.exports = factory();}}).
+define([], function(){
+var exports = validate;
+// setup primitive classes to be JSON Schema types
+exports.Integer = {type:"integer"};
+var primitiveConstructors = {
+ String: String,
+ Boolean: Boolean,
+ Number: Number,
+ Object: Object,
+ Array: Array,
+ Date: Date
+}
+exports.validate = validate;
+function validate(/*Any*/instance,/*Object*/schema) {
+ // Summary:
+ // To use the validator call JSONSchema.validate with an instance object and an optional schema object.
+ // If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
+ // that schema will be used to validate and the schema parameter is not necessary (if both exist,
+ // both validations will occur).
+ // The validate method will return an object with two properties:
+ // valid: A boolean indicating if the instance is valid by the schema
+ // errors: An array of validation errors. If there are no errors, then an
+ // empty list will be returned. A validation error will have two properties:
+ // property: which indicates which property had the error
+ // message: which indicates what the error was
+ //
+ return validate(instance, schema, {changing: false});//, coerce: false, existingOnly: false});
+ };
+exports.checkPropertyChange = function(/*Any*/value,/*Object*/schema, /*String*/property) {
+ // Summary:
+ // The checkPropertyChange method will check to see if an value can legally be in property with the given schema
+ // This is slightly different than the validate method in that it will fail if the schema is readonly and it will
+ // not check for self-validation, it is assumed that the passed in value is already internally valid.
+ // The checkPropertyChange method will return the same object type as validate, see JSONSchema.validate for
+ // information.
+ //
+ return validate(value, schema, {changing: property || "property"});
+ };
+var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*Object*/options) {
+
+ if (!options) options = {};
+ var _changing = options.changing;
+
+ function getType(schema){
+ return schema.type || (primitiveConstructors[schema.name] == schema && schema.name.toLowerCase());
+ }
+ var errors = [];
+ // validate a value against a property definition
+ function checkProp(value, schema, path,i){
+
+ var l;
+ path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i;
+ function addError(message){
+ errors.push({property:path,message:message});
+ }
+
+ if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function') && !(schema && getType(schema))){
+ if(typeof schema == 'function'){
+ if(!(value instanceof schema)){
+ addError("is not an instance of the class/constructor " + schema.name);
+ }
+ }else if(schema){
+ addError("Invalid schema/property definition " + schema);
+ }
+ return null;
+ }
+ if(_changing && schema.readonly){
+ addError("is a readonly field, it can not be changed");
+ }
+ if(schema['extends']){ // if it extends another schema, it must pass that schema as well
+ checkProp(value,schema['extends'],path,i);
+ }
+ // validate a value against a type definition
+ function checkType(type,value){
+ if(type){
+ if(typeof type == 'string' && type != 'any' &&
+ (type == 'null' ? value !== null : typeof value != type) &&
+ !(value instanceof Array && type == 'array') &&
+ !(value instanceof Date && type == 'date') &&
+ !(type == 'integer' && value%1===0)){
+ return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
+ }
+ if(type instanceof Array){
+ var unionErrors=[];
+ for(var j = 0; j < type.length; j++){ // a union type
+ if(!(unionErrors=checkType(type[j],value)).length){
+ break;
+ }
+ }
+ if(unionErrors.length){
+ return unionErrors;
+ }
+ }else if(typeof type == 'object'){
+ var priorErrors = errors;
+ errors = [];
+ checkProp(value,type,path);
+ var theseErrors = errors;
+ errors = priorErrors;
+ return theseErrors;
+ }
+ }
+ return [];
+ }
+ if(value === undefined){
+ if(schema.required){
+ addError("is missing and it is required");
+ }
+ }else{
+ errors = errors.concat(checkType(getType(schema),value));
+ if(schema.disallow && !checkType(schema.disallow,value).length){
+ addError(" disallowed value was matched");
+ }
+ if(value !== null){
+ if(value instanceof Array){
+ if(schema.items){
+ var itemsIsArray = schema.items instanceof Array;
+ var propDef = schema.items;
+ for (i = 0, l = value.length; i < l; i += 1) {
+ if (itemsIsArray)
+ propDef = schema.items[i];
+ if (options.coerce)
+ value[i] = options.coerce(value[i], propDef);
+ errors.concat(checkProp(value[i],propDef,path,i));
+ }
+ }
+ if(schema.minItems && value.length < schema.minItems){
+ addError("There must be a minimum of " + schema.minItems + " in the array");
+ }
+ if(schema.maxItems && value.length > schema.maxItems){
+ addError("There must be a maximum of " + schema.maxItems + " in the array");
+ }
+ }else if(schema.properties || schema.additionalProperties){
+ errors.concat(checkObj(value, schema.properties, path, schema.additionalProperties));
+ }
+ if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){
+ addError("does not match the regex pattern " + schema.pattern);
+ }
+ if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){
+ addError("may only be " + schema.maxLength + " characters long");
+ }
+ if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){
+ addError("must be at least " + schema.minLength + " characters long");
+ }
+ if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum &&
+ schema.minimum > value){
+ addError("must have a minimum value of " + schema.minimum);
+ }
+ if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum &&
+ schema.maximum < value){
+ addError("must have a maximum value of " + schema.maximum);
+ }
+ if(schema['enum']){
+ var enumer = schema['enum'];
+ l = enumer.length;
+ var found;
+ for(var j = 0; j < l; j++){
+ if(enumer[j]===value){
+ found=1;
+ break;
+ }
+ }
+ if(!found){
+ addError("does not have a value in the enumeration " + enumer.join(", "));
+ }
+ }
+ if(typeof schema.maxDecimal == 'number' &&
+ (value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){
+ addError("may only have " + schema.maxDecimal + " digits of decimal places");
+ }
+ }
+ }
+ return null;
+ }
+ // validate an object against a schema
+ function checkObj(instance,objTypeDef,path,additionalProp){
+
+ if(typeof objTypeDef =='object'){
+ if(typeof instance != 'object' || instance instanceof Array){
+ errors.push({property:path,message:"an object is required"});
+ }
+
+ for(var i in objTypeDef){
+ if(objTypeDef.hasOwnProperty(i)){
+ var value = instance[i];
+ // skip _not_ specified properties
+ if (value === undefined && options.existingOnly) continue;
+ var propDef = objTypeDef[i];
+ // set default
+ if(value === undefined && propDef["default"]){
+ value = instance[i] = propDef["default"];
+ }
+ if(options.coerce && i in instance){
+ value = instance[i] = options.coerce(value, propDef);
+ }
+ checkProp(value,propDef,path,i);
+ }
+ }
+ }
+ for(i in instance){
+ if(instance.hasOwnProperty(i) && !(i.charAt(0) == '_' && i.charAt(1) == '_') && objTypeDef && !objTypeDef[i] && additionalProp===false){
+ if (options.filter) {
+ delete instance[i];
+ continue;
+ } else {
+ errors.push({property:path,message:(typeof value) + "The property " + i +
+ " is not defined in the schema and the schema does not allow additional properties"});
+ }
+ }
+ var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires;
+ if(requires && !(requires in instance)){
+ errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"});
+ }
+ value = instance[i];
+ if(additionalProp && (!(objTypeDef && typeof objTypeDef == 'object') || !(i in objTypeDef))){
+ if(options.coerce){
+ value = instance[i] = options.coerce(value, additionalProp);
+ }
+ checkProp(value,additionalProp,path,i);
+ }
+ if(!_changing && value && value.$schema){
+ errors = errors.concat(checkProp(value,value.$schema,path,i));
+ }
+ }
+ return errors;
+ }
+ if(schema){
+ checkProp(instance,schema,'',_changing || '');
+ }
+ if(!_changing && instance && instance.$schema){
+ checkProp(instance,instance.$schema,'','');
+ }
+ return {valid:!errors.length,errors:errors};
+};
+exports.mustBeValid = function(result){
+ // summary:
+ // This checks to ensure that the result is valid and will throw an appropriate error message if it is not
+ // result: the result returned from checkPropertyChange or validate
+ if(!result.valid){
+ throw new TypeError(result.errors.map(function(error){return "for property " + error.property + ': ' + error.message;}).join(", \n"));
+ }
+}
+
+return exports;
+});
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/package.json b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/package.json
new file mode 100644
index 000000000..ff4eeb116
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/package.json
@@ -0,0 +1,86 @@
+{
+ "_args": [
+ [
+ "json-schema@0.2.2",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim"
+ ]
+ ],
+ "_from": "json-schema@0.2.2",
+ "_id": "json-schema@0.2.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/jsprim/json-schema",
+ "_npmUser": {
+ "email": "kriszyp@gmail.com",
+ "name": "kriszyp"
+ },
+ "_npmVersion": "1.1.59",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "json-schema",
+ "raw": "json-schema@0.2.2",
+ "rawSpec": "0.2.2",
+ "scope": null,
+ "spec": "0.2.2",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/request/http-signature/jsprim"
+ ],
+ "_resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.2.tgz",
+ "_shasum": "50354f19f603917c695f70b85afa77c3b0f23506",
+ "_shrinkwrap": null,
+ "_spec": "json-schema@0.2.2",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim",
+ "author": {
+ "name": "Kris Zyp"
+ },
+ "bugs": {
+ "url": "https://github.com/kriszyp/json-schema/issues"
+ },
+ "dependencies": {},
+ "description": "JSON Schema validation and specifications",
+ "devDependencies": {
+ "vows": "*"
+ },
+ "directories": {
+ "lib": "./lib"
+ },
+ "dist": {
+ "shasum": "50354f19f603917c695f70b85afa77c3b0f23506",
+ "tarball": "http://registry.npmjs.org/json-schema/-/json-schema-0.2.2.tgz"
+ },
+ "homepage": "https://github.com/kriszyp/json-schema#readme",
+ "keywords": [
+ "json",
+ "schema"
+ ],
+ "licenses": [
+ {
+ "type": "AFLv2.1",
+ "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43"
+ },
+ {
+ "type": "BSD",
+ "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13"
+ }
+ ],
+ "main": "./lib/validate.js",
+ "maintainers": [
+ {
+ "name": "kriszyp",
+ "email": "kriszyp@gmail.com"
+ }
+ ],
+ "name": "json-schema",
+ "optionalDependencies": {},
+ "readme": "JSON Schema is a repository for the JSON Schema specification, reference schemas and a CommonJS implementation of JSON Schema (not the only JavaScript implementation of JSON Schema, JSV is another excellent JavaScript validator).\r\n\r\nCode is licensed under the AFL or BSD license as part of the Persevere \r\nproject which is administered under the Dojo foundation,\r\nand all contributions require a Dojo CLA.",
+ "repository": {
+ "type": "git",
+ "url": "git+ssh://git@github.com/kriszyp/json-schema.git"
+ },
+ "scripts": {
+ "test": "echo TESTS DISABLED vows --spec test/*.js"
+ },
+ "version": "0.2.2"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/test/tests.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/test/tests.js
new file mode 100644
index 000000000..2938aea7c
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/test/tests.js
@@ -0,0 +1,95 @@
+var assert = require('assert');
+var vows = require('vows');
+var path = require('path');
+var fs = require('fs');
+
+var validate = require('../lib/validate').validate;
+
+
+var revision = 'draft-03';
+var schemaRoot = path.join(__dirname, '..', revision);
+var schemaNames = ['schema', 'hyper-schema', 'links', 'json-ref' ];
+var schemas = {};
+
+schemaNames.forEach(function(name) {
+ var file = path.join(schemaRoot, name);
+ schemas[name] = loadSchema(file);
+});
+
+schemaNames.forEach(function(name) {
+ var s, n = name+'-nsd', f = path.join(schemaRoot, name);
+ schemas[n] = loadSchema(f);
+ s = schemas[n];
+ delete s['$schema'];
+});
+
+function loadSchema(path) {
+ var data = fs.readFileSync(path, 'utf-8');
+ var schema = JSON.parse(data);
+ return schema;
+}
+
+function resultIsValid() {
+ return function(result) {
+ assert.isObject(result);
+ //assert.isBoolean(result.valid);
+ assert.equal(typeof(result.valid), 'boolean');
+ assert.isArray(result.errors);
+ for (var i = 0; i < result.errors.length; i++) {
+ assert.notEqual(result.errors[i], null, 'errors['+i+'] is null');
+ }
+ }
+}
+
+function assertValidates(doc, schema) {
+ var context = {};
+
+ context[': validate('+doc+', '+schema+')'] = {
+ topic: validate(schemas[doc], schemas[schema]),
+ 'returns valid result': resultIsValid(),
+ 'with valid=true': function(result) { assert.equal(result.valid, true); },
+ 'and no errors': function(result) {
+ // XXX work-around for bug in vows: [null] chokes it
+ if (result.errors[0] == null) assert.fail('(errors contains null)');
+ assert.length(result.errors, 0);
+ }
+ };
+
+ return context;
+}
+
+function assertSelfValidates(doc) {
+ var context = {};
+
+ context[': validate('+doc+')'] = {
+ topic: validate(schemas[doc]),
+ 'returns valid result': resultIsValid(),
+ 'with valid=true': function(result) { assert.equal(result.valid, true); },
+ 'and no errors': function(result) { assert.length(result.errors, 0); }
+ };
+
+ return context;
+}
+
+var suite = vows.describe('JSON Schema').addBatch({
+ 'Core-NSD self-validates': assertSelfValidates('schema-nsd'),
+ 'Core-NSD/Core-NSD': assertValidates('schema-nsd', 'schema-nsd'),
+ 'Core-NSD/Core': assertValidates('schema-nsd', 'schema'),
+
+ 'Core self-validates': assertSelfValidates('schema'),
+ 'Core/Core': assertValidates('schema', 'schema'),
+
+ 'Hyper-NSD self-validates': assertSelfValidates('hyper-schema-nsd'),
+ 'Hyper self-validates': assertSelfValidates('hyper-schema'),
+ 'Hyper/Hyper': assertValidates('hyper-schema', 'hyper-schema'),
+ 'Hyper/Core': assertValidates('hyper-schema', 'schema'),
+
+ 'Links-NSD self-validates': assertSelfValidates('links-nsd'),
+ 'Links self-validates': assertSelfValidates('links'),
+ 'Links/Hyper': assertValidates('links', 'hyper-schema'),
+ 'Links/Core': assertValidates('links', 'schema'),
+
+ 'Json-Ref self-validates': assertSelfValidates('json-ref'),
+ 'Json-Ref/Hyper': assertValidates('json-ref', 'hyper-schema'),
+ 'Json-Ref/Core': assertValidates('json-ref', 'schema')
+}).export(module);
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.gitmodules b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.gitmodules
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.gitmodules
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.npmignore
new file mode 100644
index 000000000..3c3629e64
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/LICENSE
new file mode 100644
index 000000000..cbc0bb3ba
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012, Joyent, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile
new file mode 100644
index 000000000..00faa97de
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+# Makefile: top-level Makefile
+#
+# This Makefile contains only repo-specific logic and uses included makefiles
+# to supply common targets (javascriptlint, jsstyle, restdown, etc.), which are
+# used by other repos as well.
+#
+
+#
+# Tools
+#
+NPM = npm
+
+#
+# Files
+#
+JS_FILES := $(shell find lib examples tests -name '*.js')
+JSL_FILES_NODE = $(JS_FILES)
+JSSTYLE_FILES = $(JS_FILES)
+JSL_CONF_NODE = jsl.node.conf
+
+.PHONY: all
+all:
+ $(NPM) install
+
+.PHONY: test
+test:
+ node tests/tst.inherit.js
+ node tests/tst.verror.js
+ node tests/tst.werror.js
+ @echo all tests passed
+
+include ./Makefile.targ
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile.targ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile.targ
new file mode 100644
index 000000000..2a64fe7e9
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile.targ
@@ -0,0 +1,285 @@
+# -*- mode: makefile -*-
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+# Makefile.targ: common targets.
+#
+# NOTE: This makefile comes from the "eng" repo. It's designed to be dropped
+# into other repos as-is without requiring any modifications. If you find
+# yourself changing this file, you should instead update the original copy in
+# eng.git and then update your repo to use the new version.
+#
+# This Makefile defines several useful targets and rules. You can use it by
+# including it from a Makefile that specifies some of the variables below.
+#
+# Targets defined in this Makefile:
+#
+# check Checks JavaScript files for lint and style
+# Checks bash scripts for syntax
+# Checks SMF manifests for validity against the SMF DTD
+#
+# clean Removes built files
+#
+# docs Builds restdown documentation in docs/
+#
+# prepush Depends on "check" and "test"
+#
+# test Does nothing (you should override this)
+#
+# xref Generates cscope (source cross-reference index)
+#
+# For details on what these targets are supposed to do, see the Joyent
+# Engineering Guide.
+#
+# To make use of these targets, you'll need to set some of these variables. Any
+# variables left unset will simply not be used.
+#
+# BASH_FILES Bash scripts to check for syntax
+# (paths relative to top-level Makefile)
+#
+# CLEAN_FILES Files to remove as part of the "clean" target. Note
+# that files generated by targets in this Makefile are
+# automatically included in CLEAN_FILES. These include
+# restdown-generated HTML and JSON files.
+#
+# DOC_FILES Restdown (documentation source) files. These are
+# assumed to be contained in "docs/", and must NOT
+# contain the "docs/" prefix.
+#
+# JSL_CONF_NODE Specify JavaScriptLint configuration files
+# JSL_CONF_WEB (paths relative to top-level Makefile)
+#
+# Node.js and Web configuration files are separate
+# because you'll usually want different global variable
+# configurations. If no file is specified, none is given
+# to jsl, which causes it to use a default configuration,
+# which probably isn't what you want.
+#
+# JSL_FILES_NODE JavaScript files to check with Node config file.
+# JSL_FILES_WEB JavaScript files to check with Web config file.
+#
+# You can also override these variables:
+#
+# BASH Path to bash (default: bash)
+#
+# CSCOPE_DIRS Directories to search for source files for the cscope
+# index. (default: ".")
+#
+# JSL Path to JavaScriptLint (default: "jsl")
+#
+# JSL_FLAGS_NODE Additional flags to pass through to JSL
+# JSL_FLAGS_WEB
+# JSL_FLAGS
+#
+# JSSTYLE Path to jsstyle (default: jsstyle)
+#
+# JSSTYLE_FLAGS Additional flags to pass through to jsstyle
+#
+
+#
+# Defaults for the various tools we use.
+#
+BASH ?= bash
+BASHSTYLE ?= tools/bashstyle
+CP ?= cp
+CSCOPE ?= cscope
+CSCOPE_DIRS ?= .
+JSL ?= jsl
+JSSTYLE ?= jsstyle
+MKDIR ?= mkdir -p
+MV ?= mv
+RESTDOWN_FLAGS ?=
+RMTREE ?= rm -rf
+JSL_FLAGS ?= --nologo --nosummary
+
+ifeq ($(shell uname -s),SunOS)
+ TAR ?= gtar
+else
+ TAR ?= tar
+endif
+
+
+#
+# Defaults for other fixed values.
+#
+BUILD = build
+DISTCLEAN_FILES += $(BUILD)
+DOC_BUILD = $(BUILD)/docs/public
+
+#
+# Configure JSL_FLAGS_{NODE,WEB} based on JSL_CONF_{NODE,WEB}.
+#
+ifneq ($(origin JSL_CONF_NODE), undefined)
+ JSL_FLAGS_NODE += --conf=$(JSL_CONF_NODE)
+endif
+
+ifneq ($(origin JSL_CONF_WEB), undefined)
+ JSL_FLAGS_WEB += --conf=$(JSL_CONF_WEB)
+endif
+
+#
+# Targets. For descriptions on what these are supposed to do, see the
+# Joyent Engineering Guide.
+#
+
+#
+# Instruct make to keep around temporary files. We have rules below that
+# automatically update git submodules as needed, but they employ a deps/*/.git
+# temporary file. Without this directive, make tries to remove these .git
+# directories after the build has completed.
+#
+.SECONDARY: $($(wildcard deps/*):%=%/.git)
+
+#
+# This rule enables other rules that use files from a git submodule to have
+# those files depend on deps/module/.git and have "make" automatically check
+# out the submodule as needed.
+#
+deps/%/.git:
+ git submodule update --init deps/$*
+
+#
+# These recipes make heavy use of dynamically-created phony targets. The parent
+# Makefile defines a list of input files like BASH_FILES. We then say that each
+# of these files depends on a fake target called filename.bashchk, and then we
+# define a pattern rule for those targets that runs bash in check-syntax-only
+# mode. This mechanism has the nice properties that if you specify zero files,
+# the rule becomes a noop (unlike a single rule to check all bash files, which
+# would invoke bash with zero files), and you can check individual files from
+# the command line with "make filename.bashchk".
+#
+.PHONY: check-bash
+check-bash: $(BASH_FILES:%=%.bashchk) $(BASH_FILES:%=%.bashstyle)
+
+%.bashchk: %
+ $(BASH) -n $^
+
+%.bashstyle: %
+ $(BASHSTYLE) $^
+
+.PHONY: check-jsl check-jsl-node check-jsl-web
+check-jsl: check-jsl-node check-jsl-web
+
+check-jsl-node: $(JSL_FILES_NODE:%=%.jslnodechk)
+
+check-jsl-web: $(JSL_FILES_WEB:%=%.jslwebchk)
+
+%.jslnodechk: % $(JSL_EXEC)
+ $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_NODE) $<
+
+%.jslwebchk: % $(JSL_EXEC)
+ $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_WEB) $<
+
+.PHONY: check-jsstyle
+check-jsstyle: $(JSSTYLE_FILES:%=%.jsstylechk)
+
+%.jsstylechk: % $(JSSTYLE_EXEC)
+ $(JSSTYLE) $(JSSTYLE_FLAGS) $<
+
+.PHONY: check
+check: check-jsl check-jsstyle check-bash
+ @echo check ok
+
+.PHONY: clean
+clean::
+ -$(RMTREE) $(CLEAN_FILES)
+
+.PHONY: distclean
+distclean:: clean
+ -$(RMTREE) $(DISTCLEAN_FILES)
+
+CSCOPE_FILES = cscope.in.out cscope.out cscope.po.out
+CLEAN_FILES += $(CSCOPE_FILES)
+
+.PHONY: xref
+xref: cscope.files
+ $(CSCOPE) -bqR
+
+.PHONY: cscope.files
+cscope.files:
+ find $(CSCOPE_DIRS) -name '*.c' -o -name '*.h' -o -name '*.cc' \
+ -o -name '*.js' -o -name '*.s' -o -name '*.cpp' > $@
+
+#
+# The "docs" target is complicated because we do several things here:
+#
+# (1) Use restdown to build HTML and JSON files from each of DOC_FILES.
+#
+# (2) Copy these files into $(DOC_BUILD) (build/docs/public), which
+# functions as a complete copy of the documentation that could be
+# mirrored or served over HTTP.
+#
+# (3) Then copy any directories and media from docs/media into
+# $(DOC_BUILD)/media. This allows projects to include their own media,
+# including files that will override same-named files provided by
+# restdown.
+#
+# Step (3) is the surprisingly complex part: in order to do this, we need to
+# identify the subdirectories in docs/media, recreate them in
+# $(DOC_BUILD)/media, then do the same with the files.
+#
+DOC_MEDIA_DIRS := $(shell find docs/media -type d 2>/dev/null | grep -v "^docs/media$$")
+DOC_MEDIA_DIRS := $(DOC_MEDIA_DIRS:docs/media/%=%)
+DOC_MEDIA_DIRS_BUILD := $(DOC_MEDIA_DIRS:%=$(DOC_BUILD)/media/%)
+
+DOC_MEDIA_FILES := $(shell find docs/media -type f 2>/dev/null)
+DOC_MEDIA_FILES := $(DOC_MEDIA_FILES:docs/media/%=%)
+DOC_MEDIA_FILES_BUILD := $(DOC_MEDIA_FILES:%=$(DOC_BUILD)/media/%)
+
+#
+# Like the other targets, "docs" just depends on the final files we want to
+# create in $(DOC_BUILD), leveraging other targets and recipes to define how
+# to get there.
+#
+.PHONY: docs
+docs: \
+ $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.html) \
+ $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.json) \
+ $(DOC_MEDIA_FILES_BUILD)
+
+#
+# We keep the intermediate files so that the next build can see whether the
+# files in DOC_BUILD are up to date.
+#
+.PRECIOUS: \
+ $(DOC_FILES:%.restdown=docs/%.html) \
+ $(DOC_FILES:%.restdown=docs/%json)
+
+#
+# We do clean those intermediate files, as well as all of DOC_BUILD.
+#
+CLEAN_FILES += \
+ $(DOC_BUILD) \
+ $(DOC_FILES:%.restdown=docs/%.html) \
+ $(DOC_FILES:%.restdown=docs/%.json)
+
+#
+# Before installing the files, we must make sure the directories exist. The |
+# syntax tells make that the dependency need only exist, not be up to date.
+# Otherwise, it might try to rebuild spuriously because the directory itself
+# appears out of date.
+#
+$(DOC_MEDIA_FILES_BUILD): | $(DOC_MEDIA_DIRS_BUILD)
+
+$(DOC_BUILD)/%: docs/% | $(DOC_BUILD)
+ $(CP) $< $@
+
+docs/%.json docs/%.html: docs/%.restdown | $(DOC_BUILD) $(RESTDOWN_EXEC)
+ $(RESTDOWN) $(RESTDOWN_FLAGS) -m $(DOC_BUILD) $<
+
+$(DOC_BUILD):
+ $(MKDIR) $@
+
+$(DOC_MEDIA_DIRS_BUILD):
+ $(MKDIR) $@
+
+#
+# The default "test" target does nothing. This should usually be overridden by
+# the parent Makefile. It's included here so we can define "prepush" without
+# requiring the repo to define "test".
+#
+.PHONY: test
+test:
+
+.PHONY: prepush
+prepush: check test
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/README.md b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/README.md
new file mode 100644
index 000000000..e9b549785
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/README.md
@@ -0,0 +1,120 @@
+# verror: richer JavaScript errors
+
+This module provides two classes: VError, for accretive errors, and WError, for
+wrapping errors. Both support printf-style error messages using extsprintf.
+
+## Printf-style errors
+
+At the most basic level, VError is just like JavaScript's Error class, but with
+printf-style arguments:
+
+ var verror = require('verror');
+
+ var opname = 'read';
+ var err = new verror.VError('"%s" operation failed', opname);
+ console.log(err.message);
+ console.log(err.stack);
+
+This prints:
+
+ "read" operation failed
+ "read" operation failed
+ at Object.<anonymous> (/Users/dap/node-verror/examples/varargs.js:4:11)
+ at Module._compile (module.js:449:26)
+ at Object.Module._extensions..js (module.js:467:10)
+ at Module.load (module.js:356:32)
+ at Function.Module._load (module.js:312:12)
+ at Module.runMain (module.js:492:10)
+ at process.startup.processNextTick.process._tickCallback (node.js:244:9)
+
+
+## VError for accretive error messages
+
+More interestingly, you can use VError to build up an error describing what
+happened at various levels in the stack. For example, suppose you have a
+request handler that stats a file and fails if it doesn't exist:
+
+ var fs = require('fs');
+ var verror = require('verror');
+
+ function checkFile(filename, callback) {
+ fs.stat(filename, function (err) {
+ if (err)
+ /* Annotate the "stat" error with what we were doing. */
+ return (callback(new verror.VError(err,
+ 'failed to check "%s"', filename)));
+
+ /* ... */
+ });
+ }
+
+ function handleRequest(filename, callback) {
+ checkFile('/nonexistent', function (err) {
+ if (err) {
+ /* Annotate the "checkFile" error with what we were doing. */
+ return (callback(new verror.VError(err, 'request failed')));
+ }
+
+ /* ... */
+ });
+ }
+
+ handleRequest('/nonexistent', function (err) {
+ if (err)
+ console.log(err.message);
+ /* ... */
+ });
+
+Since the file "/nonexistent" doesn't exist, this prints out:
+
+ request failed: failed to check "/nonexistent": ENOENT, stat '/nonexistent'
+
+The idea here is that the lowest level (Node's "fs.stat" function) generates an
+arbitrary error, and each higher level (request handler and stat callback)
+creates a new VError that annotates the previous error with what it was doing,
+so that the result is a clear message explaining what failed at each level.
+
+This plays nicely with extsprintf's "%r" specifier, which prints out a
+Java-style stacktrace with the whole chain of exceptions:
+
+ EXCEPTION: VError: request failed: failed to check "/nonexistent": ENOENT, stat '/nonexistent'
+ at /Users/dap/work/node-verror/examples/levels.js:21:21
+ at /Users/dap/work/node-verror/examples/levels.js:9:12
+ at Object.oncomplete (fs.js:297:15)
+ Caused by: EXCEPTION: VError: failed to check "/nonexistent": ENOENT, stat '/nonexistent'
+ at /Users/dap/work/node-verror/examples/levels.js:9:21
+ at Object.oncomplete (fs.js:297:15)
+ Caused by: EXCEPTION: Error: Error: ENOENT, stat '/nonexistent'
+
+
+## WError for wrapped errors
+
+Sometimes you don't want an Error's "message" field to include the details of
+all of the low-level errors, but you still want to be able to get at them
+programmatically. For example, in an HTTP server, you probably don't want to
+spew all of the low-level errors back to the client, but you do want to include
+them in the audit log entry for the request. In that case, you can use a
+WError, which is created exactly like VError (and also supports both
+printf-style arguments and an optional cause), but the resulting "message" only
+contains the top-level error. It's also more verbose, including the class
+associated with each error in the cause chain. Using the same example above,
+but replacing the VError in handleRequest with WError, we get this output:
+
+ request failed
+
+That's what we wanted -- just a high-level summary for the client. But we can
+get the object's toString() for the full details:
+
+ WError: request failed; caused by WError: failed to check "/nonexistent";
+ caused by Error: ENOENT, stat '/nonexistent'
+
+# Contributing
+
+Contributions welcome. Code should be "make check" clean. To run "make check",
+you'll need these tools:
+
+* https://github.com/davepacheco/jsstyle
+* https://github.com/davepacheco/javascriptlint
+
+If you're changing something non-trivial or user-facing, you may want to submit
+an issue first.
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
new file mode 100644
index 000000000..53a7022c6
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js
@@ -0,0 +1,36 @@
+var extsprintf = require('extsprintf');
+var fs = require('fs');
+var verror = require('../lib/verror');
+
+function checkFile(filename, callback) {
+ fs.stat(filename, function (err) {
+ if (err)
+ /* Annotate the "stat" error with what we were doing. */
+ return (callback(new verror.VError(err,
+ 'failed to check "%s"', filename)));
+
+ /* ... */
+ return (callback());
+ });
+}
+
+function handleRequest(filename, callback) {
+ checkFile('/nonexistent', function (err) {
+ if (err)
+ /* Annotate the "checkFile" error. */
+ return (callback(new verror.VError(
+ err, 'request failed')));
+
+ /* ... */
+ return (callback());
+ });
+}
+
+handleRequest('/nonexistent', function (err) {
+ if (err) {
+ console.log(err.message);
+ console.log(extsprintf.sprintf('%r', err));
+ }
+
+ /* ... */
+});
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-werror.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-werror.js
new file mode 100644
index 000000000..7e570756e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-werror.js
@@ -0,0 +1,34 @@
+var extsprintf = require('extsprintf');
+var fs = require('fs');
+var verror = require('../lib/verror');
+
+function checkFile(filename, callback) {
+ fs.stat(filename, function (err) {
+ if (err)
+ /* Annotate the "stat" error with what we were doing. */
+ return (callback(new verror.VError(err,
+ 'failed to check "%s"', filename)));
+
+ /* ... */
+ return (callback());
+ });
+}
+
+function handleRequest(filename, callback) {
+ checkFile('/nonexistent', function (err) {
+ if (err)
+ /* Wrap the "checkFile" error. */
+ return (callback(new verror.WError(
+ err, 'request failed')));
+
+ /* ... */
+ return (callback());
+ });
+}
+
+handleRequest('/nonexistent', function (err) {
+ if (err) {
+ console.log(err.message);
+ console.log(err.toString());
+ }
+});
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/varargs.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/varargs.js
new file mode 100644
index 000000000..2e14ee48c
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/varargs.js
@@ -0,0 +1,6 @@
+var verror = require('../lib/verror');
+
+var opname = 'read';
+var err = new verror.VError('"%s" operation failed', opname);
+console.log(err.message);
+console.log(err.stack);
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/verror.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/verror.js
new file mode 100644
index 000000000..887b181b0
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/verror.js
@@ -0,0 +1,13 @@
+var mod_fs = require('fs');
+var mod_verror = require('../lib/verror');
+
+var filename = '/nonexistent';
+
+mod_fs.stat(filename, function (err1) {
+ var err2 = new mod_verror.VError(err1, 'failed to stat "%s"', filename);
+
+ /* The following would normally be higher up the stack. */
+ var err3 = new mod_verror.VError(err2, 'failed to handle request');
+ console.log(err3.message);
+ console.log(err3.stack);
+});
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/werror.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/werror.js
new file mode 100644
index 000000000..f55e5322e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/werror.js
@@ -0,0 +1,14 @@
+var mod_fs = require('fs');
+var mod_verror = require('../lib/verror');
+
+var filename = '/nonexistent';
+
+mod_fs.stat(filename, function (err1) {
+ var err2 = new mod_verror.WError(err1, 'failed to stat "%s"', filename);
+
+ /* The following would normally be higher up the stack. */
+ var err3 = new mod_verror.WError(err2, 'failed to handle request');
+ console.log(err3.message);
+ console.log(err3.toString());
+ console.log(err3.stack);
+});
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/jsl.node.conf b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/jsl.node.conf
new file mode 100644
index 000000000..bd724a2c7
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/jsl.node.conf
@@ -0,0 +1,139 @@
+#
+# Configuration File for JavaScript Lint
+#
+# This configuration file can be used to lint a collection of scripts, or to enable
+# or disable warnings for scripts that are linted via the command line.
+#
+
+### Warnings
+# Enable or disable warnings based on requirements.
+# Use "+WarningName" to display or "-WarningName" to suppress.
+#
++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent
++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity
++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement
++anon_no_return_value # anonymous function does not always return value
++assign_to_function_call # assignment to a function call
+-block_without_braces # block statement without curly braces
++comma_separated_stmts # multiple statements separated by commas (use semicolons?)
++comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
++default_not_at_end # the default case is not at the end of the switch statement
++dup_option_explicit # duplicate "option explicit" control comment
++duplicate_case_in_switch # duplicate case in switch statement
++duplicate_formal # duplicate formal argument {name}
++empty_statement # empty statement or extra semicolon
++identifier_hides_another # identifer {name} hides an identifier in a parent scope
+-inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement
++incorrect_version # Expected /*jsl:content-type*/ control comment. The script was parsed with the wrong version.
++invalid_fallthru # unexpected "fallthru" control comment
++invalid_pass # unexpected "pass" control comment
++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax
++leading_decimal_point # leading decimal point may indicate a number or an object member
++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax
++meaningless_block # meaningless block; curly braces have no impact
++mismatch_ctrl_comments # mismatched control comment; "ignore" and "end" control comments must have a one-to-one correspondence
++misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
++missing_break # missing break statement
++missing_break_for_last_case # missing break statement for last case in switch
++missing_default_case # missing default case in switch statement
++missing_option_explicit # the "option explicit" control comment is missing
++missing_semicolon # missing semicolon
++missing_semicolon_for_lambda # missing semicolon for lambda assignment
++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
++nested_comment # nested comment
++no_return_value # function {name} does not always return a value
++octal_number # leading zeros make an octal number
++parseint_missing_radix # parseInt missing radix parameter
++partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag
++redeclared_var # redeclaration of {name}
++trailing_comma_in_array # extra comma is not recommended in array initializers
++trailing_decimal_point # trailing decimal point may indicate a number or an object member
++undeclared_identifier # undeclared identifier: {name}
++unreachable_code # unreachable code
+-unreferenced_argument # argument declared but never referenced: {name}
+-unreferenced_function # function is declared but never referenced: {name}
++unreferenced_variable # variable is declared but never referenced: {name}
++unsupported_version # JavaScript {version} is not supported
++use_of_label # use of label
++useless_assign # useless assignment
++useless_comparison # useless comparison; comparing identical expressions
+-useless_quotes # the quotation marks are unnecessary
++useless_void # use of the void type may be unnecessary (void is always undefined)
++var_hides_arg # variable {name} hides argument
++want_assign_or_call # expected an assignment or function call
++with_statement # with statement hides undeclared variables; use temporary variable instead
+
+
+### Output format
+# Customize the format of the error message.
+# __FILE__ indicates current file path
+# __FILENAME__ indicates current file name
+# __LINE__ indicates current line
+# __COL__ indicates current column
+# __ERROR__ indicates error message (__ERROR_PREFIX__: __ERROR_MSG__)
+# __ERROR_NAME__ indicates error name (used in configuration file)
+# __ERROR_PREFIX__ indicates error prefix
+# __ERROR_MSG__ indicates error message
+#
+# For machine-friendly output, the output format can be prefixed with
+# "encode:". If specified, all items will be encoded with C-slashes.
+#
+# Visual Studio syntax (default):
++output-format __FILE__(__LINE__): __ERROR__
+# Alternative syntax:
+#+output-format __FILE__:__LINE__: __ERROR__
+
+
+### Context
+# Show the in-line position of the error.
+# Use "+context" to display or "-context" to suppress.
+#
++context
+
+
+### Control Comments
+# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for
+# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is
+# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason,
+# although legacy control comments are enabled by default for backward compatibility.
+#
+-legacy_control_comments
+
+
+### Defining identifiers
+# By default, "option explicit" is enabled on a per-file basis.
+# To enable this for all files, use "+always_use_option_explicit"
+-always_use_option_explicit
+
+# Define certain identifiers of which the lint is not aware.
+# (Use this in conjunction with the "undeclared identifier" warning.)
+#
+# Common uses for webpages might be:
++define __dirname
++define clearInterval
++define clearTimeout
++define console
++define exports
++define global
++define process
++define require
++define setInterval
++define setTimeout
++define Buffer
++define JSON
++define Math
++define __dirname
++define __filename
+
+### JavaScript Version
+# To change the default JavaScript version:
+#+default-type text/javascript;version=1.5
+#+default-type text/javascript;e4x=1
+
+### Files
+# Specify which files to lint
+# Use "+recurse" to enable recursion (disabled by default).
+# To add a set of files, use "+process FileName", "+process Folder\Path\*.js",
+# or "+process Folder\Path\*.htm".
+#
+
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/lib/verror.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/lib/verror.js
new file mode 100644
index 000000000..9ca087b17
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/lib/verror.js
@@ -0,0 +1,157 @@
+/*
+ * verror.js: richer JavaScript errors
+ */
+
+var mod_assert = require('assert');
+var mod_util = require('util');
+
+var mod_extsprintf = require('extsprintf');
+
+/*
+ * Public interface
+ */
+exports.VError = VError;
+exports.WError = WError;
+exports.MultiError = MultiError;
+
+/*
+ * Like JavaScript's built-in Error class, but supports a "cause" argument and a
+ * printf-style message. The cause argument can be null.
+ */
+function VError(options)
+{
+ var args, causedBy, ctor, tailmsg;
+
+ if (options instanceof Error || typeof (options) === 'object') {
+ args = Array.prototype.slice.call(arguments, 1);
+ } else {
+ args = Array.prototype.slice.call(arguments, 0);
+ options = undefined;
+ }
+
+ tailmsg = args.length > 0 ?
+ mod_extsprintf.sprintf.apply(null, args) : '';
+ this.jse_shortmsg = tailmsg;
+ this.jse_summary = tailmsg;
+
+ if (options) {
+ causedBy = options.cause;
+
+ if (!causedBy || !(options.cause instanceof Error))
+ causedBy = options;
+
+ if (causedBy && (causedBy instanceof Error)) {
+ this.jse_cause = causedBy;
+ this.jse_summary += ': ' + causedBy.message;
+ }
+ }
+
+ this.message = this.jse_summary;
+ Error.call(this, this.jse_summary);
+
+ if (Error.captureStackTrace) {
+ ctor = options ? options.constructorOpt : undefined;
+ ctor = ctor || arguments.callee;
+ Error.captureStackTrace(this, ctor);
+ }
+}
+
+mod_util.inherits(VError, Error);
+VError.prototype.name = 'VError';
+
+VError.prototype.toString = function ve_toString()
+{
+ var str = (this.hasOwnProperty('name') && this.name ||
+ this.constructor.name || this.constructor.prototype.name);
+ if (this.message)
+ str += ': ' + this.message;
+
+ return (str);
+};
+
+VError.prototype.cause = function ve_cause()
+{
+ return (this.jse_cause);
+};
+
+
+/*
+ * Represents a collection of errors for the purpose of consumers that generally
+ * only deal with one error. Callers can extract the individual errors
+ * contained in this object, but may also just treat it as a normal single
+ * error, in which case a summary message will be printed.
+ */
+function MultiError(errors)
+{
+ mod_assert.ok(errors.length > 0);
+ this.ase_errors = errors;
+
+ VError.call(this, errors[0], 'first of %d error%s',
+ errors.length, errors.length == 1 ? '' : 's');
+}
+
+mod_util.inherits(MultiError, VError);
+
+
+
+/*
+ * Like JavaScript's built-in Error class, but supports a "cause" argument which
+ * is wrapped, not "folded in" as with VError. Accepts a printf-style message.
+ * The cause argument can be null.
+ */
+function WError(options)
+{
+ Error.call(this);
+
+ var args, cause, ctor;
+ if (typeof (options) === 'object') {
+ args = Array.prototype.slice.call(arguments, 1);
+ } else {
+ args = Array.prototype.slice.call(arguments, 0);
+ options = undefined;
+ }
+
+ if (args.length > 0) {
+ this.message = mod_extsprintf.sprintf.apply(null, args);
+ } else {
+ this.message = '';
+ }
+
+ if (options) {
+ if (options instanceof Error) {
+ cause = options;
+ } else {
+ cause = options.cause;
+ ctor = options.constructorOpt;
+ }
+ }
+
+ Error.captureStackTrace(this, ctor || this.constructor);
+ if (cause)
+ this.cause(cause);
+
+}
+
+mod_util.inherits(WError, Error);
+WError.prototype.name = 'WError';
+
+
+WError.prototype.toString = function we_toString()
+{
+ var str = (this.hasOwnProperty('name') && this.name ||
+ this.constructor.name || this.constructor.prototype.name);
+ if (this.message)
+ str += ': ' + this.message;
+ if (this.we_cause && this.we_cause.message)
+ str += '; caused by ' + this.we_cause.toString();
+
+ return (str);
+};
+
+WError.prototype.cause = function we_cause(c)
+{
+ if (c instanceof Error)
+ this.we_cause = c;
+
+ return (this.we_cause);
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/package.json b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/package.json
new file mode 100644
index 000000000..d1cd81287
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/package.json
@@ -0,0 +1,70 @@
+{
+ "_args": [
+ [
+ "verror@1.3.6",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim"
+ ]
+ ],
+ "_from": "verror@1.3.6",
+ "_id": "verror@1.3.6",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/jsprim/verror",
+ "_npmUser": {
+ "email": "dap@cs.brown.edu",
+ "name": "dap"
+ },
+ "_npmVersion": "1.1.65",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "verror",
+ "raw": "verror@1.3.6",
+ "rawSpec": "1.3.6",
+ "scope": null,
+ "spec": "1.3.6",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/request/http-signature/jsprim"
+ ],
+ "_resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz",
+ "_shasum": "cff5df12946d297d2baaefaa2689e25be01c005c",
+ "_shrinkwrap": null,
+ "_spec": "verror@1.3.6",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim",
+ "bugs": {
+ "url": "https://github.com/davepacheco/node-verror/issues"
+ },
+ "dependencies": {
+ "extsprintf": "1.0.2"
+ },
+ "description": "richer JavaScript errors",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "cff5df12946d297d2baaefaa2689e25be01c005c",
+ "tarball": "http://registry.npmjs.org/verror/-/verror-1.3.6.tgz"
+ },
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "homepage": "https://github.com/davepacheco/node-verror#readme",
+ "main": "./lib/verror.js",
+ "maintainers": [
+ {
+ "name": "dap",
+ "email": "dap@cs.brown.edu"
+ }
+ ],
+ "name": "verror",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/davepacheco/node-verror.git"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "version": "1.3.6"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.inherit.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.inherit.js
new file mode 100644
index 000000000..0f0d70b5f
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.inherit.js
@@ -0,0 +1,100 @@
+/*
+ * tst.inherit.js: test that inheriting from VError and WError work as expected.
+ */
+
+var mod_assert = require('assert');
+var mod_util = require('util');
+
+var mod_verror = require('../lib/verror');
+
+var VError = mod_verror.VError;
+var WError = mod_verror.WError;
+var err, suberr;
+
+function VErrorChild()
+{
+ VError.apply(this, Array.prototype.slice.call(arguments));
+}
+
+mod_util.inherits(VErrorChild, VError);
+VErrorChild.prototype.name = 'VErrorChild';
+
+
+function WErrorChild()
+{
+ WError.apply(this, Array.prototype.slice.call(arguments));
+}
+
+mod_util.inherits(WErrorChild, WError);
+WErrorChild.prototype.name = 'WErrorChild';
+
+
+suberr = new Error('root cause');
+err = new VErrorChild(suberr, 'top');
+mod_assert.ok(err instanceof Error);
+mod_assert.ok(err instanceof VError);
+mod_assert.ok(err instanceof VErrorChild);
+mod_assert.equal(err.cause(), suberr);
+mod_assert.equal(err.message, 'top: root cause');
+mod_assert.equal(err.toString(), 'VErrorChild: top: root cause');
+mod_assert.equal(err.stack.split('\n')[0], 'VErrorChild: top: root cause');
+
+suberr = new Error('root cause');
+err = new WErrorChild(suberr, 'top');
+mod_assert.ok(err instanceof Error);
+mod_assert.ok(err instanceof WError);
+mod_assert.ok(err instanceof WErrorChild);
+mod_assert.equal(err.cause(), suberr);
+mod_assert.equal(err.message, 'top');
+mod_assert.equal(err.toString(),
+ 'WErrorChild: top; caused by Error: root cause');
+mod_assert.equal(err.stack.split('\n')[0],
+ 'WErrorChild: top; caused by Error: root cause');
+
+
+// Test that `<Ctor>.toString()` uses the ctor name. I.e. setting
+// `<Ctor>.prototype.name` isn't necessary.
+function VErrorChildNoName() {
+ VError.apply(this, Array.prototype.slice.call(arguments));
+}
+mod_util.inherits(VErrorChildNoName, VError);
+err = new VErrorChildNoName('top');
+mod_assert.equal(err.toString(), 'VErrorChildNoName: top');
+
+function WErrorChildNoName() {
+ WError.apply(this, Array.prototype.slice.call(arguments));
+}
+mod_util.inherits(WErrorChildNoName, WError);
+err = new WErrorChildNoName('top');
+mod_assert.equal(err.toString(), 'WErrorChildNoName: top');
+
+
+// Test that `<Ctor>.prototype.name` can be used for the `.toString()`
+// when the ctor is anonymous.
+var VErrorChildAnon = function () {
+ VError.apply(this, Array.prototype.slice.call(arguments));
+};
+mod_util.inherits(VErrorChildAnon, VError);
+VErrorChildAnon.prototype.name = 'VErrorChildAnon';
+err = new VErrorChildAnon('top');
+mod_assert.equal(err.toString(), 'VErrorChildAnon: top');
+
+var WErrorChildAnon = function () {
+ WError.apply(this, Array.prototype.slice.call(arguments));
+};
+mod_util.inherits(WErrorChildAnon, WError);
+WErrorChildAnon.prototype.name = 'WErrorChildAnon';
+err = new WErrorChildAnon('top');
+mod_assert.equal(err.toString(), 'WErrorChildAnon: top');
+
+
+// Test get appropriate exception name in `.toString()` when reconstituting
+// an error instance a la:
+// https://github.com/mcavage/node-fast/blob/master/lib/client.js#L215
+err = new VError('top');
+err.name = 'CustomNameError';
+mod_assert.equal(err.toString(), 'CustomNameError: top');
+
+err = new WError('top');
+err.name = 'CustomNameError';
+mod_assert.equal(err.toString(), 'CustomNameError: top');
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.verror.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.verror.js
new file mode 100644
index 000000000..ee937cd00
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.verror.js
@@ -0,0 +1,156 @@
+/*
+ * tst.verror.js: tests basic functionality of the VError class.
+ */
+
+var mod_assert = require('assert');
+var mod_verror = require('../lib/verror');
+
+var VError = mod_verror.VError;
+var WError = mod_verror.WError;
+
+var err, suberr, stack, substack;
+
+/*
+ * Remove full paths and relative line numbers from stack traces so that we can
+ * compare against "known-good" output.
+ */
+function cleanStack(stacktxt)
+{
+ var re = new RegExp(__filename + ':\\d+:\\d+', 'gm');
+ stacktxt = stacktxt.replace(re, 'tst.verror.js');
+ return (stacktxt);
+}
+
+/*
+ * Save the generic parts of all stack traces so we can avoid hardcoding
+ * Node-specific implementation details in our testing of stack traces.
+ */
+var nodestack = new Error().stack.split('\n').slice(2).join('\n');
+
+/* no arguments */
+err = new VError();
+mod_assert.equal(err.name, 'VError');
+mod_assert.ok(err instanceof Error);
+mod_assert.ok(err instanceof VError);
+mod_assert.equal(err.message, '');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
+
+/* options-argument form */
+err = new VError({});
+mod_assert.equal(err.message, '');
+mod_assert.ok(err.cause() === undefined);
+
+/* simple message */
+err = new VError('my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError: my error',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = new VError({}, 'my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.ok(err.cause() === undefined);
+
+/* printf-style message */
+err = new VError('%s error: %3d problems', 'very bad', 15);
+mod_assert.equal(err.message, 'very bad error: 15 problems');
+mod_assert.ok(err.cause() === undefined);
+
+err = new VError({}, '%s error: %3d problems', 'very bad', 15);
+mod_assert.equal(err.message, 'very bad error: 15 problems');
+mod_assert.ok(err.cause() === undefined);
+
+/* caused by another error, with no additional message */
+suberr = new Error('root cause');
+err = new VError(suberr);
+mod_assert.equal(err.message, ': root cause');
+mod_assert.ok(err.cause() === suberr);
+
+err = new VError({ 'cause': suberr });
+mod_assert.equal(err.message, ': root cause');
+mod_assert.ok(err.cause() === suberr);
+
+/* caused by another error, with annotation */
+err = new VError(suberr, 'proximate cause: %d issues', 3);
+mod_assert.equal(err.message, 'proximate cause: 3 issues: root cause');
+mod_assert.ok(err.cause() === suberr);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError: proximate cause: 3 issues: root cause',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = new VError({ 'cause': suberr }, 'proximate cause: %d issues', 3);
+mod_assert.equal(err.message, 'proximate cause: 3 issues: root cause');
+mod_assert.ok(err.cause() === suberr);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError: proximate cause: 3 issues: root cause',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
+
+/* caused by another VError, with annotation. */
+suberr = err;
+err = new VError(suberr, 'top');
+mod_assert.equal(err.message, 'top: proximate cause: 3 issues: root cause');
+mod_assert.ok(err.cause() === suberr);
+
+err = new VError({ 'cause': suberr }, 'top');
+mod_assert.equal(err.message, 'top: proximate cause: 3 issues: root cause');
+mod_assert.ok(err.cause() === suberr);
+
+/* caused by a WError */
+suberr = new WError(new Error('root cause'), 'mid');
+err = new VError(suberr, 'top');
+mod_assert.equal(err.message, 'top: mid');
+mod_assert.ok(err.cause() === suberr);
+
+/* null cause (for backwards compatibility with older versions) */
+err = new VError(null, 'my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError: my error',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = new VError({ 'cause': null }, 'my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.ok(err.cause() === undefined);
+
+err = new VError(null);
+mod_assert.equal(err.message, '');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
+
+/* constructorOpt */
+function makeErr(options) {
+ return (new VError(options, 'test error'));
+}
+err = makeErr({});
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError: test error',
+ ' at makeErr (tst.verror.js)',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = makeErr({ 'constructorOpt': makeErr });
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'VError: test error',
+ ' at Object.<anonymous> (tst.verror.js)'
+].join('\n') + '\n' + nodestack);
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.werror.js b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.werror.js
new file mode 100644
index 000000000..c8cdc615a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.werror.js
@@ -0,0 +1,179 @@
+/*
+ * tst.werror.js: tests basic functionality of the WError class.
+ */
+
+var mod_assert = require('assert');
+var mod_verror = require('../lib/verror');
+
+var VError = mod_verror.VError;
+var WError = mod_verror.WError;
+
+var err, suberr, stack, substack;
+
+/*
+ * Remove full paths and relative line numbers from stack traces so that we can
+ * compare against "known-good" output.
+ */
+function cleanStack(stacktxt)
+{
+ var re = new RegExp(__filename + ':\\d+:\\d+', 'gm');
+ stacktxt = stacktxt.replace(re, 'tst.werror.js');
+ return (stacktxt);
+}
+
+/*
+ * Save the generic parts of all stack traces so we can avoid hardcoding
+ * Node-specific implementation details in our testing of stack traces.
+ */
+var nodestack = new Error().stack.split('\n').slice(2).join('\n');
+
+/* no arguments */
+err = new WError();
+mod_assert.equal(err.name, 'WError');
+mod_assert.ok(err instanceof Error);
+mod_assert.ok(err instanceof WError);
+mod_assert.equal(err.message, '');
+mod_assert.equal(err.toString(), 'WError');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
+
+/* options-argument form */
+err = new WError({});
+mod_assert.equal(err.message, '');
+mod_assert.equal(err.toString(), 'WError');
+mod_assert.ok(err.cause() === undefined);
+
+/* simple message */
+err = new WError('my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.equal(err.toString(), 'WError: my error');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError: my error',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = new WError({}, 'my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.equal(err.toString(), 'WError: my error');
+mod_assert.ok(err.cause() === undefined);
+
+/* printf-style message */
+err = new WError('%s error: %3d problems', 'very bad', 15);
+mod_assert.equal(err.message, 'very bad error: 15 problems');
+mod_assert.equal(err.toString(), 'WError: very bad error: 15 problems');
+mod_assert.ok(err.cause() === undefined);
+
+err = new WError({}, '%s error: %3d problems', 'very bad', 15);
+mod_assert.equal(err.message, 'very bad error: 15 problems');
+mod_assert.equal(err.toString(), 'WError: very bad error: 15 problems');
+mod_assert.ok(err.cause() === undefined);
+
+/* caused by another error, with no additional message */
+suberr = new Error('root cause');
+err = new WError(suberr);
+mod_assert.equal(err.message, '');
+mod_assert.equal(err.toString(), 'WError; caused by Error: root cause');
+mod_assert.ok(err.cause() === suberr);
+
+err = new WError({ 'cause': suberr });
+mod_assert.equal(err.message, '');
+mod_assert.equal(err.toString(), 'WError; caused by Error: root cause');
+mod_assert.ok(err.cause() === suberr);
+
+/* caused by another error, with annotation */
+err = new WError(suberr, 'proximate cause: %d issues', 3);
+mod_assert.equal(err.message, 'proximate cause: 3 issues');
+mod_assert.equal(err.toString(), 'WError: proximate cause: 3 issues; ' +
+ 'caused by Error: root cause');
+mod_assert.ok(err.cause() === suberr);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError: proximate cause: 3 issues; caused by Error: root cause',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = new WError({ 'cause': suberr }, 'proximate cause: %d issues', 3);
+mod_assert.equal(err.message, 'proximate cause: 3 issues');
+mod_assert.equal(err.toString(), 'WError: proximate cause: 3 issues; ' +
+ 'caused by Error: root cause');
+mod_assert.ok(err.cause() === suberr);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError: proximate cause: 3 issues; caused by Error: root cause',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
+
+/* caused by another WError, with annotation. */
+suberr = err;
+err = new WError(suberr, 'top');
+mod_assert.equal(err.message, 'top');
+mod_assert.equal(err.toString(), 'WError: top; caused by WError: ' +
+ 'proximate cause: 3 issues; caused by Error: root cause');
+mod_assert.ok(err.cause() === suberr);
+
+err = new WError({ 'cause': suberr }, 'top');
+mod_assert.equal(err.message, 'top');
+mod_assert.equal(err.toString(), 'WError: top; caused by WError: ' +
+ 'proximate cause: 3 issues; caused by Error: root cause');
+mod_assert.ok(err.cause() === suberr);
+
+/* caused by a VError */
+suberr = new VError(new Error('root cause'), 'mid');
+err = new WError(suberr, 'top');
+mod_assert.equal(err.message, 'top');
+mod_assert.equal(err.toString(),
+ 'WError: top; caused by VError: mid: root cause');
+mod_assert.ok(err.cause() === suberr);
+
+/* null cause (for backwards compatibility with older versions) */
+err = new WError(null, 'my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.equal(err.toString(), 'WError: my error');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError: my error',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = new WError({ 'cause': null }, 'my error');
+mod_assert.equal(err.message, 'my error');
+mod_assert.equal(err.toString(), 'WError: my error');
+mod_assert.ok(err.cause() === undefined);
+
+err = new WError(null);
+mod_assert.equal(err.message, '');
+mod_assert.equal(err.toString(), 'WError');
+mod_assert.ok(err.cause() === undefined);
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
+
+/* constructorOpt */
+function makeErr(options) {
+ return (new WError(options, 'test error'));
+}
+err = makeErr({});
+mod_assert.equal(err.toString(), 'WError: test error');
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError: test error',
+ ' at makeErr (tst.werror.js)',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
+
+err = makeErr({ 'constructorOpt': makeErr });
+mod_assert.equal(err.toString(), 'WError: test error');
+stack = cleanStack(err.stack);
+mod_assert.equal(stack, [
+ 'WError: test error',
+ ' at Object.<anonymous> (tst.werror.js)'
+].join('\n') + '\n' + nodestack);
diff --git a/node_modules/request/node_modules/http-signature/node_modules/jsprim/package.json b/node_modules/request/node_modules/http-signature/node_modules/jsprim/package.json
new file mode 100644
index 000000000..c172f6233
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/jsprim/package.json
@@ -0,0 +1,73 @@
+{
+ "_args": [
+ [
+ "jsprim@^1.2.2",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature"
+ ]
+ ],
+ "_from": "jsprim@>=1.2.2 <2.0.0",
+ "_id": "jsprim@1.2.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/jsprim",
+ "_nodeVersion": "0.12.2",
+ "_npmUser": {
+ "email": "dap@cs.brown.edu",
+ "name": "dap"
+ },
+ "_npmVersion": "2.7.4",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "jsprim",
+ "raw": "jsprim@^1.2.2",
+ "rawSpec": "^1.2.2",
+ "scope": null,
+ "spec": ">=1.2.2 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature"
+ ],
+ "_resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.2.2.tgz",
+ "_shasum": "f20c906ac92abd58e3b79ac8bc70a48832512da1",
+ "_shrinkwrap": null,
+ "_spec": "jsprim@^1.2.2",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature",
+ "bugs": {
+ "url": "https://github.com/davepacheco/node-jsprim/issues"
+ },
+ "dependencies": {
+ "extsprintf": "1.0.2",
+ "json-schema": "0.2.2",
+ "verror": "1.3.6"
+ },
+ "description": "utilities for primitive JavaScript types",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "f20c906ac92abd58e3b79ac8bc70a48832512da1",
+ "tarball": "http://registry.npmjs.org/jsprim/-/jsprim-1.2.2.tgz"
+ },
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "gitHead": "0e709876c35eddfe4c1f95104ac3c4abfc9dab84",
+ "homepage": "https://github.com/davepacheco/node-jsprim",
+ "license": "MIT",
+ "main": "./lib/jsprim.js",
+ "maintainers": [
+ {
+ "name": "dap",
+ "email": "dap@cs.brown.edu"
+ }
+ ],
+ "name": "jsprim",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/davepacheco/node-jsprim.git"
+ },
+ "scripts": {},
+ "version": "1.2.2"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/sshpk/.npmignore
new file mode 100644
index 000000000..a4261fc06
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/.npmignore
@@ -0,0 +1,8 @@
+.gitmodules
+deps
+docs
+Makefile
+node_modules
+test
+tools
+coverage
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/.travis.yml b/node_modules/request/node_modules/http-signature/node_modules/sshpk/.travis.yml
new file mode 100644
index 000000000..54692343d
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/.travis.yml
@@ -0,0 +1,11 @@
+language: node_js
+node_js:
+ - "4.2"
+ - "4.1"
+ - "0.12"
+ - "0.10"
+ - "0.8"
+before_install:
+ - "make check"
+after_success:
+ - '[ "${TRAVIS_NODE_VERSION}" = "4.2" ] && make codecovio'
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/sshpk/LICENSE
index e3d4e695a..f6d947d2f 100644
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/LICENSE
@@ -1,4 +1,4 @@
-Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+Copyright Joyent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/README.md
new file mode 100644
index 000000000..a17f0fd19
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/README.md
@@ -0,0 +1,436 @@
+sshpk
+=========
+
+Parse, convert, fingerprint and use SSH keys (both public and private) in pure
+node -- no `ssh-keygen` or other external dependencies.
+
+Supports RSA, DSA, ECDSA (nistp-\*) and ED25519 key types, in PEM (PKCS#1,
+PKCS#8) and OpenSSH formats.
+
+This library has been extracted from
+[`node-http-signature`](https://github.com/joyent/node-http-signature)
+(work by [Mark Cavage](https://github.com/mcavage) and
+[Dave Eddy](https://github.com/bahamas10)) and
+[`node-ssh-fingerprint`](https://github.com/bahamas10/node-ssh-fingerprint)
+(work by Dave Eddy), with additions (including ECDSA support) by
+[Alex Wilson](https://github.com/arekinath).
+
+Install
+-------
+
+```
+npm install sshpk
+```
+
+Examples
+--------
+
+```js
+var sshpk = require('sshpk');
+
+var fs = require('fs');
+
+/* Read in an OpenSSH-format public key */
+var keyPub = fs.readFileSync('id_rsa.pub');
+var key = sshpk.parseKey(keyPub, 'ssh');
+
+/* Get metadata about the key */
+console.log('type => %s', key.type);
+console.log('size => %d bits', key.size);
+console.log('comment => %s', key.comment);
+
+/* Compute key fingerprints, in new OpenSSH (>6.7) format, and old MD5 */
+console.log('fingerprint => %s', key.fingerprint().toString());
+console.log('old-style fingerprint => %s', key.fingerprint('md5').toString());
+```
+
+Example output:
+
+```
+type => rsa
+size => 2048 bits
+comment => foo@foo.com
+fingerprint => SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w
+old-style fingerprint => a0:c8:ad:6c:32:9a:32:fa:59:cc:a9:8c:0a:0d:6e:bd
+```
+
+More examples: converting between formats:
+
+```js
+/* Read in a PEM public key */
+var keyPem = fs.readFileSync('id_rsa.pem');
+var key = sshpk.parseKey(keyPem, 'pem');
+
+/* Convert to PEM PKCS#8 public key format */
+var pemBuf = key.toBuffer('pkcs8');
+
+/* Convert to SSH public key format (and return as a string) */
+var sshKey = key.toString('ssh');
+```
+
+Signing and verifying:
+
+```js
+/* Read in an OpenSSH/PEM *private* key */
+var keyPriv = fs.readFileSync('id_ecdsa');
+var key = sshpk.parsePrivateKey(keyPriv, 'pem');
+
+var data = 'some data';
+
+/* Sign some data with the key */
+var s = key.createSign('sha1');
+s.update(data);
+var signature = s.sign();
+
+/* Now load the public key (could also use just key.toPublic()) */
+var keyPub = fs.readFileSync('id_ecdsa.pub');
+key = sshpk.parseKey(keyPub, 'ssh');
+
+/* Make a crypto.Verifier with this key */
+var v = key.createVerify('sha1');
+v.update(data);
+var valid = v.verify(signature);
+/* => true! */
+```
+
+Matching fingerprints with keys:
+
+```js
+var fp = sshpk.parseFingerprint('SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w');
+
+var keys = [sshpk.parseKey(...), sshpk.parseKey(...), ...];
+
+keys.forEach(function (key) {
+ if (fp.matches(key))
+ console.log('found it!');
+});
+```
+
+Usage
+-----
+
+## Public keys
+
+### `parseKey(data[, format = 'auto'[, name]])`
+
+Parses a key from a given data format and returns a new `Key` object.
+
+Parameters
+
+- `data` -- Either a Buffer or String, containing the key
+- `format` -- String name of format to use, valid options are:
+ - `auto`: choose automatically from all below
+ - `pem`: supports both PKCS#1 and PKCS#8
+ - `ssh`: standard OpenSSH format,
+ - `pkcs1`, `pkcs8`: variants of `pem`
+ - `rfc4253`: raw OpenSSH wire format
+ - `openssh`: new post-OpenSSH 6.5 internal format, produced by
+ `ssh-keygen -o`
+- `name` -- Optional name for the key being parsed (eg. the filename that
+ was opened). Used to generate Error messages
+
+### `Key.isKey(obj)`
+
+Returns `true` if the given object is a valid `Key` object created by a version
+of `sshpk` compatible with this one.
+
+Parameters
+
+- `obj` -- Object to identify
+
+### `Key#type`
+
+String, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`.
+
+### `Key#size`
+
+Integer, "size" of the key in bits. For RSA/DSA this is the size of the modulus;
+for ECDSA this is the bit size of the curve in use.
+
+### `Key#comment`
+
+Optional string, a key comment used by some formats (eg the `ssh` format).
+
+### `Key#curve`
+
+Only present if `this.type === 'ecdsa'`, string containing the name of the
+named curve used with this key. Possible values include `nistp256`, `nistp384`
+and `nistp521`.
+
+### `Key#toBuffer([format = 'ssh'])`
+
+Convert the key into a given data format and return the serialized key as
+a Buffer.
+
+Parameters
+
+- `format` -- String name of format to use, for valid options see `parseKey()`
+
+### `Key#toString([format = 'ssh])`
+
+Same as `this.toBuffer(format).toString()`.
+
+### `Key#fingerprint([algorithm = 'sha256'])`
+
+Creates a new `Fingerprint` object representing this Key's fingerprint.
+
+Parameters
+
+- `algorithm` -- String name of hash algorithm to use, valid options are `md5`,
+ `sha1`, `sha256`, `sha384`, `sha512`
+
+### `Key#createVerify([hashAlgorithm])`
+
+Creates a `crypto.Verifier` specialized to use this Key (and the correct public
+key algorithm to match it). The returned Verifier has the same API as a regular
+one, except that the `verify()` function takes only the target signature as an
+argument.
+
+Parameters
+
+- `hashAlgorithm` -- optional String name of hash algorithm to use, any
+ supported by OpenSSL are valid, usually including
+ `sha1`, `sha256`.
+
+`v.verify(signature[, format])` Parameters
+
+- `signature` -- either a Signature object, or a Buffer or String
+- `format` -- optional String, name of format to interpret given String with.
+ Not valid if `signature` is a Signature or Buffer.
+
+### `Key#createDiffieHellman()`
+### `Key#createDH()`
+
+Creates a Diffie-Hellman key exchange object initialized with this key and all
+necessary parameters. This has the same API as a `crypto.DiffieHellman`
+instance, except that functions take `Key` and `PrivateKey` objects as
+arguments, and return them where indicated for.
+
+This is only valid for keys belonging to a cryptosystem that supports DHE
+or a close analogue (i.e. `dsa`, `ecdsa` and `curve25519` keys). An attempt
+to call this function on other keys will yield an `Error`.
+
+## Private keys
+
+### `parsePrivateKey(data[, format = 'auto'[, name]])`
+
+Parses a private key from a given data format and returns a new
+`PrivateKey` object.
+
+Parameters
+
+- `data` -- Either a Buffer or String, containing the key
+- `format` -- String name of format to use, valid options are:
+ - `auto`: choose automatically from all below
+ - `pem`: supports both PKCS#1 and PKCS#8
+ - `ssh`, `openssh`: new post-OpenSSH 6.5 internal format, produced by
+ `ssh-keygen -o`
+ - `pkcs1`, `pkcs8`: variants of `pem`
+ - `rfc4253`: raw OpenSSH wire format
+- `name` -- Optional name for the key being parsed (eg. the filename that
+ was opened). Used to generate Error messages
+
+### `PrivateKey.isPrivateKey(obj)`
+
+Returns `true` if the given object is a valid `PrivateKey` object created by a
+version of `sshpk` compatible with this one.
+
+Parameters
+
+- `obj` -- Object to identify
+
+### `PrivateKey#type`
+
+String, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`.
+
+### `PrivateKey#size`
+
+Integer, "size" of the key in bits. For RSA/DSA this is the size of the modulus;
+for ECDSA this is the bit size of the curve in use.
+
+### `PrivateKey#curve`
+
+Only present if `this.type === 'ecdsa'`, string containing the name of the
+named curve used with this key. Possible values include `nistp256`, `nistp384`
+and `nistp521`.
+
+### `PrivateKey#toBuffer([format = 'pkcs1'])`
+
+Convert the key into a given data format and return the serialized key as
+a Buffer.
+
+Parameters
+
+- `format` -- String name of format to use, valid options are listed under
+ `parsePrivateKey`. Note that ED25519 keys default to `openssh`
+ format instead (as they have no `pkcs1` representation).
+
+### `PrivateKey#toString([format = 'pkcs1'])`
+
+Same as `this.toBuffer(format).toString()`.
+
+### `PrivateKey#toPublic()`
+
+Extract just the public part of this private key, and return it as a `Key`
+object.
+
+### `PrivateKey#fingerprint([algorithm = 'sha256'])`
+
+Same as `this.toPublic().fingerprint()`.
+
+### `PrivateKey#createVerify([hashAlgorithm])`
+
+Same as `this.toPublic().createVerify()`.
+
+### `PrivateKey#createSign([hashAlgorithm])`
+
+Creates a `crypto.Sign` specialized to use this PrivateKey (and the correct
+key algorithm to match it). The returned Signer has the same API as a regular
+one, except that the `sign()` function takes no arguments, and returns a
+`Signature` object.
+
+Parameters
+
+- `hashAlgorithm` -- optional String name of hash algorithm to use, any
+ supported by OpenSSL are valid, usually including
+ `sha1`, `sha256`.
+
+`v.sign()` Parameters
+
+- none
+
+### `PrivateKey#derive(newType)`
+
+Derives a related key of type `newType` from this key. Currently this is
+only supported to change between `ed25519` and `curve25519` keys which are
+stored with the same private key (but usually distinct public keys in order
+to avoid degenerate keys that lead to a weak Diffie-Hellman exchange).
+
+Parameters
+
+- `newType` -- String, type of key to derive, either `ed25519` or `curve25519`
+
+## Fingerprints
+
+### `parseFingerprint(fingerprint[, algorithms])`
+
+Pre-parses a fingerprint, creating a `Fingerprint` object that can be used to
+quickly locate a key by using the `Fingerprint#matches` function.
+
+Parameters
+
+- `fingerprint` -- String, the fingerprint value, in any supported format
+- `algorithms` -- Optional list of strings, names of hash algorithms to limit
+ support to. If `fingerprint` uses a hash algorithm not on
+ this list, throws `InvalidAlgorithmError`.
+
+### `Fingerprint.isFingerprint(obj)`
+
+Returns `true` if the given object is a valid `Fingerprint` object created by a
+version of `sshpk` compatible with this one.
+
+Parameters
+
+- `obj` -- Object to identify
+
+### `Fingerprint#toString([format])`
+
+Returns a fingerprint as a string, in the given format.
+
+Parameters
+
+- `format` -- Optional String, format to use, valid options are `hex` and
+ `base64`. If this `Fingerprint` uses the `md5` algorithm, the
+ default format is `hex`. Otherwise, the default is `base64`.
+
+### `Fingerprint#matches(key)`
+
+Verifies whether or not this `Fingerprint` matches a given `Key`. This function
+uses double-hashing to avoid leaking timing information. Returns a boolean.
+
+Parameters
+
+- `key` -- a `Key` object, the key to match this fingerprint against
+
+## Signatures
+
+### `parseSignature(signature, algorithm, format)`
+
+Parses a signature in a given format, creating a `Signature` object. Useful
+for converting between the SSH and ASN.1 (PKCS/OpenSSL) signature formats, and
+also returned as output from `PrivateKey#createSign().sign()`.
+
+A Signature object can also be passed to a verifier produced by
+`Key#createVerify()` and it will automatically be converted internally into the
+correct format for verification.
+
+Parameters
+
+- `signature` -- a Buffer (binary) or String (base64), data of the actual
+ signature in the given format
+- `algorithm` -- a String, name of the algorithm to be used, possible values
+ are `rsa`, `dsa`, `ecdsa`
+- `format` -- a String, either `asn1` or `ssh`
+
+### `Signature.isSignature(obj)`
+
+Returns `true` if the given object is a valid `Signature` object created by a
+version of `sshpk` compatible with this one.
+
+Parameters
+
+- `obj` -- Object to identify
+
+### `Signature#toBuffer([format = 'asn1'])`
+
+Converts a Signature to the given format and returns it as a Buffer.
+
+Parameters
+
+- `format` -- a String, either `asn1` or `ssh`
+
+### `Signature#toString([format = 'asn1'])`
+
+Same as `this.toBuffer(format).toString('base64')`.
+
+Errors
+------
+
+### `InvalidAlgorithmError`
+
+The specified algorithm is not valid, either because it is not supported, or
+because it was not included on a list of allowed algorithms.
+
+Thrown by `Fingerprint.parse`, `Key#fingerprint`.
+
+Properties
+
+- `algorithm` -- the algorithm that could not be validated
+
+### `FingerprintFormatError`
+
+The fingerprint string given could not be parsed as a supported fingerprint
+format, or the specified fingerprint format is invalid.
+
+Thrown by `Fingerprint.parse`, `Fingerprint#toString`.
+
+Properties
+
+- `fingerprint` -- if caused by a fingerprint, the string value given
+- `format` -- if caused by an invalid format specification, the string value given
+
+### `KeyParseError`
+
+The key data given could not be parsed as a valid key.
+
+Properties
+
+- `keyName` -- `name` that was given to `Key#parse`
+- `format` -- the `format` that was trying to parse the key
+- `innerErr` -- the inner Error thrown by the format parser
+
+Friends of sshpk
+----------------
+
+ * [`sshpk-agent`](https://github.com/arekinath/node-sshpk-agent) is a library
+ for speaking the `ssh-agent` protocol from node.js, which uses `sshpk`
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv b/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
new file mode 100755
index 000000000..b592af71a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
@@ -0,0 +1,183 @@
+#!/usr/bin/env node
+// -*- mode: js -*-
+// vim: set filetype=javascript :
+// Copyright 2015 Joyent, Inc. All rights reserved.
+
+var dashdash = require('dashdash');
+var sshpk = require('../lib/index');
+var fs = require('fs');
+var path = require('path');
+
+var options = [
+ {
+ names: ['outformat', 't'],
+ type: 'string',
+ help: 'Output format'
+ },
+ {
+ names: ['informat', 'T'],
+ type: 'string',
+ help: 'Input format'
+ },
+ {
+ names: ['file', 'f'],
+ type: 'string',
+ help: 'Input file name (default stdin)'
+ },
+ {
+ names: ['out', 'o'],
+ type: 'string',
+ help: 'Output file name (default stdout)'
+ },
+ {
+ names: ['private', 'p'],
+ type: 'bool',
+ help: 'Produce a private key as output'
+ },
+ {
+ names: ['derive', 'd'],
+ type: 'string',
+ help: 'Output a new key derived from this one, with given algo'
+ },
+ {
+ names: ['identify', 'i'],
+ type: 'bool',
+ help: 'Print key metadata instead of converting'
+ },
+ {
+ names: ['comment', 'c'],
+ type: 'string',
+ help: 'Set key comment, if output format supports'
+ },
+ {
+ names: ['help', 'h'],
+ type: 'bool',
+ help: 'Shows this help text'
+ }
+];
+
+if (require.main === module) {
+ var parser = dashdash.createParser({
+ options: options
+ });
+
+ try {
+ var opts = parser.parse(process.argv);
+ } catch (e) {
+ console.error('sshpk-conv: error: %s', e.message);
+ process.exit(1);
+ }
+
+ if (opts.help || opts._args.length > 1) {
+ var help = parser.help({}).trimRight();
+ console.error('sshpk-conv: converts between SSH key formats\n');
+ console.error(help);
+ console.error('\navailable formats:');
+ console.error(' - pem, pkcs1 eg id_rsa');
+ console.error(' - ssh eg id_rsa.pub');
+ console.error(' - pkcs8 format you want for openssl');
+ console.error(' - openssh like output of ssh-keygen -o');
+ console.error(' - rfc4253 raw OpenSSH wire format');
+ process.exit(1);
+ }
+
+ /*
+ * Key derivation can only be done on private keys, so use of the -d
+ * option necessarily implies -p.
+ */
+ if (opts.derive)
+ opts.private = true;
+
+ var inFile = process.stdin;
+ var inFileName = 'stdin';
+
+ var inFilePath;
+ if (opts.file) {
+ inFilePath = opts.file;
+ } else if (opts._args.length === 1) {
+ inFilePath = opts._args[0];
+ }
+
+ if (inFilePath)
+ inFileName = path.basename(inFilePath);
+
+ try {
+ if (inFilePath) {
+ fs.accessSync(inFilePath, fs.R_OK);
+ inFile = fs.createReadStream(inFilePath);
+ }
+ } catch (e) {
+ console.error('sshpk-conv: error opening input file' +
+ ': ' + e.name + ': ' + e.message);
+ process.exit(1);
+ }
+
+ var outFile = process.stdout;
+
+ try {
+ if (opts.out && !opts.identify) {
+ fs.accessSync(path.dirname(opts.out), fs.W_OK);
+ outFile = fs.createWriteStream(opts.out);
+ }
+ } catch (e) {
+ console.error('sshpk-conv: error opening output file' +
+ ': ' + e.name + ': ' + e.message);
+ process.exit(1);
+ }
+
+ var bufs = [];
+ inFile.on('readable', function () {
+ var data;
+ while ((data = inFile.read()))
+ bufs.push(data);
+ });
+ inFile.on('end', function () {
+ var buf = Buffer.concat(bufs);
+ var fmt = 'auto';
+ if (opts.informat)
+ fmt = opts.informat;
+ var f = sshpk.parseKey;
+ if (opts.private)
+ f = sshpk.parsePrivateKey;
+ try {
+ var key = f(buf, fmt, inFileName);
+ } catch (e) {
+ console.error('sshpk-conv: ' +
+ e.name + ': ' + e.message);
+ process.exit(1);
+ }
+
+ if (opts.derive)
+ key = key.derive(opts.derive);
+
+ if (opts.comment)
+ key.comment = opts.comment;
+
+ if (!opts.identify) {
+ fmt = undefined;
+ if (opts.outformat)
+ fmt = opts.outformat;
+ outFile.write(key.toBuffer(fmt));
+ if (fmt === 'ssh' ||
+ (!opts.private && fmt === undefined))
+ outFile.write('\n');
+ outFile.once('drain', function () {
+ process.exit(0);
+ });
+ } else {
+ var kind = 'public';
+ if (PrivateKey.isPrivateKey(key))
+ kind = 'private';
+ console.log('%s: a %d bit %s %s key', inFileName,
+ key.size, key.type.toUpperCase(), kind);
+ if (key.type === 'ecdsa')
+ console.log('ECDSA curve: %s', key.curve);
+ if (key.comment)
+ console.log('Comment: %s', key.comment);
+ console.log('Fingerprint:');
+ console.log(' ' + key.fingerprint().toString());
+ console.log(' ' + key.fingerprint('md5').toString());
+ process.exit(0);
+ }
+ });
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/algs.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/algs.js
new file mode 100644
index 000000000..f30af560e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/algs.js
@@ -0,0 +1,168 @@
+// Copyright 2015 Joyent, Inc.
+
+var algInfo = {
+ 'dsa': {
+ parts: ['p', 'q', 'g', 'y'],
+ sizePart: 'p'
+ },
+ 'rsa': {
+ parts: ['e', 'n'],
+ sizePart: 'n'
+ },
+ 'ecdsa': {
+ parts: ['curve', 'Q'],
+ sizePart: 'Q'
+ },
+ 'ed25519': {
+ parts: ['R'],
+ normalize: false,
+ sizePart: 'R'
+ }
+};
+algInfo['curve25519'] = algInfo['ed25519'];
+
+var algPrivInfo = {
+ 'dsa': {
+ parts: ['p', 'q', 'g', 'y', 'x']
+ },
+ 'rsa': {
+ parts: ['n', 'e', 'd', 'iqmp', 'p', 'q']
+ },
+ 'ecdsa': {
+ parts: ['curve', 'Q', 'd']
+ },
+ 'ed25519': {
+ parts: ['R', 'r'],
+ normalize: false
+ }
+};
+algPrivInfo['curve25519'] = algPrivInfo['ed25519'];
+
+var hashAlgs = {
+ 'md5': true,
+ 'sha1': true,
+ 'sha256': true,
+ 'sha384': true,
+ 'sha512': true
+};
+
+/*
+ * Taken from
+ * http://csrc.nist.gov/groups/ST/toolkit/documents/dss/NISTReCur.pdf
+ */
+var curves = {
+ 'nistp256': {
+ size: 256,
+ pkcs8oid: '1.2.840.10045.3.1.7',
+ p: new Buffer(('00' +
+ 'ffffffff 00000001 00000000 00000000' +
+ '00000000 ffffffff ffffffff ffffffff').
+ replace(/ /g, ''), 'hex'),
+ a: new Buffer(('00' +
+ 'FFFFFFFF 00000001 00000000 00000000' +
+ '00000000 FFFFFFFF FFFFFFFF FFFFFFFC').
+ replace(/ /g, ''), 'hex'),
+ b: new Buffer((
+ '5ac635d8 aa3a93e7 b3ebbd55 769886bc' +
+ '651d06b0 cc53b0f6 3bce3c3e 27d2604b').
+ replace(/ /g, ''), 'hex'),
+ s: new Buffer(('00' +
+ 'c49d3608 86e70493 6a6678e1 139d26b7' +
+ '819f7e90').
+ replace(/ /g, ''), 'hex'),
+ n: new Buffer(('00' +
+ 'ffffffff 00000000 ffffffff ffffffff' +
+ 'bce6faad a7179e84 f3b9cac2 fc632551').
+ replace(/ /g, ''), 'hex'),
+ G: new Buffer(('04' +
+ '6b17d1f2 e12c4247 f8bce6e5 63a440f2' +
+ '77037d81 2deb33a0 f4a13945 d898c296' +
+ '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16' +
+ '2bce3357 6b315ece cbb64068 37bf51f5').
+ replace(/ /g, ''), 'hex')
+ },
+ 'nistp384': {
+ size: 384,
+ pkcs8oid: '1.3.132.0.34',
+ p: new Buffer(('00' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff fffffffe' +
+ 'ffffffff 00000000 00000000 ffffffff').
+ replace(/ /g, ''), 'hex'),
+ a: new Buffer(('00' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE' +
+ 'FFFFFFFF 00000000 00000000 FFFFFFFC').
+ replace(/ /g, ''), 'hex'),
+ b: new Buffer((
+ 'b3312fa7 e23ee7e4 988e056b e3f82d19' +
+ '181d9c6e fe814112 0314088f 5013875a' +
+ 'c656398d 8a2ed19d 2a85c8ed d3ec2aef').
+ replace(/ /g, ''), 'hex'),
+ s: new Buffer(('00' +
+ 'a335926a a319a27a 1d00896a 6773a482' +
+ '7acdac73').
+ replace(/ /g, ''), 'hex'),
+ n: new Buffer(('00' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff c7634d81 f4372ddf' +
+ '581a0db2 48b0a77a ecec196a ccc52973').
+ replace(/ /g, ''), 'hex'),
+ G: new Buffer(('04' +
+ 'aa87ca22 be8b0537 8eb1c71e f320ad74' +
+ '6e1d3b62 8ba79b98 59f741e0 82542a38' +
+ '5502f25d bf55296c 3a545e38 72760ab7' +
+ '3617de4a 96262c6f 5d9e98bf 9292dc29' +
+ 'f8f41dbd 289a147c e9da3113 b5f0b8c0' +
+ '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f').
+ replace(/ /g, ''), 'hex')
+ },
+ 'nistp521': {
+ size: 521,
+ pkcs8oid: '1.3.132.0.35',
+ p: new Buffer((
+ '01ffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffff').replace(/ /g, ''), 'hex'),
+ a: new Buffer(('01FF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' +
+ 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC').
+ replace(/ /g, ''), 'hex'),
+ b: new Buffer(('51' +
+ '953eb961 8e1c9a1f 929a21a0 b68540ee' +
+ 'a2da725b 99b315f3 b8b48991 8ef109e1' +
+ '56193951 ec7e937b 1652c0bd 3bb1bf07' +
+ '3573df88 3d2c34f1 ef451fd4 6b503f00').
+ replace(/ /g, ''), 'hex'),
+ s: new Buffer(('00' +
+ 'd09e8800 291cb853 96cc6717 393284aa' +
+ 'a0da64ba').replace(/ /g, ''), 'hex'),
+ n: new Buffer(('01ff' +
+ 'ffffffff ffffffff ffffffff ffffffff' +
+ 'ffffffff ffffffff ffffffff fffffffa' +
+ '51868783 bf2f966b 7fcc0148 f709a5d0' +
+ '3bb5c9b8 899c47ae bb6fb71e 91386409').
+ replace(/ /g, ''), 'hex'),
+ G: new Buffer(('04' +
+ '00c6 858e06b7 0404e9cd 9e3ecb66 2395b442' +
+ '9c648139 053fb521 f828af60 6b4d3dba' +
+ 'a14b5e77 efe75928 fe1dc127 a2ffa8de' +
+ '3348b3c1 856a429b f97e7e31 c2e5bd66' +
+ '0118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9' +
+ '98f54449 579b4468 17afbd17 273e662c' +
+ '97ee7299 5ef42640 c550b901 3fad0761' +
+ '353c7086 a272c240 88be9476 9fd16650').
+ replace(/ /g, ''), 'hex')
+ }
+};
+
+module.exports = {
+ info: algInfo,
+ privInfo: algPrivInfo,
+ hashAlgs: hashAlgs,
+ curves: curves
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/dhe.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/dhe.js
new file mode 100644
index 000000000..8f9548ce5
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/dhe.js
@@ -0,0 +1,311 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = DiffieHellman;
+
+var assert = require('assert-plus');
+var crypto = require('crypto');
+var algs = require('./algs');
+var utils = require('./utils');
+var ed;
+
+var Key = require('./key');
+var PrivateKey = require('./private-key');
+
+var CRYPTO_HAVE_ECDH = (crypto.createECDH !== undefined);
+
+var ecdh, ec, jsbn;
+
+function DiffieHellman(key) {
+ utils.assertCompatible(key, Key, [1, 4], 'key');
+ this._isPriv = PrivateKey.isPrivateKey(key, [1, 3]);
+ this._algo = key.type;
+ this._curve = key.curve;
+ this._key = key;
+ if (key.type === 'dsa') {
+ if (!CRYPTO_HAVE_ECDH) {
+ throw (new Error('Due to bugs in the node 0.10 ' +
+ 'crypto API, node 0.12.x or later is required ' +
+ 'to use DH'));
+ }
+ this._dh = crypto.createDiffieHellman(
+ key.part.p.data, undefined,
+ key.part.g.data, undefined);
+ this._p = key.part.p;
+ this._g = key.part.g;
+ if (this._isPriv)
+ this._dh.setPrivateKey(key.part.x.data);
+ this._dh.setPublicKey(key.part.y.data);
+
+ } else if (key.type === 'ecdsa') {
+ if (!CRYPTO_HAVE_ECDH) {
+ if (ecdh === undefined)
+ ecdh = require('ecc-jsbn');
+ if (ec === undefined)
+ ec = require('ecc-jsbn/lib/ec');
+ if (jsbn === undefined)
+ jsbn = require('jsbn').BigInteger;
+
+ this._ecParams = new X9ECParameters(this._curve);
+
+ if (this._isPriv) {
+ this._priv = new ECPrivate(
+ this._ecParams, key.part.d.data);
+ }
+ return;
+ }
+
+ var curve = {
+ 'nistp256': 'prime256v1',
+ 'nistp384': 'secp384r1',
+ 'nistp521': 'secp521r1'
+ }[key.curve];
+ this._dh = crypto.createECDH(curve);
+ if (typeof (this._dh) !== 'object' ||
+ typeof (this._dh.setPrivateKey) !== 'function') {
+ CRYPTO_HAVE_ECDH = false;
+ DiffieHellman.call(this, key);
+ return;
+ }
+ if (this._isPriv)
+ this._dh.setPrivateKey(key.part.d.data);
+ this._dh.setPublicKey(key.part.Q.data);
+
+ } else if (key.type === 'curve25519') {
+ if (ed === undefined)
+ ed = require('jodid25519');
+
+ if (this._isPriv) {
+ this._priv = key.part.r.data;
+ if (this._priv[0] === 0x00)
+ this._priv = this._priv.slice(1);
+ this._priv = this._priv.slice(0, 32);
+ }
+
+ } else {
+ throw (new Error('DH not supported for ' + key.type + ' keys'));
+ }
+}
+
+DiffieHellman.prototype.getPublicKey = function () {
+ if (this._isPriv)
+ return (this._key.toPublic());
+ return (this._key);
+};
+
+DiffieHellman.prototype.getPrivateKey = function () {
+ if (this._isPriv)
+ return (this._key);
+ else
+ return (undefined);
+};
+DiffieHellman.prototype.getKey = DiffieHellman.prototype.getPrivateKey;
+
+DiffieHellman.prototype._keyCheck = function (pk, isPub) {
+ assert.object(pk, 'key');
+ if (!isPub)
+ utils.assertCompatible(pk, PrivateKey, [1, 3], 'key');
+ utils.assertCompatible(pk, Key, [1, 4], 'key');
+
+ if (pk.type !== this._algo) {
+ throw (new Error('A ' + pk.type + ' key cannot be used in ' +
+ this._algo + ' Diffie-Hellman'));
+ }
+
+ if (pk.curve !== this._curve) {
+ throw (new Error('A key from the ' + pk.curve + ' curve ' +
+ 'cannot be used with a ' + this._curve +
+ ' Diffie-Hellman'));
+ }
+
+ if (pk.type === 'dsa') {
+ assert.deepEqual(pk.part.p, this._p,
+ 'DSA key prime does not match');
+ assert.deepEqual(pk.part.g, this._g,
+ 'DSA key generator does not match');
+ }
+};
+
+DiffieHellman.prototype.setKey = function (pk) {
+ this._keyCheck(pk);
+
+ if (pk.type === 'dsa') {
+ this._dh.setPrivateKey(pk.part.x.data);
+ this._dh.setPublicKey(pk.part.y.data);
+
+ } else if (pk.type === 'ecdsa') {
+ if (CRYPTO_HAVE_ECDH) {
+ this._dh.setPrivateKey(pk.part.d.data);
+ this._dh.setPublicKey(pk.part.Q.data);
+ } else {
+ this._priv = new ECPrivate(
+ this._ecParams, pk.part.d.data);
+ }
+
+ } else if (pk.type === 'curve25519') {
+ this._priv = pk.part.r.data;
+ if (this._priv[0] === 0x00)
+ this._priv = this._priv.slice(1);
+ this._priv = this._priv.slice(0, 32);
+ }
+ this._key = pk;
+ this._isPriv = true;
+};
+DiffieHellman.prototype.setPrivateKey = DiffieHellman.prototype.setKey;
+
+DiffieHellman.prototype.computeSecret = function (otherpk) {
+ this._keyCheck(otherpk, true);
+ if (!this._isPriv)
+ throw (new Error('DH exchange has not been initialized with ' +
+ 'a private key yet'));
+
+ var pub;
+ if (this._algo === 'dsa') {
+ return (this._dh.computeSecret(
+ otherpk.part.y.data));
+
+ } else if (this._algo === 'ecdsa') {
+ if (CRYPTO_HAVE_ECDH) {
+ return (this._dh.computeSecret(
+ otherpk.part.Q.data));
+ } else {
+ pub = new ECPublic(
+ this._ecParams, otherpk.part.Q.data);
+ return (this._priv.deriveSharedSecret(pub));
+ }
+
+ } else if (this._algo === 'curve25519') {
+ pub = otherpk.part.R.data;
+ if (pub[0] === 0x00)
+ pub = pub.slice(1);
+
+ var secret = ed.dh.computeKey(
+ this._priv.toString('binary'),
+ pub.toString('binary'));
+
+ return (new Buffer(secret, 'binary'));
+ }
+
+ throw (new Error('Invalid algorithm: ' + this._algo));
+};
+
+DiffieHellman.prototype.generateKey = function () {
+ var parts = [];
+ var priv, pub;
+ if (this._algo === 'dsa') {
+ this._dh.generateKeys();
+
+ parts.push({name: 'p', data: this._p.data});
+ parts.push({name: 'q', data: this._key.part.q.data});
+ parts.push({name: 'g', data: this._g.data});
+ parts.push({name: 'y', data: this._dh.getPublicKey()});
+ parts.push({name: 'x', data: this._dh.getPrivateKey()});
+ this._key = new PrivateKey({
+ type: 'dsa',
+ parts: parts
+ });
+ this._isPriv = true;
+ return (this._key);
+
+ } else if (this._algo === 'ecdsa') {
+ if (CRYPTO_HAVE_ECDH) {
+ this._dh.generateKeys();
+
+ parts.push({name: 'curve',
+ data: new Buffer(this._curve)});
+ parts.push({name: 'Q', data: this._dh.getPublicKey()});
+ parts.push({name: 'd', data: this._dh.getPrivateKey()});
+ this._key = new PrivateKey({
+ type: 'ecdsa',
+ curve: this._curve,
+ parts: parts
+ });
+ this._isPriv = true;
+ return (this._key);
+
+ } else {
+ var n = this._ecParams.getN();
+ var r = new jsbn(crypto.randomBytes(n.bitLength()));
+ var n1 = n.subtract(jsbn.ONE);
+ priv = r.mod(n1).add(jsbn.ONE);
+ pub = this._ecParams.getG().multiply(priv);
+
+ priv = new Buffer(priv.toByteArray());
+ pub = new Buffer(this._ecParams.getCurve().
+ encodePointHex(pub), 'hex');
+
+ this._priv = new ECPrivate(this._ecParams, priv);
+
+ parts.push({name: 'curve',
+ data: new Buffer(this._curve)});
+ parts.push({name: 'Q', data: pub});
+ parts.push({name: 'd', data: priv});
+
+ this._key = new PrivateKey({
+ type: 'ecdsa',
+ curve: this._curve,
+ parts: parts
+ });
+ this._isPriv = true;
+ return (this._key);
+ }
+
+ } else if (this._algo === 'curve25519') {
+ priv = ed.dh.generateKey();
+ pub = ed.dh.publicKey(priv);
+ this._priv = priv = new Buffer(priv, 'binary');
+ pub = new Buffer(pub, 'binary');
+
+ parts.push({name: 'R', data: pub});
+ parts.push({name: 'r', data: Buffer.concat([priv, pub])});
+ this._key = new PrivateKey({
+ type: 'curve25519',
+ parts: parts
+ });
+ this._isPriv = true;
+ return (this._key);
+ }
+
+ throw (new Error('Invalid algorithm: ' + this._algo));
+};
+DiffieHellman.prototype.generateKeys = DiffieHellman.prototype.generateKey;
+
+/* These are helpers for using ecc-jsbn (for node 0.10 compatibility). */
+
+function X9ECParameters(name) {
+ var params = algs.curves[name];
+ assert.object(params);
+
+ var p = new jsbn(params.p);
+ var a = new jsbn(params.a);
+ var b = new jsbn(params.b);
+ var n = new jsbn(params.n);
+ var h = jsbn.ONE;
+ var curve = new ec.ECCurveFp(p, a, b);
+ var G = curve.decodePointHex(params.G.toString('hex'));
+
+ this.curve = curve;
+ this.g = G;
+ this.n = n;
+ this.h = h;
+}
+X9ECParameters.prototype.getCurve = function () { return (this.curve); };
+X9ECParameters.prototype.getG = function () { return (this.g); };
+X9ECParameters.prototype.getN = function () { return (this.n); };
+X9ECParameters.prototype.getH = function () { return (this.h); };
+
+function ECPublic(params, buffer) {
+ this._params = params;
+ if (buffer[0] === 0x00)
+ buffer = buffer.slice(1);
+ this._pub = params.getCurve().decodePointHex(buffer.toString('hex'));
+}
+
+function ECPrivate(params, buffer) {
+ this._params = params;
+ this._priv = new jsbn(utils.mpNormalize(buffer));
+}
+ECPrivate.prototype.deriveSharedSecret = function (pubKey) {
+ assert.ok(pubKey instanceof ECPublic);
+ var S = pubKey._pub.multiply(this._priv);
+ return (new Buffer(S.getX().toBigInteger().toByteArray()));
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ed-compat.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ed-compat.js
new file mode 100644
index 000000000..ad46339b9
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ed-compat.js
@@ -0,0 +1,94 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ Verifier: Verifier,
+ Signer: Signer
+};
+
+var nacl;
+var stream = require('stream');
+var util = require('util');
+var assert = require('assert-plus');
+var Signature = require('./signature');
+
+function Verifier(key, hashAlgo) {
+ if (nacl === undefined)
+ nacl = require('tweetnacl');
+
+ if (hashAlgo.toLowerCase() !== 'sha512')
+ throw (new Error('ED25519 only supports the use of ' +
+ 'SHA-512 hashes'));
+
+ this.key = key;
+ this.chunks = [];
+
+ stream.Writable.call(this, {});
+}
+util.inherits(Verifier, stream.Writable);
+
+Verifier.prototype._write = function (chunk, enc, cb) {
+ this.chunks.push(chunk);
+ cb();
+};
+
+Verifier.prototype.update = function (chunk) {
+ if (typeof (chunk) === 'string')
+ chunk = new Buffer(chunk, 'binary');
+ this.chunks.push(chunk);
+};
+
+Verifier.prototype.verify = function (signature, fmt) {
+ var sig;
+ if (Signature.isSignature(signature, [2, 0])) {
+ sig = signature.toBuffer('raw');
+
+ } else if (typeof (signature) === 'string') {
+ sig = new Buffer(signature, 'base64');
+
+ } else if (Signature.isSignature(signature, [1, 0])) {
+ throw (new Error('signature was created by too old ' +
+ 'a version of sshpk and cannot be verified'));
+ }
+
+ assert.buffer(sig);
+ return (nacl.sign.detached.verify(
+ new Uint8Array(Buffer.concat(this.chunks)),
+ new Uint8Array(sig),
+ new Uint8Array(this.key.part.R.data)));
+};
+
+function Signer(key, hashAlgo) {
+ if (nacl === undefined)
+ nacl = require('tweetnacl');
+
+ if (hashAlgo.toLowerCase() !== 'sha512')
+ throw (new Error('ED25519 only supports the use of ' +
+ 'SHA-512 hashes'));
+
+ this.key = key;
+ this.chunks = [];
+
+ stream.Writable.call(this, {});
+}
+util.inherits(Signer, stream.Writable);
+
+Signer.prototype._write = function (chunk, enc, cb) {
+ this.chunks.push(chunk);
+ cb();
+};
+
+Signer.prototype.update = function (chunk) {
+ if (typeof (chunk) === 'string')
+ chunk = new Buffer(chunk, 'binary');
+ this.chunks.push(chunk);
+};
+
+Signer.prototype.sign = function () {
+ var sig = nacl.sign.detached(
+ new Uint8Array(Buffer.concat(this.chunks)),
+ new Uint8Array(this.key.part.r.data));
+ var sigBuf = new Buffer(sig);
+ var sigObj = Signature.parse(sigBuf, 'ed25519', 'raw');
+ sigObj.hashAlgorithm = 'sha512';
+ return (sigObj);
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/errors.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/errors.js
new file mode 100644
index 000000000..3551c1071
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/errors.js
@@ -0,0 +1,58 @@
+// Copyright 2015 Joyent, Inc.
+
+var assert = require('assert-plus');
+var util = require('util');
+
+function FingerprintFormatError(fp, format) {
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, FingerprintFormatError);
+ this.name = 'FingerprintFormatError';
+ this.fingerprint = fp;
+ this.format = format;
+ this.message = 'Fingerprint format is not supported, or is invalid: ';
+ if (fp !== undefined)
+ this.message += ' fingerprint = ' + fp;
+ if (format !== undefined)
+ this.message += ' format = ' + format;
+}
+util.inherits(FingerprintFormatError, Error);
+
+function InvalidAlgorithmError(alg) {
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, InvalidAlgorithmError);
+ this.name = 'InvalidAlgorithmError';
+ this.algorithm = alg;
+ this.message = 'Algorithm "' + alg + '" is not supported';
+}
+util.inherits(InvalidAlgorithmError, Error);
+
+function KeyParseError(name, format, innerErr) {
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, KeyParseError);
+ this.name = 'KeyParseError';
+ this.format = format;
+ this.keyName = name;
+ this.innerErr = innerErr;
+ this.message = 'Failed to parse ' + name + ' as a valid ' + format +
+ ' format key: ' + innerErr.message;
+}
+util.inherits(KeyParseError, Error);
+
+function SignatureParseError(type, format, innerErr) {
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, SignatureParseError);
+ this.name = 'SignatureParseError';
+ this.type = type;
+ this.format = format;
+ this.innerErr = innerErr;
+ this.message = 'Failed to parse the given data as a ' + type +
+ ' signature in ' + format + ' format: ' + innerErr.message;
+}
+util.inherits(SignatureParseError, Error);
+
+module.exports = {
+ FingerprintFormatError: FingerprintFormatError,
+ InvalidAlgorithmError: InvalidAlgorithmError,
+ KeyParseError: KeyParseError,
+ SignatureParseError: SignatureParseError
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/fingerprint.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/fingerprint.js
new file mode 100644
index 000000000..c607330e7
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/fingerprint.js
@@ -0,0 +1,140 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = Fingerprint;
+
+var assert = require('assert-plus');
+var algs = require('./algs');
+var crypto = require('crypto');
+var errs = require('./errors');
+var Key = require('./key');
+var utils = require('./utils');
+
+var FingerprintFormatError = errs.FingerprintFormatError;
+var InvalidAlgorithmError = errs.InvalidAlgorithmError;
+
+function Fingerprint(opts) {
+ assert.object(opts, 'options');
+ assert.buffer(opts.hash, 'options.hash');
+ assert.string(opts.algorithm, 'options.algorithm');
+
+ this.algorithm = opts.algorithm.toLowerCase();
+ if (algs.hashAlgs[this.algorithm] !== true)
+ throw (new InvalidAlgorithmError(this.algorithm));
+
+ this.hash = opts.hash;
+}
+
+Fingerprint.prototype.toString = function (format) {
+ if (format === undefined) {
+ if (this.algorithm === 'md5')
+ format = 'hex';
+ else
+ format = 'base64';
+ }
+ assert.string(format);
+
+ switch (format) {
+ case 'hex':
+ return (addColons(this.hash.toString('hex')));
+ case 'base64':
+ return (sshBase64Format(this.algorithm,
+ this.hash.toString('base64')));
+ default:
+ throw (new FingerprintFormatError(undefined, format));
+ }
+};
+
+Fingerprint.prototype.matches = function (key) {
+ assert.object(key, 'key');
+ utils.assertCompatible(key, Key, [1, 0], 'key');
+
+ var theirHash = key.hash(this.algorithm);
+ var theirHash2 = crypto.createHash(this.algorithm).
+ update(theirHash).digest('base64');
+
+ if (this.hash2 === undefined)
+ this.hash2 = crypto.createHash(this.algorithm).
+ update(this.hash).digest('base64');
+
+ return (this.hash2 === theirHash2);
+};
+
+Fingerprint.parse = function (fp, enAlgs) {
+ assert.string(fp, 'fingerprint');
+
+ var alg, hash;
+ assert.optionalArrayOfString(enAlgs, 'algorithms');
+
+ var parts = fp.split(':');
+ if (parts.length == 2) {
+ alg = parts[0].toLowerCase();
+ /*JSSTYLED*/
+ var base64RE = /^[A-Za-z0-9+\/=]+$/;
+ if (!base64RE.test(parts[1]))
+ throw (new FingerprintFormatError(fp));
+ try {
+ hash = new Buffer(parts[1], 'base64');
+ } catch (e) {
+ throw (new FingerprintFormatError(fp));
+ }
+ } else if (parts.length > 2) {
+ alg = 'md5';
+ if (parts[0].toLowerCase() === 'md5')
+ parts = parts.slice(1);
+ parts = parts.join('');
+ /*JSSTYLED*/
+ var md5RE = /^[a-fA-F0-9]+$/;
+ if (!md5RE.test(parts))
+ throw (new FingerprintFormatError(fp));
+ try {
+ hash = new Buffer(parts, 'hex');
+ } catch (e) {
+ throw (new FingerprintFormatError(fp));
+ }
+ }
+
+ if (alg === undefined)
+ throw (new FingerprintFormatError(fp));
+
+ if (algs.hashAlgs[alg] === undefined)
+ throw (new InvalidAlgorithmError(alg));
+
+ if (enAlgs !== undefined) {
+ enAlgs = enAlgs.map(function (a) { return a.toLowerCase(); });
+ if (enAlgs.indexOf(alg) === -1)
+ throw (new InvalidAlgorithmError(alg));
+ }
+
+ return (new Fingerprint({algorithm: alg, hash: hash}));
+};
+
+function addColons(s) {
+ /*JSSTYLED*/
+ return (s.replace(/(.{2})(?=.)/g, '$1:'));
+}
+
+function base64Strip(s) {
+ /*JSSTYLED*/
+ return (s.replace(/=*$/, ''));
+}
+
+function sshBase64Format(alg, h) {
+ return (alg.toUpperCase() + ':' + base64Strip(h));
+}
+
+Fingerprint.isFingerprint = function (obj, ver) {
+ return (utils.isCompatible(obj, Fingerprint, ver));
+};
+
+/*
+ * API versions for Fingerprint:
+ * [1,0] -- initial ver
+ * [1,1] -- first tagged ver
+ */
+Fingerprint.prototype._sshpkApiVersion = [1, 1];
+
+Fingerprint._oldVersionDetect = function (obj) {
+ assert.func(obj.toString);
+ assert.func(obj.matches);
+ return ([1, 0]);
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/auto.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/auto.js
new file mode 100644
index 000000000..37c3cc813
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/auto.js
@@ -0,0 +1,73 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ read: read,
+ write: write
+};
+
+var assert = require('assert-plus');
+var utils = require('../utils');
+var Key = require('../key');
+var PrivateKey = require('../private-key');
+
+var pem = require('./pem');
+var ssh = require('./ssh');
+var rfc4253 = require('./rfc4253');
+
+function read(buf) {
+ if (typeof (buf) === 'string') {
+ if (buf.trim().match(/^[-]+[ ]*BEGIN/))
+ return (pem.read(buf));
+ if (buf.match(/^\s*ssh-[a-z]/))
+ return (ssh.read(buf));
+ if (buf.match(/^\s*ecdsa-/))
+ return (ssh.read(buf));
+ buf = new Buffer(buf, 'binary');
+ } else {
+ assert.buffer(buf);
+ if (findPEMHeader(buf))
+ return (pem.read(buf));
+ if (findSSHHeader(buf))
+ return (ssh.read(buf));
+ }
+ if (buf.readUInt32BE(0) < buf.length)
+ return (rfc4253.read(buf));
+ throw (new Error('Failed to auto-detect format of key'));
+}
+
+function findSSHHeader(buf) {
+ var offset = 0;
+ while (offset < buf.length &&
+ (buf[offset] === 32 || buf[offset] === 10 || buf[offset] === 9))
+ ++offset;
+ if (offset + 4 <= buf.length &&
+ buf.slice(offset, offset + 4).toString('ascii') === 'ssh-')
+ return (true);
+ if (offset + 6 <= buf.length &&
+ buf.slice(offset, offset + 6).toString('ascii') === 'ecdsa-')
+ return (true);
+ return (false);
+}
+
+function findPEMHeader(buf) {
+ var offset = 0;
+ while (offset < buf.length &&
+ (buf[offset] === 32 || buf[offset] === 10))
+ ++offset;
+ if (buf[offset] !== 45)
+ return (false);
+ while (offset < buf.length &&
+ (buf[offset] === 45))
+ ++offset;
+ while (offset < buf.length &&
+ (buf[offset] === 32))
+ ++offset;
+ if (offset + 5 > buf.length ||
+ buf.slice(offset, offset + 5).toString('ascii') !== 'BEGIN')
+ return (false);
+ return (true);
+}
+
+function write(key) {
+ throw (new Error('"auto" format cannot be used for writing'));
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pem.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pem.js
new file mode 100644
index 000000000..1d907607e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pem.js
@@ -0,0 +1,152 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ read: read,
+ write: write
+};
+
+var assert = require('assert-plus');
+var asn1 = require('asn1');
+var algs = require('../algs');
+var utils = require('../utils');
+var Key = require('../key');
+var PrivateKey = require('../private-key');
+
+var pkcs1 = require('./pkcs1');
+var pkcs8 = require('./pkcs8');
+var sshpriv = require('./ssh-private');
+var rfc4253 = require('./rfc4253');
+
+/*
+ * For reading we support both PKCS#1 and PKCS#8. If we find a private key,
+ * we just take the public component of it and use that.
+ */
+function read(buf, forceType) {
+ var input = buf;
+ if (typeof (buf) !== 'string') {
+ assert.buffer(buf, 'buf');
+ buf = buf.toString('ascii');
+ }
+
+ var lines = buf.trim().split('\n');
+
+ var m = lines[0].match(/*JSSTYLED*/
+ /[-]+[ ]*BEGIN ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);
+ assert.ok(m, 'invalid PEM header');
+
+ var m2 = lines[lines.length - 1].match(/*JSSTYLED*/
+ /[-]+[ ]*END ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/);
+ assert.ok(m2, 'invalid PEM footer');
+
+ /* Begin and end banners must match key type */
+ assert.equal(m[2], m2[2]);
+ var type = m[2].toLowerCase();
+
+ var alg;
+ if (m[1]) {
+ /* They also must match algorithms, if given */
+ assert.equal(m[1], m2[1], 'PEM header and footer mismatch');
+ alg = m[1].trim();
+ }
+
+ var headers = {};
+ while (true) {
+ lines = lines.slice(1);
+ m = lines[0].match(/*JSSTYLED*/
+ /^([A-Za-z0-9-]+): (.+)$/);
+ if (!m)
+ break;
+ headers[m[1].toLowerCase()] = m[2];
+ }
+ if (headers['proc-type']) {
+ var parts = headers['proc-type'].split(',');
+ if (parts[0] === '4' && parts[1] === 'ENCRYPTED') {
+ throw (new Error('PEM key is encrypted ' +
+ '(password-protected). Please use the ' +
+ 'SSH agent or decrypt the key.'));
+ }
+ }
+
+ /* Chop off the first and last lines */
+ lines = lines.slice(0, -1).join('');
+ buf = new Buffer(lines, 'base64');
+
+ /* The new OpenSSH internal format abuses PEM headers */
+ if (alg && alg.toLowerCase() === 'openssh')
+ return (sshpriv.readSSHPrivate(type, buf));
+ if (alg && alg.toLowerCase() === 'ssh2')
+ return (rfc4253.readType(type, buf));
+
+ var der = new asn1.BerReader(buf);
+ der.originalInput = input;
+
+ /*
+ * All of the PEM file types start with a sequence tag, so chop it
+ * off here
+ */
+ der.readSequence();
+
+ /* PKCS#1 type keys name an algorithm in the banner explicitly */
+ if (alg) {
+ if (forceType)
+ assert.strictEqual(forceType, 'pkcs1');
+ return (pkcs1.readPkcs1(alg, type, der));
+ } else {
+ if (forceType)
+ assert.strictEqual(forceType, 'pkcs8');
+ return (pkcs8.readPkcs8(alg, type, der));
+ }
+}
+
+function write(key, type) {
+ assert.object(key);
+
+ var alg = {'ecdsa': 'EC', 'rsa': 'RSA', 'dsa': 'DSA'}[key.type];
+ var header;
+
+ var der = new asn1.BerWriter();
+
+ if (PrivateKey.isPrivateKey(key)) {
+ if (type && type === 'pkcs8') {
+ header = 'PRIVATE KEY';
+ pkcs8.writePkcs8(der, key);
+ } else {
+ if (type)
+ assert.strictEqual(type, 'pkcs1');
+ header = alg + ' PRIVATE KEY';
+ pkcs1.writePkcs1(der, key);
+ }
+
+ } else if (Key.isKey(key)) {
+ if (type && type === 'pkcs1') {
+ header = alg + ' PUBLIC KEY';
+ pkcs1.writePkcs1(der, key);
+ } else {
+ if (type)
+ assert.strictEqual(type, 'pkcs8');
+ header = 'PUBLIC KEY';
+ pkcs8.writePkcs8(der, key);
+ }
+
+ } else {
+ throw (new Error('key is not a Key or PrivateKey'));
+ }
+
+ var tmp = der.buffer.toString('base64');
+ var len = tmp.length + (tmp.length / 64) +
+ 18 + 16 + header.length*2 + 10;
+ var buf = new Buffer(len);
+ var o = 0;
+ o += buf.write('-----BEGIN ' + header + '-----\n', o);
+ for (var i = 0; i < tmp.length; ) {
+ var limit = i + 64;
+ if (limit > tmp.length)
+ limit = tmp.length;
+ o += buf.write(tmp.slice(i, limit), o);
+ buf[o++] = 10;
+ i = limit;
+ }
+ o += buf.write('-----END ' + header + '-----\n', o);
+
+ return (buf.slice(0, o));
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs1.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs1.js
new file mode 100644
index 000000000..6f9a24f11
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs1.js
@@ -0,0 +1,320 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ read: read,
+ readPkcs1: readPkcs1,
+ write: write,
+ writePkcs1: writePkcs1
+};
+
+var assert = require('assert-plus');
+var asn1 = require('asn1');
+var algs = require('../algs');
+var utils = require('../utils');
+
+var Key = require('../key');
+var PrivateKey = require('../private-key');
+var pem = require('./pem');
+
+var pkcs8 = require('./pkcs8');
+var readECDSACurve = pkcs8.readECDSACurve;
+
+function read(buf) {
+ return (pem.read(buf, 'pkcs1'));
+}
+
+function write(key) {
+ return (pem.write(key, 'pkcs1'));
+}
+
+/* Helper to read in a single mpint */
+function readMPInt(der, nm) {
+ assert.strictEqual(der.peek(), asn1.Ber.Integer,
+ nm + ' is not an Integer');
+ return (utils.mpNormalize(der.readString(asn1.Ber.Integer, true)));
+}
+
+function readPkcs1(alg, type, der) {
+ switch (alg) {
+ case 'RSA':
+ if (type === 'public')
+ return (readPkcs1RSAPublic(der));
+ else if (type === 'private')
+ return (readPkcs1RSAPrivate(der));
+ throw (new Error('Unknown key type: ' + type));
+ case 'DSA':
+ if (type === 'public')
+ return (readPkcs1DSAPublic(der));
+ else if (type === 'private')
+ return (readPkcs1DSAPrivate(der));
+ throw (new Error('Unknown key type: ' + type));
+ case 'EC':
+ case 'ECDSA':
+ if (type === 'private')
+ return (readPkcs1ECDSAPrivate(der));
+ else if (type === 'public')
+ return (readPkcs1ECDSAPublic(der));
+ throw (new Error('Unknown key type: ' + type));
+ default:
+ throw (new Error('Unknown key algo: ' + alg));
+ }
+}
+
+function readPkcs1RSAPublic(der) {
+ // modulus and exponent
+ var n = readMPInt(der, 'modulus');
+ var e = readMPInt(der, 'exponent');
+
+ // now, make the key
+ var key = {
+ type: 'rsa',
+ parts: [
+ { name: 'e', data: e },
+ { name: 'n', data: n }
+ ]
+ };
+
+ return (new Key(key));
+}
+
+function readPkcs1RSAPrivate(der) {
+ var version = readMPInt(der, 'version');
+ assert.strictEqual(version[0], 0);
+
+ // modulus then public exponent
+ var n = readMPInt(der, 'modulus');
+ var e = readMPInt(der, 'public exponent');
+ var d = readMPInt(der, 'private exponent');
+ var p = readMPInt(der, 'prime1');
+ var q = readMPInt(der, 'prime2');
+ var dmodp = readMPInt(der, 'exponent1');
+ var dmodq = readMPInt(der, 'exponent2');
+ var iqmp = readMPInt(der, 'iqmp');
+
+ // now, make the key
+ var key = {
+ type: 'rsa',
+ parts: [
+ { name: 'n', data: n },
+ { name: 'e', data: e },
+ { name: 'd', data: d },
+ { name: 'iqmp', data: iqmp },
+ { name: 'p', data: p },
+ { name: 'q', data: q },
+ { name: 'dmodp', data: dmodp },
+ { name: 'dmodq', data: dmodq }
+ ]
+ };
+
+ return (new PrivateKey(key));
+}
+
+function readPkcs1DSAPrivate(der) {
+ var version = readMPInt(der, 'version');
+ assert.strictEqual(version.readUInt8(0), 0);
+
+ var p = readMPInt(der, 'p');
+ var q = readMPInt(der, 'q');
+ var g = readMPInt(der, 'g');
+ var y = readMPInt(der, 'y');
+ var x = readMPInt(der, 'x');
+
+ // now, make the key
+ var key = {
+ type: 'dsa',
+ parts: [
+ { name: 'p', data: p },
+ { name: 'q', data: q },
+ { name: 'g', data: g },
+ { name: 'y', data: y },
+ { name: 'x', data: x }
+ ]
+ };
+
+ return (new PrivateKey(key));
+}
+
+function readPkcs1DSAPublic(der) {
+ var y = readMPInt(der, 'y');
+ var p = readMPInt(der, 'p');
+ var q = readMPInt(der, 'q');
+ var g = readMPInt(der, 'g');
+
+ var key = {
+ type: 'dsa',
+ parts: [
+ { name: 'y', data: y },
+ { name: 'p', data: p },
+ { name: 'q', data: q },
+ { name: 'g', data: g }
+ ]
+ };
+
+ return (new Key(key));
+}
+
+function readPkcs1ECDSAPublic(der) {
+ der.readSequence();
+
+ var oid = der.readOID();
+ assert.strictEqual(oid, '1.2.840.10045.2.1', 'must be ecPublicKey');
+
+ var curveOid = der.readOID();
+
+ var curve;
+ var curves = Object.keys(algs.curves);
+ for (var j = 0; j < curves.length; ++j) {
+ var c = curves[j];
+ var cd = algs.curves[c];
+ if (cd.pkcs8oid === curveOid) {
+ curve = c;
+ break;
+ }
+ }
+ assert.string(curve, 'a known ECDSA named curve');
+
+ var Q = der.readString(asn1.Ber.BitString, true);
+ Q = utils.ecNormalize(Q);
+
+ var key = {
+ type: 'ecdsa',
+ parts: [
+ { name: 'curve', data: new Buffer(curve) },
+ { name: 'Q', data: Q }
+ ]
+ };
+
+ return (new Key(key));
+}
+
+function readPkcs1ECDSAPrivate(der) {
+ var version = readMPInt(der, 'version');
+ assert.strictEqual(version.readUInt8(0), 1);
+
+ // private key
+ var d = der.readString(asn1.Ber.OctetString, true);
+
+ der.readSequence(0xa0);
+ var curve = readECDSACurve(der);
+ assert.string(curve, 'a known elliptic curve');
+
+ der.readSequence(0xa1);
+ var Q = der.readString(asn1.Ber.BitString, true);
+ Q = utils.ecNormalize(Q);
+
+ var key = {
+ type: 'ecdsa',
+ parts: [
+ { name: 'curve', data: new Buffer(curve) },
+ { name: 'Q', data: Q },
+ { name: 'd', data: d }
+ ]
+ };
+
+ return (new PrivateKey(key));
+}
+
+function writePkcs1(der, key) {
+ der.startSequence();
+
+ switch (key.type) {
+ case 'rsa':
+ if (PrivateKey.isPrivateKey(key))
+ writePkcs1RSAPrivate(der, key);
+ else
+ writePkcs1RSAPublic(der, key);
+ break;
+ case 'dsa':
+ if (PrivateKey.isPrivateKey(key))
+ writePkcs1DSAPrivate(der, key);
+ else
+ writePkcs1DSAPublic(der, key);
+ break;
+ case 'ecdsa':
+ if (PrivateKey.isPrivateKey(key))
+ writePkcs1ECDSAPrivate(der, key);
+ else
+ writePkcs1ECDSAPublic(der, key);
+ break;
+ default:
+ throw (new Error('Unknown key algo: ' + key.type));
+ }
+
+ der.endSequence();
+}
+
+function writePkcs1RSAPublic(der, key) {
+ der.writeBuffer(key.part.n.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.e.data, asn1.Ber.Integer);
+}
+
+function writePkcs1RSAPrivate(der, key) {
+ var ver = new Buffer(1);
+ ver[0] = 0;
+ der.writeBuffer(ver, asn1.Ber.Integer);
+
+ der.writeBuffer(key.part.n.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.e.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.d.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.p.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.q.data, asn1.Ber.Integer);
+ if (!key.part.dmodp || !key.part.dmodq)
+ utils.addRSAMissing(key);
+ der.writeBuffer(key.part.dmodp.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.dmodq.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.iqmp.data, asn1.Ber.Integer);
+}
+
+function writePkcs1DSAPrivate(der, key) {
+ var ver = new Buffer(1);
+ ver[0] = 0;
+ der.writeBuffer(ver, asn1.Ber.Integer);
+
+ der.writeBuffer(key.part.p.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.q.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.g.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.y.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.x.data, asn1.Ber.Integer);
+}
+
+function writePkcs1DSAPublic(der, key) {
+ der.writeBuffer(key.part.y.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.p.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.q.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.g.data, asn1.Ber.Integer);
+}
+
+function writePkcs1ECDSAPublic(der, key) {
+ der.startSequence();
+
+ der.writeOID('1.2.840.10045.2.1'); /* ecPublicKey */
+ var curve = key.part.curve.data.toString();
+ var curveOid = algs.curves[curve].pkcs8oid;
+ assert.string(curveOid, 'a known ECDSA named curve');
+ der.writeOID(curveOid);
+
+ der.endSequence();
+
+ var Q = utils.ecNormalize(key.part.Q.data, true);
+ der.writeBuffer(Q, asn1.Ber.BitString);
+}
+
+function writePkcs1ECDSAPrivate(der, key) {
+ var ver = new Buffer(1);
+ ver[0] = 1;
+ der.writeBuffer(ver, asn1.Ber.Integer);
+
+ der.writeBuffer(key.part.d.data, asn1.Ber.OctetString);
+
+ der.startSequence(0xa0);
+ var curve = key.part.curve.data.toString();
+ var curveOid = algs.curves[curve].pkcs8oid;
+ assert.string(curveOid, 'a known ECDSA named curve');
+ der.writeOID(curveOid);
+ der.endSequence();
+
+ der.startSequence(0xa1);
+ var Q = utils.ecNormalize(key.part.Q.data, true);
+ der.writeBuffer(Q, asn1.Ber.BitString);
+ der.endSequence();
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs8.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs8.js
new file mode 100644
index 000000000..c57c85537
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs8.js
@@ -0,0 +1,510 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ read: read,
+ readPkcs8: readPkcs8,
+ write: write,
+ writePkcs8: writePkcs8,
+
+ readECDSACurve: readECDSACurve,
+ writeECDSACurve: writeECDSACurve
+};
+
+var assert = require('assert-plus');
+var asn1 = require('asn1');
+var algs = require('../algs');
+var utils = require('../utils');
+var Key = require('../key');
+var PrivateKey = require('../private-key');
+var pem = require('./pem');
+
+function read(buf) {
+ return (pem.read(buf, 'pkcs8'));
+}
+
+function write(key) {
+ return (pem.write(key, 'pkcs8'));
+}
+
+/* Helper to read in a single mpint */
+function readMPInt(der, nm) {
+ assert.strictEqual(der.peek(), asn1.Ber.Integer,
+ nm + ' is not an Integer');
+ return (utils.mpNormalize(der.readString(asn1.Ber.Integer, true)));
+}
+
+function readPkcs8(alg, type, der) {
+ /* Private keys in pkcs#8 format have a weird extra int */
+ if (der.peek() === asn1.Ber.Integer) {
+ assert.strictEqual(type, 'private',
+ 'unexpected Integer at start of public key');
+ der.readString(asn1.Ber.Integer, true);
+ }
+
+ der.readSequence();
+
+ var oid = der.readOID();
+ switch (oid) {
+ case '1.2.840.113549.1.1.1':
+ if (type === 'public')
+ return (readPkcs8RSAPublic(der));
+ else
+ return (readPkcs8RSAPrivate(der));
+ case '1.2.840.10040.4.1':
+ if (type === 'public')
+ return (readPkcs8DSAPublic(der));
+ else
+ return (readPkcs8DSAPrivate(der));
+ case '1.2.840.10045.2.1':
+ if (type === 'public')
+ return (readPkcs8ECDSAPublic(der));
+ else
+ return (readPkcs8ECDSAPrivate(der));
+ default:
+ throw (new Error('Unknown key type OID ' + oid));
+ }
+}
+
+function readPkcs8RSAPublic(der) {
+ // Null -- XXX this probably isn't good practice
+ der.readByte();
+ der.readByte();
+
+ // bit string sequence
+ der.readSequence(asn1.Ber.BitString);
+ der.readByte();
+ der.readSequence();
+
+ // modulus
+ var n = readMPInt(der, 'modulus');
+ var e = readMPInt(der, 'exponent');
+
+ // now, make the key
+ var key = {
+ type: 'rsa',
+ source: der.originalInput,
+ parts: [
+ { name: 'e', data: e },
+ { name: 'n', data: n }
+ ]
+ };
+
+ return (new Key(key));
+}
+
+function readPkcs8RSAPrivate(der) {
+ der.readByte();
+ der.readByte();
+
+ der.readSequence(asn1.Ber.OctetString);
+ der.readSequence();
+
+ var ver = readMPInt(der, 'version');
+ assert.equal(ver[0], 0x0, 'unknown RSA private key version');
+
+ // modulus then public exponent
+ var n = readMPInt(der, 'modulus');
+ var e = readMPInt(der, 'public exponent');
+ var d = readMPInt(der, 'private exponent');
+ var p = readMPInt(der, 'prime1');
+ var q = readMPInt(der, 'prime2');
+ var dmodp = readMPInt(der, 'exponent1');
+ var dmodq = readMPInt(der, 'exponent2');
+ var iqmp = readMPInt(der, 'iqmp');
+
+ // now, make the key
+ var key = {
+ type: 'rsa',
+ parts: [
+ { name: 'n', data: n },
+ { name: 'e', data: e },
+ { name: 'd', data: d },
+ { name: 'iqmp', data: iqmp },
+ { name: 'p', data: p },
+ { name: 'q', data: q },
+ { name: 'dmodp', data: dmodp },
+ { name: 'dmodq', data: dmodq }
+ ]
+ };
+
+ return (new PrivateKey(key));
+}
+
+function readPkcs8DSAPublic(der) {
+ der.readSequence();
+
+ var p = readMPInt(der, 'p');
+ var q = readMPInt(der, 'q');
+ var g = readMPInt(der, 'g');
+
+ // bit string sequence
+ der.readSequence(asn1.Ber.BitString);
+ der.readByte();
+
+ var y = readMPInt(der, 'y');
+
+ // now, make the key
+ var key = {
+ type: 'dsa',
+ parts: [
+ { name: 'p', data: p },
+ { name: 'q', data: q },
+ { name: 'g', data: g },
+ { name: 'y', data: y }
+ ]
+ };
+
+ return (new Key(key));
+}
+
+function readPkcs8DSAPrivate(der) {
+ der.readSequence();
+
+ var p = readMPInt(der, 'p');
+ var q = readMPInt(der, 'q');
+ var g = readMPInt(der, 'g');
+
+ der.readSequence(asn1.Ber.OctetString);
+ var x = readMPInt(der, 'x');
+
+ /* The pkcs#8 format does not include the public key */
+ var y = utils.calculateDSAPublic(g, p, x);
+
+ var key = {
+ type: 'dsa',
+ parts: [
+ { name: 'p', data: p },
+ { name: 'q', data: q },
+ { name: 'g', data: g },
+ { name: 'y', data: y },
+ { name: 'x', data: x }
+ ]
+ };
+
+ return (new PrivateKey(key));
+}
+
+function readECDSACurve(der) {
+ var curveName, curveNames;
+ var j, c, cd;
+
+ if (der.peek() === asn1.Ber.OID) {
+ var oid = der.readOID();
+
+ curveNames = Object.keys(algs.curves);
+ for (j = 0; j < curveNames.length; ++j) {
+ c = curveNames[j];
+ cd = algs.curves[c];
+ if (cd.pkcs8oid === oid) {
+ curveName = c;
+ break;
+ }
+ }
+
+ } else {
+ // ECParameters sequence
+ der.readSequence();
+ var version = der.readString(asn1.Ber.Integer, true);
+ assert.strictEqual(version[0], 1, 'ECDSA key not version 1');
+
+ var curve = {};
+
+ // FieldID sequence
+ der.readSequence();
+ var fieldTypeOid = der.readOID();
+ assert.strictEqual(fieldTypeOid, '1.2.840.10045.1.1',
+ 'ECDSA key is not from a prime-field');
+ var p = curve.p = utils.mpNormalize(
+ der.readString(asn1.Ber.Integer, true));
+ /*
+ * p always starts with a 1 bit, so count the zeros to get its
+ * real size.
+ */
+ curve.size = p.length * 8 - utils.countZeros(p);
+
+ // Curve sequence
+ der.readSequence();
+ curve.a = utils.mpNormalize(
+ der.readString(asn1.Ber.OctetString, true));
+ curve.b = utils.mpNormalize(
+ der.readString(asn1.Ber.OctetString, true));
+ if (der.peek() === asn1.Ber.BitString)
+ curve.s = der.readString(asn1.Ber.BitString, true);
+
+ // Combined Gx and Gy
+ curve.G = der.readString(asn1.Ber.OctetString, true);
+ assert.strictEqual(curve.G[0], 0x4,
+ 'uncompressed G is required');
+
+ curve.n = utils.mpNormalize(
+ der.readString(asn1.Ber.Integer, true));
+ curve.h = utils.mpNormalize(
+ der.readString(asn1.Ber.Integer, true));
+ assert.strictEqual(curve.h[0], 0x1, 'a cofactor=1 curve is ' +
+ 'required');
+
+ curveNames = Object.keys(algs.curves);
+ var ks = Object.keys(curve);
+ for (j = 0; j < curveNames.length; ++j) {
+ c = curveNames[j];
+ cd = algs.curves[c];
+ var equal = true;
+ for (var i = 0; i < ks.length; ++i) {
+ var k = ks[i];
+ if (cd[k] === undefined)
+ continue;
+ if (typeof (cd[k]) === 'object' &&
+ cd[k].equals !== undefined) {
+ if (!cd[k].equals(curve[k])) {
+ equal = false;
+ break;
+ }
+ } else if (Buffer.isBuffer(cd[k])) {
+ if (cd[k].toString('binary')
+ !== curve[k].toString('binary')) {
+ equal = false;
+ break;
+ }
+ } else {
+ if (cd[k] !== curve[k]) {
+ equal = false;
+ break;
+ }
+ }
+ }
+ if (equal) {
+ curveName = c;
+ break;
+ }
+ }
+ }
+ return (curveName);
+}
+
+function readPkcs8ECDSAPrivate(der) {
+ var curveName = readECDSACurve(der);
+ assert.string(curveName, 'a known elliptic curve');
+
+ der.readSequence(asn1.Ber.OctetString);
+ der.readSequence();
+
+ var version = readMPInt(der, 'version');
+ assert.equal(version[0], 1, 'unknown version of ECDSA key');
+
+ var d = der.readString(asn1.Ber.OctetString, true);
+ der.readSequence(0xa1);
+
+ var Q = der.readString(asn1.Ber.BitString, true);
+ Q = utils.ecNormalize(Q);
+
+ var key = {
+ type: 'ecdsa',
+ parts: [
+ { name: 'curve', data: new Buffer(curveName) },
+ { name: 'Q', data: Q },
+ { name: 'd', data: d }
+ ]
+ };
+
+ return (new PrivateKey(key));
+}
+
+function readPkcs8ECDSAPublic(der) {
+ var curveName = readECDSACurve(der);
+ assert.string(curveName, 'a known elliptic curve');
+
+ var Q = der.readString(asn1.Ber.BitString, true);
+ Q = utils.ecNormalize(Q);
+
+ var key = {
+ type: 'ecdsa',
+ parts: [
+ { name: 'curve', data: new Buffer(curveName) },
+ { name: 'Q', data: Q }
+ ]
+ };
+
+ return (new Key(key));
+}
+
+function writePkcs8(der, key) {
+ der.startSequence();
+
+ if (PrivateKey.isPrivateKey(key)) {
+ var sillyInt = new Buffer(1);
+ sillyInt[0] = 0x0;
+ der.writeBuffer(sillyInt, asn1.Ber.Integer);
+ }
+
+ der.startSequence();
+ switch (key.type) {
+ case 'rsa':
+ der.writeOID('1.2.840.113549.1.1.1');
+ if (PrivateKey.isPrivateKey(key))
+ writePkcs8RSAPrivate(key, der);
+ else
+ writePkcs8RSAPublic(key, der);
+ break;
+ case 'dsa':
+ der.writeOID('1.2.840.10040.4.1');
+ if (PrivateKey.isPrivateKey(key))
+ writePkcs8DSAPrivate(key, der);
+ else
+ writePkcs8DSAPublic(key, der);
+ break;
+ case 'ecdsa':
+ der.writeOID('1.2.840.10045.2.1');
+ if (PrivateKey.isPrivateKey(key))
+ writePkcs8ECDSAPrivate(key, der);
+ else
+ writePkcs8ECDSAPublic(key, der);
+ break;
+ default:
+ throw (new Error('Unsupported key type: ' + key.type));
+ }
+
+ der.endSequence();
+}
+
+function writePkcs8RSAPrivate(key, der) {
+ der.writeNull();
+ der.endSequence();
+
+ der.startSequence(asn1.Ber.OctetString);
+ der.startSequence();
+
+ var version = new Buffer(1);
+ version[0] = 0;
+ der.writeBuffer(version, asn1.Ber.Integer);
+
+ der.writeBuffer(key.part.n.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.e.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.d.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.p.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.q.data, asn1.Ber.Integer);
+ if (!key.part.dmodp || !key.part.dmodq)
+ utils.addRSAMissing(key);
+ der.writeBuffer(key.part.dmodp.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.dmodq.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.iqmp.data, asn1.Ber.Integer);
+
+ der.endSequence();
+ der.endSequence();
+}
+
+function writePkcs8RSAPublic(key, der) {
+ der.writeNull();
+ der.endSequence();
+
+ der.startSequence(asn1.Ber.BitString);
+ der.writeByte(0x00);
+
+ der.startSequence();
+ der.writeBuffer(key.part.n.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.e.data, asn1.Ber.Integer);
+ der.endSequence();
+
+ der.endSequence();
+}
+
+function writePkcs8DSAPrivate(key, der) {
+ der.startSequence();
+ der.writeBuffer(key.part.p.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.q.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.g.data, asn1.Ber.Integer);
+ der.endSequence();
+
+ der.endSequence();
+
+ der.startSequence(asn1.Ber.OctetString);
+ der.writeBuffer(key.part.x.data, asn1.Ber.Integer);
+ der.endSequence();
+}
+
+function writePkcs8DSAPublic(key, der) {
+ der.startSequence();
+ der.writeBuffer(key.part.p.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.q.data, asn1.Ber.Integer);
+ der.writeBuffer(key.part.g.data, asn1.Ber.Integer);
+ der.endSequence();
+ der.endSequence();
+
+ der.startSequence(asn1.Ber.BitString);
+ der.writeByte(0x00);
+ der.writeBuffer(key.part.y.data, asn1.Ber.Integer);
+ der.endSequence();
+}
+
+function writeECDSACurve(key, der) {
+ var curve = algs.curves[key.curve];
+ if (curve.pkcs8oid) {
+ /* This one has a name in pkcs#8, so just write the oid */
+ der.writeOID(curve.pkcs8oid);
+
+ } else {
+ // ECParameters sequence
+ der.startSequence();
+
+ var version = new Buffer(1);
+ version.writeUInt8(1, 0);
+ der.writeBuffer(version, asn1.Ber.Integer);
+
+ // FieldID sequence
+ der.startSequence();
+ der.writeOID('1.2.840.10045.1.1'); // prime-field
+ der.writeBuffer(curve.p, asn1.Ber.Integer);
+ der.endSequence();
+
+ // Curve sequence
+ der.startSequence();
+ var a = curve.p;
+ if (a[0] === 0x0)
+ a = a.slice(1);
+ der.writeBuffer(a, asn1.Ber.OctetString);
+ der.writeBuffer(curve.b, asn1.Ber.OctetString);
+ der.writeBuffer(curve.s, asn1.Ber.BitString);
+ der.endSequence();
+
+ der.writeBuffer(curve.G, asn1.Ber.OctetString);
+ der.writeBuffer(curve.n, asn1.Ber.Integer);
+ var h = curve.h;
+ if (!h) {
+ h = new Buffer(1);
+ h[0] = 1;
+ }
+ der.writeBuffer(h, asn1.Ber.Integer);
+
+ // ECParameters
+ der.endSequence();
+ }
+}
+
+function writePkcs8ECDSAPublic(key, der) {
+ writeECDSACurve(key, der);
+ der.endSequence();
+
+ var Q = utils.ecNormalize(key.part.Q.data, true);
+ der.writeBuffer(Q, asn1.Ber.BitString);
+}
+
+function writePkcs8ECDSAPrivate(key, der) {
+ writeECDSACurve(key, der);
+ der.endSequence();
+
+ der.startSequence(asn1.Ber.OctetString);
+ der.startSequence();
+
+ var version = new Buffer(1);
+ version[0] = 1;
+ der.writeBuffer(version, asn1.Ber.Integer);
+
+ der.writeBuffer(key.part.d.data, asn1.Ber.OctetString);
+
+ der.startSequence(0xa1);
+ var Q = utils.ecNormalize(key.part.Q.data, true);
+ der.writeBuffer(Q, asn1.Ber.BitString);
+ der.endSequence();
+
+ der.endSequence();
+ der.endSequence();
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/rfc4253.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/rfc4253.js
new file mode 100644
index 000000000..94e6a907d
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/rfc4253.js
@@ -0,0 +1,145 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ read: read.bind(undefined, false, undefined),
+ readType: read.bind(undefined, false),
+ write: write,
+ /* semi-private api, used by sshpk-agent */
+ readPartial: read.bind(undefined, true),
+
+ /* shared with ssh format */
+ readInternal: read,
+ keyTypeToAlg: keyTypeToAlg,
+ algToKeyType: algToKeyType
+};
+
+var assert = require('assert-plus');
+var algs = require('../algs');
+var utils = require('../utils');
+var Key = require('../key');
+var PrivateKey = require('../private-key');
+var SSHBuffer = require('../ssh-buffer');
+
+function algToKeyType(alg) {
+ assert.string(alg);
+ if (alg === 'ssh-dss')
+ return ('dsa');
+ else if (alg === 'ssh-rsa')
+ return ('rsa');
+ else if (alg === 'ssh-ed25519')
+ return ('ed25519');
+ else if (alg === 'ssh-curve25519')
+ return ('curve25519');
+ else if (alg.match(/^ecdsa-sha2-/))
+ return ('ecdsa');
+ else
+ throw (new Error('Unknown algorithm ' + alg));
+}
+
+function keyTypeToAlg(key) {
+ assert.object(key);
+ if (key.type === 'dsa')
+ return ('ssh-dss');
+ else if (key.type === 'rsa')
+ return ('ssh-rsa');
+ else if (key.type === 'ed25519')
+ return ('ssh-ed25519');
+ else if (key.type === 'curve25519')
+ return ('ssh-curve25519');
+ else if (key.type === 'ecdsa')
+ return ('ecdsa-sha2-' + key.part.curve.data.toString());
+ else
+ throw (new Error('Unknown key type ' + key.type));
+}
+
+function read(partial, type, buf) {
+ if (typeof (buf) === 'string')
+ buf = new Buffer(buf);
+ assert.buffer(buf, 'buf');
+
+ var key = {};
+
+ var parts = key.parts = [];
+ var sshbuf = new SSHBuffer({buffer: buf});
+
+ var alg = sshbuf.readString();
+ assert.ok(!sshbuf.atEnd(), 'key must have at least one part');
+
+ key.type = algToKeyType(alg);
+
+ var partCount = algs.info[key.type].parts.length;
+ if (type && type === 'private')
+ partCount = algs.privInfo[key.type].parts.length;
+
+ while (!sshbuf.atEnd() && parts.length < partCount)
+ parts.push(sshbuf.readPart());
+ while (!partial && !sshbuf.atEnd())
+ parts.push(sshbuf.readPart());
+
+ assert.ok(parts.length >= 1,
+ 'key must have at least one part');
+ assert.ok(partial || sshbuf.atEnd(),
+ 'leftover bytes at end of key');
+
+ var Constructor = Key;
+ var algInfo = algs.info[key.type];
+ if (type === 'private' || algInfo.parts.length !== parts.length) {
+ algInfo = algs.privInfo[key.type];
+ Constructor = PrivateKey;
+ }
+ assert.strictEqual(algInfo.parts.length, parts.length);
+
+ if (key.type === 'ecdsa') {
+ var res = /^ecdsa-sha2-(.+)$/.exec(alg);
+ assert.ok(res !== null);
+ assert.strictEqual(res[1], parts[0].data.toString());
+ }
+
+ var normalized = true;
+ for (var i = 0; i < algInfo.parts.length; ++i) {
+ parts[i].name = algInfo.parts[i];
+ if (parts[i].name !== 'curve' &&
+ algInfo.normalize !== false) {
+ var p = parts[i];
+ var nd = utils.mpNormalize(p.data);
+ if (nd !== p.data) {
+ p.data = nd;
+ normalized = false;
+ }
+ }
+ }
+
+ if (normalized)
+ key._rfc4253Cache = sshbuf.toBuffer();
+
+ if (partial && typeof (partial) === 'object') {
+ partial.remainder = sshbuf.remainder();
+ partial.consumed = sshbuf._offset;
+ }
+
+ return (new Constructor(key));
+}
+
+function write(key) {
+ assert.object(key);
+
+ var alg = keyTypeToAlg(key);
+ var i;
+
+ var algInfo = algs.info[key.type];
+ if (PrivateKey.isPrivateKey(key))
+ algInfo = algs.privInfo[key.type];
+ var parts = algInfo.parts;
+
+ var buf = new SSHBuffer({});
+
+ buf.writeString(alg);
+
+ for (i = 0; i < parts.length; ++i) {
+ var data = key.part[parts[i]].data;
+ data = utils.mpNormalize(data);
+ buf.writeBuffer(data);
+ }
+
+ return (buf.toBuffer());
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh-private.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh-private.js
new file mode 100644
index 000000000..02d7c27e8
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh-private.js
@@ -0,0 +1,138 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ read: read,
+ readSSHPrivate: readSSHPrivate,
+ write: write
+};
+
+var assert = require('assert-plus');
+var asn1 = require('asn1');
+var algs = require('../algs');
+var utils = require('../utils');
+var crypto = require('crypto');
+
+var Key = require('../key');
+var PrivateKey = require('../private-key');
+var pem = require('./pem');
+var rfc4253 = require('./rfc4253');
+var SSHBuffer = require('../ssh-buffer');
+
+function read(buf) {
+ return (pem.read(buf));
+}
+
+var MAGIC = 'openssh-key-v1';
+
+function readSSHPrivate(type, buf) {
+ buf = new SSHBuffer({buffer: buf});
+
+ var magic = buf.readCString();
+ assert.strictEqual(magic, MAGIC, 'bad magic string');
+
+ var cipher = buf.readString();
+ var kdf = buf.readString();
+
+ /* We only support unencrypted keys. */
+ if (cipher !== 'none' || kdf !== 'none') {
+ throw (new Error('OpenSSH-format key is encrypted ' +
+ '(password-protected). Please use the SSH agent ' +
+ 'or decrypt the key.'));
+ }
+
+ /* Skip over kdfoptions. */
+ buf.readString();
+
+ var nkeys = buf.readInt();
+ if (nkeys !== 1) {
+ throw (new Error('OpenSSH-format key file contains ' +
+ 'multiple keys: this is unsupported.'));
+ }
+
+ var pubKey = buf.readBuffer();
+
+ if (type === 'public') {
+ assert.ok(buf.atEnd(), 'excess bytes left after key');
+ return (rfc4253.read(pubKey));
+ }
+
+ var privKeyBlob = buf.readBuffer();
+ assert.ok(buf.atEnd(), 'excess bytes left after key');
+
+ buf = new SSHBuffer({buffer: privKeyBlob});
+
+ var checkInt1 = buf.readInt();
+ var checkInt2 = buf.readInt();
+ assert.strictEqual(checkInt1, checkInt2, 'checkints do not match');
+
+ var ret = {};
+ var key = rfc4253.readInternal(ret, 'private', buf.remainder());
+
+ buf.skip(ret.consumed);
+
+ var comment = buf.readString();
+ key.comment = comment;
+
+ return (key);
+}
+
+function write(key) {
+ var pubKey;
+ if (PrivateKey.isPrivateKey(key))
+ pubKey = key.toPublic();
+ else
+ pubKey = key;
+
+ var privBuf;
+ if (PrivateKey.isPrivateKey(key)) {
+ privBuf = new SSHBuffer({});
+ var checkInt = crypto.randomBytes(4).readUInt32BE(0);
+ privBuf.writeInt(checkInt);
+ privBuf.writeInt(checkInt);
+ privBuf.write(key.toBuffer('rfc4253'));
+ privBuf.writeString(key.comment || '');
+
+ var n = 1;
+ while (privBuf._offset % 8 !== 0)
+ privBuf.writeChar(n++);
+ }
+
+ var buf = new SSHBuffer({});
+
+ buf.writeCString(MAGIC);
+ buf.writeString('none'); /* cipher */
+ buf.writeString('none'); /* kdf */
+ buf.writeBuffer(new Buffer(0)); /* kdfoptions */
+
+ buf.writeInt(1); /* nkeys */
+ buf.writeBuffer(pubKey.toBuffer('rfc4253'));
+
+ if (privBuf)
+ buf.writeBuffer(privBuf.toBuffer());
+
+ buf = buf.toBuffer();
+
+ var header;
+ if (PrivateKey.isPrivateKey(key))
+ header = 'OPENSSH PRIVATE KEY';
+ else
+ header = 'OPENSSH PUBLIC KEY';
+
+ var tmp = buf.toString('base64');
+ var len = tmp.length + (tmp.length / 70) +
+ 18 + 16 + header.length*2 + 10;
+ buf = new Buffer(len);
+ var o = 0;
+ o += buf.write('-----BEGIN ' + header + '-----\n', o);
+ for (var i = 0; i < tmp.length; ) {
+ var limit = i + 70;
+ if (limit > tmp.length)
+ limit = tmp.length;
+ o += buf.write(tmp.slice(i, limit), o);
+ buf[o++] = 10;
+ i = limit;
+ }
+ o += buf.write('-----END ' + header + '-----\n', o);
+
+ return (buf.slice(0, o));
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh.js
new file mode 100644
index 000000000..f7baa48cf
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh.js
@@ -0,0 +1,114 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ read: read,
+ write: write
+};
+
+var assert = require('assert-plus');
+var rfc4253 = require('./rfc4253');
+var utils = require('../utils');
+var Key = require('../key');
+var PrivateKey = require('../private-key');
+
+var sshpriv = require('./ssh-private');
+
+/*JSSTYLED*/
+var SSHKEY_RE = /^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/]+[=]*)([\n \t]+([^\n]+))?$/;
+/*JSSTYLED*/
+var SSHKEY_RE2 = /^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/ \t\n]+[=]*)(.*)$/;
+
+function read(buf) {
+ if (typeof (buf) !== 'string') {
+ assert.buffer(buf, 'buf');
+ buf = buf.toString('ascii');
+ }
+
+ var trimmed = buf.trim().replace(/[\\\r]/g, '');
+ var m = trimmed.match(SSHKEY_RE);
+ if (!m)
+ m = trimmed.match(SSHKEY_RE2);
+ assert.ok(m, 'key must match regex');
+
+ var type = rfc4253.algToKeyType(m[1]);
+ var kbuf = new Buffer(m[2], 'base64');
+
+ /*
+ * This is a bit tricky. If we managed to parse the key and locate the
+ * key comment with the regex, then do a non-partial read and assert
+ * that we have consumed all bytes. If we couldn't locate the key
+ * comment, though, there may be whitespace shenanigans going on that
+ * have conjoined the comment to the rest of the key. We do a partial
+ * read in this case to try to make the best out of a sorry situation.
+ */
+ var key;
+ var ret = {};
+ if (m[4]) {
+ try {
+ key = rfc4253.read(kbuf);
+
+ } catch (e) {
+ m = trimmed.match(SSHKEY_RE2);
+ assert.ok(m, 'key must match regex');
+ kbuf = new Buffer(m[2], 'base64');
+ key = rfc4253.readInternal(ret, 'public', kbuf);
+ }
+ } else {
+ key = rfc4253.readInternal(ret, 'public', kbuf);
+ }
+
+ assert.strictEqual(type, key.type);
+
+ if (m[4] && m[4].length > 0) {
+ key.comment = m[4];
+
+ } else if (ret.consumed) {
+ /*
+ * Now the magic: trying to recover the key comment when it's
+ * gotten conjoined to the key or otherwise shenanigan'd.
+ *
+ * Work out how much base64 we used, then drop all non-base64
+ * chars from the beginning up to this point in the the string.
+ * Then offset in this and try to make up for missing = chars.
+ */
+ var data = m[2] + m[3];
+ var realOffset = Math.ceil(ret.consumed / 3) * 4;
+ data = data.slice(0, realOffset - 2). /*JSSTYLED*/
+ replace(/[^a-zA-Z0-9+\/=]/g, '') +
+ data.slice(realOffset - 2);
+
+ var padding = ret.consumed % 3;
+ if (padding > 0 &&
+ data.slice(realOffset - 1, realOffset) !== '=')
+ realOffset--;
+ while (data.slice(realOffset, realOffset + 1) === '=')
+ realOffset++;
+
+ /* Finally, grab what we think is the comment & clean it up. */
+ var trailer = data.slice(realOffset);
+ trailer = trailer.replace(/[\r\n]/g, ' ').
+ replace(/^\s+/, '');
+ if (trailer.match(/^[a-zA-Z0-9]/))
+ key.comment = trailer;
+ }
+
+ return (key);
+}
+
+function write(key) {
+ assert.object(key);
+ if (!Key.isKey(key))
+ throw (new Error('Must be a public key'));
+
+ var parts = [];
+ var alg = rfc4253.keyTypeToAlg(key);
+ parts.push(alg);
+
+ var buf = rfc4253.write(key);
+ parts.push(buf.toString('base64'));
+
+ if (key.comment)
+ parts.push(key.comment);
+
+ return (new Buffer(parts.join(' ')));
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/index.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/index.js
new file mode 100644
index 000000000..5cd962b31
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/index.js
@@ -0,0 +1,25 @@
+// Copyright 2015 Joyent, Inc.
+
+var Key = require('./key');
+var Fingerprint = require('./fingerprint');
+var Signature = require('./signature');
+var PrivateKey = require('./private-key');
+var errs = require('./errors');
+
+module.exports = {
+ /* top-level classes */
+ Key: Key,
+ parseKey: Key.parse,
+ Fingerprint: Fingerprint,
+ parseFingerprint: Fingerprint.parse,
+ Signature: Signature,
+ parseSignature: Signature.parse,
+ PrivateKey: PrivateKey,
+ parsePrivateKey: PrivateKey.parse,
+
+ /* errors */
+ FingerprintFormatError: errs.FingerprintFormatError,
+ InvalidAlgorithmError: errs.InvalidAlgorithmError,
+ KeyParseError: errs.KeyParseError,
+ SignatureParseError: errs.SignatureParseError
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/key.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/key.js
new file mode 100644
index 000000000..0a841b962
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/key.js
@@ -0,0 +1,260 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = Key;
+
+var assert = require('assert-plus');
+var algs = require('./algs');
+var crypto = require('crypto');
+var Fingerprint = require('./fingerprint');
+var Signature = require('./signature');
+var DiffieHellman = require('./dhe');
+var errs = require('./errors');
+var utils = require('./utils');
+var PrivateKey = require('./private-key');
+var edCompat;
+
+try {
+ edCompat = require('./ed-compat');
+} catch (e) {
+ /* Just continue through, and bail out if we try to use it. */
+}
+
+var InvalidAlgorithmError = errs.InvalidAlgorithmError;
+var KeyParseError = errs.KeyParseError;
+
+var formats = {};
+formats['auto'] = require('./formats/auto');
+formats['pem'] = require('./formats/pem');
+formats['pkcs1'] = require('./formats/pkcs1');
+formats['pkcs8'] = require('./formats/pkcs8');
+formats['rfc4253'] = require('./formats/rfc4253');
+formats['ssh'] = require('./formats/ssh');
+formats['ssh-private'] = require('./formats/ssh-private');
+formats['openssh'] = formats['ssh-private'];
+
+function Key(opts) {
+ assert.object(opts, 'options');
+ assert.arrayOfObject(opts.parts, 'options.parts');
+ assert.string(opts.type, 'options.type');
+ assert.optionalString(opts.comment, 'options.comment');
+
+ var algInfo = algs.info[opts.type];
+ if (typeof (algInfo) !== 'object')
+ throw (new InvalidAlgorithmError(opts.type));
+
+ var partLookup = {};
+ for (var i = 0; i < opts.parts.length; ++i) {
+ var part = opts.parts[i];
+ partLookup[part.name] = part;
+ }
+
+ this.type = opts.type;
+ this.parts = opts.parts;
+ this.part = partLookup;
+ this.comment = undefined;
+ this.source = opts.source;
+
+ /* for speeding up hashing/fingerprint operations */
+ this._rfc4253Cache = opts._rfc4253Cache;
+ this._hashCache = {};
+
+ var sz;
+ this.curve = undefined;
+ if (this.type === 'ecdsa') {
+ var curve = this.part.curve.data.toString();
+ this.curve = curve;
+ sz = algs.curves[curve].size;
+ } else if (this.type === 'ed25519') {
+ sz = 256;
+ this.curve = 'curve25519';
+ } else {
+ var szPart = this.part[algInfo.sizePart];
+ sz = szPart.data.length;
+ sz = sz * 8 - utils.countZeros(szPart.data);
+ }
+ this.size = sz;
+}
+
+Key.formats = formats;
+
+Key.prototype.toBuffer = function (format) {
+ if (format === undefined)
+ format = 'ssh';
+ assert.string(format, 'format');
+ assert.object(formats[format], 'formats[format]');
+
+ if (format === 'rfc4253') {
+ if (this._rfc4253Cache === undefined)
+ this._rfc4253Cache = formats['rfc4253'].write(this);
+ return (this._rfc4253Cache);
+ }
+
+ return (formats[format].write(this));
+};
+
+Key.prototype.toString = function (format) {
+ return (this.toBuffer(format).toString());
+};
+
+Key.prototype.hash = function (algo) {
+ assert.string(algo, 'algorithm');
+ algo = algo.toLowerCase();
+ if (algs.hashAlgs[algo] === undefined)
+ throw (new InvalidAlgorithmError(algo));
+
+ if (this._hashCache[algo])
+ return (this._hashCache[algo]);
+
+ var hash = crypto.createHash(algo).
+ update(this.toBuffer('rfc4253')).digest();
+ /* Workaround for node 0.8 */
+ if (typeof (hash) === 'string')
+ hash = new Buffer(hash, 'binary');
+ this._hashCache[algo] = hash;
+ return (hash);
+};
+
+Key.prototype.fingerprint = function (algo) {
+ if (algo === undefined)
+ algo = 'sha256';
+ assert.string(algo, 'algorithm');
+ var opts = {
+ hash: this.hash(algo),
+ algorithm: algo
+ };
+ return (new Fingerprint(opts));
+};
+
+Key.prototype.defaultHashAlgorithm = function () {
+ var hashAlgo = 'sha1';
+ if (this.type === 'rsa')
+ hashAlgo = 'sha256';
+ if (this.type === 'dsa' && this.size > 1024)
+ hashAlgo = 'sha256';
+ if (this.type === 'ed25519')
+ hashAlgo = 'sha512';
+ if (this.type === 'ecdsa') {
+ if (this.size <= 256)
+ hashAlgo = 'sha256';
+ else if (this.size <= 384)
+ hashAlgo = 'sha384';
+ else
+ hashAlgo = 'sha512';
+ }
+ return (hashAlgo);
+};
+
+Key.prototype.createVerify = function (hashAlgo) {
+ if (hashAlgo === undefined)
+ hashAlgo = this.defaultHashAlgorithm();
+ assert.string(hashAlgo, 'hash algorithm');
+
+ /* ED25519 is not supported by OpenSSL, use a javascript impl. */
+ if (this.type === 'ed25519' && edCompat !== undefined)
+ return (new edCompat.Verifier(this, hashAlgo));
+ if (this.type === 'curve25519')
+ throw (new Error('Curve25519 keys are not suitable for ' +
+ 'signing or verification'));
+
+ var v, nm, err;
+ try {
+ nm = this.type.toUpperCase() + '-';
+ if (this.type === 'ecdsa')
+ nm = 'ecdsa-with-';
+ nm += hashAlgo.toUpperCase();
+ v = crypto.createVerify(nm);
+ } catch (e) {
+ err = e;
+ }
+ if (v === undefined || (err instanceof Error &&
+ err.message.match(/Unknown message digest/))) {
+ nm = 'RSA-';
+ nm += hashAlgo.toUpperCase();
+ v = crypto.createVerify(nm);
+ }
+ assert.ok(v, 'failed to create verifier');
+ var oldVerify = v.verify.bind(v);
+ var key = this.toBuffer('pkcs8');
+ v.verify = function (signature, fmt) {
+ if (Signature.isSignature(signature, [2, 0])) {
+ return (oldVerify(key, signature.toBuffer('asn1')));
+
+ } else if (typeof (signature) === 'string' ||
+ Buffer.isBuffer(signature)) {
+ return (oldVerify(key, signature, fmt));
+
+ /*
+ * Avoid doing this on valid arguments, walking the prototype
+ * chain can be quite slow.
+ */
+ } else if (Signature.isSignature(signature, [1, 0])) {
+ throw (new Error('signature was created by too old ' +
+ 'a version of sshpk and cannot be verified'));
+
+ } else {
+ throw (new TypeError('signature must be a string, ' +
+ 'Buffer, or Signature object'));
+ }
+ };
+ return (v);
+};
+
+Key.prototype.createDiffieHellman = function () {
+ if (this.type === 'rsa')
+ throw (new Error('RSA keys do not support Diffie-Hellman'));
+
+ return (new DiffieHellman(this));
+};
+Key.prototype.createDH = Key.prototype.createDiffieHellman;
+
+Key.parse = function (data, format, name) {
+ if (typeof (data) !== 'string')
+ assert.buffer(data, 'data');
+ if (format === undefined)
+ format = 'auto';
+ assert.string(format, 'format');
+ if (name === undefined)
+ name = '(unnamed)';
+
+ assert.object(formats[format], 'formats[format]');
+
+ try {
+ var k = formats[format].read(data);
+ if (k instanceof PrivateKey)
+ k = k.toPublic();
+ if (!k.comment)
+ k.comment = name;
+ return (k);
+ } catch (e) {
+ throw (new KeyParseError(name, format, e));
+ }
+};
+
+Key.isKey = function (obj, ver) {
+ return (utils.isCompatible(obj, Key, ver));
+};
+
+/*
+ * API versions for Key:
+ * [1,0] -- initial ver, may take Signature for createVerify or may not
+ * [1,1] -- added pkcs1, pkcs8 formats
+ * [1,2] -- added auto, ssh-private, openssh formats
+ * [1,3] -- added defaultHashAlgorithm
+ * [1,4] -- added ed support, createDH
+ * [1,5] -- first explicitly tagged version
+ */
+Key.prototype._sshpkApiVersion = [1, 5];
+
+Key._oldVersionDetect = function (obj) {
+ assert.func(obj.toBuffer);
+ assert.func(obj.fingerprint);
+ if (obj.createDH)
+ return ([1, 4]);
+ if (obj.defaultHashAlgorithm)
+ return ([1, 3]);
+ if (obj.formats['auto'])
+ return ([1, 2]);
+ if (obj.formats['pkcs1'])
+ return ([1, 1]);
+ return ([1, 0]);
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/private-key.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/private-key.js
new file mode 100644
index 000000000..993ae3265
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/private-key.js
@@ -0,0 +1,224 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = PrivateKey;
+
+var assert = require('assert-plus');
+var algs = require('./algs');
+var crypto = require('crypto');
+var Fingerprint = require('./fingerprint');
+var Signature = require('./signature');
+var errs = require('./errors');
+var util = require('util');
+var utils = require('./utils');
+var edCompat;
+var ed;
+
+try {
+ edCompat = require('./ed-compat');
+} catch (e) {
+ /* Just continue through, and bail out if we try to use it. */
+}
+
+var Key = require('./key');
+
+var InvalidAlgorithmError = errs.InvalidAlgorithmError;
+var KeyParseError = errs.KeyParseError;
+
+var formats = {};
+formats['auto'] = require('./formats/auto');
+formats['pem'] = require('./formats/pem');
+formats['pkcs1'] = require('./formats/pkcs1');
+formats['pkcs8'] = require('./formats/pkcs8');
+formats['rfc4253'] = require('./formats/rfc4253');
+formats['ssh-private'] = require('./formats/ssh-private');
+formats['openssh'] = formats['ssh-private'];
+formats['ssh'] = formats['ssh-private'];
+
+function PrivateKey(opts) {
+ assert.object(opts, 'options');
+ Key.call(this, opts);
+
+ this._pubCache = undefined;
+}
+util.inherits(PrivateKey, Key);
+
+PrivateKey.formats = formats;
+
+PrivateKey.prototype.toBuffer = function (format) {
+ if (format === undefined)
+ format = 'pkcs1';
+ assert.string(format, 'format');
+ assert.object(formats[format], 'formats[format]');
+
+ return (formats[format].write(this));
+};
+
+PrivateKey.prototype.hash = function (algo) {
+ return (this.toPublic().hash(algo));
+};
+
+PrivateKey.prototype.toPublic = function () {
+ if (this._pubCache)
+ return (this._pubCache);
+
+ var algInfo = algs.info[this.type];
+ var pubParts = [];
+ for (var i = 0; i < algInfo.parts.length; ++i) {
+ var p = algInfo.parts[i];
+ pubParts.push(this.part[p]);
+ }
+
+ this._pubCache = new Key({
+ type: this.type,
+ source: this,
+ parts: pubParts
+ });
+ if (this.comment)
+ this._pubCache.comment = this.comment;
+ return (this._pubCache);
+};
+
+PrivateKey.prototype.derive = function (newType, newSize) {
+ assert.string(newType, 'type');
+ assert.optionalNumber(newSize, 'size');
+ var priv, pub;
+
+ if (this.type === 'ed25519' && newType === 'curve25519') {
+ if (ed === undefined)
+ ed = require('jodid25519');
+
+ priv = this.part.r.data;
+ if (priv[0] === 0x00)
+ priv = priv.slice(1);
+ priv = priv.slice(0, 32);
+
+ pub = ed.dh.publicKey(priv);
+ priv = utils.mpNormalize(Buffer.concat([priv, pub]));
+
+ return (new PrivateKey({
+ type: 'curve25519',
+ parts: [
+ { name: 'R', data: utils.mpNormalize(pub) },
+ { name: 'r', data: priv }
+ ]
+ }));
+ } else if (this.type === 'curve25519' && newType === 'ed25519') {
+ if (ed === undefined)
+ ed = require('jodid25519');
+
+ priv = this.part.r.data;
+ if (priv[0] === 0x00)
+ priv = priv.slice(1);
+ priv = priv.slice(0, 32);
+
+ pub = ed.eddsa.publicKey(priv.toString('binary'));
+ pub = new Buffer(pub, 'binary');
+
+ priv = utils.mpNormalize(Buffer.concat([priv, pub]));
+
+ return (new PrivateKey({
+ type: 'ed25519',
+ parts: [
+ { name: 'R', data: utils.mpNormalize(pub) },
+ { name: 'r', data: priv }
+ ]
+ }));
+ }
+ throw (new Error('Key derivation not supported from ' + this.type +
+ ' to ' + newType));
+};
+
+PrivateKey.prototype.createVerify = function (hashAlgo) {
+ return (this.toPublic().createVerify(hashAlgo));
+};
+
+PrivateKey.prototype.createSign = function (hashAlgo) {
+ if (hashAlgo === undefined)
+ hashAlgo = this.defaultHashAlgorithm();
+ assert.string(hashAlgo, 'hash algorithm');
+
+ /* ED25519 is not supported by OpenSSL, use a javascript impl. */
+ if (this.type === 'ed25519' && edCompat !== undefined)
+ return (new edCompat.Signer(this, hashAlgo));
+ if (this.type === 'curve25519')
+ throw (new Error('Curve25519 keys are not suitable for ' +
+ 'signing or verification'));
+
+ var v, nm, err;
+ try {
+ nm = this.type.toUpperCase() + '-';
+ if (this.type === 'ecdsa')
+ nm = 'ecdsa-with-';
+ nm += hashAlgo.toUpperCase();
+ v = crypto.createSign(nm);
+ } catch (e) {
+ err = e;
+ }
+ if (v === undefined || (err instanceof Error &&
+ err.message.match(/Unknown message digest/))) {
+ nm = 'RSA-';
+ nm += hashAlgo.toUpperCase();
+ v = crypto.createSign(nm);
+ }
+ assert.ok(v, 'failed to create verifier');
+ var oldSign = v.sign.bind(v);
+ var key = this.toBuffer('pkcs1');
+ var type = this.type;
+ v.sign = function () {
+ var sig = oldSign(key);
+ if (typeof (sig) === 'string')
+ sig = new Buffer(sig, 'binary');
+ sig = Signature.parse(sig, type, 'asn1');
+ sig.hashAlgorithm = hashAlgo;
+ return (sig);
+ };
+ return (v);
+};
+
+PrivateKey.parse = function (data, format, name) {
+ if (typeof (data) !== 'string')
+ assert.buffer(data, 'data');
+ if (format === undefined)
+ format = 'auto';
+ assert.string(format, 'format');
+ if (name === undefined)
+ name = '(unnamed)';
+
+ assert.object(formats[format], 'formats[format]');
+
+ try {
+ var k = formats[format].read(data);
+ assert.ok(k instanceof PrivateKey, 'key is not a private key');
+ if (!k.comment)
+ k.comment = name;
+ return (k);
+ } catch (e) {
+ throw (new KeyParseError(name, format, e));
+ }
+};
+
+PrivateKey.isPrivateKey = function (obj, ver) {
+ return (utils.isCompatible(obj, PrivateKey, ver));
+};
+
+/*
+ * API versions for PrivateKey:
+ * [1,0] -- initial ver
+ * [1,1] -- added auto, pkcs[18], openssh/ssh-private formats
+ * [1,2] -- added defaultHashAlgorithm
+ * [1,3] -- added derive, ed, createDH
+ * [1,4] -- first tagged version
+ */
+PrivateKey.prototype._sshpkApiVersion = [1, 4];
+
+PrivateKey._oldVersionDetect = function (obj) {
+ assert.func(obj.toPublic);
+ assert.func(obj.createSign);
+ if (obj.derive)
+ return ([1, 3]);
+ if (obj.defaultHashAlgorithm)
+ return ([1, 2]);
+ if (obj.formats['auto'])
+ return ([1, 1]);
+ return ([1, 0]);
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/signature.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/signature.js
new file mode 100644
index 000000000..ddf4a8c98
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/signature.js
@@ -0,0 +1,237 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = Signature;
+
+var assert = require('assert-plus');
+var algs = require('./algs');
+var crypto = require('crypto');
+var errs = require('./errors');
+var utils = require('./utils');
+var asn1 = require('asn1');
+var SSHBuffer = require('./ssh-buffer');
+
+var InvalidAlgorithmError = errs.InvalidAlgorithmError;
+var SignatureParseError = errs.SignatureParseError;
+
+function Signature(opts) {
+ assert.object(opts, 'options');
+ assert.arrayOfObject(opts.parts, 'options.parts');
+ assert.string(opts.type, 'options.type');
+
+ var partLookup = {};
+ for (var i = 0; i < opts.parts.length; ++i) {
+ var part = opts.parts[i];
+ partLookup[part.name] = part;
+ }
+
+ this.type = opts.type;
+ this.hashAlgorithm = opts.hashAlgo;
+ this.parts = opts.parts;
+ this.part = partLookup;
+}
+
+Signature.prototype.toBuffer = function (format) {
+ if (format === undefined)
+ format = 'asn1';
+ assert.string(format, 'format');
+
+ var buf;
+
+ switch (this.type) {
+ case 'rsa':
+ case 'ed25519':
+ if (format === 'ssh') {
+ buf = new SSHBuffer({});
+ buf.writeString('ssh-' + this.type);
+ buf.writePart(this.part.sig);
+ return (buf.toBuffer());
+ } else {
+ return (this.part.sig.data);
+ }
+
+ case 'dsa':
+ case 'ecdsa':
+ var r, s;
+ if (format === 'asn1') {
+ var der = new asn1.BerWriter();
+ der.startSequence();
+ r = utils.mpNormalize(this.part.r.data);
+ s = utils.mpNormalize(this.part.s.data);
+ der.writeBuffer(r, asn1.Ber.Integer);
+ der.writeBuffer(s, asn1.Ber.Integer);
+ der.endSequence();
+ return (der.buffer);
+ } else if (format === 'ssh' && this.type === 'dsa') {
+ buf = new SSHBuffer({});
+ buf.writeString('ssh-dss');
+ r = this.part.r.data;
+ if (r[0] === 0x00)
+ r = r.slice(1);
+ s = this.part.s.data;
+ buf.writeBuffer(Buffer.concat([r, s]));
+ return (buf.toBuffer());
+ } else if (format === 'ssh' && this.type === 'ecdsa') {
+ var inner = new SSHBuffer({});
+ r = this.part.r;
+ if (r[0] === 0x00)
+ r = r.slice(1);
+ inner.writePart(r);
+ inner.writePart(this.part.s);
+
+ buf = new SSHBuffer({});
+ /* XXX: find a more proper way to do this? */
+ var curve;
+ var sz = this.part.r.data.length * 8;
+ if (sz === 256)
+ curve = 'nistp256';
+ else if (sz === 384)
+ curve = 'nistp384';
+ else if (sz === 528)
+ curve = 'nistp521';
+ buf.writeString('ecdsa-sha2-' + curve);
+ buf.writeBuffer(inner.toBuffer());
+ return (buf.toBuffer());
+ }
+ throw (new Error('Invalid signature format'));
+ default:
+ throw (new Error('Invalid signature data'));
+ }
+};
+
+Signature.prototype.toString = function (format) {
+ assert.optionalString(format, 'format');
+ return (this.toBuffer(format).toString('base64'));
+};
+
+Signature.parse = function (data, type, format) {
+ if (typeof (data) === 'string')
+ data = new Buffer(data, 'base64');
+ assert.buffer(data, 'data');
+ assert.string(format, 'format');
+ assert.string(type, 'type');
+
+ var opts = {};
+ opts.type = type.toLowerCase();
+ opts.parts = [];
+
+ try {
+ assert.ok(data.length > 0, 'signature must not be empty');
+ switch (opts.type) {
+ case 'rsa':
+ return (parseOneNum(data, type, format, opts,
+ 'ssh-rsa'));
+ case 'ed25519':
+ return (parseOneNum(data, type, format, opts,
+ 'ssh-ed25519'));
+
+ case 'dsa':
+ case 'ecdsa':
+ if (format === 'asn1')
+ return (parseDSAasn1(data, type, format, opts));
+ else if (opts.type === 'dsa')
+ return (parseDSA(data, type, format, opts));
+ else
+ return (parseECDSA(data, type, format, opts));
+
+ default:
+ throw (new InvalidAlgorithmError(type));
+ }
+
+ } catch (e) {
+ if (e instanceof InvalidAlgorithmError)
+ throw (e);
+ throw (new SignatureParseError(type, format, e));
+ }
+};
+
+function parseOneNum(data, type, format, opts, headType) {
+ if (format === 'ssh') {
+ try {
+ var buf = new SSHBuffer({buffer: data});
+ var head = buf.readString();
+ } catch (e) {
+ /* fall through */
+ }
+ if (head === headType) {
+ var sig = buf.readPart();
+ assert.ok(buf.atEnd(), 'extra trailing bytes');
+ sig.name = 'sig';
+ opts.parts.push(sig);
+ return (new Signature(opts));
+ }
+ }
+ opts.parts.push({name: 'sig', data: data});
+ return (new Signature(opts));
+}
+
+function parseDSAasn1(data, type, format, opts) {
+ var der = new asn1.BerReader(data);
+ der.readSequence();
+ var r = der.readString(asn1.Ber.Integer, true);
+ var s = der.readString(asn1.Ber.Integer, true);
+
+ opts.parts.push({name: 'r', data: utils.mpNormalize(r)});
+ opts.parts.push({name: 's', data: utils.mpNormalize(s)});
+
+ return (new Signature(opts));
+}
+
+function parseDSA(data, type, format, opts) {
+ if (data.length != 40) {
+ var buf = new SSHBuffer({buffer: data});
+ var d = buf.readBuffer();
+ if (d.toString('ascii') === 'ssh-dss')
+ d = buf.readBuffer();
+ assert.ok(buf.atEnd(), 'extra trailing bytes');
+ assert.strictEqual(d.length, 40, 'invalid inner length');
+ data = d;
+ }
+ opts.parts.push({name: 'r', data: data.slice(0, 20)});
+ opts.parts.push({name: 's', data: data.slice(20, 40)});
+ return (new Signature(opts));
+}
+
+function parseECDSA(data, type, format, opts) {
+ var buf = new SSHBuffer({buffer: data});
+
+ var r, s;
+ var inner = buf.readBuffer();
+ if (inner.toString('ascii').match(/^ecdsa-/)) {
+ inner = buf.readBuffer();
+ assert.ok(buf.atEnd(), 'extra trailing bytes on outer');
+ buf = new SSHBuffer({buffer: inner});
+ r = buf.readPart();
+ } else {
+ r = {data: inner};
+ }
+
+ s = buf.readPart();
+ assert.ok(buf.atEnd(), 'extra trailing bytes');
+
+ r.name = 'r';
+ s.name = 's';
+
+ opts.parts.push(r);
+ opts.parts.push(s);
+ return (new Signature(opts));
+}
+
+Signature.isSignature = function (obj, ver) {
+ return (utils.isCompatible(obj, Signature, ver));
+};
+
+/*
+ * API versions for Signature:
+ * [1,0] -- initial ver
+ * [2,0] -- support for rsa in full ssh format, compat with sshpk-agent
+ * hashAlgorithm property
+ * [2,1] -- first tagged version
+ */
+Signature.prototype._sshpkApiVersion = [2, 1];
+
+Signature._oldVersionDetect = function (obj) {
+ assert.func(obj.toBuffer);
+ if (obj.hasOwnProperty('hashAlgorithm'))
+ return ([2, 0]);
+ return ([1, 0]);
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js
new file mode 100644
index 000000000..c22c8a3f3
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js
@@ -0,0 +1,123 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = SSHBuffer;
+
+var assert = require('assert-plus');
+
+function SSHBuffer(opts) {
+ assert.object(opts, 'options');
+ if (opts.buffer !== undefined)
+ assert.buffer(opts.buffer, 'options.buffer');
+
+ this._size = opts.buffer ? opts.buffer.length : 1024;
+ this._buffer = opts.buffer || (new Buffer(this._size));
+ this._offset = 0;
+}
+
+SSHBuffer.prototype.toBuffer = function () {
+ return (this._buffer.slice(0, this._offset));
+};
+
+SSHBuffer.prototype.atEnd = function () {
+ return (this._offset >= this._buffer.length);
+};
+
+SSHBuffer.prototype.remainder = function () {
+ return (this._buffer.slice(this._offset));
+};
+
+SSHBuffer.prototype.skip = function (n) {
+ this._offset += n;
+};
+
+SSHBuffer.prototype.expand = function () {
+ this._size *= 2;
+ var buf = new Buffer(this._size);
+ this._buffer.copy(buf, 0);
+ this._buffer = buf;
+};
+
+SSHBuffer.prototype.readPart = function () {
+ return ({data: this.readBuffer()});
+};
+
+SSHBuffer.prototype.readBuffer = function () {
+ var len = this._buffer.readUInt32BE(this._offset);
+ this._offset += 4;
+ assert.ok(this._offset + len <= this._buffer.length,
+ 'length out of bounds at +0x' + this._offset.toString(16));
+ var buf = this._buffer.slice(this._offset, this._offset + len);
+ this._offset += len;
+ return (buf);
+};
+
+SSHBuffer.prototype.readString = function () {
+ return (this.readBuffer().toString());
+};
+
+SSHBuffer.prototype.readCString = function () {
+ var offset = this._offset;
+ while (offset < this._buffer.length &&
+ this._buffer[offset] !== 0x00)
+ offset++;
+ assert.ok(offset < this._buffer.length, 'c string does not terminate');
+ var str = this._buffer.slice(this._offset, offset).toString();
+ this._offset = offset + 1;
+ return (str);
+};
+
+SSHBuffer.prototype.readInt = function () {
+ var v = this._buffer.readUInt32BE(this._offset);
+ this._offset += 4;
+ return (v);
+};
+
+SSHBuffer.prototype.readChar = function () {
+ var v = this._buffer[this._offset++];
+ return (v);
+};
+
+SSHBuffer.prototype.writeBuffer = function (buf) {
+ while (this._offset + 4 + buf.length > this._size)
+ this.expand();
+ this._buffer.writeUInt32BE(buf.length, this._offset);
+ this._offset += 4;
+ buf.copy(this._buffer, this._offset);
+ this._offset += buf.length;
+};
+
+SSHBuffer.prototype.writeString = function (str) {
+ this.writeBuffer(new Buffer(str, 'utf8'));
+};
+
+SSHBuffer.prototype.writeCString = function (str) {
+ while (this._offset + 1 + str.length > this._size)
+ this.expand();
+ this._buffer.write(str, this._offset);
+ this._offset += str.length;
+ this._buffer[this._offset++] = 0;
+};
+
+SSHBuffer.prototype.writeInt = function (v) {
+ while (this._offset + 4 > this._size)
+ this.expand();
+ this._buffer.writeUInt32BE(v, this._offset);
+ this._offset += 4;
+};
+
+SSHBuffer.prototype.writeChar = function (v) {
+ while (this._offset + 1 > this._size)
+ this.expand();
+ this._buffer[this._offset++] = v;
+};
+
+SSHBuffer.prototype.writePart = function (p) {
+ this.writeBuffer(p.data);
+};
+
+SSHBuffer.prototype.write = function (buf) {
+ while (this._offset + buf.length > this._size)
+ this.expand();
+ buf.copy(this._buffer, this._offset);
+ this._offset += buf.length;
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js
new file mode 100644
index 000000000..34c22d31a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js
@@ -0,0 +1,207 @@
+// Copyright 2015 Joyent, Inc.
+
+module.exports = {
+ bufferSplit: bufferSplit,
+ addRSAMissing: addRSAMissing,
+ calculateDSAPublic: calculateDSAPublic,
+ mpNormalize: mpNormalize,
+ ecNormalize: ecNormalize,
+ countZeros: countZeros,
+ assertCompatible: assertCompatible,
+ isCompatible: isCompatible
+};
+
+var assert = require('assert-plus');
+var PrivateKey = require('./private-key');
+
+var MAX_CLASS_DEPTH = 3;
+
+function isCompatible(obj, klass, needVer) {
+ if (obj === null || typeof (obj) !== 'object')
+ return (false);
+ if (needVer === undefined)
+ needVer = klass.prototype._sshpkApiVersion;
+ if (obj instanceof klass &&
+ klass.prototype._sshpkApiVersion[0] == needVer[0])
+ return (true);
+ var proto = Object.getPrototypeOf(obj);
+ var depth = 0;
+ while (proto.constructor.name !== klass.name) {
+ proto = Object.getPrototypeOf(proto);
+ if (!proto || ++depth > MAX_CLASS_DEPTH)
+ return (false);
+ }
+ if (proto.constructor.name !== klass.name)
+ return (false);
+ var ver = proto._sshpkApiVersion;
+ if (ver === undefined)
+ ver = klass._oldVersionDetect(obj);
+ if (ver[0] != needVer[0] || ver[1] < needVer[1])
+ return (false);
+ return (true);
+}
+
+function assertCompatible(obj, klass, needVer, name) {
+ if (name === undefined)
+ name = 'object';
+ assert.ok(obj, name + ' must not be null');
+ assert.object(obj, name + ' must be an object');
+ if (needVer === undefined)
+ needVer = klass.prototype._sshpkApiVersion;
+ if (obj instanceof klass &&
+ klass.prototype._sshpkApiVersion[0] == needVer[0])
+ return;
+ var proto = Object.getPrototypeOf(obj);
+ var depth = 0;
+ while (proto.constructor.name !== klass.name) {
+ proto = Object.getPrototypeOf(proto);
+ assert.ok(proto && ++depth <= MAX_CLASS_DEPTH,
+ name + ' must be a ' + klass.name + ' instance');
+ }
+ assert.strictEqual(proto.constructor.name, klass.name,
+ name + ' must be a ' + klass.name + ' instance');
+ var ver = proto._sshpkApiVersion;
+ if (ver === undefined)
+ ver = klass._oldVersionDetect(obj);
+ assert.ok(ver[0] == needVer[0] && ver[1] >= needVer[1],
+ name + ' must be compatible with ' + klass.name + ' klass ' +
+ 'version ' + needVer[0] + '.' + needVer[1]);
+}
+
+/* Count leading zero bits on a buffer */
+function countZeros(buf) {
+ var o = 0, obit = 8;
+ while (o < buf.length) {
+ var mask = (1 << obit);
+ if ((buf[o] & mask) === mask)
+ break;
+ obit--;
+ if (obit < 0) {
+ o++;
+ obit = 8;
+ }
+ }
+ return (o*8 + (8 - obit) - 1);
+}
+
+function bufferSplit(buf, chr) {
+ assert.buffer(buf);
+ assert.string(chr);
+
+ var parts = [];
+ var lastPart = 0;
+ var matches = 0;
+ for (var i = 0; i < buf.length; ++i) {
+ if (buf[i] === chr.charCodeAt(matches))
+ ++matches;
+ else if (buf[i] === chr.charCodeAt(0))
+ matches = 1;
+ else
+ matches = 0;
+
+ if (matches >= chr.length) {
+ var newPart = i + 1;
+ parts.push(buf.slice(lastPart, newPart - matches));
+ lastPart = newPart;
+ matches = 0;
+ }
+ }
+ if (lastPart <= buf.length)
+ parts.push(buf.slice(lastPart, buf.length));
+
+ return (parts);
+}
+
+function ecNormalize(buf, addZero) {
+ assert.buffer(buf);
+ if (buf[0] === 0x00 && buf[1] === 0x04) {
+ if (addZero)
+ return (buf);
+ return (buf.slice(1));
+ } else if (buf[0] === 0x04) {
+ if (!addZero)
+ return (buf);
+ } else {
+ while (buf[0] === 0x00)
+ buf = buf.slice(1);
+ if (buf[0] === 0x02 || buf[0] === 0x03)
+ throw (new Error('Compressed elliptic curve points ' +
+ 'are not supported'));
+ if (buf[0] !== 0x04)
+ throw (new Error('Not a valid elliptic curve point'));
+ if (!addZero)
+ return (buf);
+ }
+ var b = new Buffer(buf.length + 1);
+ b[0] = 0x0;
+ buf.copy(b, 1);
+ return (b);
+}
+
+function mpNormalize(buf) {
+ assert.buffer(buf);
+ while (buf.length > 1 && buf[0] === 0x00 && (buf[1] & 0x80) === 0x00)
+ buf = buf.slice(1);
+ if ((buf[0] & 0x80) === 0x80) {
+ var b = new Buffer(buf.length + 1);
+ b[0] = 0x00;
+ buf.copy(b, 1);
+ buf = b;
+ }
+ return (buf);
+}
+
+function bigintToMpBuf(bigint) {
+ var buf = new Buffer(bigint.toByteArray());
+ buf = mpNormalize(buf);
+ return (buf);
+}
+
+function calculateDSAPublic(g, p, x) {
+ assert.buffer(g);
+ assert.buffer(p);
+ assert.buffer(x);
+ try {
+ var bigInt = require('jsbn').BigInteger;
+ } catch (e) {
+ throw (new Error('To load a PKCS#8 format DSA private key, ' +
+ 'the node jsbn library is required.'));
+ }
+ g = new bigInt(g);
+ p = new bigInt(p);
+ x = new bigInt(x);
+ var y = g.modPow(x, p);
+ var ybuf = bigintToMpBuf(y);
+ return (ybuf);
+}
+
+function addRSAMissing(key) {
+ assert.object(key);
+ assertCompatible(key, PrivateKey, [1, 1]);
+ try {
+ var bigInt = require('jsbn').BigInteger;
+ } catch (e) {
+ throw (new Error('To write a PEM private key from ' +
+ 'this source, the node jsbn lib is required.'));
+ }
+
+ var d = new bigInt(key.part.d.data);
+ var buf;
+
+ if (!key.part.dmodp) {
+ var p = new bigInt(key.part.p.data);
+ var dmodp = d.mod(p.subtract(1));
+
+ buf = bigintToMpBuf(dmodp);
+ key.part.dmodp = {name: 'dmodp', data: buf};
+ key.parts.push(key.part.dmodp);
+ }
+ if (!key.part.dmodq) {
+ var q = new bigInt(key.part.q.data);
+ var dmodq = d.mod(q.subtract(1));
+
+ buf = bigintToMpBuf(dmodq);
+ key.part.dmodq = {name: 'dmodq', data: buf};
+ key.parts.push(key.part.dmodq);
+ }
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.npmignore
index eb03e3e1e..eb03e3e1e 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.npmignore
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.travis.yml b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.travis.yml
new file mode 100644
index 000000000..09d3ef378
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.8
+ - 0.10
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/LICENSE
index 9b5dcdb7f..9b5dcdb7f 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/LICENSE
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/README.md
index 7cebf7a2e..7cebf7a2e 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/README.md
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/errors.js
index ff21d4fab..ff21d4fab 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/errors.js
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/index.js
index 4fb90aea9..4fb90aea9 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/index.js
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/reader.js
index bd3357a67..0a00e98e3 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/reader.js
@@ -24,18 +24,26 @@ function Reader(data) {
// These hold the "current" state
this._len = 0;
this._offset = 0;
-
- var self = this;
- this.__defineGetter__('length', function() { return self._len; });
- this.__defineGetter__('offset', function() { return self._offset; });
- this.__defineGetter__('remain', function() {
- return self._size - self._offset;
- });
- this.__defineGetter__('buffer', function() {
- return self._buf.slice(self._offset);
- });
}
+Object.defineProperty(Reader.prototype, 'length', {
+ enumerable: true,
+ get: function () { return (this._len); }
+});
+
+Object.defineProperty(Reader.prototype, 'offset', {
+ enumerable: true,
+ get: function () { return (this._offset); }
+});
+
+Object.defineProperty(Reader.prototype, 'remain', {
+ get: function () { return (this._size - this._offset); }
+});
+
+Object.defineProperty(Reader.prototype, 'buffer', {
+ get: function () { return (this._buf.slice(this._offset)); }
+});
+
/**
* Reads a single byte and advances offset; you can pass in `true` to make this
@@ -171,7 +179,7 @@ Reader.prototype.readString = function(tag, retbuf) {
this._offset = o;
if (this.length === 0)
- return '';
+ return retbuf ? new Buffer(0) : '';
var str = this._buf.slice(this._offset, this._offset + this.length);
this._offset += this.length;
@@ -183,28 +191,15 @@ Reader.prototype.readOID = function(tag) {
if (!tag)
tag = ASN1.OID;
- var b = this.peek();
+ var b = this.readString(tag, true);
if (b === null)
return null;
- if (b !== tag)
- throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
- ': got 0x' + b.toString(16));
-
- var o = this.readLength(this._offset + 1); // stored in `length`
- if (o === null)
- return null;
-
- if (this.length > this._size - o)
- return null;
-
- this._offset = o;
-
var values = [];
var value = 0;
- for (var i = 0; i < this.length; i++) {
- var byte = this._buf[this._offset++] & 0xff;
+ for (var i = 0; i < b.length; i++) {
+ var byte = b[i] & 0xff;
value <<= 7;
value += byte & 0x7f;
@@ -245,19 +240,18 @@ Reader.prototype._readTag = function(tag) {
return null;
this._offset = o;
- var fb = this._buf[this._offset++];
+ var fb = this._buf[this._offset];
var value = 0;
- value = fb & 0x7F;
- for (var i = 1; i < this.length; i++) {
+ for (var i = 0; i < this.length; i++) {
value <<= 8;
value |= (this._buf[this._offset++] & 0xff);
}
- if ((fb & 0x80) == 0x80)
- value = -value;
+ if ((fb & 0x80) == 0x80 && i !== 4)
+ value -= (1 << (i * 8));
- return value;
+ return value >> 0;
};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/types.js
index 8aea00013..8aea00013 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/types.js
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/writer.js
index 7b445cc60..d9d99af68 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/writer.js
@@ -50,16 +50,16 @@ function Writer(options) {
// A list of offsets in the buffer where we need to insert
// sequence tag/len pairs.
this._seq = [];
-
- var self = this;
- this.__defineGetter__('buffer', function() {
- if (self._seq.length)
- throw new InvalidAsn1Error(self._seq.length + ' unended sequence(s)');
-
- return self._buf.slice(0, self._offset);
- });
}
+Object.defineProperty(Writer.prototype, 'buffer', {
+ get: function () {
+ if (this._seq.length)
+ throw new InvalidAsn1Error(this._seq.length + ' unended sequence(s)');
+
+ return (this._buf.slice(0, this._offset));
+ }
+});
Writer.prototype.writeByte = function(b) {
if (typeof(b) !== 'number')
@@ -78,7 +78,7 @@ Writer.prototype.writeInt = function(i, tag) {
var sz = 4;
- while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000)) &&
+ while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000 >> 0)) &&
(sz > 1)) {
sz--;
i <<= 8;
@@ -92,7 +92,7 @@ Writer.prototype.writeInt = function(i, tag) {
this._buf[this._offset++] = sz;
while (sz-- > 0) {
- this._buf[this._offset++] = ((i & 0xff000000) >> 24);
+ this._buf[this._offset++] = ((i & 0xff000000) >>> 24);
i <<= 8;
}
@@ -236,7 +236,6 @@ Writer.prototype.writeLength = function(len) {
this._buf[this._offset++] = len >> 8;
this._buf[this._offset++] = len;
} else if (len <= 0xffffff) {
- this._shift(start, len, 1);
this._buf[this._offset++] = 0x83;
this._buf[this._offset++] = len >> 16;
this._buf[this._offset++] = len >> 8;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/index.js
index d1766e7a6..d1766e7a6 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/index.js
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/package.json
new file mode 100644
index 000000000..9d3b1f7ec
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/package.json
@@ -0,0 +1,90 @@
+{
+ "_args": [
+ [
+ "asn1@>=0.2.3 <0.3.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk"
+ ]
+ ],
+ "_from": "asn1@>=0.2.3 <0.3.0",
+ "_id": "asn1@0.2.3",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/asn1",
+ "_npmUser": {
+ "email": "patrick.f.mooney@gmail.com",
+ "name": "pfmooney"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "asn1",
+ "raw": "asn1@>=0.2.3 <0.3.0",
+ "rawSpec": ">=0.2.3 <0.3.0",
+ "scope": null,
+ "spec": ">=0.2.3 <0.3.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk"
+ ],
+ "_resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
+ "_shasum": "dac8787713c9966849fc8180777ebe9c1ddf3b86",
+ "_shrinkwrap": null,
+ "_spec": "asn1@>=0.2.3 <0.3.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk",
+ "author": {
+ "email": "mcavage@gmail.com",
+ "name": "Mark Cavage"
+ },
+ "bugs": {
+ "url": "https://github.com/mcavage/node-asn1/issues"
+ },
+ "contributors": [
+ {
+ "name": "David Gwynne",
+ "email": "loki@animata.net"
+ },
+ {
+ "name": "Yunong Xiao",
+ "email": "yunong@joyent.com"
+ },
+ {
+ "name": "Alex Wilson",
+ "email": "alex.wilson@joyent.com"
+ }
+ ],
+ "dependencies": {},
+ "description": "Contains parsers and serializers for ASN.1 (currently BER only)",
+ "devDependencies": {
+ "tap": "0.4.8"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "dac8787713c9966849fc8180777ebe9c1ddf3b86",
+ "tarball": "http://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz"
+ },
+ "homepage": "https://github.com/mcavage/node-asn1",
+ "license": "MIT",
+ "main": "lib/index.js",
+ "maintainers": [
+ {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ },
+ {
+ "name": "pfmooney",
+ "email": "patrick.f.mooney@gmail.com"
+ }
+ ],
+ "name": "asn1",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mcavage/node-asn1.git"
+ },
+ "scripts": {
+ "test": "tap ./tst"
+ },
+ "version": "0.2.3"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/reader.test.js
index 0b78b474f..062fd7ee3 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/reader.test.js
@@ -69,6 +69,42 @@ test('read 4 byte int', function(t) {
});
+test('read 1 byte negative int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x01, 0xdc]));
+ t.ok(reader);
+ t.equal(reader.readInt(), -36, 'wrong value');
+ t.equal(reader.length, 0x01, 'wrong length');
+ t.end();
+});
+
+
+test('read 2 byte negative int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x02, 0xc0, 0x4e]));
+ t.ok(reader);
+ t.equal(reader.readInt(), -16306, 'wrong value');
+ t.equal(reader.length, 0x02, 'wrong length');
+ t.end();
+});
+
+
+test('read 3 byte negative int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x03, 0xff, 0x00, 0x19]));
+ t.ok(reader);
+ t.equal(reader.readInt(), -65511, 'wrong value');
+ t.equal(reader.length, 0x03, 'wrong length');
+ t.end();
+});
+
+
+test('read 4 byte negative int', function(t) {
+ var reader = new BerReader(new Buffer([0x02, 0x04, 0x91, 0x7c, 0x22, 0x1f]));
+ t.ok(reader);
+ t.equal(reader.readInt(), -1854135777, 'wrong value');
+ t.equal(reader.length, 0x04, 'wrong length');
+ t.end();
+});
+
+
test('read boolean true', function(t) {
var reader = new BerReader(new Buffer([0x01, 0x01, 0xff]));
t.ok(reader);
diff --git a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/writer.test.js
index add0b9fd3..d87cb7bc9 100644
--- a/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/writer.test.js
@@ -105,6 +105,80 @@ test('write 4 byte int', function(t) {
});
+test('write 1 byte negative int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(-128);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+
+ t.equal(ber.length, 3, 'Wrong length for an int');
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+ t.equal(ber[1], 0x01, 'length wrong');
+ t.equal(ber[2], 0x80, 'value wrong (byte 1)');
+
+ t.end();
+});
+
+
+test('write 2 byte negative int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(-22400);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+
+ t.equal(ber.length, 4, 'Wrong length for an int');
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+ t.equal(ber[1], 0x02, 'length wrong');
+ t.equal(ber[2], 0xa8, 'value wrong (byte 1)');
+ t.equal(ber[3], 0x80, 'value wrong (byte 2)');
+
+ t.end();
+});
+
+
+test('write 3 byte negative int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(-481653);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+
+ t.equal(ber.length, 5, 'Wrong length for an int');
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+ t.equal(ber[1], 0x03, 'length wrong');
+ t.equal(ber[2], 0xf8, 'value wrong (byte 1)');
+ t.equal(ber[3], 0xa6, 'value wrong (byte 2)');
+ t.equal(ber[4], 0x8b, 'value wrong (byte 3)');
+
+ t.end();
+});
+
+
+test('write 4 byte negative int', function(t) {
+ var writer = new BerWriter();
+
+ writer.writeInt(-1522904131);
+ var ber = writer.buffer;
+
+ t.ok(ber);
+
+ t.equal(ber.length, 6, 'Wrong length for an int');
+ t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+ t.equal(ber[1], 0x04, 'length wrong');
+ t.equal(ber[2], 0xa5, 'value wrong (byte 1)');
+ t.equal(ber[3], 0x3a, 'value wrong (byte 2)');
+ t.equal(ber[4], 0x53, 'value wrong (byte 3)');
+ t.equal(ber[5], 0xbd, 'value wrong (byte 4)');
+
+ t.end();
+});
+
+
test('write boolean', function(t) {
var writer = new BerWriter();
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/AUTHORS b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/AUTHORS
new file mode 100644
index 000000000..1923524fe
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/AUTHORS
@@ -0,0 +1,6 @@
+Dave Eddy <dave@daveeddy.com>
+Fred Kuo <fred.kuo@joyent.com>
+Lars-Magnus Skog <ralphtheninja@riseup.net>
+Mark Cavage <mcavage@gmail.com>
+Patrick Mooney <pmooney@pfmooney.com>
+Rob Gulewich <robert.gulewich@joyent.com>
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/CHANGES.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/CHANGES.md
new file mode 100644
index 000000000..d249d9b2a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/CHANGES.md
@@ -0,0 +1,8 @@
+# assert-plus Changelog
+
+## 0.2.0
+
+- Fix `assert.object(null)` so it throws
+- Fix optional/arrayOf exports for non-type-of asserts
+- Add optiona/arrayOf exports for Stream/Date/Regex/uuid
+- Add basic unit test coverage
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/README.md
new file mode 100644
index 000000000..0b39593ce
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/README.md
@@ -0,0 +1,155 @@
+# assert-plus
+
+This library is a super small wrapper over node's assert module that has two
+things: (1) the ability to disable assertions with the environment variable
+NODE\_NDEBUG, and (2) some API wrappers for argument testing. Like
+`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks
+like this:
+
+```javascript
+ var assert = require('assert-plus');
+
+ function fooAccount(options, callback) {
+ assert.object(options, 'options');
+ assert.number(options.id, 'options.id');
+ assert.bool(options.isManager, 'options.isManager');
+ assert.string(options.name, 'options.name');
+ assert.arrayOfString(options.email, 'options.email');
+ assert.func(callback, 'callback');
+
+ // Do stuff
+ callback(null, {});
+ }
+```
+
+# API
+
+All methods that *aren't* part of node's core assert API are simply assumed to
+take an argument, and then a string 'name' that's not a message; `AssertionError`
+will be thrown if the assertion fails with a message like:
+
+ AssertionError: foo (string) is required
+ at test (/home/mark/work/foo/foo.js:3:9)
+ at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)
+ at Module._compile (module.js:446:26)
+ at Object..js (module.js:464:10)
+ at Module.load (module.js:353:31)
+ at Function._load (module.js:311:12)
+ at Array.0 (module.js:484:10)
+ at EventEmitter._tickCallback (node.js:190:38)
+
+from:
+
+```javascript
+ function test(foo) {
+ assert.string(foo, 'foo');
+ }
+```
+
+There you go. You can check that arrays are of a homogeneous type with `Arrayof$Type`:
+
+```javascript
+ function test(foo) {
+ assert.arrayOfString(foo, 'foo');
+ }
+```
+
+You can assert IFF an argument is not `undefined` (i.e., an optional arg):
+
+```javascript
+ assert.optionalString(foo, 'foo');
+```
+
+Lastly, you can opt-out of assertion checking altogether by setting the
+environment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have
+lots of assertions, and don't want to pay `typeof ()` taxes to v8 in
+production. Be advised: The standard functions re-exported from `assert` are
+also disabled in assert-plus if NDEBUG is specified. Using them directly from
+the `assert` module avoids this behavior.
+
+The complete list of APIs is:
+
+* assert.array
+* assert.bool
+* assert.buffer
+* assert.func
+* assert.number
+* assert.object
+* assert.string
+* assert.stream
+* assert.date
+* assert.regex
+* assert.uuid
+* assert.arrayOfArray
+* assert.arrayOfBool
+* assert.arrayOfBuffer
+* assert.arrayOfFunc
+* assert.arrayOfNumber
+* assert.arrayOfObject
+* assert.arrayOfString
+* assert.arrayOfStream
+* assert.arrayOfDate
+* assert.arrayOfUuid
+* assert.optionalArray
+* assert.optionalBool
+* assert.optionalBuffer
+* assert.optionalFunc
+* assert.optionalNumber
+* assert.optionalObject
+* assert.optionalString
+* assert.optionalStream
+* assert.optionalDate
+* assert.optionalUuid
+* assert.optionalArrayOfArray
+* assert.optionalArrayOfBool
+* assert.optionalArrayOfBuffer
+* assert.optionalArrayOfFunc
+* assert.optionalArrayOfNumber
+* assert.optionalArrayOfObject
+* assert.optionalArrayOfString
+* assert.optionalArrayOfStream
+* assert.optionalArrayOfDate
+* assert.optionalArrayOfUuid
+* assert.AssertionError
+* assert.fail
+* assert.ok
+* assert.equal
+* assert.notEqual
+* assert.deepEqual
+* assert.notDeepEqual
+* assert.strictEqual
+* assert.notStrictEqual
+* assert.throws
+* assert.doesNotThrow
+* assert.ifError
+
+# Installation
+
+ npm install assert-plus
+
+## License
+
+The MIT License (MIT)
+Copyright (c) 2012 Mark Cavage
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+## Bugs
+
+See <https://github.com/mcavage/node-assert-plus/issues>.
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/assert.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/assert.js
new file mode 100644
index 000000000..6bce4d8c6
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/assert.js
@@ -0,0 +1,206 @@
+// Copyright (c) 2012, Mark Cavage. All rights reserved.
+// Copyright 2015 Joyent, Inc.
+
+var assert = require('assert');
+var Stream = require('stream').Stream;
+var util = require('util');
+
+
+///--- Globals
+
+/* JSSTYLED */
+var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
+
+
+///--- Internal
+
+function _capitalize(str) {
+ return (str.charAt(0).toUpperCase() + str.slice(1));
+}
+
+function _toss(name, expected, oper, arg, actual) {
+ throw new assert.AssertionError({
+ message: util.format('%s (%s) is required', name, expected),
+ actual: (actual === undefined) ? typeof (arg) : actual(arg),
+ expected: expected,
+ operator: oper || '===',
+ stackStartFunction: _toss.caller
+ });
+}
+
+function _getClass(arg) {
+ return (Object.prototype.toString.call(arg).slice(8, -1));
+}
+
+function noop() {
+ // Why even bother with asserts?
+}
+
+
+///--- Exports
+
+var types = {
+ bool: {
+ check: function (arg) { return typeof (arg) === 'boolean'; }
+ },
+ func: {
+ check: function (arg) { return typeof (arg) === 'function'; }
+ },
+ string: {
+ check: function (arg) { return typeof (arg) === 'string'; }
+ },
+ object: {
+ check: function (arg) {
+ return typeof (arg) === 'object' && arg !== null;
+ }
+ },
+ number: {
+ check: function (arg) {
+ return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg);
+ }
+ },
+ buffer: {
+ check: function (arg) { return Buffer.isBuffer(arg); },
+ operator: 'Buffer.isBuffer'
+ },
+ array: {
+ check: function (arg) { return Array.isArray(arg); },
+ operator: 'Array.isArray'
+ },
+ stream: {
+ check: function (arg) { return arg instanceof Stream; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ date: {
+ check: function (arg) { return arg instanceof Date; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ regexp: {
+ check: function (arg) { return arg instanceof RegExp; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ uuid: {
+ check: function (arg) {
+ return typeof (arg) === 'string' && UUID_REGEXP.test(arg);
+ },
+ operator: 'isUUID'
+ }
+};
+
+function _setExports(ndebug) {
+ var keys = Object.keys(types);
+ var out;
+
+ /* re-export standard assert */
+ if (process.env.NODE_NDEBUG) {
+ out = noop;
+ } else {
+ out = function (arg, msg) {
+ if (!arg) {
+ _toss(msg, 'true', arg);
+ }
+ };
+ }
+
+ /* standard checks */
+ keys.forEach(function (k) {
+ if (ndebug) {
+ out[k] = noop;
+ return;
+ }
+ var type = types[k];
+ out[k] = function (arg, msg) {
+ if (!type.check(arg)) {
+ _toss(msg, k, type.operator, arg, type.actual);
+ }
+ };
+ });
+
+ /* optional checks */
+ keys.forEach(function (k) {
+ var name = 'optional' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ out[name] = function (arg, msg) {
+ if (arg === undefined || arg === null) {
+ return;
+ }
+ if (!type.check(arg)) {
+ _toss(msg, k, type.operator, arg, type.actual);
+ }
+ };
+ });
+
+ /* arrayOf checks */
+ keys.forEach(function (k) {
+ var name = 'arrayOf' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ var expected = '[' + k + ']';
+ out[name] = function (arg, msg) {
+ if (!Array.isArray(arg)) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ var i;
+ for (i = 0; i < arg.length; i++) {
+ if (!type.check(arg[i])) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ }
+ };
+ });
+
+ /* optionalArrayOf checks */
+ keys.forEach(function (k) {
+ var name = 'optionalArrayOf' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ var expected = '[' + k + ']';
+ out[name] = function (arg, msg) {
+ if (arg === undefined || arg === null) {
+ return;
+ }
+ if (!Array.isArray(arg)) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ var i;
+ for (i = 0; i < arg.length; i++) {
+ if (!type.check(arg[i])) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ }
+ };
+ });
+
+ /* re-export built-in assertions */
+ Object.keys(assert).forEach(function (k) {
+ if (k === 'AssertionError') {
+ out[k] = assert[k];
+ return;
+ }
+ if (ndebug) {
+ out[k] = noop;
+ return;
+ }
+ out[k] = assert[k];
+ });
+
+ /* export ourselves (for unit tests _only_) */
+ out._setExports = _setExports;
+
+ return out;
+}
+
+module.exports = _setExports(process.env.NODE_NDEBUG);
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/package.json
new file mode 100644
index 000000000..09597df69
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/package.json
@@ -0,0 +1,107 @@
+{
+ "_args": [
+ [
+ "assert-plus@>=0.2.0 <0.3.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk"
+ ]
+ ],
+ "_from": "assert-plus@>=0.2.0 <0.3.0",
+ "_id": "assert-plus@0.2.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/assert-plus",
+ "_nodeVersion": "0.10.36",
+ "_npmUser": {
+ "email": "patrick.f.mooney@gmail.com",
+ "name": "pfmooney"
+ },
+ "_npmVersion": "3.3.8",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "assert-plus",
+ "raw": "assert-plus@>=0.2.0 <0.3.0",
+ "rawSpec": ">=0.2.0 <0.3.0",
+ "scope": null,
+ "spec": ">=0.2.0 <0.3.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk"
+ ],
+ "_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
+ "_shasum": "d74e1b87e7affc0db8aadb7021f3fe48101ab234",
+ "_shrinkwrap": null,
+ "_spec": "assert-plus@>=0.2.0 <0.3.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk",
+ "author": {
+ "email": "mcavage@gmail.com",
+ "name": "Mark Cavage"
+ },
+ "bugs": {
+ "url": "https://github.com/mcavage/node-assert-plus/issues"
+ },
+ "contributors": [
+ {
+ "name": "Dave Eddy",
+ "email": "dave@daveeddy.com"
+ },
+ {
+ "name": "Fred Kuo",
+ "email": "fred.kuo@joyent.com"
+ },
+ {
+ "name": "Lars-Magnus Skog",
+ "email": "ralphtheninja@riseup.net"
+ },
+ {
+ "name": "Mark Cavage",
+ "email": "mcavage@gmail.com"
+ },
+ {
+ "name": "Patrick Mooney",
+ "email": "pmooney@pfmooney.com"
+ },
+ {
+ "name": "Rob Gulewich",
+ "email": "robert.gulewich@joyent.com"
+ }
+ ],
+ "dependencies": {},
+ "description": "Extra assertions on top of node's assert module",
+ "devDependencies": {
+ "faucet": "0.0.1",
+ "tape": "4.2.2"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "d74e1b87e7affc0db8aadb7021f3fe48101ab234",
+ "tarball": "http://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz"
+ },
+ "engines": {
+ "node": ">=0.8"
+ },
+ "homepage": "https://github.com/mcavage/node-assert-plus#readme",
+ "license": "MIT",
+ "main": "./assert.js",
+ "maintainers": [
+ {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ },
+ {
+ "name": "pfmooney",
+ "email": "patrick.f.mooney@gmail.com"
+ }
+ ],
+ "name": "assert-plus",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/mcavage/node-assert-plus.git"
+ },
+ "scripts": {
+ "test": "tape tests/*.js | ./node_modules/.bin/faucet"
+ },
+ "version": "0.2.0"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/README.md
new file mode 100644
index 000000000..fdbe5f42a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/README.md
@@ -0,0 +1,508 @@
+A light, featureful and explicit option parsing library for node.js.
+
+[Why another one? See below](#why). tl;dr: The others I've tried are one of
+too loosey goosey (not explicit), too big/too many deps, or ill specified.
+YMMV.
+
+Follow <a href="https://twitter.com/intent/user?screen_name=trentmick" target="_blank">@trentmick</a>
+for updates to node-dashdash.
+
+# Install
+
+ npm install dashdash
+
+
+# Usage
+
+```javascript
+var dashdash = require('dashdash');
+
+// Specify the options. Minimally `name` (or `names`) and `type`
+// must be given for each.
+var options = [
+ {
+ // `names` or a single `name`. First element is the `opts.KEY`.
+ names: ['help', 'h'],
+ // See "Option specs" below for types.
+ type: 'bool',
+ help: 'Print this help and exit.'
+ }
+];
+
+// Shortcut form. As called it infers `process.argv`. See below for
+// the longer form to use methods like `.help()` on the Parser object.
+var opts = dashdash.parse({options: options});
+
+console.log("opts:", opts);
+console.log("args:", opts._args);
+```
+
+
+# Longer Example
+
+A more realistic [starter script "foo.js"](./examples/foo.js) is as follows.
+This also shows using `parser.help()` for formatted option help.
+
+```javascript
+var dashdash = require('./lib/dashdash');
+
+var options = [
+ {
+ name: 'version',
+ type: 'bool',
+ help: 'Print tool version and exit.'
+ },
+ {
+ names: ['help', 'h'],
+ type: 'bool',
+ help: 'Print this help and exit.'
+ },
+ {
+ names: ['verbose', 'v'],
+ type: 'arrayOfBool',
+ help: 'Verbose output. Use multiple times for more verbose.'
+ },
+ {
+ names: ['file', 'f'],
+ type: 'string',
+ help: 'File to process',
+ helpArg: 'FILE'
+ }
+];
+
+var parser = dashdash.createParser({options: options});
+try {
+ var opts = parser.parse(process.argv);
+} catch (e) {
+ console.error('foo: error: %s', e.message);
+ process.exit(1);
+}
+
+console.log("# opts:", opts);
+console.log("# args:", opts._args);
+
+// Use `parser.help()` for formatted options help.
+if (opts.help) {
+ var help = parser.help({includeEnv: true}).trimRight();
+ console.log('usage: node foo.js [OPTIONS]\n'
+ + 'options:\n'
+ + help);
+ process.exit(0);
+}
+
+// ...
+```
+
+
+Some example output from this script (foo.js):
+
+```
+$ node foo.js -h
+# opts: { help: true,
+ _order: [ { name: 'help', value: true, from: 'argv' } ],
+ _args: [] }
+# args: []
+usage: node foo.js [OPTIONS]
+options:
+ --version Print tool version and exit.
+ -h, --help Print this help and exit.
+ -v, --verbose Verbose output. Use multiple times for more verbose.
+ -f FILE, --file=FILE File to process
+
+$ node foo.js -v
+# opts: { verbose: [ true ],
+ _order: [ { name: 'verbose', value: true, from: 'argv' } ],
+ _args: [] }
+# args: []
+
+$ node foo.js --version arg1
+# opts: { version: true,
+ _order: [ { name: 'version', value: true, from: 'argv' } ],
+ _args: [ 'arg1' ] }
+# args: [ 'arg1' ]
+
+$ node foo.js -f bar.txt
+# opts: { file: 'bar.txt',
+ _order: [ { name: 'file', value: 'bar.txt', from: 'argv' } ],
+ _args: [] }
+# args: []
+
+$ node foo.js -vvv --file=blah
+# opts: { verbose: [ true, true, true ],
+ file: 'blah',
+ _order:
+ [ { name: 'verbose', value: true, from: 'argv' },
+ { name: 'verbose', value: true, from: 'argv' },
+ { name: 'verbose', value: true, from: 'argv' },
+ { name: 'file', value: 'blah', from: 'argv' } ],
+ _args: [] }
+# args: []
+```
+
+
+See the ["examples"](examples/) dir for a number of starter examples using
+some of dashdash's features.
+
+
+# Environment variable integration
+
+If you want to allow environment variables to specify options to your tool,
+dashdash makes this easy. We can change the 'verbose' option in the example
+above to include an 'env' field:
+
+```javascript
+ {
+ names: ['verbose', 'v'],
+ type: 'arrayOfBool',
+ env: 'FOO_VERBOSE', // <--- add this line
+ help: 'Verbose output. Use multiple times for more verbose.'
+ },
+```
+
+then the **"FOO_VERBOSE" environment variable** can be used to set this
+option:
+
+```shell
+$ FOO_VERBOSE=1 node foo.js
+# opts: { verbose: [ true ],
+ _order: [ { name: 'verbose', value: true, from: 'env' } ],
+ _args: [] }
+# args: []
+```
+
+Boolean options will interpret the empty string as unset, '0' as false
+and anything else as true.
+
+```shell
+$ FOO_VERBOSE= node examples/foo.js # not set
+# opts: { _order: [], _args: [] }
+# args: []
+
+$ FOO_VERBOSE=0 node examples/foo.js # '0' is false
+# opts: { verbose: [ false ],
+ _order: [ { key: 'verbose', value: false, from: 'env' } ],
+ _args: [] }
+# args: []
+
+$ FOO_VERBOSE=1 node examples/foo.js # true
+# opts: { verbose: [ true ],
+ _order: [ { key: 'verbose', value: true, from: 'env' } ],
+ _args: [] }
+# args: []
+
+$ FOO_VERBOSE=boogabooga node examples/foo.js # true
+# opts: { verbose: [ true ],
+ _order: [ { key: 'verbose', value: true, from: 'env' } ],
+ _args: [] }
+# args: []
+```
+
+Non-booleans can be used as well. Strings:
+
+```shell
+$ FOO_FILE=data.txt node examples/foo.js
+# opts: { file: 'data.txt',
+ _order: [ { key: 'file', value: 'data.txt', from: 'env' } ],
+ _args: [] }
+# args: []
+```
+
+Numbers:
+
+```shell
+$ FOO_TIMEOUT=5000 node examples/foo.js
+# opts: { timeout: 5000,
+ _order: [ { key: 'timeout', value: 5000, from: 'env' } ],
+ _args: [] }
+# args: []
+
+$ FOO_TIMEOUT=blarg node examples/foo.js
+foo: error: arg for "FOO_TIMEOUT" is not a positive integer: "blarg"
+```
+
+With the `includeEnv: true` config to `parser.help()` the environment
+variable can also be included in **help output**:
+
+ usage: node foo.js [OPTIONS]
+ options:
+ --version Print tool version and exit.
+ -h, --help Print this help and exit.
+ -v, --verbose Verbose output. Use multiple times for more verbose.
+ Environment: FOO_VERBOSE=1
+ -f FILE, --file=FILE File to process
+
+
+# Parser config
+
+Parser construction (i.e. `dashdash.createParser(CONFIG)`) takes the
+following fields:
+
+- `options` (Array of option specs). Required. See the
+ [Option specs](#option-specs) section below.
+
+- `interspersed` (Boolean). Optional. Default is true. If true this allows
+ interspersed arguments and options. I.e.:
+
+ node ./tool.js -v arg1 arg2 -h # '-h' is after interspersed args
+
+ Set it to false to have '-h' **not** get parsed as an option in the above
+ example.
+
+- `allowUnknown` (Boolean). Optional. Default is false. If false, this causes
+ unknown arguments to throw an error. I.e.:
+
+ node ./tool.js -v arg1 --afe8asefksjefhas
+
+ Set it to true to treat the unknown option as a positional
+ argument.
+
+ **Caveat**: When a shortopt group, such as `-xaz` contains a mix of
+ known and unknown options, the *entire* group is passed through
+ unmolested as a positional argument.
+
+ Consider if you have a known short option `-a`, and parse the
+ following command line:
+
+ node ./tool.js -xaz
+
+ where `-x` and `-z` are unknown. There are multiple ways to
+ interpret this:
+
+ 1. `-x` takes a value: `{x: 'az'}`
+ 2. `-x` and `-z` are both booleans: `{x:true,a:true,z:true}`
+
+ Since dashdash does not know what `-x` and `-z` are, it can't know
+ if you'd prefer to receive `{a:true,_args:['-x','-z']}` or
+ `{x:'az'}`, or `{_args:['-xaz']}`. Leaving the positional arg unprocessed
+ is the easiest mistake for the user to recover from.
+
+
+# Option specs
+
+Example using all fields:
+
+```javascript
+{
+ names: ['file', 'f'], // Required (or `name`).
+ type: 'string', // Required.
+ env: 'MYTOOL_FILE',
+ help: 'Config file to load before running "mytool"',
+ helpArg: 'PATH',
+ helpWrap: false,
+ default: path.resolve(process.env.HOME, '.mytoolrc')
+}
+```
+
+Each option spec in the `options` array must/can have the following fields:
+
+- `name` (String) or `names` (Array). Required. These give the option name
+ and aliases. The first name (if more than one given) is the key for the
+ parsed `opts` object.
+
+- `type` (String). Required. One of:
+
+ - bool
+ - string
+ - number
+ - integer
+ - positiveInteger
+ - date (epoch seconds, e.g. 1396031701, or ISO 8601 format
+ `YYYY-MM-DD[THH:MM:SS[.sss][Z]]`, e.g. "2014-03-28T18:35:01.489Z")
+ - arrayOfBool
+ - arrayOfString
+ - arrayOfNumber
+ - arrayOfInteger
+ - arrayOfPositiveInteger
+ - arrayOfDate
+
+ FWIW, these names attempt to match with asserts on
+ [assert-plus](https://github.com/mcavage/node-assert-plus).
+ You can add your own custom option types with `dashdash.addOptionType`.
+ See below.
+
+- `env` (String or Array of String). Optional. An environment variable name
+ (or names) that can be used as a fallback for this option. For example,
+ given a "foo.js" like this:
+
+ var options = [{names: ['dry-run', 'n'], env: 'FOO_DRY_RUN'}];
+ var opts = dashdash.parse({options: options});
+
+ Both `node foo.js --dry-run` and `FOO_DRY_RUN=1 node foo.js` would result
+ in `opts.dry_run = true`.
+
+ An environment variable is only used as a fallback, i.e. it is ignored if
+ the associated option is given in `argv`.
+
+- `help` (String). Optional. Used for `parser.help()` output.
+
+- `helpArg` (String). Optional. Used in help output as the placeholder for
+ the option argument, e.g. the "PATH" in:
+
+ ...
+ -f PATH, --file=PATH File to process
+ ...
+
+- `helpWrap` (Boolean). Optional, default true. Set this to `false` to have
+ that option's `help` *not* be text wrapped in `<parser>.help()` output.
+
+- `default`. Optional. A default value used for this option, if the
+ option isn't specified in argv.
+
+- `hidden` (Boolean). Optional, default false. If true, help output will not
+ include this option.
+
+
+# Option group headings
+
+You can add headings between option specs in the `options` array. To do so,
+simply add an object with only a `group` property -- the string to print as
+the heading for the subsequent options in the array. For example:
+
+```javascript
+var options = [
+ {
+ group: 'Armament Options'
+ },
+ {
+ names: [ 'weapon', 'w' ],
+ type: 'string'
+ },
+ {
+ group: 'General Options'
+ },
+ {
+ names: [ 'help', 'h' ],
+ type: 'bool'
+ }
+];
+...
+```
+
+Note: You can use an empty string, `{group: ''}`, to get a blank line in help
+output between groups of options.
+
+
+# Help config
+
+The `parser.help(...)` function is configurable as follows:
+
+ Options:
+ Armament Options:
+ ^^ -w WEAPON, --weapon=WEAPON Weapon with which to crush. One of: |
+ / sword, spear, maul |
+ / General Options: |
+ / -h, --help Print this help and exit. |
+ / ^^^^ ^ |
+ \ `-- indent `-- helpCol maxCol ---'
+ `-- headingIndent
+
+- `indent` (Number or String). Default 4. Set to a number (for that many
+ spaces) or a string for the literal indent.
+- `headingIndent` (Number or String). Default half length of `indent`. Set to
+ a number (for that many spaces) or a string for the literal indent. This
+ indent applies to group heading lines, between normal option lines.
+- `nameSort` (String). Default is 'length'. By default the names are
+ sorted to put the short opts first (i.e. '-h, --help' preferred
+ to '--help, -h'). Set to 'none' to not do this sorting.
+- `maxCol` (Number). Default 80. Note that reflow is just done on whitespace
+ so a long token in the option help can overflow maxCol.
+- `helpCol` (Number). If not set a reasonable value will be determined
+ between `minHelpCol` and `maxHelpCol`.
+- `minHelpCol` (Number). Default 20.
+- `maxHelpCol` (Number). Default 40.
+- `helpWrap` (Boolean). Default true. Set to `false` to have option `help`
+ strings *not* be textwrapped to the helpCol..maxCol range.
+- `includeEnv` (Boolean). Default false. If the option has associated
+ environment variables (via the `env` option spec attribute), then
+ append mentioned of those envvars to the help string.
+- `includeDefault` (Boolean). Default false. If the option has a default value
+ (via the `default` option spec attribute, or a default on the option's type),
+ then a "Default: VALUE" string will be appended to the help string.
+
+
+# Custom option types
+
+Dashdash includes a good starter set of option types that it will parse for
+you. However you can add your own via:
+
+ var dashdash = require('dashdash');
+ dashdash.addOptionType({
+ name: '...',
+ takesArg: true,
+ helpArg: '...',
+ parseArg: function (option, optstr, arg) {
+ ...
+ },
+ default: ... // optional
+ });
+
+For example, a simple option type that accepts 'yes', 'y', 'no' or 'n' as
+a boolean argument would look like:
+
+ var dashdash = require('dashdash');
+
+ function parseYesNo(option, optstr, arg) {
+ var argLower = arg.toLowerCase()
+ if (~['yes', 'y'].indexOf(argLower)) {
+ return true;
+ } else if (~['no', 'n'].indexOf(argLower)) {
+ return false;
+ } else {
+ throw new Error(format(
+ 'arg for "%s" is not "yes" or "no": "%s"',
+ optstr, arg));
+ }
+ }
+
+ dashdash.addOptionType({
+ name: 'yesno'
+ takesArg: true,
+ helpArg: '<yes|no>',
+ parseArg: parseYesNo
+ });
+
+ var options = {
+ {names: ['answer', 'a'], type: 'yesno'}
+ };
+ var opts = dashdash.parse({options: options});
+
+See "examples/custom-option-duration.js" for another example adding a "duration"
+option type. Please let me know [on twitter](https://twitter.com/trentmick)
+or [with an issue](https://github.com/trentm/node-dashdash/issues/new) if you
+write a generally useful one.
+
+
+
+# Why
+
+Why another node.js option parsing lib?
+
+- `nopt` really is just for "tools like npm". Implicit opts (e.g. '--no-foo'
+ works for every '--foo'). Can't disable abbreviated opts. Can't do multiple
+ usages of same opt, e.g. '-vvv' (I think). Can't do grouped short opts.
+
+- `optimist` has surprise interpretation of options (at least to me).
+ Implicit opts mean ambiguities and poor error handling for fat-fingering.
+ `process.exit` calls makes it hard to use as a libary.
+
+- `optparse` Incomplete docs. Is this an attempted clone of Python's `optparse`.
+ Not clear. Some divergence. `parser.on("name", ...)` API is weird.
+
+- `argparse` Dep on underscore. No thanks just for option processing.
+ `find lib | wc -l` -> `26`. Overkill.
+ Argparse is a bit different anyway. Not sure I want that.
+
+- `posix-getopt` No type validation. Though that isn't a killer. AFAIK can't
+ have a long opt without a short alias. I.e. no `getopt_long` semantics.
+ Also, no whizbang features like generated help output.
+
+- ["commander.js"](https://github.com/visionmedia/commander.js): I wrote
+ [a critique](http://trentm.com/2014/01/a-critique-of-commander-for-nodejs.html)
+ a while back. It seems fine, but last I checked had
+ [an outstanding bug](https://github.com/visionmedia/commander.js/pull/121)
+ that would prevent me from using it.
+
+
+# License
+
+MIT. See LICENSE.txt.
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/lib/dashdash.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/lib/dashdash.js
new file mode 100644
index 000000000..014b2ed0e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/lib/dashdash.js
@@ -0,0 +1,813 @@
+/**
+ * dashdash - A light, featureful and explicit option parsing library for
+ * node.js.
+ */
+// vim: set ts=4 sts=4 sw=4 et:
+
+var p = console.log;
+var format = require('util').format;
+
+var assert = require('assert-plus');
+
+var DEBUG = true;
+if (DEBUG) {
+ var debug = console.warn;
+} else {
+ var debug = function () {};
+}
+
+
+
+// ---- internal support stuff
+
+/**
+ * Return a shallow copy of the given object;
+ */
+function shallowCopy(obj) {
+ if (!obj) {
+ return (obj);
+ }
+ var copy = {};
+ Object.keys(obj).forEach(function (k) {
+ copy[k] = obj[k];
+ });
+ return (copy);
+}
+
+
+function space(n) {
+ var s = '';
+ for (var i = 0; i < n; i++) {
+ s += ' ';
+ }
+ return s;
+}
+
+
+function makeIndent(arg, deflen, name) {
+ if (arg === null || arg === undefined)
+ return space(deflen);
+ else if (typeof (arg) === 'number')
+ return space(arg);
+ else if (typeof (arg) === 'string')
+ return arg;
+ else
+ assert.fail('invalid "' + name + '": not a string or number: ' + arg);
+}
+
+
+/**
+ * Return an array of lines wrapping the given text to the given width.
+ * This splits on whitespace. Single tokens longer than `width` are not
+ * broken up.
+ */
+function textwrap(s, width) {
+ var words = s.trim().split(/\s+/);
+ var lines = [];
+ var line = '';
+ words.forEach(function (w) {
+ var newLength = line.length + w.length;
+ if (line.length > 0)
+ newLength += 1;
+ if (newLength > width) {
+ lines.push(line);
+ line = '';
+ }
+ if (line.length > 0)
+ line += ' ';
+ line += w;
+ });
+ lines.push(line);
+ return lines;
+}
+
+
+/**
+ * Transform an option name to a "key" that is used as the field
+ * on the `opts` object returned from `<parser>.parse()`.
+ *
+ * Transformations:
+ * - '-' -> '_': This allow one to use hyphen in option names (common)
+ * but not have to do silly things like `opt["dry-run"]` to access the
+ * parsed results.
+ */
+function optionKeyFromName(name) {
+ return name.replace(/-/g, '_');
+}
+
+
+
+// ---- Option types
+
+function parseBool(option, optstr, arg) {
+ return Boolean(arg);
+}
+
+function parseString(option, optstr, arg) {
+ assert.string(arg, 'arg');
+ return arg;
+}
+
+function parseNumber(option, optstr, arg) {
+ assert.string(arg, 'arg');
+ var num = Number(arg);
+ if (isNaN(num)) {
+ throw new Error(format('arg for "%s" is not a number: "%s"',
+ optstr, arg));
+ }
+ return num;
+}
+
+function parseInteger(option, optstr, arg) {
+ assert.string(arg, 'arg');
+ var num = Number(arg);
+ if (!/^[0-9-]+$/.test(arg) || isNaN(num)) {
+ throw new Error(format('arg for "%s" is not an integer: "%s"',
+ optstr, arg));
+ }
+ return num;
+}
+
+function parsePositiveInteger(option, optstr, arg) {
+ assert.string(arg, 'arg');
+ var num = Number(arg);
+ if (!/^[0-9]+$/.test(arg) || isNaN(num)) {
+ throw new Error(format('arg for "%s" is not a positive integer: "%s"',
+ optstr, arg));
+ }
+ return num;
+}
+
+/**
+ * Supported date args:
+ * - epoch second times (e.g. 1396031701)
+ * - ISO 8601 format: YYYY-MM-DD[THH:MM:SS[.sss][Z]]
+ * 2014-03-28T18:35:01.489Z
+ * 2014-03-28T18:35:01.489
+ * 2014-03-28T18:35:01Z
+ * 2014-03-28T18:35:01
+ * 2014-03-28
+ */
+function parseDate(option, optstr, arg) {
+ assert.string(arg, 'arg');
+ var date;
+ if (/^\d+$/.test(arg)) {
+ // epoch seconds
+ date = new Date(Number(arg) * 1000);
+ /* JSSTYLED */
+ } else if (/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?Z?)?$/i.test(arg)) {
+ // ISO 8601 format
+ date = new Date(arg);
+ } else {
+ throw new Error(format('arg for "%s" is not a valid date format: "%s"',
+ optstr, arg));
+ }
+ if (date.toString() === 'Invalid Date') {
+ throw new Error(format('arg for "%s" is an invalid date: "%s"',
+ optstr, arg));
+ }
+ return date;
+}
+
+var optionTypes = {
+ bool: {
+ takesArg: false,
+ parseArg: parseBool
+ },
+ string: {
+ takesArg: true,
+ helpArg: 'ARG',
+ parseArg: parseString
+ },
+ number: {
+ takesArg: true,
+ helpArg: 'NUM',
+ parseArg: parseNumber
+ },
+ integer: {
+ takesArg: true,
+ helpArg: 'INT',
+ parseArg: parseInteger
+ },
+ positiveInteger: {
+ takesArg: true,
+ helpArg: 'INT',
+ parseArg: parsePositiveInteger
+ },
+ date: {
+ takesArg: true,
+ helpArg: 'DATE',
+ parseArg: parseDate
+ },
+ arrayOfBool: {
+ takesArg: false,
+ array: true,
+ parseArg: parseBool
+ },
+ arrayOfString: {
+ takesArg: true,
+ helpArg: 'ARG',
+ array: true,
+ parseArg: parseString
+ },
+ arrayOfNumber: {
+ takesArg: true,
+ helpArg: 'NUM',
+ array: true,
+ parseArg: parseNumber
+ },
+ arrayOfInteger: {
+ takesArg: true,
+ helpArg: 'INT',
+ array: true,
+ parseArg: parseInteger
+ },
+ arrayOfPositiveInteger: {
+ takesArg: true,
+ helpArg: 'INT',
+ array: true,
+ parseArg: parsePositiveInteger
+ },
+ arrayOfDate: {
+ takesArg: true,
+ helpArg: 'INT',
+ array: true,
+ parseArg: parseDate
+ },
+};
+
+
+
+// ---- Parser
+
+/**
+ * Parser constructor.
+ *
+ * @param config {Object} The parser configuration
+ * - options {Array} Array of option specs. See the README for how to
+ * specify each option spec.
+ * - allowUnknown {Boolean} Default false. Whether to throw on unknown
+ * options. If false, then unknown args are included in the _args array.
+ * - interspersed {Boolean} Default true. Whether to allow interspersed
+ * arguments (non-options) and options. E.g.:
+ * node tool.js arg1 arg2 -v
+ * '-v' is after some args here. If `interspersed: false` then '-v'
+ * would not be parsed out. Note that regardless of `interspersed`
+ * the presence of '--' will stop option parsing, as all good
+ * option parsers should.
+ */
+function Parser(config) {
+ assert.object(config, 'config');
+ assert.arrayOfObject(config.options, 'config.options');
+ assert.optionalBool(config.interspersed, 'config.interspersed');
+ var self = this;
+
+ // Allow interspersed arguments (true by default).
+ this.interspersed = (config.interspersed !== undefined
+ ? config.interspersed : true);
+
+ // Don't allow unknown flags (true by default).
+ this.allowUnknown = (config.allowUnknown !== undefined
+ ? config.allowUnknown : false);
+
+ this.options = config.options.map(function (o) { return shallowCopy(o); });
+ this.optionFromName = {};
+ this.optionFromEnv = {};
+ for (var i = 0; i < this.options.length; i++) {
+ var o = this.options[i];
+ if (o.group !== undefined && o.group !== null) {
+ assert.optionalString(o.group,
+ format('config.options.%d.group', i));
+ continue;
+ }
+ assert.ok(optionTypes[o.type],
+ format('invalid config.options.%d.type: "%s" in %j',
+ i, o.type, o));
+ assert.optionalString(o.name, format('config.options.%d.name', i));
+ assert.optionalArrayOfString(o.names,
+ format('config.options.%d.names', i));
+ assert.ok((o.name || o.names) && !(o.name && o.names),
+ format('exactly one of "name" or "names" required: %j', o));
+ assert.optionalString(o.help, format('config.options.%d.help', i));
+ var env = o.env || [];
+ if (typeof (env) === 'string') {
+ env = [env];
+ }
+ assert.optionalArrayOfString(env, format('config.options.%d.env', i));
+ assert.optionalString(o.helpGroup,
+ format('config.options.%d.helpGroup', i));
+ assert.optionalBool(o.helpWrap,
+ format('config.options.%d.helpWrap', i));
+ assert.optionalBool(o.hidden, format('config.options.%d.hidden', i));
+
+ if (o.name) {
+ o.names = [o.name];
+ } else {
+ assert.string(o.names[0],
+ format('config.options.%d.names is empty', i));
+ }
+ o.key = optionKeyFromName(o.names[0]);
+ o.names.forEach(function (n) {
+ if (self.optionFromName[n]) {
+ throw new Error(format(
+ 'option name collision: "%s" used in %j and %j',
+ n, self.optionFromName[n], o));
+ }
+ self.optionFromName[n] = o;
+ });
+ env.forEach(function (n) {
+ if (self.optionFromEnv[n]) {
+ throw new Error(format(
+ 'option env collision: "%s" used in %j and %j',
+ n, self.optionFromEnv[n], o));
+ }
+ self.optionFromEnv[n] = o;
+ });
+ }
+}
+
+Parser.prototype.optionTakesArg = function optionTakesArg(option) {
+ return optionTypes[option.type].takesArg;
+};
+
+/**
+ * Parse options from the given argv.
+ *
+ * @param inputs {Object} Optional.
+ * - argv {Array} Optional. The argv to parse. Defaults to
+ * `process.argv`.
+ * - slice {Number} The index into argv at which options/args begin.
+ * Default is 2, as appropriate for `process.argv`.
+ * - env {Object} Optional. The env to use for 'env' entries in the
+ * option specs. Defaults to `process.env`.
+ * @returns {Object} Parsed `opts`. It has special keys `_args` (the
+ * remaining args from `argv`) and `_order` (gives the order that
+ * options were specified).
+ */
+Parser.prototype.parse = function parse(inputs) {
+ var self = this;
+
+ // Old API was `parse([argv, [slice]])`
+ if (Array.isArray(arguments[0])) {
+ inputs = {argv: arguments[0], slice: arguments[1]};
+ }
+
+ assert.optionalObject(inputs, 'inputs');
+ if (!inputs) {
+ inputs = {};
+ }
+ assert.optionalArrayOfString(inputs.argv, 'inputs.argv');
+ //assert.optionalNumber(slice, 'slice');
+ var argv = inputs.argv || process.argv;
+ var slice = inputs.slice !== undefined ? inputs.slice : 2;
+ var args = argv.slice(slice);
+ var env = inputs.env || process.env;
+ var opts = {};
+ var _order = [];
+
+ function addOpt(option, optstr, key, val, from) {
+ var type = optionTypes[option.type];
+ var parsedVal = type.parseArg(option, optstr, val);
+ if (type.array) {
+ if (!opts[key]) {
+ opts[key] = [];
+ }
+ opts[key].push(parsedVal);
+ } else {
+ opts[key] = parsedVal;
+ }
+ var item = { key: key, value: parsedVal, from: from };
+ _order.push(item);
+ }
+
+ // Parse args.
+ var _args = [];
+ var i = 0;
+ outer: while (i < args.length) {
+ var arg = args[i];
+
+ // End of options marker.
+ if (arg === '--') {
+ i++;
+ break;
+
+ // Long option
+ } else if (arg.slice(0, 2) === '--') {
+ var name = arg.slice(2);
+ var val = null;
+ var idx = name.indexOf('=');
+ if (idx !== -1) {
+ val = name.slice(idx + 1);
+ name = name.slice(0, idx);
+ }
+ var option = this.optionFromName[name];
+ if (!option) {
+ if (!this.allowUnknown)
+ throw new Error(format('unknown option: "--%s"', name));
+ else if (this.interspersed)
+ _args.push(arg);
+ else
+ break outer;
+ } else {
+ var takesArg = this.optionTakesArg(option);
+ if (val !== null && !takesArg) {
+ throw new Error(format('argument given to "--%s" option '
+ + 'that does not take one: "%s"', name, arg));
+ }
+ if (!takesArg) {
+ addOpt(option, '--'+name, option.key, true, 'argv');
+ } else if (val !== null) {
+ addOpt(option, '--'+name, option.key, val, 'argv');
+ } else if (i + 1 >= args.length) {
+ throw new Error(format('do not have enough args for "--%s" '
+ + 'option', name));
+ } else {
+ addOpt(option, '--'+name, option.key, args[i + 1], 'argv');
+ i++;
+ }
+ }
+
+ // Short option
+ } else if (arg[0] === '-' && arg.length > 1) {
+ var j = 1;
+ var allFound = true;
+ while (j < arg.length) {
+ var name = arg[j];
+ var option = this.optionFromName[name];
+ if (!option) {
+ allFound = false;
+ if (this.allowUnknown) {
+ if (this.interspersed) {
+ _args.push(arg);
+ break;
+ } else
+ break outer;
+ } else if (arg.length > 2) {
+ throw new Error(format(
+ 'unknown option: "-%s" in "%s" group',
+ name, arg));
+ } else {
+ throw new Error(format('unknown option: "-%s"', name));
+ }
+ } else if (this.optionTakesArg(option)) {
+ break;
+ }
+ j++;
+ }
+
+ j = 1;
+ while (allFound && j < arg.length) {
+ var name = arg[j];
+ var val = arg.slice(j + 1); // option val if it takes an arg
+ var option = this.optionFromName[name];
+ var takesArg = this.optionTakesArg(option);
+ if (!takesArg) {
+ addOpt(option, '-'+name, option.key, true, 'argv');
+ } else if (val) {
+ addOpt(option, '-'+name, option.key, val, 'argv');
+ break;
+ } else {
+ if (i + 1 >= args.length) {
+ throw new Error(format('do not have enough args '
+ + 'for "-%s" option', name));
+ }
+ addOpt(option, '-'+name, option.key, args[i + 1], 'argv');
+ i++;
+ break;
+ }
+ j++;
+ }
+
+ // An interspersed arg
+ } else if (this.interspersed) {
+ _args.push(arg);
+
+ // An arg and interspersed args are not allowed, so done options.
+ } else {
+ break outer;
+ }
+ i++;
+ }
+ _args = _args.concat(args.slice(i));
+
+ // Parse environment.
+ Object.keys(this.optionFromEnv).forEach(function (envname) {
+ var val = env[envname];
+ if (val === undefined)
+ return;
+ var option = self.optionFromEnv[envname];
+ if (opts[option.key] !== undefined)
+ return;
+ var takesArg = self.optionTakesArg(option);
+ if (takesArg) {
+ addOpt(option, envname, option.key, val, 'env');
+ } else if (val !== '') {
+ // Boolean envvar handling:
+ // - VAR=<empty-string> not set (as if the VAR was not set)
+ // - VAR=0 false
+ // - anything else true
+ addOpt(option, envname, option.key, (val !== '0'), 'env');
+ }
+ });
+
+ // Apply default values.
+ this.options.forEach(function (o) {
+ if (opts[o.key] === undefined) {
+ if (o.default !== undefined) {
+ opts[o.key] = o.default;
+ } else if (o.type && optionTypes[o.type].default !== undefined) {
+ opts[o.key] = optionTypes[o.type].default;
+ }
+ }
+ });
+
+ opts._order = _order;
+ opts._args = _args;
+ return opts;
+};
+
+
+/**
+ * Return help output for the current options.
+ *
+ * E.g.: if the current options are:
+ * [{names: ['help', 'h'], type: 'bool', help: 'Show help and exit.'}]
+ * then this would return:
+ * ' -h, --help Show help and exit.\n'
+ *
+ * @param config {Object} Config for controlling the option help output.
+ * - indent {Number|String} Default 4. An indent/prefix to use for
+ * each option line.
+ * - nameSort {String} Default is 'length'. By default the names are
+ * sorted to put the short opts first (i.e. '-h, --help' preferred
+ * to '--help, -h'). Set to 'none' to not do this sorting.
+ * - maxCol {Number} Default 80. Note that long tokens in a help string
+ * can go past this.
+ * - helpCol {Number} Set to specify a specific column at which
+ * option help will be aligned. By default this is determined
+ * automatically.
+ * - minHelpCol {Number} Default 20.
+ * - maxHelpCol {Number} Default 40.
+ * - includeEnv {Boolean} Default false. If true, a note stating the `env`
+ * envvar (if specified for this option) will be appended to the help
+ * output.
+ * - includeDefault {Boolean} Default false. If true, a note stating
+ * the `default` for this option, if any, will be appended to the help
+ * output.
+ * - helpWrap {Boolean} Default true. Wrap help text in helpCol..maxCol
+ * bounds.
+ * @returns {String}
+ */
+Parser.prototype.help = function help(config) {
+ config = config || {};
+ assert.object(config, 'config');
+
+ var indent = makeIndent(config.indent, 4, 'config.indent');
+ var headingIndent = makeIndent(config.headingIndent,
+ Math.round(indent.length / 2), 'config.headingIndent');
+
+ assert.optionalString(config.nameSort, 'config.nameSort');
+ var nameSort = config.nameSort || 'length';
+ assert.ok(~['length', 'none'].indexOf(nameSort),
+ 'invalid "config.nameSort"');
+ assert.optionalNumber(config.maxCol, 'config.maxCol');
+ assert.optionalNumber(config.maxHelpCol, 'config.maxHelpCol');
+ assert.optionalNumber(config.minHelpCol, 'config.minHelpCol');
+ assert.optionalNumber(config.helpCol, 'config.helpCol');
+ assert.optionalBool(config.includeEnv, 'config.includeEnv');
+ assert.optionalBool(config.includeDefault, 'config.includeDefault');
+ assert.optionalBool(config.helpWrap, 'config.helpWrap');
+ var maxCol = config.maxCol || 80;
+ var minHelpCol = config.minHelpCol || 20;
+ var maxHelpCol = config.maxHelpCol || 40;
+
+ var lines = [];
+ var maxWidth = 0;
+ this.options.forEach(function (o) {
+ if (o.hidden) {
+ return;
+ }
+ if (o.group !== undefined && o.group !== null) {
+ // We deal with groups in the next pass
+ lines.push(null);
+ return;
+ }
+ var type = optionTypes[o.type];
+ var arg = o.helpArg || type.helpArg || 'ARG';
+ var line = '';
+ var names = o.names.slice();
+ if (nameSort === 'length') {
+ names.sort(function (a, b) {
+ if (a.length < b.length)
+ return -1;
+ else if (b.length < a.length)
+ return 1;
+ else
+ return 0;
+ })
+ }
+ names.forEach(function (name, i) {
+ if (i > 0)
+ line += ', ';
+ if (name.length === 1) {
+ line += '-' + name
+ if (type.takesArg)
+ line += ' ' + arg;
+ } else {
+ line += '--' + name
+ if (type.takesArg)
+ line += '=' + arg;
+ }
+ });
+ maxWidth = Math.max(maxWidth, line.length);
+ lines.push(line);
+ });
+
+ // Add help strings.
+ var helpCol = config.helpCol;
+ if (!helpCol) {
+ helpCol = maxWidth + indent.length + 2;
+ helpCol = Math.min(Math.max(helpCol, minHelpCol), maxHelpCol);
+ }
+ var i = -1;
+ this.options.forEach(function (o) {
+ if (o.hidden) {
+ return;
+ }
+ i++;
+
+ if (o.group !== undefined && o.group !== null) {
+ if (o.group === '') {
+ // Support a empty string "group" to have a blank line between
+ // sets of options.
+ lines[i] = '';
+ } else {
+ // Render the group heading with the heading-specific indent.
+ lines[i] = (i === 0 ? '' : '\n') + headingIndent +
+ o.group + ':';
+ }
+ return;
+ }
+
+ var helpDefault;
+ if (config.includeDefault) {
+ if (o.default !== undefined) {
+ helpDefault = format('Default: %j', o.default);
+ } else if (o.type && optionTypes[o.type].default !== undefined) {
+ helpDefault = format('Default: %j',
+ optionTypes[o.type].default);
+ }
+ }
+
+ var line = lines[i] = indent + lines[i];
+ if (!o.help && !(config.includeEnv && o.env) && !helpDefault) {
+ return;
+ }
+ var n = helpCol - line.length;
+ if (n >= 0) {
+ line += space(n);
+ } else {
+ line += '\n' + space(helpCol);
+ }
+
+ var helpEnv = '';
+ if (o.env && o.env.length && config.includeEnv) {
+ helpEnv += 'Environment: ';
+ var type = optionTypes[o.type];
+ var arg = o.helpArg || type.helpArg || 'ARG';
+ var envs = (Array.isArray(o.env) ? o.env : [o.env]).map(
+ function (e) {
+ if (type.takesArg) {
+ return e + '=' + arg;
+ } else {
+ return e + '=1';
+ }
+ }
+ );
+ helpEnv += envs.join(', ');
+ }
+ var help = (o.help || '').trim();
+ if (o.helpWrap !== false && config.helpWrap !== false) {
+ // Wrap help description normally.
+ if (help.length && !~'.!?"\''.indexOf(help.slice(-1))) {
+ help += '.';
+ }
+ if (help.length) {
+ help += ' ';
+ }
+ help += helpEnv;
+ if (helpDefault) {
+ if (helpEnv) {
+ help += '. ';
+ }
+ help += helpDefault;
+ }
+ line += textwrap(help, maxCol - helpCol).join(
+ '\n' + space(helpCol));
+ } else {
+ // Do not wrap help description, but indent newlines appropriately.
+ var helpLines = help.split('\n').filter(
+ function (ln) { return ln.length });
+ if (helpEnv !== '') {
+ helpLines.push(helpEnv);
+ }
+ if (helpDefault) {
+ helpLines.push(helpDefault);
+ }
+ line += helpLines.join('\n' + space(helpCol));
+ }
+
+ lines[i] = line;
+ });
+
+ var rv = '';
+ if (lines.length > 0) {
+ rv = lines.join('\n') + '\n';
+ }
+ return rv;
+};
+
+
+
+// ---- exports
+
+function createParser(config) {
+ return new Parser(config);
+}
+
+/**
+ * Parse argv with the given options.
+ *
+ * @param config {Object} A merge of all the available fields from
+ * `dashdash.Parser` and `dashdash.Parser.parse`: options, interspersed,
+ * argv, env, slice.
+ */
+function parse(config) {
+ assert.object(config, 'config');
+ assert.optionalArrayOfString(config.argv, 'config.argv');
+ assert.optionalObject(config.env, 'config.env');
+ var config = shallowCopy(config);
+ var argv = config.argv;
+ delete config.argv;
+ var env = config.env;
+ delete config.env;
+
+ var parser = new Parser(config);
+ return parser.parse({argv: argv, env: env});
+}
+
+
+/**
+ * Add a new option type.
+ *
+ * @params optionType {Object}:
+ * - name {String} Required.
+ * - takesArg {Boolean} Required. Whether this type of option takes an
+ * argument on process.argv. Typically this is true for all but the
+ * "bool" type.
+ * - helpArg {String} Required iff `takesArg === true`. The string to
+ * show in generated help for options of this type.
+ * - parseArg {Function} Require. `function (option, optstr, arg)` parser
+ * that takes a string argument and returns an instance of the
+ * appropriate type, or throws an error if the arg is invalid.
+ * - array {Boolean} Optional. Set to true if this is an 'arrayOf' type
+ * that collects multiple usages of the option in process.argv and
+ * puts results in an array.
+ * - default Optional. Default value for options of this type, if no
+ * default is specified in the option type usage.
+ */
+function addOptionType(optionType) {
+ assert.object(optionType, 'optionType');
+ assert.string(optionType.name, 'optionType.name');
+ assert.bool(optionType.takesArg, 'optionType.takesArg');
+ if (optionType.takesArg) {
+ assert.string(optionType.helpArg, 'optionType.helpArg');
+ }
+ assert.func(optionType.parseArg, 'optionType.parseArg');
+ assert.optionalBool(optionType.array, 'optionType.array');
+
+ optionTypes[optionType.name] = {
+ takesArg: optionType.takesArg,
+ helpArg: optionType.helpArg,
+ parseArg: optionType.parseArg,
+ array: optionType.array,
+ default: optionType.default
+ }
+}
+
+
+module.exports = {
+ createParser: createParser,
+ Parser: Parser,
+ parse: parse,
+ addOptionType: addOptionType,
+
+ // Export the parseFoo parsers because they might be useful as primitives
+ // for custom option types.
+ parseBool: parseBool,
+ parseString: parseString,
+ parseNumber: parseNumber,
+ parseInteger: parseInteger,
+ parsePositiveInteger: parsePositiveInteger,
+ parseDate: parseDate
+};
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/README.md
new file mode 100644
index 000000000..c0c3a5308
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/README.md
@@ -0,0 +1,126 @@
+# node-assert-plus
+
+This library is a super small wrapper over node's assert module that has two
+things: (1) the ability to disable assertions with the environment variable
+NODE_NDEBUG, and (2) some API wrappers for argument testing. Like
+`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks
+like this:
+
+ var assert = require('assert-plus');
+
+ function fooAccount(options, callback) {
+ assert.object(options, 'options');
+ assert.number(options.id, 'options.id);
+ assert.bool(options.isManager, 'options.isManager');
+ assert.string(options.name, 'options.name');
+ assert.arrayOfString(options.email, 'options.email');
+ assert.func(callback, 'callback');
+
+ // Do stuff
+ callback(null, {});
+ }
+
+# API
+
+All methods that *aren't* part of node's core assert API are simply assumed to
+take an argument, and then a string 'name' that's not a message; `AssertionError`
+will be thrown if the assertion fails with a message like:
+
+ AssertionError: foo (string) is required
+ at test (/home/mark/work/foo/foo.js:3:9)
+ at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)
+ at Module._compile (module.js:446:26)
+ at Object..js (module.js:464:10)
+ at Module.load (module.js:353:31)
+ at Function._load (module.js:311:12)
+ at Array.0 (module.js:484:10)
+ at EventEmitter._tickCallback (node.js:190:38)
+
+from:
+
+ function test(foo) {
+ assert.string(foo, 'foo');
+ }
+
+There you go. You can check that arrays are of a homogenous type with `Arrayof$Type`:
+
+ function test(foo) {
+ assert.arrayOfString(foo, 'foo');
+ }
+
+You can assert IFF an argument is not `undefined` (i.e., an optional arg):
+
+ assert.optionalString(foo, 'foo');
+
+Lastly, you can opt-out of assertion checking altogether by setting the
+environment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have
+lots of assertions, and don't want to pay `typeof ()` taxes to v8 in
+production.
+
+The complete list of APIs is:
+
+* assert.bool
+* assert.buffer
+* assert.func
+* assert.number
+* assert.object
+* assert.string
+* assert.arrayOfBool
+* assert.arrayOfFunc
+* assert.arrayOfNumber
+* assert.arrayOfObject
+* assert.arrayOfString
+* assert.optionalBool
+* assert.optionalBuffer
+* assert.optionalFunc
+* assert.optionalNumber
+* assert.optionalObject
+* assert.optionalString
+* assert.optionalArrayOfBool
+* assert.optionalArrayOfFunc
+* assert.optionalArrayOfNumber
+* assert.optionalArrayOfObject
+* assert.optionalArrayOfString
+* assert.AssertionError
+* assert.fail
+* assert.ok
+* assert.equal
+* assert.notEqual
+* assert.deepEqual
+* assert.notDeepEqual
+* assert.strictEqual
+* assert.notStrictEqual
+* assert.throws
+* assert.doesNotThrow
+* assert.ifError
+
+# Installation
+
+ npm install assert-plus
+
+## License
+
+The MIT License (MIT)
+Copyright (c) 2012 Mark Cavage
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+## Bugs
+
+See <https://github.com/mcavage/node-assert-plus/issues>.
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/assert.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/assert.js
new file mode 100644
index 000000000..ff2ba02de
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/assert.js
@@ -0,0 +1,245 @@
+// Copyright (c) 2012, Mark Cavage. All rights reserved.
+
+var assert = require('assert');
+var Stream = require('stream').Stream;
+var util = require('util');
+
+
+
+///--- Globals
+
+var NDEBUG = process.env.NODE_NDEBUG || false;
+var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
+
+
+
+///--- Messages
+
+var ARRAY_TYPE_REQUIRED = '%s ([%s]) required';
+var TYPE_REQUIRED = '%s (%s) is required';
+
+
+
+///--- Internal
+
+function capitalize(str) {
+ return (str.charAt(0).toUpperCase() + str.slice(1));
+}
+
+function uncapitalize(str) {
+ return (str.charAt(0).toLowerCase() + str.slice(1));
+}
+
+function _() {
+ return (util.format.apply(util, arguments));
+}
+
+
+function _assert(arg, type, name, stackFunc) {
+ if (!NDEBUG) {
+ name = name || type;
+ stackFunc = stackFunc || _assert.caller;
+ var t = typeof (arg);
+
+ if (t !== type) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, type),
+ actual: t,
+ expected: type,
+ operator: '===',
+ stackStartFunction: stackFunc
+ });
+ }
+ }
+}
+
+
+function _instanceof(arg, type, name, stackFunc) {
+ if (!NDEBUG) {
+ name = name || type;
+ stackFunc = stackFunc || _instanceof.caller;
+
+ if (!(arg instanceof type)) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, type.name),
+ actual: _getClass(arg),
+ expected: type.name,
+ operator: 'instanceof',
+ stackStartFunction: stackFunc
+ });
+ }
+ }
+}
+
+function _getClass(object) {
+ return (Object.prototype.toString.call(object).slice(8, -1));
+};
+
+
+
+///--- API
+
+function array(arr, type, name) {
+ if (!NDEBUG) {
+ name = name || type;
+
+ if (!Array.isArray(arr)) {
+ throw new assert.AssertionError({
+ message: _(ARRAY_TYPE_REQUIRED, name, type),
+ actual: typeof (arr),
+ expected: 'array',
+ operator: 'Array.isArray',
+ stackStartFunction: array.caller
+ });
+ }
+
+ for (var i = 0; i < arr.length; i++) {
+ _assert(arr[i], type, name, array);
+ }
+ }
+}
+
+
+function bool(arg, name) {
+ _assert(arg, 'boolean', name, bool);
+}
+
+
+function buffer(arg, name) {
+ if (!Buffer.isBuffer(arg)) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name || '', 'Buffer'),
+ actual: typeof (arg),
+ expected: 'buffer',
+ operator: 'Buffer.isBuffer',
+ stackStartFunction: buffer
+ });
+ }
+}
+
+
+function func(arg, name) {
+ _assert(arg, 'function', name);
+}
+
+
+function number(arg, name) {
+ _assert(arg, 'number', name);
+ if (!NDEBUG && (isNaN(arg) || !isFinite(arg))) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, 'number'),
+ actual: arg,
+ expected: 'number',
+ operator: 'isNaN',
+ stackStartFunction: number
+ });
+ }
+}
+
+
+function object(arg, name) {
+ _assert(arg, 'object', name);
+}
+
+
+function stream(arg, name) {
+ _instanceof(arg, Stream, name);
+}
+
+
+function date(arg, name) {
+ _instanceof(arg, Date, name);
+}
+
+function regexp(arg, name) {
+ _instanceof(arg, RegExp, name);
+}
+
+
+function string(arg, name) {
+ _assert(arg, 'string', name);
+}
+
+
+function uuid(arg, name) {
+ string(arg, name);
+ if (!NDEBUG && !UUID_REGEXP.test(arg)) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, 'uuid'),
+ actual: 'string',
+ expected: 'uuid',
+ operator: 'test',
+ stackStartFunction: uuid
+ });
+ }
+}
+
+
+///--- Exports
+
+module.exports = {
+ bool: bool,
+ buffer: buffer,
+ date: date,
+ func: func,
+ number: number,
+ object: object,
+ regexp: regexp,
+ stream: stream,
+ string: string,
+ uuid: uuid
+};
+
+
+Object.keys(module.exports).forEach(function (k) {
+ if (k === 'buffer')
+ return;
+
+ var name = 'arrayOf' + capitalize(k);
+
+ if (k === 'bool')
+ k = 'boolean';
+ if (k === 'func')
+ k = 'function';
+ module.exports[name] = function (arg, name) {
+ array(arg, k, name);
+ };
+});
+
+Object.keys(module.exports).forEach(function (k) {
+ var _name = 'optional' + capitalize(k);
+ var s = uncapitalize(k.replace('arrayOf', ''));
+ if (s === 'bool')
+ s = 'boolean';
+ if (s === 'func')
+ s = 'function';
+
+ if (k.indexOf('arrayOf') !== -1) {
+ module.exports[_name] = function (arg, name) {
+ if (!NDEBUG && arg !== undefined) {
+ array(arg, s, name);
+ }
+ };
+ } else {
+ module.exports[_name] = function (arg, name) {
+ if (!NDEBUG && arg !== undefined) {
+ _assert(arg, s, name);
+ }
+ };
+ }
+});
+
+
+// Reexport built-in assertions
+Object.keys(assert).forEach(function (k) {
+ if (k === 'AssertionError') {
+ module.exports[k] = assert[k];
+ return;
+ }
+
+ module.exports[k] = function () {
+ if (!NDEBUG) {
+ assert[k].apply(assert[k], arguments);
+ }
+ };
+});
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/package.json
new file mode 100644
index 000000000..e5663d99a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/node_modules/assert-plus/package.json
@@ -0,0 +1,71 @@
+{
+ "_args": [
+ [
+ "assert-plus@0.1.x",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash"
+ ],
+ [
+ "assert-plus@^0.1.5",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature"
+ ]
+ ],
+ "_from": "assert-plus@>=0.1.0 <0.2.0",
+ "_id": "assert-plus@0.1.5",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/dashdash/assert-plus",
+ "_npmUser": {
+ "email": "mcavage@gmail.com",
+ "name": "mcavage"
+ },
+ "_npmVersion": "1.3.11",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "assert-plus",
+ "raw": "assert-plus@0.1.x",
+ "rawSpec": "0.1.x",
+ "scope": null,
+ "spec": ">=0.1.0 <0.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk/dashdash"
+ ],
+ "_shrinkwrap": null,
+ "_spec": "assert-plus@0.1.x",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash",
+ "author": {
+ "email": "mcavage@gmail.com",
+ "name": "Mark Cavage"
+ },
+ "bugs": {
+ "url": "https://github.com/mcavage/node-assert-plus/issues"
+ },
+ "dependencies": {},
+ "description": "Extra assertions on top of node's assert module",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "ee74009413002d84cec7219c6ac811812e723160",
+ "tarball": "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz"
+ },
+ "engines": {
+ "node": ">=0.8"
+ },
+ "homepage": "https://github.com/mcavage/node-assert-plus#readme",
+ "main": "./assert.js",
+ "maintainers": [
+ {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ }
+ ],
+ "name": "assert-plus",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/mcavage/node-assert-plus.git"
+ },
+ "version": "0.1.5"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/package.json
new file mode 100644
index 000000000..5df7c555c
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/package.json
@@ -0,0 +1,106 @@
+{
+ "_args": [
+ [
+ "dashdash@>=1.10.1 <2.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk"
+ ]
+ ],
+ "_from": "dashdash@>=1.10.1 <2.0.0",
+ "_id": "dashdash@1.10.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/dashdash",
+ "_npmUser": {
+ "email": "trentm@gmail.com",
+ "name": "trentm"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "dashdash",
+ "raw": "dashdash@>=1.10.1 <2.0.0",
+ "rawSpec": ">=1.10.1 <2.0.0",
+ "scope": null,
+ "spec": ">=1.10.1 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk"
+ ],
+ "_resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.10.1.tgz",
+ "_shasum": "0abf1af89a8f5129a81f18c2b35b21df22622f60",
+ "_shrinkwrap": null,
+ "_spec": "dashdash@>=1.10.1 <2.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk",
+ "author": {
+ "email": "trentm@gmail.com",
+ "name": "Trent Mick",
+ "url": "http://trentm.com"
+ },
+ "bugs": {
+ "url": "https://github.com/trentm/node-dashdash/issues"
+ },
+ "contributors": [
+ {
+ "name": "Trent Mick",
+ "email": "trentm@gmail.com",
+ "url": "http://trentm.com"
+ },
+ {
+ "name": "Isaac Schlueter",
+ "url": "https://github.com/isaacs"
+ },
+ {
+ "name": "Joshua M. Clulow",
+ "url": "https://github.com/jclulow"
+ },
+ {
+ "name": "Patrick Mooney",
+ "url": "https://github.com/pfmooney"
+ }
+ ],
+ "dependencies": {
+ "assert-plus": "0.1.x"
+ },
+ "description": "A light, featureful and explicit option parsing library.",
+ "devDependencies": {
+ "nodeunit": "0.9.x"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "0abf1af89a8f5129a81f18c2b35b21df22622f60",
+ "tarball": "http://registry.npmjs.org/dashdash/-/dashdash-1.10.1.tgz"
+ },
+ "engines": {
+ "node": ">=0.8"
+ },
+ "gitHead": "e95a66a095553ef045283b34d7615bf02f0dfaac",
+ "homepage": "https://github.com/trentm/node-dashdash",
+ "keywords": [
+ "args",
+ "cli",
+ "command",
+ "option",
+ "parser",
+ "parsing"
+ ],
+ "license": "MIT",
+ "main": "./lib/dashdash.js",
+ "maintainers": [
+ {
+ "name": "trentm",
+ "email": "trentm@gmail.com"
+ }
+ ],
+ "name": "dashdash",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/trentm/node-dashdash.git"
+ },
+ "scripts": {
+ "test": "nodeunit test/*.test.js"
+ },
+ "version": "1.10.1"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/.npmignore
new file mode 100644
index 000000000..a72b52ebe
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/.npmignore
@@ -0,0 +1,15 @@
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+node_modules
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/license.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/LICENSE
index c67e3532b..f668fefc6 100644
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/license.md
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/LICENSE
@@ -1,4 +1,6 @@
-# Copyright (c) 2015 Calvin Metcalf
+The MIT License (MIT)
+
+Copyright (c) 2014 Jeremie Miller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -10,10 +12,10 @@ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
-**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.**
+SOFTWARE. \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/README.md
new file mode 100644
index 000000000..b5d0b9de9
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/README.md
@@ -0,0 +1,8 @@
+ecc-jsbn
+========
+
+ECC package based on [jsbn](https://github.com/andyperlitch/jsbn) from [Tom Wu](http://www-cs-students.stanford.edu/~tjw/).
+
+This is a subset of the same interface as the [node compiled module](https://github.com/quartzjer/ecc), but works in the browser too.
+
+Also uses point compression now from [https://github.com/kaielvin](https://github.com/kaielvin/jsbn-ec-point-compression).
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/index.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/index.js
new file mode 100644
index 000000000..24372810b
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/index.js
@@ -0,0 +1,57 @@
+var crypto = require("crypto");
+var BigInteger = require("jsbn").BigInteger;
+var ECPointFp = require("./lib/ec.js").ECPointFp;
+exports.ECCurves = require("./lib/sec.js");
+
+// zero prepad
+function unstupid(hex,len)
+{
+ return (hex.length >= len) ? hex : unstupid("0"+hex,len);
+}
+
+exports.ECKey = function(curve, key, isPublic)
+{
+ var priv;
+ var c = curve();
+ var n = c.getN();
+ var bytes = Math.floor(n.bitLength()/8);
+
+ if(key)
+ {
+ if(isPublic)
+ {
+ var curve = c.getCurve();
+// var x = key.slice(1,bytes+1); // skip the 04 for uncompressed format
+// var y = key.slice(bytes+1);
+// this.P = new ECPointFp(curve,
+// curve.fromBigInteger(new BigInteger(x.toString("hex"), 16)),
+// curve.fromBigInteger(new BigInteger(y.toString("hex"), 16)));
+ this.P = curve.decodePointHex(key.toString("hex"));
+ }else{
+ if(key.length != bytes) return false;
+ priv = new BigInteger(key.toString("hex"), 16);
+ }
+ }else{
+ var n1 = n.subtract(BigInteger.ONE);
+ var r = new BigInteger(crypto.randomBytes(n.bitLength()));
+ priv = r.mod(n1).add(BigInteger.ONE);
+ this.P = c.getG().multiply(priv);
+ }
+ if(this.P)
+ {
+// var pubhex = unstupid(this.P.getX().toBigInteger().toString(16),bytes*2)+unstupid(this.P.getY().toBigInteger().toString(16),bytes*2);
+// this.PublicKey = new Buffer("04"+pubhex,"hex");
+ this.PublicKey = new Buffer(c.getCurve().encodeCompressedPointHex(this.P),"hex");
+ }
+ if(priv)
+ {
+ this.PrivateKey = new Buffer(unstupid(priv.toString(16),bytes*2),"hex");
+ this.deriveSharedSecret = function(key)
+ {
+ if(!key || !key.P) return false;
+ var S = key.P.multiply(priv);
+ return new Buffer(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex");
+ }
+ }
+}
+
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/LICENSE-jsbn b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/LICENSE-jsbn
new file mode 100644
index 000000000..24502a9cf
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/LICENSE-jsbn
@@ -0,0 +1,40 @@
+Licensing
+---------
+
+This software is covered under the following copyright:
+
+/*
+ * Copyright (c) 2003-2005 Tom Wu
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
+ * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * In addition, the following condition applies:
+ *
+ * All redistributions must retain an intact copy of this copyright notice
+ * and disclaimer.
+ */
+
+Address all questions regarding this license to:
+
+ Tom Wu
+ tjw@cs.Stanford.EDU
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/ec.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/ec.js
new file mode 100644
index 000000000..3852671ec
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/ec.js
@@ -0,0 +1,561 @@
+// Basic Javascript Elliptic Curve implementation
+// Ported loosely from BouncyCastle's Java EC code
+// Only Fp curves implemented for now
+
+// Requires jsbn.js and jsbn2.js
+var BigInteger = require('jsbn').BigInteger
+var Barrett = BigInteger.prototype.Barrett
+
+// ----------------
+// ECFieldElementFp
+
+// constructor
+function ECFieldElementFp(q,x) {
+ this.x = x;
+ // TODO if(x.compareTo(q) >= 0) error
+ this.q = q;
+}
+
+function feFpEquals(other) {
+ if(other == this) return true;
+ return (this.q.equals(other.q) && this.x.equals(other.x));
+}
+
+function feFpToBigInteger() {
+ return this.x;
+}
+
+function feFpNegate() {
+ return new ECFieldElementFp(this.q, this.x.negate().mod(this.q));
+}
+
+function feFpAdd(b) {
+ return new ECFieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q));
+}
+
+function feFpSubtract(b) {
+ return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q));
+}
+
+function feFpMultiply(b) {
+ return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q));
+}
+
+function feFpSquare() {
+ return new ECFieldElementFp(this.q, this.x.square().mod(this.q));
+}
+
+function feFpDivide(b) {
+ return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q));
+}
+
+ECFieldElementFp.prototype.equals = feFpEquals;
+ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger;
+ECFieldElementFp.prototype.negate = feFpNegate;
+ECFieldElementFp.prototype.add = feFpAdd;
+ECFieldElementFp.prototype.subtract = feFpSubtract;
+ECFieldElementFp.prototype.multiply = feFpMultiply;
+ECFieldElementFp.prototype.square = feFpSquare;
+ECFieldElementFp.prototype.divide = feFpDivide;
+
+// ----------------
+// ECPointFp
+
+// constructor
+function ECPointFp(curve,x,y,z) {
+ this.curve = curve;
+ this.x = x;
+ this.y = y;
+ // Projective coordinates: either zinv == null or z * zinv == 1
+ // z and zinv are just BigIntegers, not fieldElements
+ if(z == null) {
+ this.z = BigInteger.ONE;
+ }
+ else {
+ this.z = z;
+ }
+ this.zinv = null;
+ //TODO: compression flag
+}
+
+function pointFpGetX() {
+ if(this.zinv == null) {
+ this.zinv = this.z.modInverse(this.curve.q);
+ }
+ var r = this.x.toBigInteger().multiply(this.zinv);
+ this.curve.reduce(r);
+ return this.curve.fromBigInteger(r);
+}
+
+function pointFpGetY() {
+ if(this.zinv == null) {
+ this.zinv = this.z.modInverse(this.curve.q);
+ }
+ var r = this.y.toBigInteger().multiply(this.zinv);
+ this.curve.reduce(r);
+ return this.curve.fromBigInteger(r);
+}
+
+function pointFpEquals(other) {
+ if(other == this) return true;
+ if(this.isInfinity()) return other.isInfinity();
+ if(other.isInfinity()) return this.isInfinity();
+ var u, v;
+ // u = Y2 * Z1 - Y1 * Z2
+ u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q);
+ if(!u.equals(BigInteger.ZERO)) return false;
+ // v = X2 * Z1 - X1 * Z2
+ v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q);
+ return v.equals(BigInteger.ZERO);
+}
+
+function pointFpIsInfinity() {
+ if((this.x == null) && (this.y == null)) return true;
+ return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO);
+}
+
+function pointFpNegate() {
+ return new ECPointFp(this.curve, this.x, this.y.negate(), this.z);
+}
+
+function pointFpAdd(b) {
+ if(this.isInfinity()) return b;
+ if(b.isInfinity()) return this;
+
+ // u = Y2 * Z1 - Y1 * Z2
+ var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q);
+ // v = X2 * Z1 - X1 * Z2
+ var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q);
+
+ if(BigInteger.ZERO.equals(v)) {
+ if(BigInteger.ZERO.equals(u)) {
+ return this.twice(); // this == b, so double
+ }
+ return this.curve.getInfinity(); // this = -b, so infinity
+ }
+
+ var THREE = new BigInteger("3");
+ var x1 = this.x.toBigInteger();
+ var y1 = this.y.toBigInteger();
+ var x2 = b.x.toBigInteger();
+ var y2 = b.y.toBigInteger();
+
+ var v2 = v.square();
+ var v3 = v2.multiply(v);
+ var x1v2 = x1.multiply(v2);
+ var zu2 = u.square().multiply(this.z);
+
+ // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
+ var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q);
+ // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
+ var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q);
+ // z3 = v^3 * z1 * z2
+ var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q);
+
+ return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
+}
+
+function pointFpTwice() {
+ if(this.isInfinity()) return this;
+ if(this.y.toBigInteger().signum() == 0) return this.curve.getInfinity();
+
+ // TODO: optimized handling of constants
+ var THREE = new BigInteger("3");
+ var x1 = this.x.toBigInteger();
+ var y1 = this.y.toBigInteger();
+
+ var y1z1 = y1.multiply(this.z);
+ var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q);
+ var a = this.curve.a.toBigInteger();
+
+ // w = 3 * x1^2 + a * z1^2
+ var w = x1.square().multiply(THREE);
+ if(!BigInteger.ZERO.equals(a)) {
+ w = w.add(this.z.square().multiply(a));
+ }
+ w = w.mod(this.curve.q);
+ //this.curve.reduce(w);
+ // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
+ var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q);
+ // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
+ var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q);
+ // z3 = 8 * (y1 * z1)^3
+ var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q);
+
+ return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
+}
+
+// Simple NAF (Non-Adjacent Form) multiplication algorithm
+// TODO: modularize the multiplication algorithm
+function pointFpMultiply(k) {
+ if(this.isInfinity()) return this;
+ if(k.signum() == 0) return this.curve.getInfinity();
+
+ var e = k;
+ var h = e.multiply(new BigInteger("3"));
+
+ var neg = this.negate();
+ var R = this;
+
+ var i;
+ for(i = h.bitLength() - 2; i > 0; --i) {
+ R = R.twice();
+
+ var hBit = h.testBit(i);
+ var eBit = e.testBit(i);
+
+ if (hBit != eBit) {
+ R = R.add(hBit ? this : neg);
+ }
+ }
+
+ return R;
+}
+
+// Compute this*j + x*k (simultaneous multiplication)
+function pointFpMultiplyTwo(j,x,k) {
+ var i;
+ if(j.bitLength() > k.bitLength())
+ i = j.bitLength() - 1;
+ else
+ i = k.bitLength() - 1;
+
+ var R = this.curve.getInfinity();
+ var both = this.add(x);
+ while(i >= 0) {
+ R = R.twice();
+ if(j.testBit(i)) {
+ if(k.testBit(i)) {
+ R = R.add(both);
+ }
+ else {
+ R = R.add(this);
+ }
+ }
+ else {
+ if(k.testBit(i)) {
+ R = R.add(x);
+ }
+ }
+ --i;
+ }
+
+ return R;
+}
+
+ECPointFp.prototype.getX = pointFpGetX;
+ECPointFp.prototype.getY = pointFpGetY;
+ECPointFp.prototype.equals = pointFpEquals;
+ECPointFp.prototype.isInfinity = pointFpIsInfinity;
+ECPointFp.prototype.negate = pointFpNegate;
+ECPointFp.prototype.add = pointFpAdd;
+ECPointFp.prototype.twice = pointFpTwice;
+ECPointFp.prototype.multiply = pointFpMultiply;
+ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo;
+
+// ----------------
+// ECCurveFp
+
+// constructor
+function ECCurveFp(q,a,b) {
+ this.q = q;
+ this.a = this.fromBigInteger(a);
+ this.b = this.fromBigInteger(b);
+ this.infinity = new ECPointFp(this, null, null);
+ this.reducer = new Barrett(this.q);
+}
+
+function curveFpGetQ() {
+ return this.q;
+}
+
+function curveFpGetA() {
+ return this.a;
+}
+
+function curveFpGetB() {
+ return this.b;
+}
+
+function curveFpEquals(other) {
+ if(other == this) return true;
+ return(this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b));
+}
+
+function curveFpGetInfinity() {
+ return this.infinity;
+}
+
+function curveFpFromBigInteger(x) {
+ return new ECFieldElementFp(this.q, x);
+}
+
+function curveReduce(x) {
+ this.reducer.reduce(x);
+}
+
+// for now, work with hex strings because they're easier in JS
+function curveFpDecodePointHex(s) {
+ switch(parseInt(s.substr(0,2), 16)) { // first byte
+ case 0:
+ return this.infinity;
+ case 2:
+ case 3:
+ // point compression not supported yet
+ return null;
+ case 4:
+ case 6:
+ case 7:
+ var len = (s.length - 2) / 2;
+ var xHex = s.substr(2, len);
+ var yHex = s.substr(len+2, len);
+
+ return new ECPointFp(this,
+ this.fromBigInteger(new BigInteger(xHex, 16)),
+ this.fromBigInteger(new BigInteger(yHex, 16)));
+
+ default: // unsupported
+ return null;
+ }
+}
+
+function curveFpEncodePointHex(p) {
+ if (p.isInfinity()) return "00";
+ var xHex = p.getX().toBigInteger().toString(16);
+ var yHex = p.getY().toBigInteger().toString(16);
+ var oLen = this.getQ().toString(16).length;
+ if ((oLen % 2) != 0) oLen++;
+ while (xHex.length < oLen) {
+ xHex = "0" + xHex;
+ }
+ while (yHex.length < oLen) {
+ yHex = "0" + yHex;
+ }
+ return "04" + xHex + yHex;
+}
+
+ECCurveFp.prototype.getQ = curveFpGetQ;
+ECCurveFp.prototype.getA = curveFpGetA;
+ECCurveFp.prototype.getB = curveFpGetB;
+ECCurveFp.prototype.equals = curveFpEquals;
+ECCurveFp.prototype.getInfinity = curveFpGetInfinity;
+ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger;
+ECCurveFp.prototype.reduce = curveReduce;
+//ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex;
+ECCurveFp.prototype.encodePointHex = curveFpEncodePointHex;
+
+// from: https://github.com/kaielvin/jsbn-ec-point-compression
+ECCurveFp.prototype.decodePointHex = function(s)
+{
+ var yIsEven;
+ switch(parseInt(s.substr(0,2), 16)) { // first byte
+ case 0:
+ return this.infinity;
+ case 2:
+ yIsEven = false;
+ case 3:
+ if(yIsEven == undefined) yIsEven = true;
+ var len = s.length - 2;
+ var xHex = s.substr(2, len);
+ var x = this.fromBigInteger(new BigInteger(xHex,16));
+ var alpha = x.multiply(x.square().add(this.getA())).add(this.getB());
+ var beta = alpha.sqrt();
+
+ if (beta == null) throw "Invalid point compression";
+
+ var betaValue = beta.toBigInteger();
+ if (betaValue.testBit(0) != yIsEven)
+ {
+ // Use the other root
+ beta = this.fromBigInteger(this.getQ().subtract(betaValue));
+ }
+ return new ECPointFp(this,x,beta);
+ case 4:
+ case 6:
+ case 7:
+ var len = (s.length - 2) / 2;
+ var xHex = s.substr(2, len);
+ var yHex = s.substr(len+2, len);
+
+ return new ECPointFp(this,
+ this.fromBigInteger(new BigInteger(xHex, 16)),
+ this.fromBigInteger(new BigInteger(yHex, 16)));
+
+ default: // unsupported
+ return null;
+ }
+}
+ECCurveFp.prototype.encodeCompressedPointHex = function(p)
+{
+ if (p.isInfinity()) return "00";
+ var xHex = p.getX().toBigInteger().toString(16);
+ var oLen = this.getQ().toString(16).length;
+ if ((oLen % 2) != 0) oLen++;
+ while (xHex.length < oLen)
+ xHex = "0" + xHex;
+ var yPrefix;
+ if(p.getY().toBigInteger().isEven()) yPrefix = "02";
+ else yPrefix = "03";
+
+ return yPrefix + xHex;
+}
+
+
+ECFieldElementFp.prototype.getR = function()
+{
+ if(this.r != undefined) return this.r;
+
+ this.r = null;
+ var bitLength = this.q.bitLength();
+ if (bitLength > 128)
+ {
+ var firstWord = this.q.shiftRight(bitLength - 64);
+ if (firstWord.intValue() == -1)
+ {
+ this.r = BigInteger.ONE.shiftLeft(bitLength).subtract(this.q);
+ }
+ }
+ return this.r;
+}
+ECFieldElementFp.prototype.modMult = function(x1,x2)
+{
+ return this.modReduce(x1.multiply(x2));
+}
+ECFieldElementFp.prototype.modReduce = function(x)
+{
+ if (this.getR() != null)
+ {
+ var qLen = q.bitLength();
+ while (x.bitLength() > (qLen + 1))
+ {
+ var u = x.shiftRight(qLen);
+ var v = x.subtract(u.shiftLeft(qLen));
+ if (!this.getR().equals(BigInteger.ONE))
+ {
+ u = u.multiply(this.getR());
+ }
+ x = u.add(v);
+ }
+ while (x.compareTo(q) >= 0)
+ {
+ x = x.subtract(q);
+ }
+ }
+ else
+ {
+ x = x.mod(q);
+ }
+ return x;
+}
+ECFieldElementFp.prototype.sqrt = function()
+{
+ if (!this.q.testBit(0)) throw "unsupported";
+
+ // p mod 4 == 3
+ if (this.q.testBit(1))
+ {
+ var z = new ECFieldElementFp(this.q,this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),this.q));
+ return z.square().equals(this) ? z : null;
+ }
+
+ // p mod 4 == 1
+ var qMinusOne = this.q.subtract(BigInteger.ONE);
+
+ var legendreExponent = qMinusOne.shiftRight(1);
+ if (!(this.x.modPow(legendreExponent, this.q).equals(BigInteger.ONE)))
+ {
+ return null;
+ }
+
+ var u = qMinusOne.shiftRight(2);
+ var k = u.shiftLeft(1).add(BigInteger.ONE);
+
+ var Q = this.x;
+ var fourQ = modDouble(modDouble(Q));
+
+ var U, V;
+ do
+ {
+ var P;
+ do
+ {
+ P = new BigInteger(this.q.bitLength(), new SecureRandom());
+ }
+ while (P.compareTo(this.q) >= 0
+ || !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, this.q).equals(qMinusOne)));
+
+ var result = this.lucasSequence(P, Q, k);
+ U = result[0];
+ V = result[1];
+
+ if (this.modMult(V, V).equals(fourQ))
+ {
+ // Integer division by 2, mod q
+ if (V.testBit(0))
+ {
+ V = V.add(q);
+ }
+
+ V = V.shiftRight(1);
+
+ return new ECFieldElementFp(q,V);
+ }
+ }
+ while (U.equals(BigInteger.ONE) || U.equals(qMinusOne));
+
+ return null;
+}
+ECFieldElementFp.prototype.lucasSequence = function(P,Q,k)
+{
+ var n = k.bitLength();
+ var s = k.getLowestSetBit();
+
+ var Uh = BigInteger.ONE;
+ var Vl = BigInteger.TWO;
+ var Vh = P;
+ var Ql = BigInteger.ONE;
+ var Qh = BigInteger.ONE;
+
+ for (var j = n - 1; j >= s + 1; --j)
+ {
+ Ql = this.modMult(Ql, Qh);
+
+ if (k.testBit(j))
+ {
+ Qh = this.modMult(Ql, Q);
+ Uh = this.modMult(Uh, Vh);
+ Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
+ Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1)));
+ }
+ else
+ {
+ Qh = Ql;
+ Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql));
+ Vh = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
+ Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1)));
+ }
+ }
+
+ Ql = this.modMult(Ql, Qh);
+ Qh = this.modMult(Ql, Q);
+ Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql));
+ Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
+ Ql = this.modMult(Ql, Qh);
+
+ for (var j = 1; j <= s; ++j)
+ {
+ Uh = this.modMult(Uh, Vl);
+ Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1)));
+ Ql = this.modMult(Ql, Ql);
+ }
+
+ return [ Uh, Vl ];
+}
+
+var exports = {
+ ECCurveFp: ECCurveFp,
+ ECPointFp: ECPointFp,
+ ECFieldElementFp: ECFieldElementFp
+}
+
+module.exports = exports
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/sec.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/sec.js
new file mode 100644
index 000000000..5eec8179f
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/sec.js
@@ -0,0 +1,170 @@
+// Named EC curves
+
+// Requires ec.js, jsbn.js, and jsbn2.js
+var BigInteger = require('jsbn').BigInteger
+var ECCurveFp = require('./ec.js').ECCurveFp
+
+
+// ----------------
+// X9ECParameters
+
+// constructor
+function X9ECParameters(curve,g,n,h) {
+ this.curve = curve;
+ this.g = g;
+ this.n = n;
+ this.h = h;
+}
+
+function x9getCurve() {
+ return this.curve;
+}
+
+function x9getG() {
+ return this.g;
+}
+
+function x9getN() {
+ return this.n;
+}
+
+function x9getH() {
+ return this.h;
+}
+
+X9ECParameters.prototype.getCurve = x9getCurve;
+X9ECParameters.prototype.getG = x9getG;
+X9ECParameters.prototype.getN = x9getN;
+X9ECParameters.prototype.getH = x9getH;
+
+// ----------------
+// SECNamedCurves
+
+function fromHex(s) { return new BigInteger(s, 16); }
+
+function secp128r1() {
+ // p = 2^128 - 2^97 - 1
+ var p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF");
+ var a = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC");
+ var b = fromHex("E87579C11079F43DD824993C2CEE5ED3");
+ //byte[] S = Hex.decode("000E0D4D696E6768756151750CC03A4473D03679");
+ var n = fromHex("FFFFFFFE0000000075A30D1B9038A115");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "161FF7528B899B2D0C28607CA52C5B86"
+ + "CF5AC8395BAFEB13C02DA292DDED7A83");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp160k1() {
+ // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73");
+ var a = BigInteger.ZERO;
+ var b = fromHex("7");
+ //byte[] S = null;
+ var n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"
+ + "938CF935318FDCED6BC28286531733C3F03C4FEE");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp160r1() {
+ // p = 2^160 - 2^31 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF");
+ var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC");
+ var b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45");
+ //byte[] S = Hex.decode("1053CDE42C14D696E67687561517533BF3F83345");
+ var n = fromHex("0100000000000000000001F4C8F927AED3CA752257");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "4A96B5688EF573284664698968C38BB913CBFC82"
+ + "23A628553168947D59DCC912042351377AC5FB32");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp192k1() {
+ // p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37");
+ var a = BigInteger.ZERO;
+ var b = fromHex("3");
+ //byte[] S = null;
+ var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D"
+ + "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp192r1() {
+ // p = 2^192 - 2^64 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF");
+ var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC");
+ var b = fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1");
+ //byte[] S = Hex.decode("3045AE6FC8422F64ED579528D38120EAE12196D5");
+ var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"
+ + "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp224r1() {
+ // p = 2^224 - 2^96 + 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001");
+ var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE");
+ var b = fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4");
+ //byte[] S = Hex.decode("BD71344799D5C7FCDC45B59FA3B9AB8F6A948BC5");
+ var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21"
+ + "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp256r1() {
+ // p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1
+ var p = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF");
+ var a = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC");
+ var b = fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B");
+ //byte[] S = Hex.decode("C49D360886E704936A6678E1139D26B7819F7E90");
+ var n = fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"
+ + "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+// TODO: make this into a proper hashtable
+function getSECCurveByName(name) {
+ if(name == "secp128r1") return secp128r1();
+ if(name == "secp160k1") return secp160k1();
+ if(name == "secp160r1") return secp160r1();
+ if(name == "secp192k1") return secp192k1();
+ if(name == "secp192r1") return secp192r1();
+ if(name == "secp224r1") return secp224r1();
+ if(name == "secp256r1") return secp256r1();
+ return null;
+}
+
+module.exports = {
+ "secp128r1":secp128r1,
+ "secp160k1":secp160k1,
+ "secp160r1":secp160r1,
+ "secp192k1":secp192k1,
+ "secp192r1":secp192r1,
+ "secp224r1":secp224r1,
+ "secp256r1":secp256r1
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/package.json
new file mode 100644
index 000000000..ec581d9a9
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/package.json
@@ -0,0 +1,82 @@
+{
+ "_args": [
+ [
+ "ecc-jsbn@>=0.0.1 <1.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk"
+ ]
+ ],
+ "_from": "ecc-jsbn@>=0.0.1 <1.0.0",
+ "_id": "ecc-jsbn@0.1.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/ecc-jsbn",
+ "_nodeVersion": "0.12.6",
+ "_npmUser": {
+ "email": "jeremie@jabber.org",
+ "name": "quartzjer"
+ },
+ "_npmVersion": "2.11.2",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "ecc-jsbn",
+ "raw": "ecc-jsbn@>=0.0.1 <1.0.0",
+ "rawSpec": ">=0.0.1 <1.0.0",
+ "scope": null,
+ "spec": ">=0.0.1 <1.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk"
+ ],
+ "_resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
+ "_shasum": "0fc73a9ed5f0d53c38193398523ef7e543777505",
+ "_shrinkwrap": null,
+ "_spec": "ecc-jsbn@>=0.0.1 <1.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk",
+ "author": {
+ "email": "jeremie@jabber.org",
+ "name": "Jeremie Miller",
+ "url": "http://jeremie.com/"
+ },
+ "bugs": {
+ "url": "https://github.com/quartzjer/ecc-jsbn/issues"
+ },
+ "dependencies": {
+ "jsbn": "~0.1.0"
+ },
+ "description": "ECC JS code based on JSBN",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "0fc73a9ed5f0d53c38193398523ef7e543777505",
+ "tarball": "http://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz"
+ },
+ "gitHead": "d35a360352496721030da645e8054f07efc22487",
+ "homepage": "https://github.com/quartzjer/ecc-jsbn",
+ "keywords": [
+ "browserify",
+ "ecc",
+ "jsbn"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "quartzjer",
+ "email": "jeremie@jabber.org"
+ },
+ {
+ "name": "rynomad",
+ "email": "nomad.ry@gmail.com"
+ }
+ ],
+ "name": "ecc-jsbn",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/quartzjer/ecc-jsbn.git"
+ },
+ "scripts": {},
+ "version": "0.1.1"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/test.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/test.js
new file mode 100644
index 000000000..bd52abfd9
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/test.js
@@ -0,0 +1,14 @@
+var ecc = require("./index.js");
+var key1 = new ecc.ECKey(ecc.ECCurves.secp160r1);
+var key2 = new ecc.ECKey(ecc.ECCurves.secp160r1);
+console.log(key1.deriveSharedSecret(key2));
+var key3 = new ecc.ECKey(ecc.ECCurves.secp160r1,key1.PrivateKey);
+var key4 = new ecc.ECKey(ecc.ECCurves.secp160r1,key2.PublicKey,true);
+console.log(key3.deriveSharedSecret(key4));
+
+var key1 = new ecc.ECKey(ecc.ECCurves.secp256r1);
+var key2 = new ecc.ECKey(ecc.ECCurves.secp256r1);
+console.log(key1.deriveSharedSecret(key2));
+var key3 = new ecc.ECKey(ecc.ECCurves.secp256r1,key1.PrivateKey);
+var key4 = new ecc.ECKey(ecc.ECCurves.secp256r1,key2.PublicKey,true);
+console.log(key3.deriveSharedSecret(key4));
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.npmignore
new file mode 100644
index 000000000..877830c06
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.npmignore
@@ -0,0 +1,11 @@
+# Editor, IDE and dev environment stuff
+*~
+.project
+.settings
+
+# Build files and directories
+/coverage
+/doc/api
+/build/
+/test/
+/jodid25519-*.tgz
diff --git a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/.travis.yml b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.travis.yml
index 5ac988553..92a990f67 100644
--- a/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/.travis.yml
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.travis.yml
@@ -1,7 +1,7 @@
language: node_js
node_js:
- - "0.8"
- "0.10"
- "0.11"
- - "0.12"
- - "iojs"
+branches:
+ only:
+ - master
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/AUTHORS.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/AUTHORS.md
new file mode 100644
index 000000000..0c1709737
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/AUTHORS.md
@@ -0,0 +1,3 @@
+* Michele Bini (original Curve25519 core code: curve25519.js)
+* Ron Garret (original Ed25519 code: fast-djbec.js)
+* Guy Kloss (package refactoring, unit testing)
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/LICENSE
new file mode 100644
index 000000000..c722113b2
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/LICENSE
@@ -0,0 +1,23 @@
+The MIT License (MIT)
+
+Copyright (c) 2012 Ron Garret
+Copyright (c) 2007, 2013, 2014 Michele Bini
+Copyright (c) 2014 Mega Limited
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/README.md
new file mode 100644
index 000000000..5335b2dec
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/README.md
@@ -0,0 +1,51 @@
+Jodid25519 [![Build Status](https://secure.travis-ci.org/meganz/jodid25519.png)](https://travis-ci.org/meganz/jodid25519)
+===================================================================================================================================
+
+Javascript implementation of the Curve25519 and Ed25519 elliptic cryptography functions by Daniel J. Bernstein.
+
+For the API, please consult the generated documentation under doc/ (you can run `make` to generate it).
+
+To run the tests do the following on the console from the project's root directory:
+
+ $ npm install
+ $ make test
+
+
+Contributors
+------------
+
+If you are one of the contributors and want to add yourself or change the information here, please do submit a pull request. Contributors appear in no particular order.
+
+### For the Curve25519 submodule
+
+* [Graydon Hoare](https://github.com/graydon): suggested clamping the private key by default for increased safety and uniformity with other implementations.
+* [liliakai](https://github.com/liliakai): spotted an unused argument in some of the functions
+* [RyanC](https://github.com/ryancdotorg): removed dependency of a function to the Javascript Math library
+* [Guy Kloss](https://github.com/pohutukawa): performance improvements through bit-shift operations, performance and conformance testing, documentation, compatibility with the npm package ecosystem, and more
+* [Michele Bini](https://github.com/rev22): originally wrote the Javascript implementation
+
+
+Copyright and MIT licensing
+---------------------------
+
+* Copyright (c) 2012 Ron Garret
+* Copyright (c) 2007, 2013, 2014 Michele Bini <michele.bini@gmail.com>
+* Copyright (c) 2014 Mega Limited
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.0 b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.0
new file mode 100644
index 000000000..55ffcc47c
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.0
@@ -0,0 +1,42 @@
+/*
+ * Curve 25519-based cryptography collection.
+ *
+ * EC Diffie-Hellman (ECDH) based on Curve25519 and digital signatures (EdDSA)
+ * based on Ed25519.
+ *
+ * Copyright (c) 2012 Ron Garret
+ * Copyright (c) 2007, 2013, 2014 Michele Bini
+ * Copyright (c) 2014 Mega Limited
+ * under the MIT License.
+ *
+ * You should have received a copy of the license along with this program.
+ */
+// See https://github.com/jrburke/almond#exporting-a-public-api
+(function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // Allow using this built library as an AMD module
+ // in another project. That other project will only
+ // see this AMD call, not the internal modules in
+ // the closure below.
+ define([], factory);
+ } else if (typeof module === 'object' && module.exports) {
+ // Allow using this built library as a CommonJS module
+ module.exports = factory();
+ } else {
+ // Browser globals case. Just assign the
+ // result to a property on the global.
+ root.jodid25519 = factory();
+ }
+}(this, function () {
+ if (typeof module === 'object' && module.exports) {
+ // If we're running under CommonJS, our dependencies get confused and
+ // each clobber module.exports which leads to bad behaviour because
+ // almond does asynchronous loading. So just pretend we're in the
+ // browser globals case, and make them write to those values instead.
+ // TODO: ditch requirejs/almond and use browserify or something.
+ var __oldModule = module;
+ var __oldExports = exports;
+ var window = global;
+ module = undefined;
+ exports = undefined;
+ }
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.1 b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.1
new file mode 100644
index 000000000..cdb5e6728
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.1
@@ -0,0 +1,13 @@
+ if (typeof module === 'object' && module.exports) {
+ // Restore CommonJS exports once our dependencies have all finished
+ // loading.
+ module = __oldModule;
+ exports = __oldExports;
+ }
+ // The modules for your project will be inlined above
+ // this snippet. Ask almond to synchronously require the
+ // module value for 'main' here and return it as the
+ // value to use for the public API for the built file.
+ return require('jodid25519');
+}));
+// See https://github.com/jrburke/almond#exporting-a-public-api
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/index.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/index.js
new file mode 100644
index 000000000..870983984
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/index.js
@@ -0,0 +1,35 @@
+"use strict";
+
+/*
+ * Copyright (c) 2014 Mega Limited
+ * under the MIT License.
+ *
+ * Authors: Guy K. Kloss
+ *
+ * You should have received a copy of the license along with this program.
+ */
+
+var dh = require('./lib/dh');
+var eddsa = require('./lib/eddsa');
+var curve255 = require('./lib/curve255');
+var utils = require('./lib/utils');
+
+ /**
+ * @exports jodid25519
+ * Curve 25519-based cryptography collection.
+ *
+ * @description
+ * EC Diffie-Hellman (ECDH) based on Curve25519 and digital signatures
+ * (EdDSA) based on Ed25519.
+ */
+ var ns = {};
+
+ /** Module version indicator as string (format: [major.minor.patch]). */
+ ns.VERSION = '0.7.1';
+
+ ns.dh = dh;
+ ns.eddsa = eddsa;
+ ns.curve255 = curve255;
+ ns.utils = utils;
+
+module.exports = ns;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/jsdoc.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/jsdoc.json
new file mode 100644
index 000000000..21eba9bd6
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/jsdoc.json
@@ -0,0 +1,19 @@
+{
+ "templates": {
+ "applicationName": "jodid25519 Library",
+ "disqus": "",
+ "googleAnalytics": "",
+ "openGraph": {
+ "title": "jodid25519 Library",
+ "type": "website",
+ "image": "",
+ "site_name": "",
+ "url": ""
+ },
+ "meta": {
+ "title": "jodid25519 Library",
+ "description": "",
+ "keyword": ""
+ }
+ }
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/core.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/core.js
new file mode 100644
index 000000000..f78fd74dd
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/core.js
@@ -0,0 +1,481 @@
+"use strict";
+/**
+ * @fileOverview
+ * Core operations on curve 25519 required for the higher level modules.
+ */
+
+/*
+ * Copyright (c) 2007, 2013, 2014 Michele Bini
+ * Copyright (c) 2014 Mega Limited
+ * under the MIT License.
+ *
+ * Authors: Guy K. Kloss, Michele Bini
+ *
+ * You should have received a copy of the license along with this program.
+ */
+
+var crypto = require('crypto');
+
+ /**
+ * @exports jodid25519/core
+ * Core operations on curve 25519 required for the higher level modules.
+ *
+ * @description
+ * Core operations on curve 25519 required for the higher level modules.
+ *
+ * <p>
+ * This core code is extracted from Michele Bini's curve255.js implementation,
+ * which is used as a base for Curve25519 ECDH and Ed25519 EdDSA operations.
+ * </p>
+ */
+ var ns = {};
+
+ function _setbit(n, c, v) {
+ var i = c >> 4;
+ var a = n[i];
+ a = a + (1 << (c & 0xf)) * v;
+ n[i] = a;
+ }
+
+ function _getbit(n, c) {
+ return (n[c >> 4] >> (c & 0xf)) & 1;
+ }
+
+ function _ZERO() {
+ return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ }
+
+ function _ONE() {
+ return [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ }
+
+ // Basepoint.
+ function _BASE() {
+ return [9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ }
+
+ // return -1, 0, +1 when a is less than, equal, or greater than b
+ function _bigintcmp(a, b) {
+ // The following code is a bit tricky to avoid code branching
+ var c, abs_r, mask;
+ var r = 0;
+ for (c = 15; c >= 0; c--) {
+ var x = a[c];
+ var y = b[c];
+ r = r + (x - y) * (1 - r * r);
+ // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs
+ // correct for [-294967295, 294967295]
+ mask = r >> 31;
+ abs_r = (r + mask) ^ mask;
+ // http://stackoverflow.com/questions/596467/how-do-i-convert-a-number-to-an-integer-in-javascript
+ // this rounds towards zero
+ r = ~~((r << 1) / (abs_r + 1));
+ }
+ return r;
+ }
+
+ function _bigintadd(a, b) {
+ var r = [];
+ var v;
+ r[0] = (v = a[0] + b[0]) & 0xffff;
+ r[1] = (v = (v >>> 16) + a[1] + b[1]) & 0xffff;
+ r[2] = (v = (v >>> 16) + a[2] + b[2]) & 0xffff;
+ r[3] = (v = (v >>> 16) + a[3] + b[3]) & 0xffff;
+ r[4] = (v = (v >>> 16) + a[4] + b[4]) & 0xffff;
+ r[5] = (v = (v >>> 16) + a[5] + b[5]) & 0xffff;
+ r[6] = (v = (v >>> 16) + a[6] + b[6]) & 0xffff;
+ r[7] = (v = (v >>> 16) + a[7] + b[7]) & 0xffff;
+ r[8] = (v = (v >>> 16) + a[8] + b[8]) & 0xffff;
+ r[9] = (v = (v >>> 16) + a[9] + b[9]) & 0xffff;
+ r[10] = (v = (v >>> 16) + a[10] + b[10]) & 0xffff;
+ r[11] = (v = (v >>> 16) + a[11] + b[11]) & 0xffff;
+ r[12] = (v = (v >>> 16) + a[12] + b[12]) & 0xffff;
+ r[13] = (v = (v >>> 16) + a[13] + b[13]) & 0xffff;
+ r[14] = (v = (v >>> 16) + a[14] + b[14]) & 0xffff;
+ r[15] = (v >>> 16) + a[15] + b[15];
+ return r;
+ }
+
+ function _bigintsub(a, b) {
+ var r = [];
+ var v;
+ r[0] = (v = 0x80000 + a[0] - b[0]) & 0xffff;
+ r[1] = (v = (v >>> 16) + 0x7fff8 + a[1] - b[1]) & 0xffff;
+ r[2] = (v = (v >>> 16) + 0x7fff8 + a[2] - b[2]) & 0xffff;
+ r[3] = (v = (v >>> 16) + 0x7fff8 + a[3] - b[3]) & 0xffff;
+ r[4] = (v = (v >>> 16) + 0x7fff8 + a[4] - b[4]) & 0xffff;
+ r[5] = (v = (v >>> 16) + 0x7fff8 + a[5] - b[5]) & 0xffff;
+ r[6] = (v = (v >>> 16) + 0x7fff8 + a[6] - b[6]) & 0xffff;
+ r[7] = (v = (v >>> 16) + 0x7fff8 + a[7] - b[7]) & 0xffff;
+ r[8] = (v = (v >>> 16) + 0x7fff8 + a[8] - b[8]) & 0xffff;
+ r[9] = (v = (v >>> 16) + 0x7fff8 + a[9] - b[9]) & 0xffff;
+ r[10] = (v = (v >>> 16) + 0x7fff8 + a[10] - b[10]) & 0xffff;
+ r[11] = (v = (v >>> 16) + 0x7fff8 + a[11] - b[11]) & 0xffff;
+ r[12] = (v = (v >>> 16) + 0x7fff8 + a[12] - b[12]) & 0xffff;
+ r[13] = (v = (v >>> 16) + 0x7fff8 + a[13] - b[13]) & 0xffff;
+ r[14] = (v = (v >>> 16) + 0x7fff8 + a[14] - b[14]) & 0xffff;
+ r[15] = (v >>> 16) - 8 + a[15] - b[15];
+ return r;
+ }
+
+ function _sqr8h(a7, a6, a5, a4, a3, a2, a1, a0) {
+ // 'division by 0x10000' can not be replaced by '>> 16' because
+ // more than 32 bits of precision are needed similarly
+ // 'multiplication by 2' cannot be replaced by '<< 1'
+ var r = [];
+ var v;
+ r[0] = (v = a0 * a0) & 0xffff;
+ r[1] = (v = (0 | (v / 0x10000)) + 2 * a0 * a1) & 0xffff;
+ r[2] = (v = (0 | (v / 0x10000)) + 2 * a0 * a2 + a1 * a1) & 0xffff;
+ r[3] = (v = (0 | (v / 0x10000)) + 2 * a0 * a3 + 2 * a1 * a2) & 0xffff;
+ r[4] = (v = (0 | (v / 0x10000)) + 2 * a0 * a4 + 2 * a1 * a3 + a2
+ * a2) & 0xffff;
+ r[5] = (v = (0 | (v / 0x10000)) + 2 * a0 * a5 + 2 * a1 * a4 + 2
+ * a2 * a3) & 0xffff;
+ r[6] = (v = (0 | (v / 0x10000)) + 2 * a0 * a6 + 2 * a1 * a5 + 2
+ * a2 * a4 + a3 * a3) & 0xffff;
+ r[7] = (v = (0 | (v / 0x10000)) + 2 * a0 * a7 + 2 * a1 * a6 + 2
+ * a2 * a5 + 2 * a3 * a4) & 0xffff;
+ r[8] = (v = (0 | (v / 0x10000)) + 2 * a1 * a7 + 2 * a2 * a6 + 2
+ * a3 * a5 + a4 * a4) & 0xffff;
+ r[9] = (v = (0 | (v / 0x10000)) + 2 * a2 * a7 + 2 * a3 * a6 + 2
+ * a4 * a5) & 0xffff;
+ r[10] = (v = (0 | (v / 0x10000)) + 2 * a3 * a7 + 2 * a4 * a6
+ + a5 * a5) & 0xffff;
+ r[11] = (v = (0 | (v / 0x10000)) + 2 * a4 * a7 + 2 * a5 * a6) & 0xffff;
+ r[12] = (v = (0 | (v / 0x10000)) + 2 * a5 * a7 + a6 * a6) & 0xffff;
+ r[13] = (v = (0 | (v / 0x10000)) + 2 * a6 * a7) & 0xffff;
+ r[14] = (v = (0 | (v / 0x10000)) + a7 * a7) & 0xffff;
+ r[15] = 0 | (v / 0x10000);
+ return r;
+ }
+
+ function _sqrmodp(a) {
+ var x = _sqr8h(a[15], a[14], a[13], a[12], a[11], a[10], a[9],
+ a[8]);
+ var z = _sqr8h(a[7], a[6], a[5], a[4], a[3], a[2], a[1], a[0]);
+ var y = _sqr8h(a[15] + a[7], a[14] + a[6], a[13] + a[5], a[12]
+ + a[4],
+ a[11] + a[3], a[10] + a[2], a[9] + a[1], a[8]
+ + a[0]);
+ var r = [];
+ var v;
+ r[0] = (v = 0x800000 + z[0] + (y[8] - x[8] - z[8] + x[0] - 0x80)
+ * 38) & 0xffff;
+ r[1] = (v = 0x7fff80 + (v >>> 16) + z[1]
+ + (y[9] - x[9] - z[9] + x[1]) * 38) & 0xffff;
+ r[2] = (v = 0x7fff80 + (v >>> 16) + z[2]
+ + (y[10] - x[10] - z[10] + x[2]) * 38) & 0xffff;
+ r[3] = (v = 0x7fff80 + (v >>> 16) + z[3]
+ + (y[11] - x[11] - z[11] + x[3]) * 38) & 0xffff;
+ r[4] = (v = 0x7fff80 + (v >>> 16) + z[4]
+ + (y[12] - x[12] - z[12] + x[4]) * 38) & 0xffff;
+ r[5] = (v = 0x7fff80 + (v >>> 16) + z[5]
+ + (y[13] - x[13] - z[13] + x[5]) * 38) & 0xffff;
+ r[6] = (v = 0x7fff80 + (v >>> 16) + z[6]
+ + (y[14] - x[14] - z[14] + x[6]) * 38) & 0xffff;
+ r[7] = (v = 0x7fff80 + (v >>> 16) + z[7]
+ + (y[15] - x[15] - z[15] + x[7]) * 38) & 0xffff;
+ r[8] = (v = 0x7fff80 + (v >>> 16) + z[8] + y[0] - x[0] - z[0]
+ + x[8] * 38) & 0xffff;
+ r[9] = (v = 0x7fff80 + (v >>> 16) + z[9] + y[1] - x[1] - z[1]
+ + x[9] * 38) & 0xffff;
+ r[10] = (v = 0x7fff80 + (v >>> 16) + z[10] + y[2] - x[2] - z[2]
+ + x[10] * 38) & 0xffff;
+ r[11] = (v = 0x7fff80 + (v >>> 16) + z[11] + y[3] - x[3] - z[3]
+ + x[11] * 38) & 0xffff;
+ r[12] = (v = 0x7fff80 + (v >>> 16) + z[12] + y[4] - x[4] - z[4]
+ + x[12] * 38) & 0xffff;
+ r[13] = (v = 0x7fff80 + (v >>> 16) + z[13] + y[5] - x[5] - z[5]
+ + x[13] * 38) & 0xffff;
+ r[14] = (v = 0x7fff80 + (v >>> 16) + z[14] + y[6] - x[6] - z[6]
+ + x[14] * 38) & 0xffff;
+ r[15] = 0x7fff80 + (v >>> 16) + z[15] + y[7] - x[7] - z[7]
+ + x[15] * 38;
+ _reduce(r);
+ return r;
+ }
+
+ function _mul8h(a7, a6, a5, a4, a3, a2, a1, a0, b7, b6, b5, b4, b3,
+ b2, b1, b0) {
+ // 'division by 0x10000' can not be replaced by '>> 16' because
+ // more than 32 bits of precision are needed
+ var r = [];
+ var v;
+ r[0] = (v = a0 * b0) & 0xffff;
+ r[1] = (v = (0 | (v / 0x10000)) + a0 * b1 + a1 * b0) & 0xffff;
+ r[2] = (v = (0 | (v / 0x10000)) + a0 * b2 + a1 * b1 + a2 * b0) & 0xffff;
+ r[3] = (v = (0 | (v / 0x10000)) + a0 * b3 + a1 * b2 + a2 * b1
+ + a3 * b0) & 0xffff;
+ r[4] = (v = (0 | (v / 0x10000)) + a0 * b4 + a1 * b3 + a2 * b2
+ + a3 * b1 + a4 * b0) & 0xffff;
+ r[5] = (v = (0 | (v / 0x10000)) + a0 * b5 + a1 * b4 + a2 * b3
+ + a3 * b2 + a4 * b1 + a5 * b0) & 0xffff;
+ r[6] = (v = (0 | (v / 0x10000)) + a0 * b6 + a1 * b5 + a2 * b4
+ + a3 * b3 + a4 * b2 + a5 * b1 + a6 * b0) & 0xffff;
+ r[7] = (v = (0 | (v / 0x10000)) + a0 * b7 + a1 * b6 + a2 * b5
+ + a3 * b4 + a4 * b3 + a5 * b2 + a6 * b1 + a7 * b0) & 0xffff;
+ r[8] = (v = (0 | (v / 0x10000)) + a1 * b7 + a2 * b6 + a3 * b5
+ + a4 * b4 + a5 * b3 + a6 * b2 + a7 * b1) & 0xffff;
+ r[9] = (v = (0 | (v / 0x10000)) + a2 * b7 + a3 * b6 + a4 * b5
+ + a5 * b4 + a6 * b3 + a7 * b2) & 0xffff;
+ r[10] = (v = (0 | (v / 0x10000)) + a3 * b7 + a4 * b6 + a5 * b5
+ + a6 * b4 + a7 * b3) & 0xffff;
+ r[11] = (v = (0 | (v / 0x10000)) + a4 * b7 + a5 * b6 + a6 * b5
+ + a7 * b4) & 0xffff;
+ r[12] = (v = (0 | (v / 0x10000)) + a5 * b7 + a6 * b6 + a7 * b5) & 0xffff;
+ r[13] = (v = (0 | (v / 0x10000)) + a6 * b7 + a7 * b6) & 0xffff;
+ r[14] = (v = (0 | (v / 0x10000)) + a7 * b7) & 0xffff;
+ r[15] = (0 | (v / 0x10000));
+ return r;
+ }
+
+ function _mulmodp(a, b) {
+ // Karatsuba multiplication scheme: x*y = (b^2+b)*x1*y1 -
+ // b*(x1-x0)*(y1-y0) + (b+1)*x0*y0
+ var x = _mul8h(a[15], a[14], a[13], a[12], a[11], a[10], a[9],
+ a[8], b[15], b[14], b[13], b[12], b[11], b[10],
+ b[9], b[8]);
+ var z = _mul8h(a[7], a[6], a[5], a[4], a[3], a[2], a[1], a[0],
+ b[7], b[6], b[5], b[4], b[3], b[2], b[1], b[0]);
+ var y = _mul8h(a[15] + a[7], a[14] + a[6], a[13] + a[5], a[12]
+ + a[4],
+ a[11] + a[3], a[10] + a[2], a[9] + a[1], a[8]
+ + a[0],
+ b[15] + b[7], b[14] + b[6], b[13] + b[5], b[12]
+ + b[4],
+ b[11] + b[3], b[10] + b[2], b[9] + b[1], b[8]
+ + b[0]);
+ var r = [];
+ var v;
+ r[0] = (v = 0x800000 + z[0] + (y[8] - x[8] - z[8] + x[0] - 0x80)
+ * 38) & 0xffff;
+ r[1] = (v = 0x7fff80 + (v >>> 16) + z[1]
+ + (y[9] - x[9] - z[9] + x[1]) * 38) & 0xffff;
+ r[2] = (v = 0x7fff80 + (v >>> 16) + z[2]
+ + (y[10] - x[10] - z[10] + x[2]) * 38) & 0xffff;
+ r[3] = (v = 0x7fff80 + (v >>> 16) + z[3]
+ + (y[11] - x[11] - z[11] + x[3]) * 38) & 0xffff;
+ r[4] = (v = 0x7fff80 + (v >>> 16) + z[4]
+ + (y[12] - x[12] - z[12] + x[4]) * 38) & 0xffff;
+ r[5] = (v = 0x7fff80 + (v >>> 16) + z[5]
+ + (y[13] - x[13] - z[13] + x[5]) * 38) & 0xffff;
+ r[6] = (v = 0x7fff80 + (v >>> 16) + z[6]
+ + (y[14] - x[14] - z[14] + x[6]) * 38) & 0xffff;
+ r[7] = (v = 0x7fff80 + (v >>> 16) + z[7]
+ + (y[15] - x[15] - z[15] + x[7]) * 38) & 0xffff;
+ r[8] = (v = 0x7fff80 + (v >>> 16) + z[8] + y[0] - x[0] - z[0]
+ + x[8] * 38) & 0xffff;
+ r[9] = (v = 0x7fff80 + (v >>> 16) + z[9] + y[1] - x[1] - z[1]
+ + x[9] * 38) & 0xffff;
+ r[10] = (v = 0x7fff80 + (v >>> 16) + z[10] + y[2] - x[2] - z[2]
+ + x[10] * 38) & 0xffff;
+ r[11] = (v = 0x7fff80 + (v >>> 16) + z[11] + y[3] - x[3] - z[3]
+ + x[11] * 38) & 0xffff;
+ r[12] = (v = 0x7fff80 + (v >>> 16) + z[12] + y[4] - x[4] - z[4]
+ + x[12] * 38) & 0xffff;
+ r[13] = (v = 0x7fff80 + (v >>> 16) + z[13] + y[5] - x[5] - z[5]
+ + x[13] * 38) & 0xffff;
+ r[14] = (v = 0x7fff80 + (v >>> 16) + z[14] + y[6] - x[6] - z[6]
+ + x[14] * 38) & 0xffff;
+ r[15] = 0x7fff80 + (v >>> 16) + z[15] + y[7] - x[7] - z[7]
+ + x[15] * 38;
+ _reduce(r);
+ return r;
+ }
+
+ function _reduce(arr) {
+ var aCopy = arr.slice(0);
+ var choice = [arr, aCopy];
+ var v = arr[15];
+ // Use the dummy copy instead of just returning to be more constant time.
+ var a = choice[(v < 0x8000) & 1];
+ a[15] = v & 0x7fff;
+ // >32-bits of precision are required here so '/ 0x8000' can not be
+ // replaced by the arithmetic equivalent '>>> 15'
+ v = (0 | (v / 0x8000)) * 19;
+ a[0] = (v += a[0]) & 0xffff;
+ v = v >>> 16;
+ a[1] = (v += a[1]) & 0xffff;
+ v = v >>> 16;
+ a[2] = (v += a[2]) & 0xffff;
+ v = v >>> 16;
+ a[3] = (v += a[3]) & 0xffff;
+ v = v >>> 16;
+ a[4] = (v += a[4]) & 0xffff;
+ v = v >>> 16;
+ a[5] = (v += a[5]) & 0xffff;
+ v = v >>> 16;
+ a[6] = (v += a[6]) & 0xffff;
+ v = v >>> 16;
+ a[7] = (v += a[7]) & 0xffff;
+ v = v >>> 16;
+ a[8] = (v += a[8]) & 0xffff;
+ v = v >>> 16;
+ a[9] = (v += a[9]) & 0xffff;
+ v = v >>> 16;
+ a[10] = (v += a[10]) & 0xffff;
+ v = v >>> 16;
+ a[11] = (v += a[11]) & 0xffff;
+ v = v >>> 16;
+ a[12] = (v += a[12]) & 0xffff;
+ v = v >>> 16;
+ a[13] = (v += a[13]) & 0xffff;
+ v = v >>> 16;
+ a[14] = (v += a[14]) & 0xffff;
+ v = v >>> 16;
+ a[15] += v;
+ }
+
+ function _addmodp(a, b) {
+ var r = [];
+ var v;
+ r[0] = (v = ((0 | (a[15] >>> 15)) + (0 | (b[15] >>> 15))) * 19
+ + a[0] + b[0]) & 0xffff;
+ r[1] = (v = (v >>> 16) + a[1] + b[1]) & 0xffff;
+ r[2] = (v = (v >>> 16) + a[2] + b[2]) & 0xffff;
+ r[3] = (v = (v >>> 16) + a[3] + b[3]) & 0xffff;
+ r[4] = (v = (v >>> 16) + a[4] + b[4]) & 0xffff;
+ r[5] = (v = (v >>> 16) + a[5] + b[5]) & 0xffff;
+ r[6] = (v = (v >>> 16) + a[6] + b[6]) & 0xffff;
+ r[7] = (v = (v >>> 16) + a[7] + b[7]) & 0xffff;
+ r[8] = (v = (v >>> 16) + a[8] + b[8]) & 0xffff;
+ r[9] = (v = (v >>> 16) + a[9] + b[9]) & 0xffff;
+ r[10] = (v = (v >>> 16) + a[10] + b[10]) & 0xffff;
+ r[11] = (v = (v >>> 16) + a[11] + b[11]) & 0xffff;
+ r[12] = (v = (v >>> 16) + a[12] + b[12]) & 0xffff;
+ r[13] = (v = (v >>> 16) + a[13] + b[13]) & 0xffff;
+ r[14] = (v = (v >>> 16) + a[14] + b[14]) & 0xffff;
+ r[15] = (v >>> 16) + (a[15] & 0x7fff) + (b[15] & 0x7fff);
+ return r;
+ }
+
+ function _submodp(a, b) {
+ var r = [];
+ var v;
+ r[0] = (v = 0x80000
+ + ((0 | (a[15] >>> 15)) - (0 | (b[15] >>> 15)) - 1)
+ * 19 + a[0] - b[0]) & 0xffff;
+ r[1] = (v = (v >>> 16) + 0x7fff8 + a[1] - b[1]) & 0xffff;
+ r[2] = (v = (v >>> 16) + 0x7fff8 + a[2] - b[2]) & 0xffff;
+ r[3] = (v = (v >>> 16) + 0x7fff8 + a[3] - b[3]) & 0xffff;
+ r[4] = (v = (v >>> 16) + 0x7fff8 + a[4] - b[4]) & 0xffff;
+ r[5] = (v = (v >>> 16) + 0x7fff8 + a[5] - b[5]) & 0xffff;
+ r[6] = (v = (v >>> 16) + 0x7fff8 + a[6] - b[6]) & 0xffff;
+ r[7] = (v = (v >>> 16) + 0x7fff8 + a[7] - b[7]) & 0xffff;
+ r[8] = (v = (v >>> 16) + 0x7fff8 + a[8] - b[8]) & 0xffff;
+ r[9] = (v = (v >>> 16) + 0x7fff8 + a[9] - b[9]) & 0xffff;
+ r[10] = (v = (v >>> 16) + 0x7fff8 + a[10] - b[10]) & 0xffff;
+ r[11] = (v = (v >>> 16) + 0x7fff8 + a[11] - b[11]) & 0xffff;
+ r[12] = (v = (v >>> 16) + 0x7fff8 + a[12] - b[12]) & 0xffff;
+ r[13] = (v = (v >>> 16) + 0x7fff8 + a[13] - b[13]) & 0xffff;
+ r[14] = (v = (v >>> 16) + 0x7fff8 + a[14] - b[14]) & 0xffff;
+ r[15] = (v >>> 16) + 0x7ff8 + (a[15] & 0x7fff)
+ - (b[15] & 0x7fff);
+ return r;
+ }
+
+ function _invmodp(a) {
+ var c = a;
+ var i = 250;
+ while (--i) {
+ a = _sqrmodp(a);
+ a = _mulmodp(a, c);
+ }
+ a = _sqrmodp(a);
+ a = _sqrmodp(a);
+ a = _mulmodp(a, c);
+ a = _sqrmodp(a);
+ a = _sqrmodp(a);
+ a = _mulmodp(a, c);
+ a = _sqrmodp(a);
+ a = _mulmodp(a, c);
+ return a;
+ }
+
+ function _mulasmall(a) {
+ // 'division by 0x10000' can not be replaced by '>> 16' because
+ // more than 32 bits of precision are needed
+ var m = 121665;
+ var r = [];
+ var v;
+ r[0] = (v = a[0] * m) & 0xffff;
+ r[1] = (v = (0 | (v / 0x10000)) + a[1] * m) & 0xffff;
+ r[2] = (v = (0 | (v / 0x10000)) + a[2] * m) & 0xffff;
+ r[3] = (v = (0 | (v / 0x10000)) + a[3] * m) & 0xffff;
+ r[4] = (v = (0 | (v / 0x10000)) + a[4] * m) & 0xffff;
+ r[5] = (v = (0 | (v / 0x10000)) + a[5] * m) & 0xffff;
+ r[6] = (v = (0 | (v / 0x10000)) + a[6] * m) & 0xffff;
+ r[7] = (v = (0 | (v / 0x10000)) + a[7] * m) & 0xffff;
+ r[8] = (v = (0 | (v / 0x10000)) + a[8] * m) & 0xffff;
+ r[9] = (v = (0 | (v / 0x10000)) + a[9] * m) & 0xffff;
+ r[10] = (v = (0 | (v / 0x10000)) + a[10] * m) & 0xffff;
+ r[11] = (v = (0 | (v / 0x10000)) + a[11] * m) & 0xffff;
+ r[12] = (v = (0 | (v / 0x10000)) + a[12] * m) & 0xffff;
+ r[13] = (v = (0 | (v / 0x10000)) + a[13] * m) & 0xffff;
+ r[14] = (v = (0 | (v / 0x10000)) + a[14] * m) & 0xffff;
+ r[15] = (0 | (v / 0x10000)) + a[15] * m;
+ _reduce(r);
+ return r;
+ }
+
+ function _dbl(x, z) {
+ var x_2, z_2, m, n, o;
+ m = _sqrmodp(_addmodp(x, z));
+ n = _sqrmodp(_submodp(x, z));
+ o = _submodp(m, n);
+ x_2 = _mulmodp(n, m);
+ z_2 = _mulmodp(_addmodp(_mulasmall(o), m), o);
+ return [x_2, z_2];
+ }
+
+ function _sum(x, z, x_p, z_p, x_1) {
+ var x_3, z_3, p, q;
+ p = _mulmodp(_submodp(x, z), _addmodp(x_p, z_p));
+ q = _mulmodp(_addmodp(x, z), _submodp(x_p, z_p));
+ x_3 = _sqrmodp(_addmodp(p, q));
+ z_3 = _mulmodp(_sqrmodp(_submodp(p, q)), x_1);
+ return [x_3, z_3];
+ }
+
+ function _generateKey(curve25519) {
+ var buffer = crypto.randomBytes(32);
+
+ // For Curve25519 DH keys, we need to apply some bit mask on generated
+ // keys:
+ // * clear bit 0, 1, 2 of first byte
+ // * clear bit 7 of last byte
+ // * set bit 6 of last byte
+ if (curve25519 === true) {
+ buffer[0] &= 0xf8;
+ buffer[31] = (buffer[31] & 0x7f) | 0x40;
+ }
+ var result = [];
+ for (var i = 0; i < buffer.length; i++) {
+ result.push(String.fromCharCode(buffer[i]));
+ }
+ return result.join('');
+ }
+
+ // Expose some functions to the outside through this name space.
+ // Note: This is not part of the public API.
+ ns.getbit = _getbit;
+ ns.setbit = _setbit;
+ ns.addmodp = _addmodp;
+ ns.invmodp = _invmodp;
+ ns.mulmodp = _mulmodp;
+ ns.reduce = _reduce;
+ ns.dbl = _dbl;
+ ns.sum = _sum;
+ ns.ZERO = _ZERO;
+ ns.ONE = _ONE;
+ ns.BASE = _BASE;
+ ns.bigintadd = _bigintadd;
+ ns.bigintsub = _bigintsub;
+ ns.bigintcmp = _bigintcmp;
+ ns.mulmodp = _mulmodp;
+ ns.sqrmodp = _sqrmodp;
+ ns.generateKey = _generateKey;
+
+
+module.exports = ns;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/curve255.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/curve255.js
new file mode 100644
index 000000000..3978b46e3
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/curve255.js
@@ -0,0 +1,221 @@
+"use strict";
+/**
+ * @fileOverview
+ * Core operations on curve 25519 required for the higher level modules.
+ */
+
+/*
+ * Copyright (c) 2007, 2013, 2014 Michele Bini
+ * Copyright (c) 2014 Mega Limited
+ * under the MIT License.
+ *
+ * Authors: Guy K. Kloss, Michele Bini
+ *
+ * You should have received a copy of the license along with this program.
+ */
+
+var core = require('./core');
+var utils = require('./utils');
+
+ /**
+ * @exports jodid25519/curve255
+ * Legacy compatibility module for Michele Bini's previous curve255.js.
+ *
+ * @description
+ * Legacy compatibility module for Michele Bini's previous curve255.js.
+ *
+ * <p>
+ * This code presents an API with all key formats as previously available
+ * from Michele Bini's curve255.js implementation.
+ * </p>
+ */
+ var ns = {};
+
+ function curve25519_raw(f, c) {
+ var a, x_1, q;
+
+ x_1 = c;
+ a = core.dbl(x_1, core.ONE());
+ q = [x_1, core.ONE()];
+
+ var n = 255;
+
+ while (core.getbit(f, n) == 0) {
+ n--;
+ // For correct constant-time operation, bit 255 should always be
+ // set to 1 so the following 'while' loop is never entered.
+ if (n < 0) {
+ return core.ZERO();
+ }
+ }
+ n--;
+
+ var aq = [a, q];
+
+ while (n >= 0) {
+ var r, s;
+ var b = core.getbit(f, n);
+ r = core.sum(aq[0][0], aq[0][1], aq[1][0], aq[1][1], x_1);
+ s = core.dbl(aq[1 - b][0], aq[1 - b][1]);
+ aq[1 - b] = s;
+ aq[b] = r;
+ n--;
+ }
+ q = aq[1];
+
+ q[1] = core.invmodp(q[1]);
+ q[0] = core.mulmodp(q[0], q[1]);
+ core.reduce(q[0]);
+ return q[0];
+ }
+
+ function curve25519b32(a, b) {
+ return _base32encode(curve25519(_base32decode(a),
+ _base32decode(b)));
+ }
+
+ function curve25519(f, c) {
+ if (!c) {
+ c = core.BASE();
+ }
+ f[0] &= 0xFFF8;
+ f[15] = (f[15] & 0x7FFF) | 0x4000;
+ return curve25519_raw(f, c);
+ }
+
+ function _hexEncodeVector(k) {
+ var hexKey = utils.hexEncode(k);
+ // Pad with '0' at the front.
+ hexKey = new Array(64 + 1 - hexKey.length).join('0') + hexKey;
+ // Invert bytes.
+ return hexKey.split(/(..)/).reverse().join('');
+ }
+
+ function _hexDecodeVector(v) {
+ // assert(length(x) == 64);
+ // Invert bytes.
+ var hexKey = v.split(/(..)/).reverse().join('');
+ return utils.hexDecode(hexKey);
+ }
+
+
+ // Expose some functions to the outside through this name space.
+
+ /**
+ * Computes the scalar product of a point on the curve 25519.
+ *
+ * This function is used for the DH key-exchange protocol.
+ *
+ * Before multiplication, some bit operations are applied to the
+ * private key to ensure it is a valid Curve25519 secret key.
+ * It is the user's responsibility to make sure that the private
+ * key is a uniformly random, secret value.
+ *
+ * @function
+ * @param f {array}
+ * Private key.
+ * @param c {array}
+ * Public point on the curve. If not given, the curve's base point is used.
+ * @returns {array}
+ * Key point resulting from scalar product.
+ */
+ ns.curve25519 = curve25519;
+
+ /**
+ * Computes the scalar product of a point on the curve 25519.
+ *
+ * This variant does not make sure that the private key is valid.
+ * The user has the responsibility to ensure the private key is
+ * valid or that this results in a safe protocol. Unless you know
+ * exactly what you are doing, you should not use this variant,
+ * please use 'curve25519' instead.
+ *
+ * @function
+ * @param f {array}
+ * Private key.
+ * @param c {array}
+ * Public point on the curve. If not given, the curve's base point is used.
+ * @returns {array}
+ * Key point resulting from scalar product.
+ */
+ ns.curve25519_raw = curve25519_raw;
+
+ /**
+ * Encodes the internal representation of a key to a canonical hex
+ * representation.
+ *
+ * This is the format commonly used in other libraries and for
+ * test vectors, and is equivalent to the hex dump of the key in
+ * little-endian binary format.
+ *
+ * @function
+ * @param n {array}
+ * Array representation of key.
+ * @returns {string}
+ * Hexadecimal string representation of key.
+ */
+ ns.hexEncodeVector = _hexEncodeVector;
+
+ /**
+ * Decodes a canonical hex representation of a key
+ * to an internally compatible array representation.
+ *
+ * @function
+ * @param n {string}
+ * Hexadecimal string representation of key.
+ * @returns {array}
+ * Array representation of key.
+ */
+ ns.hexDecodeVector = _hexDecodeVector;
+
+ /**
+ * Encodes the internal representation of a key into a
+ * hexadecimal representation.
+ *
+ * This is a strict positional notation, most significant digit first.
+ *
+ * @function
+ * @param n {array}
+ * Array representation of key.
+ * @returns {string}
+ * Hexadecimal string representation of key.
+ */
+ ns.hexencode = utils.hexEncode;
+
+ /**
+ * Decodes a hex representation of a key to an internally
+ * compatible array representation.
+ *
+ * @function
+ * @param n {string}
+ * Hexadecimal string representation of key.
+ * @returns {array}
+ * Array representation of key.
+ */
+ ns.hexdecode = utils.hexDecode;
+
+ /**
+ * Encodes the internal representation of a key to a base32
+ * representation.
+ *
+ * @function
+ * @param n {array}
+ * Array representation of key.
+ * @returns {string}
+ * Base32 string representation of key.
+ */
+ ns.base32encode = utils.base32encode;
+
+ /**
+ * Decodes a base32 representation of a key to an internally
+ * compatible array representation.
+ *
+ * @function
+ * @param n {string}
+ * Base32 string representation of key.
+ * @returns {array}
+ * Array representation of key.
+ */
+ ns.base32decode = utils.base32decode;
+
+module.exports = ns;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/dh.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/dh.js
new file mode 100644
index 000000000..2f75494a4
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/dh.js
@@ -0,0 +1,111 @@
+"use strict";
+/**
+ * @fileOverview
+ * EC Diffie-Hellman operations on Curve25519.
+ */
+
+/*
+ * Copyright (c) 2014 Mega Limited
+ * under the MIT License.
+ *
+ * Authors: Guy K. Kloss
+ *
+ * You should have received a copy of the license along with this program.
+ */
+
+var core = require('./core');
+var utils = require('./utils');
+var curve255 = require('./curve255');
+
+
+ /**
+ * @exports jodid25519/dh
+ * EC Diffie-Hellman operations on Curve25519.
+ *
+ * @description
+ * EC Diffie-Hellman operations on Curve25519.
+ */
+ var ns = {};
+
+
+ function _toString(vector) {
+ var u = new Uint16Array(vector);
+ return (new Buffer(new Uint8Array(u.buffer)));
+ }
+
+ function _fromString(vector) {
+ if (Buffer.isBuffer(vector)) {
+ var u = new Uint8Array(vector);
+ return (new Uint16Array(u.buffer));
+ }
+
+ var result = new Array(16);
+ for (var i = 0, l = 0; i < vector.length; i += 2) {
+ result[l] = (vector.charCodeAt(i + 1) << 8) | vector.charCodeAt(i);
+ l++;
+ }
+ return result;
+ }
+
+
+ /**
+ * Computes a key through scalar multiplication of a point on the curve 25519.
+ *
+ * This function is used for the DH key-exchange protocol. It computes a
+ * key based on a secret key with a public component (opponent's public key
+ * or curve base point if not given) by using scalar multiplication.
+ *
+ * Before multiplication, some bit operations are applied to the
+ * private key to ensure it is a valid Curve25519 secret key.
+ * It is the user's responsibility to make sure that the private
+ * key is a uniformly random, secret value.
+ *
+ * @function
+ * @param privateComponent {string}
+ * Private point as byte string on the curve.
+ * @param publicComponent {string}
+ * Public point as byte string on the curve. If not given, the curve's
+ * base point is used.
+ * @returns {string}
+ * Key point as byte string resulting from scalar product.
+ */
+ ns.computeKey = function(privateComponent, publicComponent) {
+ if (publicComponent) {
+ return _toString(curve255.curve25519(_fromString(privateComponent),
+ _fromString(publicComponent)));
+ } else {
+ return _toString(curve255.curve25519(_fromString(privateComponent)));
+ }
+ };
+
+ /**
+ * Computes the public key to a private key on the curve 25519.
+ *
+ * Before multiplication, some bit operations are applied to the
+ * private key to ensure it is a valid Curve25519 secret key.
+ * It is the user's responsibility to make sure that the private
+ * key is a uniformly random, secret value.
+ *
+ * @function
+ * @param privateKey {string}
+ * Private point as byte string on the curve.
+ * @returns {string}
+ * Public key point as byte string resulting from scalar product.
+ */
+ ns.publicKey = function(privateKey) {
+ return _toString(curve255.curve25519(_fromString(privateKey)));
+ };
+
+
+ /**
+ * Generates a new random private key of 32 bytes length (256 bit).
+ *
+ * @function
+ * @returns {string}
+ * Byte string containing a new random private key seed.
+ */
+ ns.generateKey = function() {
+ return core.generateKey(true);
+ };
+
+module.exports = ns;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/eddsa.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/eddsa.js
new file mode 100644
index 000000000..c384f3293
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/eddsa.js
@@ -0,0 +1,573 @@
+"use strict";
+/**
+ * @fileOverview
+ * Digital signature scheme based on Curve25519 (Ed25519 or EdDSA).
+ */
+
+/*
+ * Copyright (c) 2011, 2012, 2014 Ron Garret
+ * Copyright (c) 2014 Mega Limited
+ * under the MIT License.
+ *
+ * Authors: Guy K. Kloss, Ron Garret
+ *
+ * You should have received a copy of the license along with this program.
+ */
+
+var core = require('./core');
+var curve255 = require('./curve255');
+var utils = require('./utils');
+var BigInteger = require('jsbn').BigInteger;
+var crypto = require('crypto');
+
+ /**
+ * @exports jodid25519/eddsa
+ * Digital signature scheme based on Curve25519 (Ed25519 or EdDSA).
+ *
+ * @description
+ * Digital signature scheme based on Curve25519 (Ed25519 or EdDSA).
+ *
+ * <p>
+ * This code is adapted from fast-djbec.js, a faster but more complicated
+ * version of the Ed25519 encryption scheme (as compared to djbec.js).
+ * It uses two different representations for big integers: The jsbn
+ * BigInteger class, which can represent arbitrary-length numbers, and a
+ * special fixed-length representation optimised for 256-bit integers.
+ * The reason both are needed is that the Ed25519 algorithm requires some
+ * 512-bit numbers.</p>
+ */
+ var ns = {};
+
+ function _bi255(value) {
+ if (!(this instanceof _bi255)) {
+ return new _bi255(value);
+ }
+ if (typeof value === 'undefined') {
+ return _ZERO;
+ }
+ var c = value.constructor;
+ if ((c === Array || c === Uint16Array || c === Uint32Array) && (value.length === 16)) {
+ this.n = value;
+ } else if ((c === Array) && (value.length === 32)) {
+ this.n = _bytes2bi255(value).n;
+ } else if (c === String) {
+ this.n = utils.hexDecode(value);
+ } else if (c === Number) {
+ this.n = [value & 0xffff,
+ value >> 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ } else if (value instanceof _bi255) {
+ this.n = value.n.slice(0); // Copy constructor
+ } else {
+ throw "Bad argument for bignum: " + value;
+ }
+ }
+
+ _bi255.prototype = {
+ 'toString' : function() {
+ return utils.hexEncode(this.n);
+ },
+ 'toSource' : function() {
+ return '_' + utils.hexEncode(this.n);
+ },
+ 'plus' : function(n1) {
+ return _bi255(core.bigintadd(this.n, n1.n));
+ },
+ 'minus' : function(n1) {
+ return _bi255(core.bigintsub(this.n, n1.n)).modq();
+ },
+ 'times' : function(n1) {
+ return _bi255(core.mulmodp(this.n, n1.n));
+ },
+ 'divide' : function(n1) {
+ return this.times(n1.inv());
+ },
+ 'sqr' : function() {
+ return _bi255(core.sqrmodp(this.n));
+ },
+ 'cmp' : function(n1) {
+ return core.bigintcmp(this.n, n1.n);
+ },
+ 'equals' : function(n1) {
+ return this.cmp(n1) === 0;
+ },
+ 'isOdd' : function() {
+ return (this.n[0] & 1) === 1;
+ },
+ 'shiftLeft' : function(cnt) {
+ _shiftL(this.n, cnt);
+ return this;
+ },
+ 'shiftRight' : function(cnt) {
+ _shiftR(this.n, cnt);
+ return this;
+ },
+ 'inv' : function() {
+ return _bi255(core.invmodp(this.n));
+ },
+ 'pow' : function(e) {
+ return _bi255(_pow(this.n, e.n));
+ },
+ 'modq' : function() {
+ return _modq(this);
+ },
+ 'bytes' : function() {
+ return _bi255_bytes(this);
+ }
+ };
+
+ function _shiftL(n, cnt) {
+ var lastcarry = 0;
+ for (var i = 0; i < 16; i++) {
+ var carry = n[i] >> (16 - cnt);
+ n[i] = (n[i] << cnt) & 0xffff | lastcarry;
+ lastcarry = carry;
+ }
+ return n;
+ }
+
+ function _shiftR(n, cnt) {
+ var lastcarry = 0;
+ for (var i = 15; i >= 0; i--) {
+ var carry = n[i] << (16 - cnt) & 0xffff;
+ n[i] = (n[i] >> cnt) | lastcarry;
+ lastcarry = carry;
+ }
+ return n;
+ }
+
+ function _bi255_bytes(n) {
+ n = _bi255(n); // Make a copy because shiftRight is destructive
+ var a = new Array(32);
+ for (var i = 31; i >= 0; i--) {
+ a[i] = n.n[0] & 0xff;
+ n.shiftRight(8);
+ }
+ return a;
+ }
+
+ function _bytes2bi255(a) {
+ var n = _ZERO;
+ for (var i = 0; i < 32; i++) {
+ n.shiftLeft(8);
+ n = n.plus(_bi255(a[i]));
+ }
+ return n;
+ }
+
+ function _pow(n, e) {
+ var result = core.ONE();
+ for (var i = 0; i < 256; i++) {
+ if (core.getbit(e, i) === 1) {
+ result = core.mulmodp(result, n);
+ }
+ n = core.sqrmodp(n);
+ }
+ return result;
+ }
+
+ var _ZERO = _bi255(0);
+ var _ONE = _bi255(1);
+ var _TWO = _bi255(2);
+ // This is the core prime.
+ var _Q = _bi255([0xffff - 18, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0x7fff]);
+
+ function _modq(n) {
+ core.reduce(n.n);
+ if (n.cmp(_Q) >= 0) {
+ return _modq(n.minus(_Q));
+ }
+ if (n.cmp(_ZERO) === -1) {
+ return _modq(n.plus(_Q));
+ } else {
+ return n;
+ }
+ }
+
+ // _RECOVERY_EXPONENT = _Q.plus(_bi255(3)).divide(_bi255(8));
+ var _RECOVERY_EXPONENT = _bi255('0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe');
+ // _D = _Q.minus(_bi255(121665)).divide(_bi255(121666));
+ var _D = _bi255('52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3');
+ // _I = _TWO.pow(_Q.minus(_ONE).divide(_bi255(4)));
+ var _I = _bi255('2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0');
+ // _L = _TWO.pow(_bi255(252)).plus(_bi255('14def9dea2f79cd65812631a5cf5d3ed'));
+ var _L = _bi255('1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed');
+ var _L_BI = _bi('1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed', 16);
+
+
+ // ////////////////////////////////////////////////////////////
+
+ function _isoncurve(p) {
+ var x = p[0];
+ var y = p[1];
+ var xsqr = x.sqr();
+ var ysqr = y.sqr();
+ var v = _D.times(xsqr).times(ysqr);
+ return ysqr.minus(xsqr).minus(_ONE).minus(v).modq().equals(_ZERO);
+ }
+
+ function _xrecover(y) {
+ var ysquared = y.sqr();
+ var xx = ysquared.minus(_ONE).divide(_ONE.plus(_D.times(ysquared)));
+ var x = xx.pow(_RECOVERY_EXPONENT);
+ if (!(x.times(x).minus(xx).equals(_ZERO))) {
+ x = x.times(_I);
+ }
+ if (x.isOdd()) {
+ x = _Q.minus(x);
+ }
+ return x;
+ }
+
+ function _x_pt_add(pt1, pt2) {
+ var x1 = pt1[0];
+ var y1 = pt1[1];
+ var z1 = pt1[2];
+ var t1 = pt1[3];
+ var x2 = pt2[0];
+ var y2 = pt2[1];
+ var z2 = pt2[2];
+ var t2 = pt2[3];
+ var A = y1.minus(x1).times(y2.plus(x2));
+ var B = y1.plus(x1).times(y2.minus(x2));
+ var C = z1.times(_TWO).times(t2);
+ var D = t1.times(_TWO).times(z2);
+ var E = D.plus(C);
+ var F = B.minus(A);
+ var G = B.plus(A);
+ var H = D.minus(C);
+ return [E.times(F), G.times(H), F.times(G), E.times(H)];
+ }
+
+ function _xpt_double(pt1) {
+ var x1 = pt1[0];
+ var y1 = pt1[1];
+ var z1 = pt1[2];
+ var A = x1.times(x1);
+ var B = y1.times(y1);
+ var C = _TWO.times(z1).times(z1);
+ var D = _Q.minus(A);
+ var J = x1.plus(y1);
+ var E = J.times(J).minus(A).minus(B);
+ var G = D.plus(B);
+ var F = G.minus(C);
+ var H = D.minus(B);
+ return [E.times(F), G.times(H), F.times(G), E.times(H)];
+ }
+
+ function _xpt_mult(pt, n) {
+ if (n.equals(_ZERO)) {
+ return [_ZERO, _ONE, _ONE, _ZERO];
+ }
+ var odd = n.isOdd();
+ n.shiftRight(1);
+ var value = _xpt_double(_xpt_mult(pt, n));
+ return odd ? _x_pt_add(value, pt) : value;
+ }
+
+ function _pt_xform(pt) {
+ var x = pt[0];
+ var y = pt[1];
+ return [x, y, _ONE, x.times(y)];
+ }
+
+ function _pt_unxform(pt) {
+ var x = pt[0];
+ var y = pt[1];
+ var z = pt[2];
+ var invz = z.inv();
+ return [x.times(invz), y.times(invz)];
+ }
+
+ function _scalarmult(pt, n) {
+ return _pt_unxform(_xpt_mult(_pt_xform(pt), n));
+ }
+
+ function _bytesgetbit(bytes, n) {
+ return (bytes[bytes.length - (n >>> 3) - 1] >> (n & 7)) & 1;
+ }
+
+ function _xpt_mult_bytes(pt, bytes) {
+ var r = [_ZERO, _ONE, _ONE, _ZERO];
+ for (var i = (bytes.length << 3) - 1; i >= 0; i--) {
+ r = _xpt_double(r);
+ if (_bytesgetbit(bytes, i) === 1) {
+ r = _x_pt_add(r, pt);
+ }
+ }
+ return r;
+ }
+
+ function _scalarmultBytes(pt, bytes) {
+ return _pt_unxform(_xpt_mult_bytes(_pt_xform(pt), bytes));
+ }
+
+ var _by = _bi255(4).divide(_bi255(5));
+ var _bx = _xrecover(_by);
+ var _bp = [_bx, _by];
+
+ function _encodeint(n) {
+ return n.bytes(32).reverse();
+ }
+ function _decodeint(b) {
+ return _bi255(b.slice(0).reverse());
+ }
+
+ function _encodepoint(p) {
+ var v = _encodeint(p[1]);
+ if (p[0].isOdd()) {
+ v[31] |= 0x80;
+ }
+ return v;
+ }
+
+ function _decodepoint(v) {
+ v = v.slice(0);
+ var signbit = v[31] >> 7;
+ v[31] &= 127;
+ var y = _decodeint(v);
+ var x = _xrecover(y);
+ if ((x.n[0] & 1) !== signbit) {
+ x = _Q.minus(x);
+ }
+ var p = [x, y];
+ if (!_isoncurve(p)) {
+ throw ('Point is not on curve');
+ }
+ return p;
+ }
+
+ // //////////////////////////////////////////////////
+
+ /**
+ * Factory function to create a suitable BigInteger.
+ *
+ * @param value
+ * The value for the big integer.
+ * @param base {integer}
+ * Base of the conversion of elements in ``value``.
+ * @returns
+ * A BigInteger object.
+ */
+ function _bi(value, base) {
+ if (base !== undefined) {
+ if (base === 256) {
+ return _bi(utils.string2bytes(value));
+ }
+ return new BigInteger(value, base);
+ } else if (typeof value === 'string') {
+ return new BigInteger(value, 10);
+ } else if ((value instanceof Array) || (value instanceof Uint8Array)
+ || Buffer.isBuffer(value)) {
+ return new BigInteger(value);
+ } else if (typeof value === 'number') {
+ return new BigInteger(value.toString(), 10);
+ } else {
+ throw "Can't convert " + value + " to BigInteger";
+ }
+ }
+
+ function _bi2bytes(n, cnt) {
+ if (cnt === undefined) {
+ cnt = (n.bitLength() + 7) >>> 3;
+ }
+ var bytes = new Array(cnt);
+ for (var i = cnt - 1; i >= 0; i--) {
+ bytes[i] = n[0] & 255; // n.and(0xff);
+ n = n.shiftRight(8);
+ }
+ return bytes;
+ }
+
+ BigInteger.prototype.bytes = function(n) {
+ return _bi2bytes(this, n);
+ };
+
+ // /////////////////////////////////////////////////////////
+
+ function _bytehash(s) {
+ var sha = crypto.createHash('sha512').update(s).digest();
+ return _bi2bytes(_bi(sha), 64).reverse();
+ }
+
+ function _stringhash(s) {
+ var sha = crypto.createHash('sha512').update(s).digest();
+ return _map(_chr, _bi2bytes(_bi(sha), 64)).join('');
+ }
+
+ function _inthash(s) {
+ // Need a leading 0 to prevent sign extension
+ return _bi([0].concat(_bytehash(s)));
+ }
+
+ function _inthash_lo(s) {
+ return _bi255(_bytehash(s).slice(32, 64));
+ }
+
+ function _inthash_mod_l(s) {
+ return _inthash(s).mod(_L_BI);
+ }
+
+ function _get_a(sk) {
+ var a = _inthash_lo(sk);
+ a.n[0] &= 0xfff8;
+ a.n[15] &= 0x3fff;
+ a.n[15] |= 0x4000;
+ return a;
+ }
+
+ function _publickey(sk) {
+ return _encodepoint(_scalarmult(_bp, _get_a(sk)));
+ }
+
+ function _map(f, l) {
+ var result = new Array(l.length);
+ for (var i = 0; i < l.length; i++) {
+ result[i] = f(l[i]);
+ }
+ return result;
+ }
+
+ function _chr(n) {
+ return String.fromCharCode(n);
+ }
+
+ function _ord(c) {
+ return c.charCodeAt(0);
+ }
+
+ function _pt_add(p1, p2) {
+ return _pt_unxform(_x_pt_add(_pt_xform(p1), _pt_xform(p2)));
+ }
+
+
+ // Exports for the API.
+
+ /**
+ * Checks whether a point is on the curve.
+ *
+ * @function
+ * @param point {string}
+ * The point to check for in a byte string representation.
+ * @returns {boolean}
+ * true if the point is on the curve, false otherwise.
+ */
+ ns.isOnCurve = function(point) {
+ try {
+ _isoncurve(_decodepoint(utils.string2bytes(point)));
+ } catch(e) {
+ if (e === 'Point is not on curve') {
+ return false;
+ } else {
+ throw e;
+ }
+ }
+ return true;
+ };
+
+
+ /**
+ * Computes the EdDSA public key.
+ *
+ * <p>Note: Seeds should be a byte string, not a unicode string containing
+ * multi-byte characters.</p>
+ *
+ * @function
+ * @param keySeed {string}
+ * Private key seed in the form of a byte string.
+ * @returns {string}
+ * Public key as byte string computed from the private key seed
+ * (32 bytes).
+ */
+ ns.publicKey = function(keySeed) {
+ return utils.bytes2string(_publickey(keySeed));
+ };
+
+
+ /**
+ * Computes an EdDSA signature of a message.
+ *
+ * <p>Notes:</p>
+ *
+ * <ul>
+ * <li>Unicode messages need to be converted to a byte representation
+ * (e. g. UTF-8).</li>
+ * <li>If `publicKey` is given, and it is *not* a point of the curve,
+ * the signature will be faulty, but no error will be thrown.</li>
+ * </ul>
+ *
+ * @function
+ * @param message {string}
+ * Message in the form of a byte string.
+ * @param keySeed {string}
+ * Private key seed in the form of a byte string.
+ * @param publicKey {string}
+ * Public key as byte string (if not present, it will be computed from
+ * the private key seed).
+ * @returns {string}
+ * Detached message signature in the form of a byte string (64 bytes).
+ */
+ ns.sign = function(message, keySeed, publicKey) {
+ if (publicKey === undefined) {
+ publicKey = _publickey(keySeed);
+ } else {
+ publicKey = utils.string2bytes(publicKey);
+ }
+ var a = _bi(_get_a(keySeed).toString(), 16);
+ var hs = _stringhash(keySeed);
+ var r = _bytehash(hs.slice(32, 64) + message);
+ var rp = _scalarmultBytes(_bp, r);
+ var erp = _encodepoint(rp);
+ r = _bi(r).mod(_bi(1, 10).shiftLeft(512));
+ var s = _map(_chr, erp).join('') + _map(_chr, publicKey).join('') + message;
+ s = _inthash_mod_l(s).multiply(a).add(r).mod(_L_BI);
+ return utils.bytes2string(erp.concat(_encodeint(s)));
+ };
+
+
+ /**
+ * Verifies an EdDSA signature of a message with the public key.
+ *
+ * <p>Note: Unicode messages need to be converted to a byte representation
+ * (e. g. UTF-8).</p>
+ *
+ * @function
+ * @param signature {string}
+ * Message signature in the form of a byte string. Can be detached
+ * (64 bytes), or attached to be sliced off.
+ * @param message {string}
+ * Message in the form of a byte string.
+ * @param publicKey {string}
+ * Public key as byte string (if not present, it will be computed from
+ * the private key seed).
+ * @returns {boolean}
+ * true, if the signature verifies.
+ */
+ ns.verify = function(signature, message, publicKey) {
+ signature = utils.string2bytes(signature.slice(0, 64));
+ publicKey = utils.string2bytes(publicKey);
+ var rpe = signature.slice(0, 32);
+ var rp = _decodepoint(rpe);
+ var a = _decodepoint(publicKey);
+ var s = _decodeint(signature.slice(32, 64));
+ var h = _inthash(utils.bytes2string(rpe.concat(publicKey)) + message);
+ var v1 = _scalarmult(_bp, s);
+ var value = _scalarmultBytes(a, _bi2bytes(h));
+ var v2 = _pt_add(rp, value);
+ return v1[0].equals(v2[0]) && v1[1].equals(v2[1]);
+ };
+
+
+ /**
+ * Generates a new random private key seed of 32 bytes length (256 bit).
+ *
+ * @function
+ * @returns {string}
+ * Byte string containing a new random private key seed.
+ */
+ ns.generateKeySeed = function() {
+ return core.generateKey(false);
+ };
+
+module.exports = ns;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/utils.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/utils.js
new file mode 100644
index 000000000..c795231ad
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/utils.js
@@ -0,0 +1,198 @@
+"use strict";
+/**
+ * @fileOverview
+ * A collection of general utility functions..
+ */
+
+/*
+ * Copyright (c) 2011, 2012, 2014 Ron Garret
+ * Copyright (c) 2007, 2013, 2014 Michele Bini
+ * Copyright (c) 2014 Mega Limited
+ * under the MIT License.
+ *
+ * Authors: Guy K. Kloss, Michele Bini, Ron Garret
+ *
+ * You should have received a copy of the license along with this program.
+ */
+
+var core = require('./core');
+
+ /**
+ * @exports jodid25519/utils
+ * A collection of general utility functions..
+ *
+ * @description
+ * A collection of general utility functions..
+ */
+ var ns = {};
+
+ var _HEXCHARS = "0123456789abcdef";
+
+ function _hexencode(vector) {
+ var result = [];
+ for (var i = vector.length - 1; i >= 0; i--) {
+ var value = vector[i];
+ result.push(_HEXCHARS.substr((value >>> 12) & 0x0f, 1));
+ result.push(_HEXCHARS.substr((value >>> 8) & 0x0f, 1));
+ result.push(_HEXCHARS.substr((value >>> 4) & 0x0f, 1));
+ result.push(_HEXCHARS.substr(value & 0x0f, 1));
+ }
+ return result.join('');
+ }
+
+ function _hexdecode(vector) {
+ var result = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+ for (var i = vector.length - 1, l = 0; i >= 0; i -= 4) {
+ result[l] = (_HEXCHARS.indexOf(vector.charAt(i)))
+ | (_HEXCHARS.indexOf(vector.charAt(i - 1)) << 4)
+ | (_HEXCHARS.indexOf(vector.charAt(i - 2)) << 8)
+ | (_HEXCHARS.indexOf(vector.charAt(i - 3)) << 12);
+ l++;
+ }
+ return result;
+ }
+
+ var _BASE32CHARS = "abcdefghijklmnopqrstuvwxyz234567";
+
+ var _BASE32VALUES = (function () {
+ var result = {};
+ for (var i = 0; i < _BASE32CHARS.length; i++) {
+ result[_BASE32CHARS.charAt(i)] = i;
+ }
+ return result;
+ })();
+
+ function _base32encode(n) {
+ var c;
+ var r = "";
+ for (c = 0; c < 255; c += 5) {
+ r = _BASE32CHARS.substr(core.getbit(n, c)
+ + (core.getbit(n, c + 1) << 1)
+ + (core.getbit(n, c + 2) << 2)
+ + (core.getbit(n, c + 3) << 3)
+ + (core.getbit(n, c + 4) << 4), 1)
+ + r;
+ }
+ return r;
+ }
+
+ function _base32decode(n) {
+ var c = 0;
+ var r = core.ZERO();
+ var l = n.length;
+ for (c = 0; (l > 0) && (c < 255); c += 5) {
+ l--;
+ var v = _BASE32VALUES[n.substr(l, 1)];
+ core.setbit(r, c, v & 1);
+ v >>= 1;
+ core.setbit(r, c + 1, v & 1);
+ v >>= 1;
+ core.setbit(r, c + 2, v & 1);
+ v >>= 1;
+ core.setbit(r, c + 3, v & 1);
+ v >>= 1;
+ core.setbit(r, c + 4, v & 1);
+ }
+ return r;
+ }
+
+ function _map(f, l) {
+ var result = new Array(l.length);
+ for (var i = 0; i < l.length; i++) {
+ result[i] = f(l[i]);
+ }
+ return result;
+ }
+
+ function _chr(n) {
+ return String.fromCharCode(n);
+ }
+
+ function _ord(c) {
+ return c.charCodeAt(0);
+ }
+
+ function _bytes2string(bytes) {
+ return _map(_chr, bytes).join('');
+ }
+
+ function _string2bytes(s) {
+ return _map(_ord, s);
+ }
+
+
+ // Expose some functions to the outside through this name space.
+
+ /**
+ * Encodes an array of unsigned 8-bit integers to a hex string.
+ *
+ * @function
+ * @param vector {array}
+ * Array containing the byte values.
+ * @returns {string}
+ * String containing vector in a hexadecimal representation.
+ */
+ ns.hexEncode = _hexencode;
+
+
+ /**
+ * Decodes a hex string to an array of unsigned 8-bit integers.
+ *
+ * @function
+ * @param vector {string}
+ * String containing vector in a hexadecimal representation.
+ * @returns {array}
+ * Array containing the byte values.
+ */
+ ns.hexDecode = _hexdecode;
+
+
+ /**
+ * Encodes an array of unsigned 8-bit integers using base32 encoding.
+ *
+ * @function
+ * @param vector {array}
+ * Array containing the byte values.
+ * @returns {string}
+ * String containing vector in a hexadecimal representation.
+ */
+ ns.base32encode = _base32encode;
+
+
+ /**
+ * Decodes a base32 encoded string to an array of unsigned 8-bit integers.
+ *
+ * @function
+ * @param vector {string}
+ * String containing vector in a hexadecimal representation.
+ * @returns {array}
+ * Array containing the byte values.
+ */
+ ns.base32decode = _base32decode;
+
+
+ /**
+ * Converts an unsigned 8-bit integer array representation to a byte string.
+ *
+ * @function
+ * @param vector {array}
+ * Array containing the byte values.
+ * @returns {string}
+ * Byte string representation of vector.
+ */
+ ns.bytes2string = _bytes2string;
+
+
+ /**
+ * Converts a byte string representation to an array of unsigned
+ * 8-bit integers.
+ *
+ * @function
+ * @param vector {array}
+ * Array containing the byte values.
+ * @returns {string}
+ * Byte string representation of vector.
+ */
+ ns.string2bytes = _string2bytes;
+
+module.exports = ns;
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/package.json
new file mode 100644
index 000000000..3bc9f501c
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/package.json
@@ -0,0 +1,96 @@
+{
+ "_args": [
+ [
+ "jodid25519@>=1.0.0 <2.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk"
+ ]
+ ],
+ "_from": "jodid25519@>=1.0.0 <2.0.0",
+ "_id": "jodid25519@1.0.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/jodid25519",
+ "_nodeVersion": "4.1.1",
+ "_npmUser": {
+ "email": "alex@cooperi.net",
+ "name": "arekinath"
+ },
+ "_npmVersion": "2.14.4",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "jodid25519",
+ "raw": "jodid25519@>=1.0.0 <2.0.0",
+ "rawSpec": ">=1.0.0 <2.0.0",
+ "scope": null,
+ "spec": ">=1.0.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk"
+ ],
+ "_resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz",
+ "_shasum": "06d4912255093419477d425633606e0e90782967",
+ "_shrinkwrap": null,
+ "_spec": "jodid25519@>=1.0.0 <2.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk",
+ "author": {
+ "name": "Michele Bini, Ron Garret, Guy K. Kloss"
+ },
+ "bugs": {
+ "url": "https://github.com/meganz/jodid25519/issues"
+ },
+ "dependencies": {
+ "jsbn": "~0.1.0"
+ },
+ "description": "jodid25519 - Curve 25519-based cryptography",
+ "devDependencies": {
+ "almond": "~0.3.1",
+ "chai": "^3.0.0",
+ "dateformat": "~1.0.7-1.2.3",
+ "ibrik": "~2.0.0",
+ "istanbul": "~0.3.5",
+ "jsdoc": "<=3.3.0",
+ "mocha": "~2.0.1",
+ "sinon": "~1.10.3",
+ "sinon-chai": "^2.8.0"
+ },
+ "directories": {
+ "doc": "doc",
+ "src": "src",
+ "test": "test"
+ },
+ "dist": {
+ "shasum": "06d4912255093419477d425633606e0e90782967",
+ "tarball": "http://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz"
+ },
+ "gitHead": "a83b9fcf7fd3be4f27cd4a57817aff171c7cd918",
+ "homepage": "https://github.com/meganz/jodid25519",
+ "keywords": [
+ "Curve25519",
+ "ECDH",
+ "ECDSA",
+ "Ed25519",
+ "EdDSA",
+ "encryption",
+ "signing"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "arekinath",
+ "email": "alex@cooperi.net"
+ }
+ ],
+ "name": "jodid25519",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/meganz/jodid25519.git"
+ },
+ "scripts": {
+ "test": "mocha test/*_test.js"
+ },
+ "version": "1.0.2"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/.npmignore
new file mode 100644
index 000000000..28f1ba756
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/.npmignore
@@ -0,0 +1,2 @@
+node_modules
+.DS_Store \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/LICENSE b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/LICENSE
new file mode 100644
index 000000000..2a6457e9e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/LICENSE
@@ -0,0 +1,40 @@
+Licensing
+---------
+
+This software is covered under the following copyright:
+
+/*
+ * Copyright (c) 2003-2005 Tom Wu
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
+ * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * In addition, the following condition applies:
+ *
+ * All redistributions must retain an intact copy of this copyright notice
+ * and disclaimer.
+ */
+
+Address all questions regarding this license to:
+
+ Tom Wu
+ tjw@cs.Stanford.EDU \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/README.md
new file mode 100644
index 000000000..7aac67f53
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/README.md
@@ -0,0 +1,175 @@
+# jsbn: javascript big number
+
+[Tom Wu's Original Website](http://www-cs-students.stanford.edu/~tjw/jsbn/)
+
+I felt compelled to put this on github and publish to npm. I haven't tested every other big integer library out there, but the few that I have tested in comparison to this one have not even come close in performance. I am aware of the `bi` module on npm, however it has been modified and I wanted to publish the original without modifications. This is jsbn and jsbn2 from Tom Wu's original website above, with the modular pattern applied to prevent global leaks and to allow for use with node.js on the server side.
+
+## usage
+
+ var BigInteger = require('jsbn');
+
+ var a = new BigInteger('91823918239182398123');
+ alert(a.bitLength()); // 67
+
+
+## API
+
+### bi.toString()
+
+returns the base-10 number as a string
+
+### bi.negate()
+
+returns a new BigInteger equal to the negation of `bi`
+
+### bi.abs
+
+returns new BI of absolute value
+
+### bi.compareTo
+
+
+
+### bi.bitLength
+
+
+
+### bi.mod
+
+
+
+### bi.modPowInt
+
+
+
+### bi.clone
+
+
+
+### bi.intValue
+
+
+
+### bi.byteValue
+
+
+
+### bi.shortValue
+
+
+
+### bi.signum
+
+
+
+### bi.toByteArray
+
+
+
+### bi.equals
+
+
+
+### bi.min
+
+
+
+### bi.max
+
+
+
+### bi.and
+
+
+
+### bi.or
+
+
+
+### bi.xor
+
+
+
+### bi.andNot
+
+
+
+### bi.not
+
+
+
+### bi.shiftLeft
+
+
+
+### bi.shiftRight
+
+
+
+### bi.getLowestSetBit
+
+
+
+### bi.bitCount
+
+
+
+### bi.testBit
+
+
+
+### bi.setBit
+
+
+
+### bi.clearBit
+
+
+
+### bi.flipBit
+
+
+
+### bi.add
+
+
+
+### bi.subtract
+
+
+
+### bi.multiply
+
+
+
+### bi.divide
+
+
+
+### bi.remainder
+
+
+
+### bi.divideAndRemainder
+
+
+
+### bi.modPow
+
+
+
+### bi.modInverse
+
+
+
+### bi.pow
+
+
+
+### bi.gcd
+
+
+
+### bi.isProbablePrime
+
+
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.html b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.html
new file mode 100644
index 000000000..7c26a5665
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title></title>
+ </head>
+ <body>
+
+
+ <script src="index.js"></script>
+ </body>
+</html> \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js
new file mode 100644
index 000000000..664c1b455
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js
@@ -0,0 +1,3 @@
+var BigInteger = require('./');
+var a = new BigInteger('91823918239182398123');
+console.log(a.bitLength()); \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js
new file mode 100644
index 000000000..e32fe13d8
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js
@@ -0,0 +1,1358 @@
+(function(){
+
+ // Copyright (c) 2005 Tom Wu
+ // All Rights Reserved.
+ // See "LICENSE" for details.
+
+ // Basic JavaScript BN library - subset useful for RSA encryption.
+
+ // Bits per digit
+ var dbits;
+
+ // JavaScript engine analysis
+ var canary = 0xdeadbeefcafe;
+ var j_lm = ((canary&0xffffff)==0xefcafe);
+
+ // (public) Constructor
+ function BigInteger(a,b,c) {
+ if(a != null)
+ if("number" == typeof a) this.fromNumber(a,b,c);
+ else if(b == null && "string" != typeof a) this.fromString(a,256);
+ else this.fromString(a,b);
+ }
+
+ // return new, unset BigInteger
+ function nbi() { return new BigInteger(null); }
+
+ // am: Compute w_j += (x*this_i), propagate carries,
+ // c is initial carry, returns final carry.
+ // c < 3*dvalue, x < 2*dvalue, this_i < dvalue
+ // We need to select the fastest one that works in this environment.
+
+ // am1: use a single mult and divide to get the high bits,
+ // max digit bits should be 26 because
+ // max internal value = 2*dvalue^2-2*dvalue (< 2^53)
+ function am1(i,x,w,j,c,n) {
+ while(--n >= 0) {
+ var v = x*this[i++]+w[j]+c;
+ c = Math.floor(v/0x4000000);
+ w[j++] = v&0x3ffffff;
+ }
+ return c;
+ }
+ // am2 avoids a big mult-and-extract completely.
+ // Max digit bits should be <= 30 because we do bitwise ops
+ // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
+ function am2(i,x,w,j,c,n) {
+ var xl = x&0x7fff, xh = x>>15;
+ while(--n >= 0) {
+ var l = this[i]&0x7fff;
+ var h = this[i++]>>15;
+ var m = xh*l+h*xl;
+ l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);
+ c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
+ w[j++] = l&0x3fffffff;
+ }
+ return c;
+ }
+ // Alternately, set max digit bits to 28 since some
+ // browsers slow down when dealing with 32-bit numbers.
+ function am3(i,x,w,j,c,n) {
+ var xl = x&0x3fff, xh = x>>14;
+ while(--n >= 0) {
+ var l = this[i]&0x3fff;
+ var h = this[i++]>>14;
+ var m = xh*l+h*xl;
+ l = xl*l+((m&0x3fff)<<14)+w[j]+c;
+ c = (l>>28)+(m>>14)+xh*h;
+ w[j++] = l&0xfffffff;
+ }
+ return c;
+ }
+ var inBrowser = typeof navigator !== "undefined";
+ if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
+ BigInteger.prototype.am = am2;
+ dbits = 30;
+ }
+ else if(inBrowser && j_lm && (navigator.appName != "Netscape")) {
+ BigInteger.prototype.am = am1;
+ dbits = 26;
+ }
+ else { // Mozilla/Netscape seems to prefer am3
+ BigInteger.prototype.am = am3;
+ dbits = 28;
+ }
+
+ BigInteger.prototype.DB = dbits;
+ BigInteger.prototype.DM = ((1<<dbits)-1);
+ BigInteger.prototype.DV = (1<<dbits);
+
+ var BI_FP = 52;
+ BigInteger.prototype.FV = Math.pow(2,BI_FP);
+ BigInteger.prototype.F1 = BI_FP-dbits;
+ BigInteger.prototype.F2 = 2*dbits-BI_FP;
+
+ // Digit conversions
+ var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
+ var BI_RC = new Array();
+ var rr,vv;
+ rr = "0".charCodeAt(0);
+ for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
+ rr = "a".charCodeAt(0);
+ for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
+ rr = "A".charCodeAt(0);
+ for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
+
+ function int2char(n) { return BI_RM.charAt(n); }
+ function intAt(s,i) {
+ var c = BI_RC[s.charCodeAt(i)];
+ return (c==null)?-1:c;
+ }
+
+ // (protected) copy this to r
+ function bnpCopyTo(r) {
+ for(var i = this.t-1; i >= 0; --i) r[i] = this[i];
+ r.t = this.t;
+ r.s = this.s;
+ }
+
+ // (protected) set from integer value x, -DV <= x < DV
+ function bnpFromInt(x) {
+ this.t = 1;
+ this.s = (x<0)?-1:0;
+ if(x > 0) this[0] = x;
+ else if(x < -1) this[0] = x+this.DV;
+ else this.t = 0;
+ }
+
+ // return bigint initialized to value
+ function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
+
+ // (protected) set from string and radix
+ function bnpFromString(s,b) {
+ var k;
+ if(b == 16) k = 4;
+ else if(b == 8) k = 3;
+ else if(b == 256) k = 8; // byte array
+ else if(b == 2) k = 1;
+ else if(b == 32) k = 5;
+ else if(b == 4) k = 2;
+ else { this.fromRadix(s,b); return; }
+ this.t = 0;
+ this.s = 0;
+ var i = s.length, mi = false, sh = 0;
+ while(--i >= 0) {
+ var x = (k==8)?s[i]&0xff:intAt(s,i);
+ if(x < 0) {
+ if(s.charAt(i) == "-") mi = true;
+ continue;
+ }
+ mi = false;
+ if(sh == 0)
+ this[this.t++] = x;
+ else if(sh+k > this.DB) {
+ this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;
+ this[this.t++] = (x>>(this.DB-sh));
+ }
+ else
+ this[this.t-1] |= x<<sh;
+ sh += k;
+ if(sh >= this.DB) sh -= this.DB;
+ }
+ if(k == 8 && (s[0]&0x80) != 0) {
+ this.s = -1;
+ if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;
+ }
+ this.clamp();
+ if(mi) BigInteger.ZERO.subTo(this,this);
+ }
+
+ // (protected) clamp off excess high words
+ function bnpClamp() {
+ var c = this.s&this.DM;
+ while(this.t > 0 && this[this.t-1] == c) --this.t;
+ }
+
+ // (public) return string representation in given radix
+ function bnToString(b) {
+ if(this.s < 0) return "-"+this.negate().toString(b);
+ var k;
+ if(b == 16) k = 4;
+ else if(b == 8) k = 3;
+ else if(b == 2) k = 1;
+ else if(b == 32) k = 5;
+ else if(b == 4) k = 2;
+ else return this.toRadix(b);
+ var km = (1<<k)-1, d, m = false, r = "", i = this.t;
+ var p = this.DB-(i*this.DB)%k;
+ if(i-- > 0) {
+ if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }
+ while(i >= 0) {
+ if(p < k) {
+ d = (this[i]&((1<<p)-1))<<(k-p);
+ d |= this[--i]>>(p+=this.DB-k);
+ }
+ else {
+ d = (this[i]>>(p-=k))&km;
+ if(p <= 0) { p += this.DB; --i; }
+ }
+ if(d > 0) m = true;
+ if(m) r += int2char(d);
+ }
+ }
+ return m?r:"0";
+ }
+
+ // (public) -this
+ function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
+
+ // (public) |this|
+ function bnAbs() { return (this.s<0)?this.negate():this; }
+
+ // (public) return + if this > a, - if this < a, 0 if equal
+ function bnCompareTo(a) {
+ var r = this.s-a.s;
+ if(r != 0) return r;
+ var i = this.t;
+ r = i-a.t;
+ if(r != 0) return (this.s<0)?-r:r;
+ while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;
+ return 0;
+ }
+
+ // returns bit length of the integer x
+ function nbits(x) {
+ var r = 1, t;
+ if((t=x>>>16) != 0) { x = t; r += 16; }
+ if((t=x>>8) != 0) { x = t; r += 8; }
+ if((t=x>>4) != 0) { x = t; r += 4; }
+ if((t=x>>2) != 0) { x = t; r += 2; }
+ if((t=x>>1) != 0) { x = t; r += 1; }
+ return r;
+ }
+
+ // (public) return the number of bits in "this"
+ function bnBitLength() {
+ if(this.t <= 0) return 0;
+ return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));
+ }
+
+ // (protected) r = this << n*DB
+ function bnpDLShiftTo(n,r) {
+ var i;
+ for(i = this.t-1; i >= 0; --i) r[i+n] = this[i];
+ for(i = n-1; i >= 0; --i) r[i] = 0;
+ r.t = this.t+n;
+ r.s = this.s;
+ }
+
+ // (protected) r = this >> n*DB
+ function bnpDRShiftTo(n,r) {
+ for(var i = n; i < this.t; ++i) r[i-n] = this[i];
+ r.t = Math.max(this.t-n,0);
+ r.s = this.s;
+ }
+
+ // (protected) r = this << n
+ function bnpLShiftTo(n,r) {
+ var bs = n%this.DB;
+ var cbs = this.DB-bs;
+ var bm = (1<<cbs)-1;
+ var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i;
+ for(i = this.t-1; i >= 0; --i) {
+ r[i+ds+1] = (this[i]>>cbs)|c;
+ c = (this[i]&bm)<<bs;
+ }
+ for(i = ds-1; i >= 0; --i) r[i] = 0;
+ r[ds] = c;
+ r.t = this.t+ds+1;
+ r.s = this.s;
+ r.clamp();
+ }
+
+ // (protected) r = this >> n
+ function bnpRShiftTo(n,r) {
+ r.s = this.s;
+ var ds = Math.floor(n/this.DB);
+ if(ds >= this.t) { r.t = 0; return; }
+ var bs = n%this.DB;
+ var cbs = this.DB-bs;
+ var bm = (1<<bs)-1;
+ r[0] = this[ds]>>bs;
+ for(var i = ds+1; i < this.t; ++i) {
+ r[i-ds-1] |= (this[i]&bm)<<cbs;
+ r[i-ds] = this[i]>>bs;
+ }
+ if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<<cbs;
+ r.t = this.t-ds;
+ r.clamp();
+ }
+
+ // (protected) r = this - a
+ function bnpSubTo(a,r) {
+ var i = 0, c = 0, m = Math.min(a.t,this.t);
+ while(i < m) {
+ c += this[i]-a[i];
+ r[i++] = c&this.DM;
+ c >>= this.DB;
+ }
+ if(a.t < this.t) {
+ c -= a.s;
+ while(i < this.t) {
+ c += this[i];
+ r[i++] = c&this.DM;
+ c >>= this.DB;
+ }
+ c += this.s;
+ }
+ else {
+ c += this.s;
+ while(i < a.t) {
+ c -= a[i];
+ r[i++] = c&this.DM;
+ c >>= this.DB;
+ }
+ c -= a.s;
+ }
+ r.s = (c<0)?-1:0;
+ if(c < -1) r[i++] = this.DV+c;
+ else if(c > 0) r[i++] = c;
+ r.t = i;
+ r.clamp();
+ }
+
+ // (protected) r = this * a, r != this,a (HAC 14.12)
+ // "this" should be the larger one if appropriate.
+ function bnpMultiplyTo(a,r) {
+ var x = this.abs(), y = a.abs();
+ var i = x.t;
+ r.t = i+y.t;
+ while(--i >= 0) r[i] = 0;
+ for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t);
+ r.s = 0;
+ r.clamp();
+ if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
+ }
+
+ // (protected) r = this^2, r != this (HAC 14.16)
+ function bnpSquareTo(r) {
+ var x = this.abs();
+ var i = r.t = 2*x.t;
+ while(--i >= 0) r[i] = 0;
+ for(i = 0; i < x.t-1; ++i) {
+ var c = x.am(i,x[i],r,2*i,0,1);
+ if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
+ r[i+x.t] -= x.DV;
+ r[i+x.t+1] = 1;
+ }
+ }
+ if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1);
+ r.s = 0;
+ r.clamp();
+ }
+
+ // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
+ // r != q, this != m. q or r may be null.
+ function bnpDivRemTo(m,q,r) {
+ var pm = m.abs();
+ if(pm.t <= 0) return;
+ var pt = this.abs();
+ if(pt.t < pm.t) {
+ if(q != null) q.fromInt(0);
+ if(r != null) this.copyTo(r);
+ return;
+ }
+ if(r == null) r = nbi();
+ var y = nbi(), ts = this.s, ms = m.s;
+ var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus
+ if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
+ else { pm.copyTo(y); pt.copyTo(r); }
+ var ys = y.t;
+ var y0 = y[ys-1];
+ if(y0 == 0) return;
+ var yt = y0*(1<<this.F1)+((ys>1)?y[ys-2]>>this.F2:0);
+ var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2;
+ var i = r.t, j = i-ys, t = (q==null)?nbi():q;
+ y.dlShiftTo(j,t);
+ if(r.compareTo(t) >= 0) {
+ r[r.t++] = 1;
+ r.subTo(t,r);
+ }
+ BigInteger.ONE.dlShiftTo(ys,t);
+ t.subTo(y,y); // "negative" y so we can replace sub with am later
+ while(y.t < ys) y[y.t++] = 0;
+ while(--j >= 0) {
+ // Estimate quotient digit
+ var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);
+ if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
+ y.dlShiftTo(j,t);
+ r.subTo(t,r);
+ while(r[i] < --qd) r.subTo(t,r);
+ }
+ }
+ if(q != null) {
+ r.drShiftTo(ys,q);
+ if(ts != ms) BigInteger.ZERO.subTo(q,q);
+ }
+ r.t = ys;
+ r.clamp();
+ if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
+ if(ts < 0) BigInteger.ZERO.subTo(r,r);
+ }
+
+ // (public) this mod a
+ function bnMod(a) {
+ var r = nbi();
+ this.abs().divRemTo(a,null,r);
+ if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
+ return r;
+ }
+
+ // Modular reduction using "classic" algorithm
+ function Classic(m) { this.m = m; }
+ function cConvert(x) {
+ if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
+ else return x;
+ }
+ function cRevert(x) { return x; }
+ function cReduce(x) { x.divRemTo(this.m,null,x); }
+ function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
+ function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
+
+ Classic.prototype.convert = cConvert;
+ Classic.prototype.revert = cRevert;
+ Classic.prototype.reduce = cReduce;
+ Classic.prototype.mulTo = cMulTo;
+ Classic.prototype.sqrTo = cSqrTo;
+
+ // (protected) return "-1/this % 2^DB"; useful for Mont. reduction
+ // justification:
+ // xy == 1 (mod m)
+ // xy = 1+km
+ // xy(2-xy) = (1+km)(1-km)
+ // x[y(2-xy)] = 1-k^2m^2
+ // x[y(2-xy)] == 1 (mod m^2)
+ // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
+ // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
+ // JS multiply "overflows" differently from C/C++, so care is needed here.
+ function bnpInvDigit() {
+ if(this.t < 1) return 0;
+ var x = this[0];
+ if((x&1) == 0) return 0;
+ var y = x&3; // y == 1/x mod 2^2
+ y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
+ y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
+ y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
+ // last step - calculate inverse mod DV directly;
+ // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
+ y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
+ // we really want the negative inverse, and -DV < y < DV
+ return (y>0)?this.DV-y:-y;
+ }
+
+ // Montgomery reduction
+ function Montgomery(m) {
+ this.m = m;
+ this.mp = m.invDigit();
+ this.mpl = this.mp&0x7fff;
+ this.mph = this.mp>>15;
+ this.um = (1<<(m.DB-15))-1;
+ this.mt2 = 2*m.t;
+ }
+
+ // xR mod m
+ function montConvert(x) {
+ var r = nbi();
+ x.abs().dlShiftTo(this.m.t,r);
+ r.divRemTo(this.m,null,r);
+ if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
+ return r;
+ }
+
+ // x/R mod m
+ function montRevert(x) {
+ var r = nbi();
+ x.copyTo(r);
+ this.reduce(r);
+ return r;
+ }
+
+ // x = x/R mod m (HAC 14.32)
+ function montReduce(x) {
+ while(x.t <= this.mt2) // pad x so am has enough room later
+ x[x.t++] = 0;
+ for(var i = 0; i < this.m.t; ++i) {
+ // faster way of calculating u0 = x[i]*mp mod DV
+ var j = x[i]&0x7fff;
+ var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
+ // use am to combine the multiply-shift-add into one call
+ j = i+this.m.t;
+ x[j] += this.m.am(0,u0,x,i,0,this.m.t);
+ // propagate carry
+ while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }
+ }
+ x.clamp();
+ x.drShiftTo(this.m.t,x);
+ if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
+ }
+
+ // r = "x^2/R mod m"; x != r
+ function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
+
+ // r = "xy/R mod m"; x,y != r
+ function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
+
+ Montgomery.prototype.convert = montConvert;
+ Montgomery.prototype.revert = montRevert;
+ Montgomery.prototype.reduce = montReduce;
+ Montgomery.prototype.mulTo = montMulTo;
+ Montgomery.prototype.sqrTo = montSqrTo;
+
+ // (protected) true iff this is even
+ function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
+
+ // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
+ function bnpExp(e,z) {
+ if(e > 0xffffffff || e < 1) return BigInteger.ONE;
+ var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
+ g.copyTo(r);
+ while(--i >= 0) {
+ z.sqrTo(r,r2);
+ if((e&(1<<i)) > 0) z.mulTo(r2,g,r);
+ else { var t = r; r = r2; r2 = t; }
+ }
+ return z.revert(r);
+ }
+
+ // (public) this^e % m, 0 <= e < 2^32
+ function bnModPowInt(e,m) {
+ var z;
+ if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
+ return this.exp(e,z);
+ }
+
+ // protected
+ BigInteger.prototype.copyTo = bnpCopyTo;
+ BigInteger.prototype.fromInt = bnpFromInt;
+ BigInteger.prototype.fromString = bnpFromString;
+ BigInteger.prototype.clamp = bnpClamp;
+ BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
+ BigInteger.prototype.drShiftTo = bnpDRShiftTo;
+ BigInteger.prototype.lShiftTo = bnpLShiftTo;
+ BigInteger.prototype.rShiftTo = bnpRShiftTo;
+ BigInteger.prototype.subTo = bnpSubTo;
+ BigInteger.prototype.multiplyTo = bnpMultiplyTo;
+ BigInteger.prototype.squareTo = bnpSquareTo;
+ BigInteger.prototype.divRemTo = bnpDivRemTo;
+ BigInteger.prototype.invDigit = bnpInvDigit;
+ BigInteger.prototype.isEven = bnpIsEven;
+ BigInteger.prototype.exp = bnpExp;
+
+ // public
+ BigInteger.prototype.toString = bnToString;
+ BigInteger.prototype.negate = bnNegate;
+ BigInteger.prototype.abs = bnAbs;
+ BigInteger.prototype.compareTo = bnCompareTo;
+ BigInteger.prototype.bitLength = bnBitLength;
+ BigInteger.prototype.mod = bnMod;
+ BigInteger.prototype.modPowInt = bnModPowInt;
+
+ // "constants"
+ BigInteger.ZERO = nbv(0);
+ BigInteger.ONE = nbv(1);
+
+ // Copyright (c) 2005-2009 Tom Wu
+ // All Rights Reserved.
+ // See "LICENSE" for details.
+
+ // Extended JavaScript BN functions, required for RSA private ops.
+
+ // Version 1.1: new BigInteger("0", 10) returns "proper" zero
+ // Version 1.2: square() API, isProbablePrime fix
+
+ // (public)
+ function bnClone() { var r = nbi(); this.copyTo(r); return r; }
+
+ // (public) return value as integer
+ function bnIntValue() {
+ if(this.s < 0) {
+ if(this.t == 1) return this[0]-this.DV;
+ else if(this.t == 0) return -1;
+ }
+ else if(this.t == 1) return this[0];
+ else if(this.t == 0) return 0;
+ // assumes 16 < DB < 32
+ return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0];
+ }
+
+ // (public) return value as byte
+ function bnByteValue() { return (this.t==0)?this.s:(this[0]<<24)>>24; }
+
+ // (public) return value as short (assumes DB>=16)
+ function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }
+
+ // (protected) return x s.t. r^x < DV
+ function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
+
+ // (public) 0 if this == 0, 1 if this > 0
+ function bnSigNum() {
+ if(this.s < 0) return -1;
+ else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
+ else return 1;
+ }
+
+ // (protected) convert to radix string
+ function bnpToRadix(b) {
+ if(b == null) b = 10;
+ if(this.signum() == 0 || b < 2 || b > 36) return "0";
+ var cs = this.chunkSize(b);
+ var a = Math.pow(b,cs);
+ var d = nbv(a), y = nbi(), z = nbi(), r = "";
+ this.divRemTo(d,y,z);
+ while(y.signum() > 0) {
+ r = (a+z.intValue()).toString(b).substr(1) + r;
+ y.divRemTo(d,y,z);
+ }
+ return z.intValue().toString(b) + r;
+ }
+
+ // (protected) convert from radix string
+ function bnpFromRadix(s,b) {
+ this.fromInt(0);
+ if(b == null) b = 10;
+ var cs = this.chunkSize(b);
+ var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
+ for(var i = 0; i < s.length; ++i) {
+ var x = intAt(s,i);
+ if(x < 0) {
+ if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
+ continue;
+ }
+ w = b*w+x;
+ if(++j >= cs) {
+ this.dMultiply(d);
+ this.dAddOffset(w,0);
+ j = 0;
+ w = 0;
+ }
+ }
+ if(j > 0) {
+ this.dMultiply(Math.pow(b,j));
+ this.dAddOffset(w,0);
+ }
+ if(mi) BigInteger.ZERO.subTo(this,this);
+ }
+
+ // (protected) alternate constructor
+ function bnpFromNumber(a,b,c) {
+ if("number" == typeof b) {
+ // new BigInteger(int,int,RNG)
+ if(a < 2) this.fromInt(1);
+ else {
+ this.fromNumber(a,c);
+ if(!this.testBit(a-1)) // force MSB set
+ this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
+ if(this.isEven()) this.dAddOffset(1,0); // force odd
+ while(!this.isProbablePrime(b)) {
+ this.dAddOffset(2,0);
+ if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
+ }
+ }
+ }
+ else {
+ // new BigInteger(int,RNG)
+ var x = new Array(), t = a&7;
+ x.length = (a>>3)+1;
+ b.nextBytes(x);
+ if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0;
+ this.fromString(x,256);
+ }
+ }
+
+ // (public) convert to bigendian byte array
+ function bnToByteArray() {
+ var i = this.t, r = new Array();
+ r[0] = this.s;
+ var p = this.DB-(i*this.DB)%8, d, k = 0;
+ if(i-- > 0) {
+ if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p)
+ r[k++] = d|(this.s<<(this.DB-p));
+ while(i >= 0) {
+ if(p < 8) {
+ d = (this[i]&((1<<p)-1))<<(8-p);
+ d |= this[--i]>>(p+=this.DB-8);
+ }
+ else {
+ d = (this[i]>>(p-=8))&0xff;
+ if(p <= 0) { p += this.DB; --i; }
+ }
+ if((d&0x80) != 0) d |= -256;
+ if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
+ if(k > 0 || d != this.s) r[k++] = d;
+ }
+ }
+ return r;
+ }
+
+ function bnEquals(a) { return(this.compareTo(a)==0); }
+ function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
+ function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
+
+ // (protected) r = this op a (bitwise)
+ function bnpBitwiseTo(a,op,r) {
+ var i, f, m = Math.min(a.t,this.t);
+ for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]);
+ if(a.t < this.t) {
+ f = a.s&this.DM;
+ for(i = m; i < this.t; ++i) r[i] = op(this[i],f);
+ r.t = this.t;
+ }
+ else {
+ f = this.s&this.DM;
+ for(i = m; i < a.t; ++i) r[i] = op(f,a[i]);
+ r.t = a.t;
+ }
+ r.s = op(this.s,a.s);
+ r.clamp();
+ }
+
+ // (public) this & a
+ function op_and(x,y) { return x&y; }
+ function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
+
+ // (public) this | a
+ function op_or(x,y) { return x|y; }
+ function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
+
+ // (public) this ^ a
+ function op_xor(x,y) { return x^y; }
+ function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
+
+ // (public) this & ~a
+ function op_andnot(x,y) { return x&~y; }
+ function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
+
+ // (public) ~this
+ function bnNot() {
+ var r = nbi();
+ for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i];
+ r.t = this.t;
+ r.s = ~this.s;
+ return r;
+ }
+
+ // (public) this << n
+ function bnShiftLeft(n) {
+ var r = nbi();
+ if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
+ return r;
+ }
+
+ // (public) this >> n
+ function bnShiftRight(n) {
+ var r = nbi();
+ if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
+ return r;
+ }
+
+ // return index of lowest 1-bit in x, x < 2^31
+ function lbit(x) {
+ if(x == 0) return -1;
+ var r = 0;
+ if((x&0xffff) == 0) { x >>= 16; r += 16; }
+ if((x&0xff) == 0) { x >>= 8; r += 8; }
+ if((x&0xf) == 0) { x >>= 4; r += 4; }
+ if((x&3) == 0) { x >>= 2; r += 2; }
+ if((x&1) == 0) ++r;
+ return r;
+ }
+
+ // (public) returns index of lowest 1-bit (or -1 if none)
+ function bnGetLowestSetBit() {
+ for(var i = 0; i < this.t; ++i)
+ if(this[i] != 0) return i*this.DB+lbit(this[i]);
+ if(this.s < 0) return this.t*this.DB;
+ return -1;
+ }
+
+ // return number of 1 bits in x
+ function cbit(x) {
+ var r = 0;
+ while(x != 0) { x &= x-1; ++r; }
+ return r;
+ }
+
+ // (public) return number of set bits
+ function bnBitCount() {
+ var r = 0, x = this.s&this.DM;
+ for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x);
+ return r;
+ }
+
+ // (public) true iff nth bit is set
+ function bnTestBit(n) {
+ var j = Math.floor(n/this.DB);
+ if(j >= this.t) return(this.s!=0);
+ return((this[j]&(1<<(n%this.DB)))!=0);
+ }
+
+ // (protected) this op (1<<n)
+ function bnpChangeBit(n,op) {
+ var r = BigInteger.ONE.shiftLeft(n);
+ this.bitwiseTo(r,op,r);
+ return r;
+ }
+
+ // (public) this | (1<<n)
+ function bnSetBit(n) { return this.changeBit(n,op_or); }
+
+ // (public) this & ~(1<<n)
+ function bnClearBit(n) { return this.changeBit(n,op_andnot); }
+
+ // (public) this ^ (1<<n)
+ function bnFlipBit(n) { return this.changeBit(n,op_xor); }
+
+ // (protected) r = this + a
+ function bnpAddTo(a,r) {
+ var i = 0, c = 0, m = Math.min(a.t,this.t);
+ while(i < m) {
+ c += this[i]+a[i];
+ r[i++] = c&this.DM;
+ c >>= this.DB;
+ }
+ if(a.t < this.t) {
+ c += a.s;
+ while(i < this.t) {
+ c += this[i];
+ r[i++] = c&this.DM;
+ c >>= this.DB;
+ }
+ c += this.s;
+ }
+ else {
+ c += this.s;
+ while(i < a.t) {
+ c += a[i];
+ r[i++] = c&this.DM;
+ c >>= this.DB;
+ }
+ c += a.s;
+ }
+ r.s = (c<0)?-1:0;
+ if(c > 0) r[i++] = c;
+ else if(c < -1) r[i++] = this.DV+c;
+ r.t = i;
+ r.clamp();
+ }
+
+ // (public) this + a
+ function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
+
+ // (public) this - a
+ function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
+
+ // (public) this * a
+ function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
+
+ // (public) this^2
+ function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
+
+ // (public) this / a
+ function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
+
+ // (public) this % a
+ function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
+
+ // (public) [this/a,this%a]
+ function bnDivideAndRemainder(a) {
+ var q = nbi(), r = nbi();
+ this.divRemTo(a,q,r);
+ return new Array(q,r);
+ }
+
+ // (protected) this *= n, this >= 0, 1 < n < DV
+ function bnpDMultiply(n) {
+ this[this.t] = this.am(0,n-1,this,0,0,this.t);
+ ++this.t;
+ this.clamp();
+ }
+
+ // (protected) this += n << w words, this >= 0
+ function bnpDAddOffset(n,w) {
+ if(n == 0) return;
+ while(this.t <= w) this[this.t++] = 0;
+ this[w] += n;
+ while(this[w] >= this.DV) {
+ this[w] -= this.DV;
+ if(++w >= this.t) this[this.t++] = 0;
+ ++this[w];
+ }
+ }
+
+ // A "null" reducer
+ function NullExp() {}
+ function nNop(x) { return x; }
+ function nMulTo(x,y,r) { x.multiplyTo(y,r); }
+ function nSqrTo(x,r) { x.squareTo(r); }
+
+ NullExp.prototype.convert = nNop;
+ NullExp.prototype.revert = nNop;
+ NullExp.prototype.mulTo = nMulTo;
+ NullExp.prototype.sqrTo = nSqrTo;
+
+ // (public) this^e
+ function bnPow(e) { return this.exp(e,new NullExp()); }
+
+ // (protected) r = lower n words of "this * a", a.t <= n
+ // "this" should be the larger one if appropriate.
+ function bnpMultiplyLowerTo(a,n,r) {
+ var i = Math.min(this.t+a.t,n);
+ r.s = 0; // assumes a,this >= 0
+ r.t = i;
+ while(i > 0) r[--i] = 0;
+ var j;
+ for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);
+ for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);
+ r.clamp();
+ }
+
+ // (protected) r = "this * a" without lower n words, n > 0
+ // "this" should be the larger one if appropriate.
+ function bnpMultiplyUpperTo(a,n,r) {
+ --n;
+ var i = r.t = this.t+a.t-n;
+ r.s = 0; // assumes a,this >= 0
+ while(--i >= 0) r[i] = 0;
+ for(i = Math.max(n-this.t,0); i < a.t; ++i)
+ r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n);
+ r.clamp();
+ r.drShiftTo(1,r);
+ }
+
+ // Barrett modular reduction
+ function Barrett(m) {
+ // setup Barrett
+ this.r2 = nbi();
+ this.q3 = nbi();
+ BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
+ this.mu = this.r2.divide(m);
+ this.m = m;
+ }
+
+ function barrettConvert(x) {
+ if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
+ else if(x.compareTo(this.m) < 0) return x;
+ else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
+ }
+
+ function barrettRevert(x) { return x; }
+
+ // x = x mod m (HAC 14.42)
+ function barrettReduce(x) {
+ x.drShiftTo(this.m.t-1,this.r2);
+ if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
+ this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
+ this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
+ while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
+ x.subTo(this.r2,x);
+ while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
+ }
+
+ // r = x^2 mod m; x != r
+ function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
+
+ // r = x*y mod m; x,y != r
+ function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
+
+ Barrett.prototype.convert = barrettConvert;
+ Barrett.prototype.revert = barrettRevert;
+ Barrett.prototype.reduce = barrettReduce;
+ Barrett.prototype.mulTo = barrettMulTo;
+ Barrett.prototype.sqrTo = barrettSqrTo;
+
+ // (public) this^e % m (HAC 14.85)
+ function bnModPow(e,m) {
+ var i = e.bitLength(), k, r = nbv(1), z;
+ if(i <= 0) return r;
+ else if(i < 18) k = 1;
+ else if(i < 48) k = 3;
+ else if(i < 144) k = 4;
+ else if(i < 768) k = 5;
+ else k = 6;
+ if(i < 8)
+ z = new Classic(m);
+ else if(m.isEven())
+ z = new Barrett(m);
+ else
+ z = new Montgomery(m);
+
+ // precomputation
+ var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;
+ g[1] = z.convert(this);
+ if(k > 1) {
+ var g2 = nbi();
+ z.sqrTo(g[1],g2);
+ while(n <= km) {
+ g[n] = nbi();
+ z.mulTo(g2,g[n-2],g[n]);
+ n += 2;
+ }
+ }
+
+ var j = e.t-1, w, is1 = true, r2 = nbi(), t;
+ i = nbits(e[j])-1;
+ while(j >= 0) {
+ if(i >= k1) w = (e[j]>>(i-k1))&km;
+ else {
+ w = (e[j]&((1<<(i+1))-1))<<(k1-i);
+ if(j > 0) w |= e[j-1]>>(this.DB+i-k1);
+ }
+
+ n = k;
+ while((w&1) == 0) { w >>= 1; --n; }
+ if((i -= n) < 0) { i += this.DB; --j; }
+ if(is1) { // ret == 1, don't bother squaring or multiplying it
+ g[w].copyTo(r);
+ is1 = false;
+ }
+ else {
+ while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
+ if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
+ z.mulTo(r2,g[w],r);
+ }
+
+ while(j >= 0 && (e[j]&(1<<i)) == 0) {
+ z.sqrTo(r,r2); t = r; r = r2; r2 = t;
+ if(--i < 0) { i = this.DB-1; --j; }
+ }
+ }
+ return z.revert(r);
+ }
+
+ // (public) gcd(this,a) (HAC 14.54)
+ function bnGCD(a) {
+ var x = (this.s<0)?this.negate():this.clone();
+ var y = (a.s<0)?a.negate():a.clone();
+ if(x.compareTo(y) < 0) { var t = x; x = y; y = t; }
+ var i = x.getLowestSetBit(), g = y.getLowestSetBit();
+ if(g < 0) return x;
+ if(i < g) g = i;
+ if(g > 0) {
+ x.rShiftTo(g,x);
+ y.rShiftTo(g,y);
+ }
+ while(x.signum() > 0) {
+ if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
+ if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
+ if(x.compareTo(y) >= 0) {
+ x.subTo(y,x);
+ x.rShiftTo(1,x);
+ }
+ else {
+ y.subTo(x,y);
+ y.rShiftTo(1,y);
+ }
+ }
+ if(g > 0) y.lShiftTo(g,y);
+ return y;
+ }
+
+ // (protected) this % n, n < 2^26
+ function bnpModInt(n) {
+ if(n <= 0) return 0;
+ var d = this.DV%n, r = (this.s<0)?n-1:0;
+ if(this.t > 0)
+ if(d == 0) r = this[0]%n;
+ else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n;
+ return r;
+ }
+
+ // (public) 1/this % m (HAC 14.61)
+ function bnModInverse(m) {
+ var ac = m.isEven();
+ if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
+ var u = m.clone(), v = this.clone();
+ var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
+ while(u.signum() != 0) {
+ while(u.isEven()) {
+ u.rShiftTo(1,u);
+ if(ac) {
+ if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
+ a.rShiftTo(1,a);
+ }
+ else if(!b.isEven()) b.subTo(m,b);
+ b.rShiftTo(1,b);
+ }
+ while(v.isEven()) {
+ v.rShiftTo(1,v);
+ if(ac) {
+ if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
+ c.rShiftTo(1,c);
+ }
+ else if(!d.isEven()) d.subTo(m,d);
+ d.rShiftTo(1,d);
+ }
+ if(u.compareTo(v) >= 0) {
+ u.subTo(v,u);
+ if(ac) a.subTo(c,a);
+ b.subTo(d,b);
+ }
+ else {
+ v.subTo(u,v);
+ if(ac) c.subTo(a,c);
+ d.subTo(b,d);
+ }
+ }
+ if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
+ if(d.compareTo(m) >= 0) return d.subtract(m);
+ if(d.signum() < 0) d.addTo(m,d); else return d;
+ if(d.signum() < 0) return d.add(m); else return d;
+ }
+
+ var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];
+ var lplim = (1<<26)/lowprimes[lowprimes.length-1];
+
+ // (public) test primality with certainty >= 1-.5^t
+ function bnIsProbablePrime(t) {
+ var i, x = this.abs();
+ if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) {
+ for(i = 0; i < lowprimes.length; ++i)
+ if(x[0] == lowprimes[i]) return true;
+ return false;
+ }
+ if(x.isEven()) return false;
+ i = 1;
+ while(i < lowprimes.length) {
+ var m = lowprimes[i], j = i+1;
+ while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];
+ m = x.modInt(m);
+ while(i < j) if(m%lowprimes[i++] == 0) return false;
+ }
+ return x.millerRabin(t);
+ }
+
+ // (protected) true if probably prime (HAC 4.24, Miller-Rabin)
+ function bnpMillerRabin(t) {
+ var n1 = this.subtract(BigInteger.ONE);
+ var k = n1.getLowestSetBit();
+ if(k <= 0) return false;
+ var r = n1.shiftRight(k);
+ t = (t+1)>>1;
+ if(t > lowprimes.length) t = lowprimes.length;
+ var a = nbi();
+ for(var i = 0; i < t; ++i) {
+ //Pick bases at random, instead of starting at 2
+ a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);
+ var y = a.modPow(r,this);
+ if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
+ var j = 1;
+ while(j++ < k && y.compareTo(n1) != 0) {
+ y = y.modPowInt(2,this);
+ if(y.compareTo(BigInteger.ONE) == 0) return false;
+ }
+ if(y.compareTo(n1) != 0) return false;
+ }
+ }
+ return true;
+ }
+
+ // protected
+ BigInteger.prototype.chunkSize = bnpChunkSize;
+ BigInteger.prototype.toRadix = bnpToRadix;
+ BigInteger.prototype.fromRadix = bnpFromRadix;
+ BigInteger.prototype.fromNumber = bnpFromNumber;
+ BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
+ BigInteger.prototype.changeBit = bnpChangeBit;
+ BigInteger.prototype.addTo = bnpAddTo;
+ BigInteger.prototype.dMultiply = bnpDMultiply;
+ BigInteger.prototype.dAddOffset = bnpDAddOffset;
+ BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
+ BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
+ BigInteger.prototype.modInt = bnpModInt;
+ BigInteger.prototype.millerRabin = bnpMillerRabin;
+
+ // public
+ BigInteger.prototype.clone = bnClone;
+ BigInteger.prototype.intValue = bnIntValue;
+ BigInteger.prototype.byteValue = bnByteValue;
+ BigInteger.prototype.shortValue = bnShortValue;
+ BigInteger.prototype.signum = bnSigNum;
+ BigInteger.prototype.toByteArray = bnToByteArray;
+ BigInteger.prototype.equals = bnEquals;
+ BigInteger.prototype.min = bnMin;
+ BigInteger.prototype.max = bnMax;
+ BigInteger.prototype.and = bnAnd;
+ BigInteger.prototype.or = bnOr;
+ BigInteger.prototype.xor = bnXor;
+ BigInteger.prototype.andNot = bnAndNot;
+ BigInteger.prototype.not = bnNot;
+ BigInteger.prototype.shiftLeft = bnShiftLeft;
+ BigInteger.prototype.shiftRight = bnShiftRight;
+ BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
+ BigInteger.prototype.bitCount = bnBitCount;
+ BigInteger.prototype.testBit = bnTestBit;
+ BigInteger.prototype.setBit = bnSetBit;
+ BigInteger.prototype.clearBit = bnClearBit;
+ BigInteger.prototype.flipBit = bnFlipBit;
+ BigInteger.prototype.add = bnAdd;
+ BigInteger.prototype.subtract = bnSubtract;
+ BigInteger.prototype.multiply = bnMultiply;
+ BigInteger.prototype.divide = bnDivide;
+ BigInteger.prototype.remainder = bnRemainder;
+ BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
+ BigInteger.prototype.modPow = bnModPow;
+ BigInteger.prototype.modInverse = bnModInverse;
+ BigInteger.prototype.pow = bnPow;
+ BigInteger.prototype.gcd = bnGCD;
+ BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
+
+ // JSBN-specific extension
+ BigInteger.prototype.square = bnSquare;
+
+ // Expose the Barrett function
+ BigInteger.prototype.Barrett = Barrett
+
+ // BigInteger interfaces not implemented in jsbn:
+
+ // BigInteger(int signum, byte[] magnitude)
+ // double doubleValue()
+ // float floatValue()
+ // int hashCode()
+ // long longValue()
+ // static BigInteger valueOf(long val)
+
+ // Random number generator - requires a PRNG backend, e.g. prng4.js
+
+ // For best results, put code like
+ // <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>
+ // in your main HTML document.
+
+ var rng_state;
+ var rng_pool;
+ var rng_pptr;
+
+ // Mix in a 32-bit integer into the pool
+ function rng_seed_int(x) {
+ rng_pool[rng_pptr++] ^= x & 255;
+ rng_pool[rng_pptr++] ^= (x >> 8) & 255;
+ rng_pool[rng_pptr++] ^= (x >> 16) & 255;
+ rng_pool[rng_pptr++] ^= (x >> 24) & 255;
+ if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;
+ }
+
+ // Mix in the current time (w/milliseconds) into the pool
+ function rng_seed_time() {
+ rng_seed_int(new Date().getTime());
+ }
+
+ // Initialize the pool with junk if needed.
+ if(rng_pool == null) {
+ rng_pool = new Array();
+ rng_pptr = 0;
+ var t;
+ if(typeof window !== "undefined" && window.crypto) {
+ if (window.crypto.getRandomValues) {
+ // Use webcrypto if available
+ var ua = new Uint8Array(32);
+ window.crypto.getRandomValues(ua);
+ for(t = 0; t < 32; ++t)
+ rng_pool[rng_pptr++] = ua[t];
+ }
+ else if(navigator.appName == "Netscape" && navigator.appVersion < "5") {
+ // Extract entropy (256 bits) from NS4 RNG if available
+ var z = window.crypto.random(32);
+ for(t = 0; t < z.length; ++t)
+ rng_pool[rng_pptr++] = z.charCodeAt(t) & 255;
+ }
+ }
+ while(rng_pptr < rng_psize) { // extract some randomness from Math.random()
+ t = Math.floor(65536 * Math.random());
+ rng_pool[rng_pptr++] = t >>> 8;
+ rng_pool[rng_pptr++] = t & 255;
+ }
+ rng_pptr = 0;
+ rng_seed_time();
+ //rng_seed_int(window.screenX);
+ //rng_seed_int(window.screenY);
+ }
+
+ function rng_get_byte() {
+ if(rng_state == null) {
+ rng_seed_time();
+ rng_state = prng_newstate();
+ rng_state.init(rng_pool);
+ for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
+ rng_pool[rng_pptr] = 0;
+ rng_pptr = 0;
+ //rng_pool = null;
+ }
+ // TODO: allow reseeding after first request
+ return rng_state.next();
+ }
+
+ function rng_get_bytes(ba) {
+ var i;
+ for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
+ }
+
+ function SecureRandom() {}
+
+ SecureRandom.prototype.nextBytes = rng_get_bytes;
+
+ // prng4.js - uses Arcfour as a PRNG
+
+ function Arcfour() {
+ this.i = 0;
+ this.j = 0;
+ this.S = new Array();
+ }
+
+ // Initialize arcfour context from key, an array of ints, each from [0..255]
+ function ARC4init(key) {
+ var i, j, t;
+ for(i = 0; i < 256; ++i)
+ this.S[i] = i;
+ j = 0;
+ for(i = 0; i < 256; ++i) {
+ j = (j + this.S[i] + key[i % key.length]) & 255;
+ t = this.S[i];
+ this.S[i] = this.S[j];
+ this.S[j] = t;
+ }
+ this.i = 0;
+ this.j = 0;
+ }
+
+ function ARC4next() {
+ var t;
+ this.i = (this.i + 1) & 255;
+ this.j = (this.j + this.S[this.i]) & 255;
+ t = this.S[this.i];
+ this.S[this.i] = this.S[this.j];
+ this.S[this.j] = t;
+ return this.S[(t + this.S[this.i]) & 255];
+ }
+
+ Arcfour.prototype.init = ARC4init;
+ Arcfour.prototype.next = ARC4next;
+
+ // Plug in your RNG constructor here
+ function prng_newstate() {
+ return new Arcfour();
+ }
+
+ // Pool size must be a multiple of 4 and greater than 32.
+ // An array of bytes the size of the pool will be passed to init()
+ var rng_psize = 256;
+
+ if (typeof exports !== 'undefined') {
+ exports = module.exports = {
+ BigInteger: BigInteger,
+ SecureRandom: SecureRandom,
+ };
+ } else {
+ this.BigInteger = BigInteger;
+ this.SecureRandom = SecureRandom;
+ }
+
+}).call(this);
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json
new file mode 100644
index 000000000..838d035ff
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json
@@ -0,0 +1,79 @@
+{
+ "_args": [
+ [
+ "jsbn@>=0.1.0 <0.2.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk"
+ ]
+ ],
+ "_from": "jsbn@>=0.1.0 <0.2.0",
+ "_id": "jsbn@0.1.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/jsbn",
+ "_nodeVersion": "0.12.2",
+ "_npmUser": {
+ "email": "andyperlitch@gmail.com",
+ "name": "andyperlitch"
+ },
+ "_npmVersion": "2.7.4",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "jsbn",
+ "raw": "jsbn@>=0.1.0 <0.2.0",
+ "rawSpec": ">=0.1.0 <0.2.0",
+ "scope": null,
+ "spec": ">=0.1.0 <0.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk",
+ "/request/http-signature/sshpk/ecc-jsbn",
+ "/request/http-signature/sshpk/jodid25519"
+ ],
+ "_resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz",
+ "_shasum": "650987da0dd74f4ebf5a11377a2aa2d273e97dfd",
+ "_shrinkwrap": null,
+ "_spec": "jsbn@>=0.1.0 <0.2.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk",
+ "author": {
+ "name": "Tom Wu"
+ },
+ "bugs": {
+ "url": "https://github.com/andyperlitch/jsbn/issues"
+ },
+ "dependencies": {},
+ "description": "The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers.",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "650987da0dd74f4ebf5a11377a2aa2d273e97dfd",
+ "tarball": "http://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz"
+ },
+ "gitHead": "148a967b112806e63ddeeed78ee7938eef74c84a",
+ "homepage": "https://github.com/andyperlitch/jsbn",
+ "keywords": [
+ "big",
+ "biginteger",
+ "bignumber",
+ "integer"
+ ],
+ "license": "BSD",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "andyperlitch",
+ "email": "andyperlitch@gmail.com"
+ }
+ ],
+ "name": "jsbn",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/andyperlitch/jsbn.git"
+ },
+ "scripts": {
+ "test": "mocha test.js"
+ },
+ "version": "0.1.0"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore
new file mode 100644
index 000000000..7d98dcbd2
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore
@@ -0,0 +1,4 @@
+.eslintrc
+.travis.yml
+bower.json
+test
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md
new file mode 100644
index 000000000..77c69bd5e
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md
@@ -0,0 +1,128 @@
+TweetNaCl.js Changelog
+======================
+
+
+v0.13.2
+-------
+
+* Fixed undefined variable bug in fast version of Poly1305. No worries, this
+ bug was *never* triggered.
+
+* Specified CC0 public domain dedication.
+
+* Updated development dependencies.
+
+
+v0.13.1
+-------
+
+* Exclude `crypto` and `buffer` modules from browserify builds.
+
+
+v0.13.0
+-------
+
+* Made `nacl-fast` the default version in NPM package. Now
+ `require("tweetnacl")` will use fast version; to get the original version,
+ use `require("tweetnacl/nacl.js")`.
+
+* Cleanup temporary array after generating random bytes.
+
+
+v0.12.2
+-------
+
+* Improved performance of curve operations, making `nacl.scalarMult`, `nacl.box`,
+ `nacl.sign` and related functions up to 3x faster in `nacl-fast` version.
+
+
+v0.12.1
+-------
+
+* Significantly improved performance of Salsa20 (~1.5x faster) and
+ Poly1305 (~3.5x faster) in `nacl-fast` version.
+
+
+v0.12.0
+-------
+
+* Instead of using the given secret key directly, TweetNaCl.js now copies it to
+ a new array in `nacl.box.keyPair.fromSecretKey` and
+ `nacl.sign.keyPair.fromSecretKey`.
+
+
+v0.11.2
+-------
+
+* Added new constant: `nacl.sign.seedLength`.
+
+
+v0.11.1
+-------
+
+* Even faster hash for both short and long inputs (in `nacl-fast`).
+
+
+v0.11.0
+-------
+
+* Implement `nacl.sign.keyPair.fromSeed` to enable creation of sign key pairs
+ deterministically from a 32-byte seed. (It behaves like
+ [libsodium's](http://doc.libsodium.org/public-key_cryptography/public-key_signatures.html)
+ `crypto_sign_seed_keypair`: the seed becomes a secret part of the secret key.)
+
+* Fast version now has an improved hash implementation that is 2x-5x faster.
+
+* Fixed benchmarks, which may have produced incorrect measurements.
+
+
+v0.10.1
+-------
+
+* Exported undocumented `nacl.lowlevel.crypto_core_hsalsa20`.
+
+
+v0.10.0
+-------
+
+* **Signature API breaking change!** `nacl.sign` and `nacl.sign.open` now deal
+ with signed messages, and new `nacl.sign.detached` and
+ `nacl.sign.detached.verify` are available.
+
+ Previously, `nacl.sign` returned a signature, and `nacl.sign.open` accepted a
+ message and "detached" signature. This was unlike NaCl's API, which dealt with
+ signed messages (concatenation of signature and message).
+
+ The new API is:
+
+ nacl.sign(message, secretKey) -> signedMessage
+ nacl.sign.open(signedMessage, publicKey) -> message | null
+
+ Since detached signatures are common, two new API functions were introduced:
+
+ nacl.sign.detached(message, secretKey) -> signature
+ nacl.sign.detached.verify(message, signature, publicKey) -> true | false
+
+ (Note that it's `verify`, not `open`, and it returns a boolean value, unlike
+ `open`, which returns an "unsigned" message.)
+
+* NPM package now comes without `test` directory to keep it small.
+
+
+v0.9.2
+------
+
+* Improved documentation.
+* Fast version: increased theoretical message size limit from 2^32-1 to 2^52
+ bytes in Poly1305 (and thus, secretbox and box). However this has no impact
+ in practice since JavaScript arrays or ArrayBuffers are limited to 32-bit
+ indexes, and most implementations won't allocate more than a gigabyte or so.
+ (Obviously, there are no tests for the correctness of implementation.) Also,
+ it's not recommended to use messages that large without splitting them into
+ smaller packets anyway.
+
+
+v0.9.1
+------
+
+* Initial release
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md
new file mode 100644
index 000000000..c40721d59
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md
@@ -0,0 +1,463 @@
+TweetNaCl.js
+============
+
+Port of [TweetNaCl](http://tweetnacl.cr.yp.to) / [NaCl](http://nacl.cr.yp.to/)
+to JavaScript for modern browsers and Node.js. Public domain.
+
+[![Build Status](https://travis-ci.org/dchest/tweetnacl-js.svg?branch=master)
+](https://travis-ci.org/dchest/tweetnacl-js)
+
+[Demo](https://dchest.github.io/tweetnacl-js/)
+
+**:warning: Beta version. The library is stable and API is frozen, however
+it has not been independently reviewed. If you can help reviewing it, please
+[contact me](mailto:dmitry@codingrobots.com).**
+
+Documentation
+=============
+
+* [Overview](#overview)
+* [Installation](#installation)
+* [Usage](#usage)
+ * [Public-key authenticated encryption (box)](#public-key-authenticated-encryption-box)
+ * [Secret-key authenticated encryption (secretbox)](#secret-key-authenticated-encryption-secretbox)
+ * [Scalar multiplication](#scalar-multiplication)
+ * [Signatures](#signatures)
+ * [Hashing](#hashing)
+ * [Random bytes generation](#random-bytes-generation)
+ * [Constant-time comparison](#constant-time-comparison)
+ * [Utilities](#utilities)
+* [Examples](#examples)
+* [System requirements](#system-requirements)
+* [Development and testing](#development-and-testing)
+* [Contributors](#contributors)
+* [Who uses it](#who-uses-it)
+
+
+Overview
+--------
+
+The primary goal of this project is to produce a translation of TweetNaCl to
+JavaScript which is as close as possible to the original C implementation, plus
+a thin layer of idiomatic high-level API on top of it.
+
+There are two versions, you can use either of them:
+
+* `nacl.js` is the port of TweetNaCl with minimum differences from the
+ original + high-level API.
+
+* `nacl-fast.js` is like `nacl.js`, but with some functions replaced with
+ faster versions.
+
+
+Installation
+------------
+
+You can install TweetNaCl.is via a package manager:
+
+[Bower](http://bower.io):
+
+ $ bower install tweetnacl
+
+[NPM](https://www.npmjs.org/):
+
+ $ npm install tweetnacl
+
+or [download source code](https://github.com/dchest/tweetnacl-js/releases).
+
+
+Usage
+------
+
+All API functions accept and return bytes as `Uint8Array`s. If you need to
+encode or decode strings, use functions from `nacl.util` namespace.
+
+### Public-key authenticated encryption (box)
+
+Implements *curve25519-xsalsa20-poly1305*.
+
+#### nacl.box.keyPair()
+
+Generates a new random key pair for box and returns it as an object with
+`publicKey` and `secretKey` members:
+
+ {
+ publicKey: ..., // Uint8Array with 32-byte public key
+ secretKey: ... // Uint8Array with 32-byte secret key
+ }
+
+
+#### nacl.box.keyPair.fromSecretKey(secretKey)
+
+Returns a key pair for box with public key corresponding to the given secret
+key.
+
+#### nacl.box(message, nonce, theirPublicKey, mySecretKey)
+
+Encrypt and authenticates message using peer's public key, our secret key, and
+the given nonce, which must be unique for each distinct message for a key pair.
+
+Returns an encrypted and authenticated message, which is
+`nacl.box.overheadLength` longer than the original message.
+
+#### nacl.box.open(box, nonce, theirPublicKey, mySecretKey)
+
+Authenticates and decrypts the given box with peer's public key, our secret
+key, and the given nonce.
+
+Returns the original message, or `false` if authentication fails.
+
+#### nacl.box.before(theirPublicKey, mySecretKey)
+
+Returns a precomputed shared key which can be used in `nacl.box.after` and
+`nacl.box.open.after`.
+
+#### nacl.box.after(message, nonce, sharedKey)
+
+Same as `nacl.box`, but uses a shared key precomputed with `nacl.box.before`.
+
+#### nacl.box.open.after(box, nonce, sharedKey)
+
+Same as `nacl.box.open`, but uses a shared key precomputed with `nacl.box.before`.
+
+#### nacl.box.publicKeyLength = 32
+
+Length of public key in bytes.
+
+#### nacl.box.secretKeyLength = 32
+
+Length of secret key in bytes.
+
+#### nacl.box.sharedKeyLength = 32
+
+Length of precomputed shared key in bytes.
+
+#### nacl.box.nonceLength = 24
+
+Length of nonce in bytes.
+
+#### nacl.box.overheadLength = 16
+
+Length of overhead added to box compared to original message.
+
+
+### Secret-key authenticated encryption (secretbox)
+
+Implements *xsalsa20-poly1305*.
+
+#### nacl.secretbox(message, nonce, key)
+
+Encrypt and authenticates message using the key and the nonce. The nonce must
+be unique for each distinct message for this key.
+
+Returns an encrypted and authenticated message, which is
+`nacl.secretbox.overheadLength` longer than the original message.
+
+#### nacl.secretbox.open(box, nonce, key)
+
+Authenticates and decrypts the given secret box using the key and the nonce.
+
+Returns the original message, or `false` if authentication fails.
+
+#### nacl.secretbox.keyLength = 32
+
+Length of key in bytes.
+
+#### nacl.secretbox.nonceLength = 24
+
+Length of nonce in bytes.
+
+#### nacl.secretbox.overheadLength = 16
+
+Length of overhead added to secret box compared to original message.
+
+
+### Scalar multiplication
+
+Implements *curve25519*.
+
+#### nacl.scalarMult(n, p)
+
+Multiplies an integer `n` by a group element `p` and returns the resulting
+group element.
+
+#### nacl.scalarMult.base(n)
+
+Multiplies an integer `n` by a standard group element and returns the resulting
+group element.
+
+#### nacl.scalarMult.scalarLength = 32
+
+Length of scalar in bytes.
+
+#### nacl.scalarMult.groupElementLength = 32
+
+Length of group element in bytes.
+
+
+### Signatures
+
+Implements [ed25519](http://ed25519.cr.yp.to).
+
+#### nacl.sign.keyPair()
+
+Generates new random key pair for signing and returns it as an object with
+`publicKey` and `secretKey` members:
+
+ {
+ publicKey: ..., // Uint8Array with 32-byte public key
+ secretKey: ... // Uint8Array with 64-byte secret key
+ }
+
+#### nacl.sign.keyPair.fromSecretKey(secretKey)
+
+Returns a signing key pair with public key corresponding to the given
+64-byte secret key. The secret key must have been generated by
+`nacl.sign.keyPair` or `nacl.sign.keyPair.fromSeed`.
+
+#### nacl.sign.keyPair.fromSeed(seed)
+
+Returns a new signing key pair generated deterministically from a 32-byte seed.
+The seed must contain enough entropy to be secure. This method is not
+recommended for general use: instead, use `nacl.sign.keyPair` to generate a new
+key pair from a random seed.
+
+#### nacl.sign(message, secretKey)
+
+Signs the message using the secret key and returns a signed message.
+
+#### nacl.sign.open(signedMessage, publicKey)
+
+Verifies the signed message and returns the message without signature.
+
+Returns `null` if verification failed.
+
+#### nacl.sign.detached(message, secretKey)
+
+Signs the message using the secret key and returns a signature.
+
+#### nacl.sign.detached.verify(message, signature, publicKey)
+
+Verifies the signature for the message and returns `true` if verification
+succeeded or `false` if it failed.
+
+#### nacl.sign.publicKeyLength = 32
+
+Length of signing public key in bytes.
+
+#### nacl.sign.secretKeyLength = 64
+
+Length of signing secret key in bytes.
+
+#### nacl.sign.seedLength = 32
+
+Length of seed for `nacl.sign.keyPair.fromSeed` in bytes.
+
+#### nacl.sign.signatureLength = 64
+
+Length of signature in bytes.
+
+
+### Hashing
+
+Implements *SHA-512*.
+
+#### nacl.hash(message)
+
+Returns SHA-512 hash of the message.
+
+#### nacl.hash.hashLength = 64
+
+Length of hash in bytes.
+
+
+### Random bytes generation
+
+#### nacl.randomBytes(length)
+
+Returns a `Uint8Array` of the given length containing random bytes of
+cryptographic quality.
+
+**Implementation note**
+
+TweetNaCl.js uses the following methods to generate random bytes,
+depending on the platform it runs on:
+
+* `window.crypto.getRandomValues` (WebCrypto standard)
+* `window.msCrypto.getRandomValues` (Internet Explorer 11)
+* `crypto.randomBytes` (Node.js)
+
+Note that browsers are required to throw `QuotaExceededError` exception if
+requested `length` is more than 65536, so do not ask for more than 65536 bytes
+in *one call* (multiple calls to get as many bytes as you like are okay:
+browsers can generate infinite amount of random bytes without any bad
+consequences).
+
+If the platform doesn't provide a suitable PRNG, the following functions,
+which require random numbers, will throw exception:
+
+* `nacl.randomBytes`
+* `nacl.box.keyPair`
+* `nacl.sign.keyPair`
+
+Other functions are deterministic and will continue working.
+
+If a platform you are targeting doesn't implement secure random number
+generator, but you somehow have a cryptographically-strong source of entropy
+(not `Math.random`!), and you know what you are doing, you can plug it into
+TweetNaCl.js like this:
+
+ nacl.setPRNG(function(x, n) {
+ // ... copy n random bytes into x ...
+ });
+
+Note that `nacl.setPRNG` *completely replaces* internal random byte generator
+with the one provided.
+
+
+### Constant-time comparison
+
+#### nacl.verify(x, y)
+
+Compares `x` and `y` in constant time and returns `true` if their lengths are
+non-zero and equal, and their contents are equal.
+
+Returns `false` if either of the arguments has zero length, or arguments have
+different lengths, or their contents differ.
+
+
+### Utilities
+
+Encoding/decoding functions are provided for convenience. They are correct,
+however their performance and wide compatibility with uncommon runtimes is not
+something that is considered important compared to the simplicity and size of
+implementation. You can use third-party libraries if you need to.
+
+#### nacl.util.decodeUTF8(string)
+
+Decodes string and returns `Uint8Array` of bytes.
+
+#### nacl.util.encodeUTF8(array)
+
+Encodes `Uint8Array` or `Array` of bytes into string.
+
+#### nacl.util.decodeBase64(string)
+
+Decodes Base-64 encoded string and returns `Uint8Array` of bytes.
+
+#### nacl.util.encodeBase64(array)
+
+Encodes `Uint8Array` or `Array` of bytes into string using Base-64 encoding.
+
+
+System requirements
+-------------------
+
+TweetNaCl.js supports modern browsers that have a cryptographically secure
+pseudorandom number generator and typed arrays, including the latest versions
+of:
+
+* Chrome
+* Firefox
+* Safari (Mac, iOS)
+* Internet Explorer 11
+
+Other systems:
+
+* Node.js (we test on 0.10 and later)
+
+
+Development and testing
+------------------------
+
+Install NPM modules needed for development:
+
+ $ npm install
+
+To build minified versions:
+
+ $ npm run build
+
+Tests use minified version, so make sure to rebuild it every time you change
+`nacl.js` or `nacl-fast.js`.
+
+### Testing
+
+To run tests in Node.js:
+
+ $ npm test
+
+By default all tests described here work on `nacl.min.js`. To test other
+versions, set environment variable `NACL_SRC` to the file name you want to test.
+For example, the following command will test fast minified version:
+
+ $ NACL_SRC=nacl-fast.min.js npm test
+
+To run full suite of tests in Node.js, including comparing outputs of
+JavaScript port to outputs of the original C version:
+
+ $ npm run testall
+
+To prepare tests for browsers:
+
+ $ npm run browser
+
+and then open `test/browser/test.html` (or `test/browser/test-fast.html`) to
+run them.
+
+To run headless browser tests with `testling`:
+
+ $ npm run testling
+
+(If you get `Error: spawn ENOENT`, install *xvfb*: `sudo apt-get install xvfb`.)
+
+### Benchmarking
+
+To run benchmarks in Node.js:
+
+ $ npm run bench
+ $ NACL_SRC=nacl-fast.min.js npm run bench
+
+To run benchmarks in a browser, open `test/benchmark/bench.html` (or
+`test/benchmark/bench-fast.html`).
+
+
+Contributors
+------------
+
+JavaScript port:
+
+ * [Dmitry Chestnykh](http://github.com/dchest) (ported xsalsa20, poly1305, curve25519)
+ * [Devi Mandiri](https://github.com/devi) (ported curve25519, ed25519, sha512)
+
+Original authors of [NaCl](http://nacl.cr.yp.to), [TweetNaCl](http://tweetnacl.cr.yp.to)
+and [Poly1305-donna](https://github.com/floodyberry/poly1305-donna)
+(who are *not* responsible for any errors in this implementation):
+
+ * [Daniel J. Bernstein](http://cr.yp.to/djb.html)
+ * Wesley Janssen
+ * [Tanja Lange](http://hyperelliptic.org/tanja)
+ * [Peter Schwabe](http://www.cryptojedi.org/users/peter/)
+ * [Matthew Dempsky](https://github.com/mdempsky)
+ * [Andrew Moon](https://github.com/floodyberry)
+
+Contributors have dedicated their work to the public domain.
+
+This software is distributed without any warranty.
+
+
+Third-party libraries based on TweetNaCl.js
+-------------------------------------------
+
+* [forward-secrecy](https://github.com/alax/forward-secrecy) — Axolotl ratchet implementation
+* [nacl-stream](https://github.com/dchest/nacl-stream-js) - streaming encryption
+* [tweetnacl-auth-js](https://github.com/dchest/tweetnacl-auth-js) — implementation of [`crypto_auth`](http://nacl.cr.yp.to/auth.html)
+
+
+Who uses it
+-----------
+
+Some notable users of TweetNaCl.js:
+
+* [miniLock](http://minilock.io/)
+* [Stellar](https://www.stellar.org/)
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js
new file mode 100644
index 000000000..6c4995848
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js
@@ -0,0 +1,2418 @@
+(function(nacl) {
+'use strict';
+
+// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
+// Public domain.
+//
+// Implementation derived from TweetNaCl version 20140427.
+// See for details: http://tweetnacl.cr.yp.to/
+
+var gf = function(init) {
+ var i, r = new Float64Array(16);
+ if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
+ return r;
+};
+
+// Pluggable, initialized in high-level API below.
+var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
+
+var _0 = new Uint8Array(16);
+var _9 = new Uint8Array(32); _9[0] = 9;
+
+var gf0 = gf(),
+ gf1 = gf([1]),
+ _121665 = gf([0xdb41, 1]),
+ D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
+ D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
+ X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
+ Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
+ I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
+
+function ts64(x, i, h, l) {
+ x[i] = (h >> 24) & 0xff;
+ x[i+1] = (h >> 16) & 0xff;
+ x[i+2] = (h >> 8) & 0xff;
+ x[i+3] = h & 0xff;
+ x[i+4] = (l >> 24) & 0xff;
+ x[i+5] = (l >> 16) & 0xff;
+ x[i+6] = (l >> 8) & 0xff;
+ x[i+7] = l & 0xff;
+}
+
+function vn(x, xi, y, yi, n) {
+ var i,d = 0;
+ for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
+ return (1 & ((d - 1) >>> 8)) - 1;
+}
+
+function crypto_verify_16(x, xi, y, yi) {
+ return vn(x,xi,y,yi,16);
+}
+
+function crypto_verify_32(x, xi, y, yi) {
+ return vn(x,xi,y,yi,32);
+}
+
+function core_salsa20(o, p, k, c) {
+ var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
+ j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
+ j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
+ j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
+ j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
+ j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
+ j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
+ j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
+ j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
+ j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
+ j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
+ j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
+ j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
+ j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
+ j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
+ j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
+
+ var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
+ x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
+ x15 = j15, u;
+
+ for (var i = 0; i < 20; i += 2) {
+ u = x0 + x12 | 0;
+ x4 ^= u<<7 | u>>>(32-7);
+ u = x4 + x0 | 0;
+ x8 ^= u<<9 | u>>>(32-9);
+ u = x8 + x4 | 0;
+ x12 ^= u<<13 | u>>>(32-13);
+ u = x12 + x8 | 0;
+ x0 ^= u<<18 | u>>>(32-18);
+
+ u = x5 + x1 | 0;
+ x9 ^= u<<7 | u>>>(32-7);
+ u = x9 + x5 | 0;
+ x13 ^= u<<9 | u>>>(32-9);
+ u = x13 + x9 | 0;
+ x1 ^= u<<13 | u>>>(32-13);
+ u = x1 + x13 | 0;
+ x5 ^= u<<18 | u>>>(32-18);
+
+ u = x10 + x6 | 0;
+ x14 ^= u<<7 | u>>>(32-7);
+ u = x14 + x10 | 0;
+ x2 ^= u<<9 | u>>>(32-9);
+ u = x2 + x14 | 0;
+ x6 ^= u<<13 | u>>>(32-13);
+ u = x6 + x2 | 0;
+ x10 ^= u<<18 | u>>>(32-18);
+
+ u = x15 + x11 | 0;
+ x3 ^= u<<7 | u>>>(32-7);
+ u = x3 + x15 | 0;
+ x7 ^= u<<9 | u>>>(32-9);
+ u = x7 + x3 | 0;
+ x11 ^= u<<13 | u>>>(32-13);
+ u = x11 + x7 | 0;
+ x15 ^= u<<18 | u>>>(32-18);
+
+ u = x0 + x3 | 0;
+ x1 ^= u<<7 | u>>>(32-7);
+ u = x1 + x0 | 0;
+ x2 ^= u<<9 | u>>>(32-9);
+ u = x2 + x1 | 0;
+ x3 ^= u<<13 | u>>>(32-13);
+ u = x3 + x2 | 0;
+ x0 ^= u<<18 | u>>>(32-18);
+
+ u = x5 + x4 | 0;
+ x6 ^= u<<7 | u>>>(32-7);
+ u = x6 + x5 | 0;
+ x7 ^= u<<9 | u>>>(32-9);
+ u = x7 + x6 | 0;
+ x4 ^= u<<13 | u>>>(32-13);
+ u = x4 + x7 | 0;
+ x5 ^= u<<18 | u>>>(32-18);
+
+ u = x10 + x9 | 0;
+ x11 ^= u<<7 | u>>>(32-7);
+ u = x11 + x10 | 0;
+ x8 ^= u<<9 | u>>>(32-9);
+ u = x8 + x11 | 0;
+ x9 ^= u<<13 | u>>>(32-13);
+ u = x9 + x8 | 0;
+ x10 ^= u<<18 | u>>>(32-18);
+
+ u = x15 + x14 | 0;
+ x12 ^= u<<7 | u>>>(32-7);
+ u = x12 + x15 | 0;
+ x13 ^= u<<9 | u>>>(32-9);
+ u = x13 + x12 | 0;
+ x14 ^= u<<13 | u>>>(32-13);
+ u = x14 + x13 | 0;
+ x15 ^= u<<18 | u>>>(32-18);
+ }
+ x0 = x0 + j0 | 0;
+ x1 = x1 + j1 | 0;
+ x2 = x2 + j2 | 0;
+ x3 = x3 + j3 | 0;
+ x4 = x4 + j4 | 0;
+ x5 = x5 + j5 | 0;
+ x6 = x6 + j6 | 0;
+ x7 = x7 + j7 | 0;
+ x8 = x8 + j8 | 0;
+ x9 = x9 + j9 | 0;
+ x10 = x10 + j10 | 0;
+ x11 = x11 + j11 | 0;
+ x12 = x12 + j12 | 0;
+ x13 = x13 + j13 | 0;
+ x14 = x14 + j14 | 0;
+ x15 = x15 + j15 | 0;
+
+ o[ 0] = x0 >>> 0 & 0xff;
+ o[ 1] = x0 >>> 8 & 0xff;
+ o[ 2] = x0 >>> 16 & 0xff;
+ o[ 3] = x0 >>> 24 & 0xff;
+
+ o[ 4] = x1 >>> 0 & 0xff;
+ o[ 5] = x1 >>> 8 & 0xff;
+ o[ 6] = x1 >>> 16 & 0xff;
+ o[ 7] = x1 >>> 24 & 0xff;
+
+ o[ 8] = x2 >>> 0 & 0xff;
+ o[ 9] = x2 >>> 8 & 0xff;
+ o[10] = x2 >>> 16 & 0xff;
+ o[11] = x2 >>> 24 & 0xff;
+
+ o[12] = x3 >>> 0 & 0xff;
+ o[13] = x3 >>> 8 & 0xff;
+ o[14] = x3 >>> 16 & 0xff;
+ o[15] = x3 >>> 24 & 0xff;
+
+ o[16] = x4 >>> 0 & 0xff;
+ o[17] = x4 >>> 8 & 0xff;
+ o[18] = x4 >>> 16 & 0xff;
+ o[19] = x4 >>> 24 & 0xff;
+
+ o[20] = x5 >>> 0 & 0xff;
+ o[21] = x5 >>> 8 & 0xff;
+ o[22] = x5 >>> 16 & 0xff;
+ o[23] = x5 >>> 24 & 0xff;
+
+ o[24] = x6 >>> 0 & 0xff;
+ o[25] = x6 >>> 8 & 0xff;
+ o[26] = x6 >>> 16 & 0xff;
+ o[27] = x6 >>> 24 & 0xff;
+
+ o[28] = x7 >>> 0 & 0xff;
+ o[29] = x7 >>> 8 & 0xff;
+ o[30] = x7 >>> 16 & 0xff;
+ o[31] = x7 >>> 24 & 0xff;
+
+ o[32] = x8 >>> 0 & 0xff;
+ o[33] = x8 >>> 8 & 0xff;
+ o[34] = x8 >>> 16 & 0xff;
+ o[35] = x8 >>> 24 & 0xff;
+
+ o[36] = x9 >>> 0 & 0xff;
+ o[37] = x9 >>> 8 & 0xff;
+ o[38] = x9 >>> 16 & 0xff;
+ o[39] = x9 >>> 24 & 0xff;
+
+ o[40] = x10 >>> 0 & 0xff;
+ o[41] = x10 >>> 8 & 0xff;
+ o[42] = x10 >>> 16 & 0xff;
+ o[43] = x10 >>> 24 & 0xff;
+
+ o[44] = x11 >>> 0 & 0xff;
+ o[45] = x11 >>> 8 & 0xff;
+ o[46] = x11 >>> 16 & 0xff;
+ o[47] = x11 >>> 24 & 0xff;
+
+ o[48] = x12 >>> 0 & 0xff;
+ o[49] = x12 >>> 8 & 0xff;
+ o[50] = x12 >>> 16 & 0xff;
+ o[51] = x12 >>> 24 & 0xff;
+
+ o[52] = x13 >>> 0 & 0xff;
+ o[53] = x13 >>> 8 & 0xff;
+ o[54] = x13 >>> 16 & 0xff;
+ o[55] = x13 >>> 24 & 0xff;
+
+ o[56] = x14 >>> 0 & 0xff;
+ o[57] = x14 >>> 8 & 0xff;
+ o[58] = x14 >>> 16 & 0xff;
+ o[59] = x14 >>> 24 & 0xff;
+
+ o[60] = x15 >>> 0 & 0xff;
+ o[61] = x15 >>> 8 & 0xff;
+ o[62] = x15 >>> 16 & 0xff;
+ o[63] = x15 >>> 24 & 0xff;
+}
+
+function core_hsalsa20(o,p,k,c) {
+ var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
+ j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
+ j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
+ j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
+ j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
+ j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
+ j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
+ j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
+ j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
+ j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
+ j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
+ j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
+ j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
+ j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
+ j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
+ j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
+
+ var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
+ x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
+ x15 = j15, u;
+
+ for (var i = 0; i < 20; i += 2) {
+ u = x0 + x12 | 0;
+ x4 ^= u<<7 | u>>>(32-7);
+ u = x4 + x0 | 0;
+ x8 ^= u<<9 | u>>>(32-9);
+ u = x8 + x4 | 0;
+ x12 ^= u<<13 | u>>>(32-13);
+ u = x12 + x8 | 0;
+ x0 ^= u<<18 | u>>>(32-18);
+
+ u = x5 + x1 | 0;
+ x9 ^= u<<7 | u>>>(32-7);
+ u = x9 + x5 | 0;
+ x13 ^= u<<9 | u>>>(32-9);
+ u = x13 + x9 | 0;
+ x1 ^= u<<13 | u>>>(32-13);
+ u = x1 + x13 | 0;
+ x5 ^= u<<18 | u>>>(32-18);
+
+ u = x10 + x6 | 0;
+ x14 ^= u<<7 | u>>>(32-7);
+ u = x14 + x10 | 0;
+ x2 ^= u<<9 | u>>>(32-9);
+ u = x2 + x14 | 0;
+ x6 ^= u<<13 | u>>>(32-13);
+ u = x6 + x2 | 0;
+ x10 ^= u<<18 | u>>>(32-18);
+
+ u = x15 + x11 | 0;
+ x3 ^= u<<7 | u>>>(32-7);
+ u = x3 + x15 | 0;
+ x7 ^= u<<9 | u>>>(32-9);
+ u = x7 + x3 | 0;
+ x11 ^= u<<13 | u>>>(32-13);
+ u = x11 + x7 | 0;
+ x15 ^= u<<18 | u>>>(32-18);
+
+ u = x0 + x3 | 0;
+ x1 ^= u<<7 | u>>>(32-7);
+ u = x1 + x0 | 0;
+ x2 ^= u<<9 | u>>>(32-9);
+ u = x2 + x1 | 0;
+ x3 ^= u<<13 | u>>>(32-13);
+ u = x3 + x2 | 0;
+ x0 ^= u<<18 | u>>>(32-18);
+
+ u = x5 + x4 | 0;
+ x6 ^= u<<7 | u>>>(32-7);
+ u = x6 + x5 | 0;
+ x7 ^= u<<9 | u>>>(32-9);
+ u = x7 + x6 | 0;
+ x4 ^= u<<13 | u>>>(32-13);
+ u = x4 + x7 | 0;
+ x5 ^= u<<18 | u>>>(32-18);
+
+ u = x10 + x9 | 0;
+ x11 ^= u<<7 | u>>>(32-7);
+ u = x11 + x10 | 0;
+ x8 ^= u<<9 | u>>>(32-9);
+ u = x8 + x11 | 0;
+ x9 ^= u<<13 | u>>>(32-13);
+ u = x9 + x8 | 0;
+ x10 ^= u<<18 | u>>>(32-18);
+
+ u = x15 + x14 | 0;
+ x12 ^= u<<7 | u>>>(32-7);
+ u = x12 + x15 | 0;
+ x13 ^= u<<9 | u>>>(32-9);
+ u = x13 + x12 | 0;
+ x14 ^= u<<13 | u>>>(32-13);
+ u = x14 + x13 | 0;
+ x15 ^= u<<18 | u>>>(32-18);
+ }
+
+ o[ 0] = x0 >>> 0 & 0xff;
+ o[ 1] = x0 >>> 8 & 0xff;
+ o[ 2] = x0 >>> 16 & 0xff;
+ o[ 3] = x0 >>> 24 & 0xff;
+
+ o[ 4] = x5 >>> 0 & 0xff;
+ o[ 5] = x5 >>> 8 & 0xff;
+ o[ 6] = x5 >>> 16 & 0xff;
+ o[ 7] = x5 >>> 24 & 0xff;
+
+ o[ 8] = x10 >>> 0 & 0xff;
+ o[ 9] = x10 >>> 8 & 0xff;
+ o[10] = x10 >>> 16 & 0xff;
+ o[11] = x10 >>> 24 & 0xff;
+
+ o[12] = x15 >>> 0 & 0xff;
+ o[13] = x15 >>> 8 & 0xff;
+ o[14] = x15 >>> 16 & 0xff;
+ o[15] = x15 >>> 24 & 0xff;
+
+ o[16] = x6 >>> 0 & 0xff;
+ o[17] = x6 >>> 8 & 0xff;
+ o[18] = x6 >>> 16 & 0xff;
+ o[19] = x6 >>> 24 & 0xff;
+
+ o[20] = x7 >>> 0 & 0xff;
+ o[21] = x7 >>> 8 & 0xff;
+ o[22] = x7 >>> 16 & 0xff;
+ o[23] = x7 >>> 24 & 0xff;
+
+ o[24] = x8 >>> 0 & 0xff;
+ o[25] = x8 >>> 8 & 0xff;
+ o[26] = x8 >>> 16 & 0xff;
+ o[27] = x8 >>> 24 & 0xff;
+
+ o[28] = x9 >>> 0 & 0xff;
+ o[29] = x9 >>> 8 & 0xff;
+ o[30] = x9 >>> 16 & 0xff;
+ o[31] = x9 >>> 24 & 0xff;
+}
+
+function crypto_core_salsa20(out,inp,k,c) {
+ core_salsa20(out,inp,k,c);
+}
+
+function crypto_core_hsalsa20(out,inp,k,c) {
+ core_hsalsa20(out,inp,k,c);
+}
+
+var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
+ // "expand 32-byte k"
+
+function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
+ var z = new Uint8Array(16), x = new Uint8Array(64);
+ var u, i;
+ for (i = 0; i < 16; i++) z[i] = 0;
+ for (i = 0; i < 8; i++) z[i] = n[i];
+ while (b >= 64) {
+ crypto_core_salsa20(x,z,k,sigma);
+ for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
+ u = 1;
+ for (i = 8; i < 16; i++) {
+ u = u + (z[i] & 0xff) | 0;
+ z[i] = u & 0xff;
+ u >>>= 8;
+ }
+ b -= 64;
+ cpos += 64;
+ mpos += 64;
+ }
+ if (b > 0) {
+ crypto_core_salsa20(x,z,k,sigma);
+ for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
+ }
+ return 0;
+}
+
+function crypto_stream_salsa20(c,cpos,b,n,k) {
+ var z = new Uint8Array(16), x = new Uint8Array(64);
+ var u, i;
+ for (i = 0; i < 16; i++) z[i] = 0;
+ for (i = 0; i < 8; i++) z[i] = n[i];
+ while (b >= 64) {
+ crypto_core_salsa20(x,z,k,sigma);
+ for (i = 0; i < 64; i++) c[cpos+i] = x[i];
+ u = 1;
+ for (i = 8; i < 16; i++) {
+ u = u + (z[i] & 0xff) | 0;
+ z[i] = u & 0xff;
+ u >>>= 8;
+ }
+ b -= 64;
+ cpos += 64;
+ }
+ if (b > 0) {
+ crypto_core_salsa20(x,z,k,sigma);
+ for (i = 0; i < b; i++) c[cpos+i] = x[i];
+ }
+ return 0;
+}
+
+function crypto_stream(c,cpos,d,n,k) {
+ var s = new Uint8Array(32);
+ crypto_core_hsalsa20(s,n,k,sigma);
+ var sn = new Uint8Array(8);
+ for (var i = 0; i < 8; i++) sn[i] = n[i+16];
+ return crypto_stream_salsa20(c,cpos,d,sn,s);
+}
+
+function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
+ var s = new Uint8Array(32);
+ crypto_core_hsalsa20(s,n,k,sigma);
+ var sn = new Uint8Array(8);
+ for (var i = 0; i < 8; i++) sn[i] = n[i+16];
+ return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
+}
+
+/*
+* Port of Andrew Moon's Poly1305-donna-16. Public domain.
+* https://github.com/floodyberry/poly1305-donna
+*/
+
+var poly1305 = function(key) {
+ this.buffer = new Uint8Array(16);
+ this.r = new Uint16Array(10);
+ this.h = new Uint16Array(10);
+ this.pad = new Uint16Array(8);
+ this.leftover = 0;
+ this.fin = 0;
+
+ var t0, t1, t2, t3, t4, t5, t6, t7;
+
+ t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
+ t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
+ t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
+ t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
+ t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
+ this.r[5] = ((t4 >>> 1)) & 0x1ffe;
+ t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
+ t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
+ t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
+ this.r[9] = ((t7 >>> 5)) & 0x007f;
+
+ this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
+ this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
+ this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
+ this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
+ this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
+ this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
+ this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
+ this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
+};
+
+poly1305.prototype.blocks = function(m, mpos, bytes) {
+ var hibit = this.fin ? 0 : (1 << 11);
+ var t0, t1, t2, t3, t4, t5, t6, t7, c;
+ var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
+
+ var h0 = this.h[0],
+ h1 = this.h[1],
+ h2 = this.h[2],
+ h3 = this.h[3],
+ h4 = this.h[4],
+ h5 = this.h[5],
+ h6 = this.h[6],
+ h7 = this.h[7],
+ h8 = this.h[8],
+ h9 = this.h[9];
+
+ var r0 = this.r[0],
+ r1 = this.r[1],
+ r2 = this.r[2],
+ r3 = this.r[3],
+ r4 = this.r[4],
+ r5 = this.r[5],
+ r6 = this.r[6],
+ r7 = this.r[7],
+ r8 = this.r[8],
+ r9 = this.r[9];
+
+ while (bytes >= 16) {
+ t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
+ t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
+ t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
+ t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
+ t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
+ h5 += ((t4 >>> 1)) & 0x1fff;
+ t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
+ t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
+ t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
+ h9 += ((t7 >>> 5)) | hibit;
+
+ c = 0;
+
+ d0 = c;
+ d0 += h0 * r0;
+ d0 += h1 * (5 * r9);
+ d0 += h2 * (5 * r8);
+ d0 += h3 * (5 * r7);
+ d0 += h4 * (5 * r6);
+ c = (d0 >>> 13); d0 &= 0x1fff;
+ d0 += h5 * (5 * r5);
+ d0 += h6 * (5 * r4);
+ d0 += h7 * (5 * r3);
+ d0 += h8 * (5 * r2);
+ d0 += h9 * (5 * r1);
+ c += (d0 >>> 13); d0 &= 0x1fff;
+
+ d1 = c;
+ d1 += h0 * r1;
+ d1 += h1 * r0;
+ d1 += h2 * (5 * r9);
+ d1 += h3 * (5 * r8);
+ d1 += h4 * (5 * r7);
+ c = (d1 >>> 13); d1 &= 0x1fff;
+ d1 += h5 * (5 * r6);
+ d1 += h6 * (5 * r5);
+ d1 += h7 * (5 * r4);
+ d1 += h8 * (5 * r3);
+ d1 += h9 * (5 * r2);
+ c += (d1 >>> 13); d1 &= 0x1fff;
+
+ d2 = c;
+ d2 += h0 * r2;
+ d2 += h1 * r1;
+ d2 += h2 * r0;
+ d2 += h3 * (5 * r9);
+ d2 += h4 * (5 * r8);
+ c = (d2 >>> 13); d2 &= 0x1fff;
+ d2 += h5 * (5 * r7);
+ d2 += h6 * (5 * r6);
+ d2 += h7 * (5 * r5);
+ d2 += h8 * (5 * r4);
+ d2 += h9 * (5 * r3);
+ c += (d2 >>> 13); d2 &= 0x1fff;
+
+ d3 = c;
+ d3 += h0 * r3;
+ d3 += h1 * r2;
+ d3 += h2 * r1;
+ d3 += h3 * r0;
+ d3 += h4 * (5 * r9);
+ c = (d3 >>> 13); d3 &= 0x1fff;
+ d3 += h5 * (5 * r8);
+ d3 += h6 * (5 * r7);
+ d3 += h7 * (5 * r6);
+ d3 += h8 * (5 * r5);
+ d3 += h9 * (5 * r4);
+ c += (d3 >>> 13); d3 &= 0x1fff;
+
+ d4 = c;
+ d4 += h0 * r4;
+ d4 += h1 * r3;
+ d4 += h2 * r2;
+ d4 += h3 * r1;
+ d4 += h4 * r0;
+ c = (d4 >>> 13); d4 &= 0x1fff;
+ d4 += h5 * (5 * r9);
+ d4 += h6 * (5 * r8);
+ d4 += h7 * (5 * r7);
+ d4 += h8 * (5 * r6);
+ d4 += h9 * (5 * r5);
+ c += (d4 >>> 13); d4 &= 0x1fff;
+
+ d5 = c;
+ d5 += h0 * r5;
+ d5 += h1 * r4;
+ d5 += h2 * r3;
+ d5 += h3 * r2;
+ d5 += h4 * r1;
+ c = (d5 >>> 13); d5 &= 0x1fff;
+ d5 += h5 * r0;
+ d5 += h6 * (5 * r9);
+ d5 += h7 * (5 * r8);
+ d5 += h8 * (5 * r7);
+ d5 += h9 * (5 * r6);
+ c += (d5 >>> 13); d5 &= 0x1fff;
+
+ d6 = c;
+ d6 += h0 * r6;
+ d6 += h1 * r5;
+ d6 += h2 * r4;
+ d6 += h3 * r3;
+ d6 += h4 * r2;
+ c = (d6 >>> 13); d6 &= 0x1fff;
+ d6 += h5 * r1;
+ d6 += h6 * r0;
+ d6 += h7 * (5 * r9);
+ d6 += h8 * (5 * r8);
+ d6 += h9 * (5 * r7);
+ c += (d6 >>> 13); d6 &= 0x1fff;
+
+ d7 = c;
+ d7 += h0 * r7;
+ d7 += h1 * r6;
+ d7 += h2 * r5;
+ d7 += h3 * r4;
+ d7 += h4 * r3;
+ c = (d7 >>> 13); d7 &= 0x1fff;
+ d7 += h5 * r2;
+ d7 += h6 * r1;
+ d7 += h7 * r0;
+ d7 += h8 * (5 * r9);
+ d7 += h9 * (5 * r8);
+ c += (d7 >>> 13); d7 &= 0x1fff;
+
+ d8 = c;
+ d8 += h0 * r8;
+ d8 += h1 * r7;
+ d8 += h2 * r6;
+ d8 += h3 * r5;
+ d8 += h4 * r4;
+ c = (d8 >>> 13); d8 &= 0x1fff;
+ d8 += h5 * r3;
+ d8 += h6 * r2;
+ d8 += h7 * r1;
+ d8 += h8 * r0;
+ d8 += h9 * (5 * r9);
+ c += (d8 >>> 13); d8 &= 0x1fff;
+
+ d9 = c;
+ d9 += h0 * r9;
+ d9 += h1 * r8;
+ d9 += h2 * r7;
+ d9 += h3 * r6;
+ d9 += h4 * r5;
+ c = (d9 >>> 13); d9 &= 0x1fff;
+ d9 += h5 * r4;
+ d9 += h6 * r3;
+ d9 += h7 * r2;
+ d9 += h8 * r1;
+ d9 += h9 * r0;
+ c += (d9 >>> 13); d9 &= 0x1fff;
+
+ c = (((c << 2) + c)) | 0;
+ c = (c + d0) | 0;
+ d0 = c & 0x1fff;
+ c = (c >>> 13);
+ d1 += c;
+
+ h0 = d0;
+ h1 = d1;
+ h2 = d2;
+ h3 = d3;
+ h4 = d4;
+ h5 = d5;
+ h6 = d6;
+ h7 = d7;
+ h8 = d8;
+ h9 = d9;
+
+ mpos += 16;
+ bytes -= 16;
+ }
+ this.h[0] = h0;
+ this.h[1] = h1;
+ this.h[2] = h2;
+ this.h[3] = h3;
+ this.h[4] = h4;
+ this.h[5] = h5;
+ this.h[6] = h6;
+ this.h[7] = h7;
+ this.h[8] = h8;
+ this.h[9] = h9;
+};
+
+poly1305.prototype.finish = function(mac, macpos) {
+ var g = new Uint16Array(10);
+ var c, mask, f, i;
+
+ if (this.leftover) {
+ i = this.leftover;
+ this.buffer[i++] = 1;
+ for (; i < 16; i++) this.buffer[i] = 0;
+ this.fin = 1;
+ this.blocks(this.buffer, 0, 16);
+ }
+
+ c = this.h[1] >>> 13;
+ this.h[1] &= 0x1fff;
+ for (i = 2; i < 10; i++) {
+ this.h[i] += c;
+ c = this.h[i] >>> 13;
+ this.h[i] &= 0x1fff;
+ }
+ this.h[0] += (c * 5);
+ c = this.h[0] >>> 13;
+ this.h[0] &= 0x1fff;
+ this.h[1] += c;
+ c = this.h[1] >>> 13;
+ this.h[1] &= 0x1fff;
+ this.h[2] += c;
+
+ g[0] = this.h[0] + 5;
+ c = g[0] >>> 13;
+ g[0] &= 0x1fff;
+ for (i = 1; i < 10; i++) {
+ g[i] = this.h[i] + c;
+ c = g[i] >>> 13;
+ g[i] &= 0x1fff;
+ }
+ g[9] -= (1 << 13);
+
+ mask = (g[9] >>> ((2 * 8) - 1)) - 1;
+ for (i = 0; i < 10; i++) g[i] &= mask;
+ mask = ~mask;
+ for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
+
+ this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
+ this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
+ this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
+ this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
+ this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
+ this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
+ this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
+ this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
+
+ f = this.h[0] + this.pad[0];
+ this.h[0] = f & 0xffff;
+ for (i = 1; i < 8; i++) {
+ f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
+ this.h[i] = f & 0xffff;
+ }
+
+ mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
+ mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
+ mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
+ mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
+ mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
+ mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
+ mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
+ mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
+ mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
+ mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
+ mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
+ mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
+ mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
+ mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
+ mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
+ mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
+};
+
+poly1305.prototype.update = function(m, mpos, bytes) {
+ var i, want;
+
+ if (this.leftover) {
+ want = (16 - this.leftover);
+ if (want > bytes)
+ want = bytes;
+ for (i = 0; i < want; i++)
+ this.buffer[this.leftover + i] = m[mpos+i];
+ bytes -= want;
+ mpos += want;
+ this.leftover += want;
+ if (this.leftover < 16)
+ return;
+ this.blocks(this.buffer, 0, 16);
+ this.leftover = 0;
+ }
+
+ if (bytes >= 16) {
+ want = bytes - (bytes % 16);
+ this.blocks(m, mpos, want);
+ mpos += want;
+ bytes -= want;
+ }
+
+ if (bytes) {
+ for (i = 0; i < bytes; i++)
+ this.buffer[this.leftover + i] = m[mpos+i];
+ this.leftover += bytes;
+ }
+};
+
+function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
+ var s = new poly1305(k);
+ s.update(m, mpos, n);
+ s.finish(out, outpos);
+ return 0;
+}
+
+function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
+ var x = new Uint8Array(16);
+ crypto_onetimeauth(x,0,m,mpos,n,k);
+ return crypto_verify_16(h,hpos,x,0);
+}
+
+function crypto_secretbox(c,m,d,n,k) {
+ var i;
+ if (d < 32) return -1;
+ crypto_stream_xor(c,0,m,0,d,n,k);
+ crypto_onetimeauth(c, 16, c, 32, d - 32, c);
+ for (i = 0; i < 16; i++) c[i] = 0;
+ return 0;
+}
+
+function crypto_secretbox_open(m,c,d,n,k) {
+ var i;
+ var x = new Uint8Array(32);
+ if (d < 32) return -1;
+ crypto_stream(x,0,32,n,k);
+ if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
+ crypto_stream_xor(m,0,c,0,d,n,k);
+ for (i = 0; i < 32; i++) m[i] = 0;
+ return 0;
+}
+
+function set25519(r, a) {
+ var i;
+ for (i = 0; i < 16; i++) r[i] = a[i]|0;
+}
+
+function car25519(o) {
+ var i, v, c = 1;
+ for (i = 0; i < 16; i++) {
+ v = o[i] + c + 65535;
+ c = Math.floor(v / 65536);
+ o[i] = v - c * 65536;
+ }
+ o[0] += c-1 + 37 * (c-1);
+}
+
+function sel25519(p, q, b) {
+ var t, c = ~(b-1);
+ for (var i = 0; i < 16; i++) {
+ t = c & (p[i] ^ q[i]);
+ p[i] ^= t;
+ q[i] ^= t;
+ }
+}
+
+function pack25519(o, n) {
+ var i, j, b;
+ var m = gf(), t = gf();
+ for (i = 0; i < 16; i++) t[i] = n[i];
+ car25519(t);
+ car25519(t);
+ car25519(t);
+ for (j = 0; j < 2; j++) {
+ m[0] = t[0] - 0xffed;
+ for (i = 1; i < 15; i++) {
+ m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
+ m[i-1] &= 0xffff;
+ }
+ m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
+ b = (m[15]>>16) & 1;
+ m[14] &= 0xffff;
+ sel25519(t, m, 1-b);
+ }
+ for (i = 0; i < 16; i++) {
+ o[2*i] = t[i] & 0xff;
+ o[2*i+1] = t[i]>>8;
+ }
+}
+
+function neq25519(a, b) {
+ var c = new Uint8Array(32), d = new Uint8Array(32);
+ pack25519(c, a);
+ pack25519(d, b);
+ return crypto_verify_32(c, 0, d, 0);
+}
+
+function par25519(a) {
+ var d = new Uint8Array(32);
+ pack25519(d, a);
+ return d[0] & 1;
+}
+
+function unpack25519(o, n) {
+ var i;
+ for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
+ o[15] &= 0x7fff;
+}
+
+function A(o, a, b) {
+ for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
+}
+
+function Z(o, a, b) {
+ for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
+}
+
+function M(o, a, b) {
+ var v, c,
+ t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
+ t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
+ t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
+ t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
+ b0 = b[0],
+ b1 = b[1],
+ b2 = b[2],
+ b3 = b[3],
+ b4 = b[4],
+ b5 = b[5],
+ b6 = b[6],
+ b7 = b[7],
+ b8 = b[8],
+ b9 = b[9],
+ b10 = b[10],
+ b11 = b[11],
+ b12 = b[12],
+ b13 = b[13],
+ b14 = b[14],
+ b15 = b[15];
+
+ v = a[0];
+ t0 += v * b0;
+ t1 += v * b1;
+ t2 += v * b2;
+ t3 += v * b3;
+ t4 += v * b4;
+ t5 += v * b5;
+ t6 += v * b6;
+ t7 += v * b7;
+ t8 += v * b8;
+ t9 += v * b9;
+ t10 += v * b10;
+ t11 += v * b11;
+ t12 += v * b12;
+ t13 += v * b13;
+ t14 += v * b14;
+ t15 += v * b15;
+ v = a[1];
+ t1 += v * b0;
+ t2 += v * b1;
+ t3 += v * b2;
+ t4 += v * b3;
+ t5 += v * b4;
+ t6 += v * b5;
+ t7 += v * b6;
+ t8 += v * b7;
+ t9 += v * b8;
+ t10 += v * b9;
+ t11 += v * b10;
+ t12 += v * b11;
+ t13 += v * b12;
+ t14 += v * b13;
+ t15 += v * b14;
+ t16 += v * b15;
+ v = a[2];
+ t2 += v * b0;
+ t3 += v * b1;
+ t4 += v * b2;
+ t5 += v * b3;
+ t6 += v * b4;
+ t7 += v * b5;
+ t8 += v * b6;
+ t9 += v * b7;
+ t10 += v * b8;
+ t11 += v * b9;
+ t12 += v * b10;
+ t13 += v * b11;
+ t14 += v * b12;
+ t15 += v * b13;
+ t16 += v * b14;
+ t17 += v * b15;
+ v = a[3];
+ t3 += v * b0;
+ t4 += v * b1;
+ t5 += v * b2;
+ t6 += v * b3;
+ t7 += v * b4;
+ t8 += v * b5;
+ t9 += v * b6;
+ t10 += v * b7;
+ t11 += v * b8;
+ t12 += v * b9;
+ t13 += v * b10;
+ t14 += v * b11;
+ t15 += v * b12;
+ t16 += v * b13;
+ t17 += v * b14;
+ t18 += v * b15;
+ v = a[4];
+ t4 += v * b0;
+ t5 += v * b1;
+ t6 += v * b2;
+ t7 += v * b3;
+ t8 += v * b4;
+ t9 += v * b5;
+ t10 += v * b6;
+ t11 += v * b7;
+ t12 += v * b8;
+ t13 += v * b9;
+ t14 += v * b10;
+ t15 += v * b11;
+ t16 += v * b12;
+ t17 += v * b13;
+ t18 += v * b14;
+ t19 += v * b15;
+ v = a[5];
+ t5 += v * b0;
+ t6 += v * b1;
+ t7 += v * b2;
+ t8 += v * b3;
+ t9 += v * b4;
+ t10 += v * b5;
+ t11 += v * b6;
+ t12 += v * b7;
+ t13 += v * b8;
+ t14 += v * b9;
+ t15 += v * b10;
+ t16 += v * b11;
+ t17 += v * b12;
+ t18 += v * b13;
+ t19 += v * b14;
+ t20 += v * b15;
+ v = a[6];
+ t6 += v * b0;
+ t7 += v * b1;
+ t8 += v * b2;
+ t9 += v * b3;
+ t10 += v * b4;
+ t11 += v * b5;
+ t12 += v * b6;
+ t13 += v * b7;
+ t14 += v * b8;
+ t15 += v * b9;
+ t16 += v * b10;
+ t17 += v * b11;
+ t18 += v * b12;
+ t19 += v * b13;
+ t20 += v * b14;
+ t21 += v * b15;
+ v = a[7];
+ t7 += v * b0;
+ t8 += v * b1;
+ t9 += v * b2;
+ t10 += v * b3;
+ t11 += v * b4;
+ t12 += v * b5;
+ t13 += v * b6;
+ t14 += v * b7;
+ t15 += v * b8;
+ t16 += v * b9;
+ t17 += v * b10;
+ t18 += v * b11;
+ t19 += v * b12;
+ t20 += v * b13;
+ t21 += v * b14;
+ t22 += v * b15;
+ v = a[8];
+ t8 += v * b0;
+ t9 += v * b1;
+ t10 += v * b2;
+ t11 += v * b3;
+ t12 += v * b4;
+ t13 += v * b5;
+ t14 += v * b6;
+ t15 += v * b7;
+ t16 += v * b8;
+ t17 += v * b9;
+ t18 += v * b10;
+ t19 += v * b11;
+ t20 += v * b12;
+ t21 += v * b13;
+ t22 += v * b14;
+ t23 += v * b15;
+ v = a[9];
+ t9 += v * b0;
+ t10 += v * b1;
+ t11 += v * b2;
+ t12 += v * b3;
+ t13 += v * b4;
+ t14 += v * b5;
+ t15 += v * b6;
+ t16 += v * b7;
+ t17 += v * b8;
+ t18 += v * b9;
+ t19 += v * b10;
+ t20 += v * b11;
+ t21 += v * b12;
+ t22 += v * b13;
+ t23 += v * b14;
+ t24 += v * b15;
+ v = a[10];
+ t10 += v * b0;
+ t11 += v * b1;
+ t12 += v * b2;
+ t13 += v * b3;
+ t14 += v * b4;
+ t15 += v * b5;
+ t16 += v * b6;
+ t17 += v * b7;
+ t18 += v * b8;
+ t19 += v * b9;
+ t20 += v * b10;
+ t21 += v * b11;
+ t22 += v * b12;
+ t23 += v * b13;
+ t24 += v * b14;
+ t25 += v * b15;
+ v = a[11];
+ t11 += v * b0;
+ t12 += v * b1;
+ t13 += v * b2;
+ t14 += v * b3;
+ t15 += v * b4;
+ t16 += v * b5;
+ t17 += v * b6;
+ t18 += v * b7;
+ t19 += v * b8;
+ t20 += v * b9;
+ t21 += v * b10;
+ t22 += v * b11;
+ t23 += v * b12;
+ t24 += v * b13;
+ t25 += v * b14;
+ t26 += v * b15;
+ v = a[12];
+ t12 += v * b0;
+ t13 += v * b1;
+ t14 += v * b2;
+ t15 += v * b3;
+ t16 += v * b4;
+ t17 += v * b5;
+ t18 += v * b6;
+ t19 += v * b7;
+ t20 += v * b8;
+ t21 += v * b9;
+ t22 += v * b10;
+ t23 += v * b11;
+ t24 += v * b12;
+ t25 += v * b13;
+ t26 += v * b14;
+ t27 += v * b15;
+ v = a[13];
+ t13 += v * b0;
+ t14 += v * b1;
+ t15 += v * b2;
+ t16 += v * b3;
+ t17 += v * b4;
+ t18 += v * b5;
+ t19 += v * b6;
+ t20 += v * b7;
+ t21 += v * b8;
+ t22 += v * b9;
+ t23 += v * b10;
+ t24 += v * b11;
+ t25 += v * b12;
+ t26 += v * b13;
+ t27 += v * b14;
+ t28 += v * b15;
+ v = a[14];
+ t14 += v * b0;
+ t15 += v * b1;
+ t16 += v * b2;
+ t17 += v * b3;
+ t18 += v * b4;
+ t19 += v * b5;
+ t20 += v * b6;
+ t21 += v * b7;
+ t22 += v * b8;
+ t23 += v * b9;
+ t24 += v * b10;
+ t25 += v * b11;
+ t26 += v * b12;
+ t27 += v * b13;
+ t28 += v * b14;
+ t29 += v * b15;
+ v = a[15];
+ t15 += v * b0;
+ t16 += v * b1;
+ t17 += v * b2;
+ t18 += v * b3;
+ t19 += v * b4;
+ t20 += v * b5;
+ t21 += v * b6;
+ t22 += v * b7;
+ t23 += v * b8;
+ t24 += v * b9;
+ t25 += v * b10;
+ t26 += v * b11;
+ t27 += v * b12;
+ t28 += v * b13;
+ t29 += v * b14;
+ t30 += v * b15;
+
+ t0 += 38 * t16;
+ t1 += 38 * t17;
+ t2 += 38 * t18;
+ t3 += 38 * t19;
+ t4 += 38 * t20;
+ t5 += 38 * t21;
+ t6 += 38 * t22;
+ t7 += 38 * t23;
+ t8 += 38 * t24;
+ t9 += 38 * t25;
+ t10 += 38 * t26;
+ t11 += 38 * t27;
+ t12 += 38 * t28;
+ t13 += 38 * t29;
+ t14 += 38 * t30;
+ // t15 left as is
+
+ // first car
+ c = 1;
+ v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
+ v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
+ v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
+ v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
+ v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
+ v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
+ v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
+ v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
+ v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
+ v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
+ v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
+ v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
+ v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
+ v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
+ v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
+ v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
+ t0 += c-1 + 37 * (c-1);
+
+ // second car
+ c = 1;
+ v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
+ v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
+ v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
+ v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
+ v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
+ v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
+ v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
+ v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
+ v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
+ v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
+ v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
+ v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
+ v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
+ v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
+ v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
+ v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
+ t0 += c-1 + 37 * (c-1);
+
+ o[ 0] = t0;
+ o[ 1] = t1;
+ o[ 2] = t2;
+ o[ 3] = t3;
+ o[ 4] = t4;
+ o[ 5] = t5;
+ o[ 6] = t6;
+ o[ 7] = t7;
+ o[ 8] = t8;
+ o[ 9] = t9;
+ o[10] = t10;
+ o[11] = t11;
+ o[12] = t12;
+ o[13] = t13;
+ o[14] = t14;
+ o[15] = t15;
+}
+
+function S(o, a) {
+ M(o, a, a);
+}
+
+function inv25519(o, i) {
+ var c = gf();
+ var a;
+ for (a = 0; a < 16; a++) c[a] = i[a];
+ for (a = 253; a >= 0; a--) {
+ S(c, c);
+ if(a !== 2 && a !== 4) M(c, c, i);
+ }
+ for (a = 0; a < 16; a++) o[a] = c[a];
+}
+
+function pow2523(o, i) {
+ var c = gf();
+ var a;
+ for (a = 0; a < 16; a++) c[a] = i[a];
+ for (a = 250; a >= 0; a--) {
+ S(c, c);
+ if(a !== 1) M(c, c, i);
+ }
+ for (a = 0; a < 16; a++) o[a] = c[a];
+}
+
+function crypto_scalarmult(q, n, p) {
+ var z = new Uint8Array(32);
+ var x = new Float64Array(80), r, i;
+ var a = gf(), b = gf(), c = gf(),
+ d = gf(), e = gf(), f = gf();
+ for (i = 0; i < 31; i++) z[i] = n[i];
+ z[31]=(n[31]&127)|64;
+ z[0]&=248;
+ unpack25519(x,p);
+ for (i = 0; i < 16; i++) {
+ b[i]=x[i];
+ d[i]=a[i]=c[i]=0;
+ }
+ a[0]=d[0]=1;
+ for (i=254; i>=0; --i) {
+ r=(z[i>>>3]>>>(i&7))&1;
+ sel25519(a,b,r);
+ sel25519(c,d,r);
+ A(e,a,c);
+ Z(a,a,c);
+ A(c,b,d);
+ Z(b,b,d);
+ S(d,e);
+ S(f,a);
+ M(a,c,a);
+ M(c,b,e);
+ A(e,a,c);
+ Z(a,a,c);
+ S(b,a);
+ Z(c,d,f);
+ M(a,c,_121665);
+ A(a,a,d);
+ M(c,c,a);
+ M(a,d,f);
+ M(d,b,x);
+ S(b,e);
+ sel25519(a,b,r);
+ sel25519(c,d,r);
+ }
+ for (i = 0; i < 16; i++) {
+ x[i+16]=a[i];
+ x[i+32]=c[i];
+ x[i+48]=b[i];
+ x[i+64]=d[i];
+ }
+ var x32 = x.subarray(32);
+ var x16 = x.subarray(16);
+ inv25519(x32,x32);
+ M(x16,x16,x32);
+ pack25519(q,x16);
+ return 0;
+}
+
+function crypto_scalarmult_base(q, n) {
+ return crypto_scalarmult(q, n, _9);
+}
+
+function crypto_box_keypair(y, x) {
+ randombytes(x, 32);
+ return crypto_scalarmult_base(y, x);
+}
+
+function crypto_box_beforenm(k, y, x) {
+ var s = new Uint8Array(32);
+ crypto_scalarmult(s, x, y);
+ return crypto_core_hsalsa20(k, _0, s, sigma);
+}
+
+var crypto_box_afternm = crypto_secretbox;
+var crypto_box_open_afternm = crypto_secretbox_open;
+
+function crypto_box(c, m, d, n, y, x) {
+ var k = new Uint8Array(32);
+ crypto_box_beforenm(k, y, x);
+ return crypto_box_afternm(c, m, d, n, k);
+}
+
+function crypto_box_open(m, c, d, n, y, x) {
+ var k = new Uint8Array(32);
+ crypto_box_beforenm(k, y, x);
+ return crypto_box_open_afternm(m, c, d, n, k);
+}
+
+var K = [
+ 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
+ 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
+ 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
+ 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
+ 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
+ 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
+ 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
+ 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
+ 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
+ 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
+ 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
+ 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
+ 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
+ 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
+ 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
+ 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
+ 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
+ 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
+ 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
+ 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
+ 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
+ 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
+ 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
+ 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
+ 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
+ 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
+ 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
+ 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
+ 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
+ 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
+ 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
+ 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
+ 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
+ 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
+ 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
+ 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
+ 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
+ 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
+ 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
+ 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
+];
+
+function crypto_hashblocks_hl(hh, hl, m, n) {
+ var wh = new Int32Array(16), wl = new Int32Array(16),
+ bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
+ bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
+ th, tl, i, j, h, l, a, b, c, d;
+
+ var ah0 = hh[0],
+ ah1 = hh[1],
+ ah2 = hh[2],
+ ah3 = hh[3],
+ ah4 = hh[4],
+ ah5 = hh[5],
+ ah6 = hh[6],
+ ah7 = hh[7],
+
+ al0 = hl[0],
+ al1 = hl[1],
+ al2 = hl[2],
+ al3 = hl[3],
+ al4 = hl[4],
+ al5 = hl[5],
+ al6 = hl[6],
+ al7 = hl[7];
+
+ var pos = 0;
+ while (n >= 128) {
+ for (i = 0; i < 16; i++) {
+ j = 8 * i + pos;
+ wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
+ wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
+ }
+ for (i = 0; i < 80; i++) {
+ bh0 = ah0;
+ bh1 = ah1;
+ bh2 = ah2;
+ bh3 = ah3;
+ bh4 = ah4;
+ bh5 = ah5;
+ bh6 = ah6;
+ bh7 = ah7;
+
+ bl0 = al0;
+ bl1 = al1;
+ bl2 = al2;
+ bl3 = al3;
+ bl4 = al4;
+ bl5 = al5;
+ bl6 = al6;
+ bl7 = al7;
+
+ // add
+ h = ah7;
+ l = al7;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ // Sigma1
+ h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
+ l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ // Ch
+ h = (ah4 & ah5) ^ (~ah4 & ah6);
+ l = (al4 & al5) ^ (~al4 & al6);
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ // K
+ h = K[i*2];
+ l = K[i*2+1];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ // w
+ h = wh[i%16];
+ l = wl[i%16];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ th = c & 0xffff | d << 16;
+ tl = a & 0xffff | b << 16;
+
+ // add
+ h = th;
+ l = tl;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ // Sigma0
+ h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
+ l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ // Maj
+ h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
+ l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ bh7 = (c & 0xffff) | (d << 16);
+ bl7 = (a & 0xffff) | (b << 16);
+
+ // add
+ h = bh3;
+ l = bl3;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = th;
+ l = tl;
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ bh3 = (c & 0xffff) | (d << 16);
+ bl3 = (a & 0xffff) | (b << 16);
+
+ ah1 = bh0;
+ ah2 = bh1;
+ ah3 = bh2;
+ ah4 = bh3;
+ ah5 = bh4;
+ ah6 = bh5;
+ ah7 = bh6;
+ ah0 = bh7;
+
+ al1 = bl0;
+ al2 = bl1;
+ al3 = bl2;
+ al4 = bl3;
+ al5 = bl4;
+ al6 = bl5;
+ al7 = bl6;
+ al0 = bl7;
+
+ if (i%16 === 15) {
+ for (j = 0; j < 16; j++) {
+ // add
+ h = wh[j];
+ l = wl[j];
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = wh[(j+9)%16];
+ l = wl[(j+9)%16];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ // sigma0
+ th = wh[(j+1)%16];
+ tl = wl[(j+1)%16];
+ h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
+ l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ // sigma1
+ th = wh[(j+14)%16];
+ tl = wl[(j+14)%16];
+ h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
+ l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ wh[j] = (c & 0xffff) | (d << 16);
+ wl[j] = (a & 0xffff) | (b << 16);
+ }
+ }
+ }
+
+ // add
+ h = ah0;
+ l = al0;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[0];
+ l = hl[0];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[0] = ah0 = (c & 0xffff) | (d << 16);
+ hl[0] = al0 = (a & 0xffff) | (b << 16);
+
+ h = ah1;
+ l = al1;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[1];
+ l = hl[1];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[1] = ah1 = (c & 0xffff) | (d << 16);
+ hl[1] = al1 = (a & 0xffff) | (b << 16);
+
+ h = ah2;
+ l = al2;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[2];
+ l = hl[2];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[2] = ah2 = (c & 0xffff) | (d << 16);
+ hl[2] = al2 = (a & 0xffff) | (b << 16);
+
+ h = ah3;
+ l = al3;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[3];
+ l = hl[3];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[3] = ah3 = (c & 0xffff) | (d << 16);
+ hl[3] = al3 = (a & 0xffff) | (b << 16);
+
+ h = ah4;
+ l = al4;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[4];
+ l = hl[4];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[4] = ah4 = (c & 0xffff) | (d << 16);
+ hl[4] = al4 = (a & 0xffff) | (b << 16);
+
+ h = ah5;
+ l = al5;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[5];
+ l = hl[5];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[5] = ah5 = (c & 0xffff) | (d << 16);
+ hl[5] = al5 = (a & 0xffff) | (b << 16);
+
+ h = ah6;
+ l = al6;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[6];
+ l = hl[6];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[6] = ah6 = (c & 0xffff) | (d << 16);
+ hl[6] = al6 = (a & 0xffff) | (b << 16);
+
+ h = ah7;
+ l = al7;
+
+ a = l & 0xffff; b = l >>> 16;
+ c = h & 0xffff; d = h >>> 16;
+
+ h = hh[7];
+ l = hl[7];
+
+ a += l & 0xffff; b += l >>> 16;
+ c += h & 0xffff; d += h >>> 16;
+
+ b += a >>> 16;
+ c += b >>> 16;
+ d += c >>> 16;
+
+ hh[7] = ah7 = (c & 0xffff) | (d << 16);
+ hl[7] = al7 = (a & 0xffff) | (b << 16);
+
+ pos += 128;
+ n -= 128;
+ }
+
+ return n;
+}
+
+function crypto_hash(out, m, n) {
+ var hh = new Int32Array(8),
+ hl = new Int32Array(8),
+ x = new Uint8Array(256),
+ i, b = n;
+
+ hh[0] = 0x6a09e667;
+ hh[1] = 0xbb67ae85;
+ hh[2] = 0x3c6ef372;
+ hh[3] = 0xa54ff53a;
+ hh[4] = 0x510e527f;
+ hh[5] = 0x9b05688c;
+ hh[6] = 0x1f83d9ab;
+ hh[7] = 0x5be0cd19;
+
+ hl[0] = 0xf3bcc908;
+ hl[1] = 0x84caa73b;
+ hl[2] = 0xfe94f82b;
+ hl[3] = 0x5f1d36f1;
+ hl[4] = 0xade682d1;
+ hl[5] = 0x2b3e6c1f;
+ hl[6] = 0xfb41bd6b;
+ hl[7] = 0x137e2179;
+
+ crypto_hashblocks_hl(hh, hl, m, n);
+ n %= 128;
+
+ for (i = 0; i < n; i++) x[i] = m[b-n+i];
+ x[n] = 128;
+
+ n = 256-128*(n<112?1:0);
+ x[n-9] = 0;
+ ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
+ crypto_hashblocks_hl(hh, hl, x, n);
+
+ for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
+
+ return 0;
+}
+
+function add(p, q) {
+ var a = gf(), b = gf(), c = gf(),
+ d = gf(), e = gf(), f = gf(),
+ g = gf(), h = gf(), t = gf();
+
+ Z(a, p[1], p[0]);
+ Z(t, q[1], q[0]);
+ M(a, a, t);
+ A(b, p[0], p[1]);
+ A(t, q[0], q[1]);
+ M(b, b, t);
+ M(c, p[3], q[3]);
+ M(c, c, D2);
+ M(d, p[2], q[2]);
+ A(d, d, d);
+ Z(e, b, a);
+ Z(f, d, c);
+ A(g, d, c);
+ A(h, b, a);
+
+ M(p[0], e, f);
+ M(p[1], h, g);
+ M(p[2], g, f);
+ M(p[3], e, h);
+}
+
+function cswap(p, q, b) {
+ var i;
+ for (i = 0; i < 4; i++) {
+ sel25519(p[i], q[i], b);
+ }
+}
+
+function pack(r, p) {
+ var tx = gf(), ty = gf(), zi = gf();
+ inv25519(zi, p[2]);
+ M(tx, p[0], zi);
+ M(ty, p[1], zi);
+ pack25519(r, ty);
+ r[31] ^= par25519(tx) << 7;
+}
+
+function scalarmult(p, q, s) {
+ var b, i;
+ set25519(p[0], gf0);
+ set25519(p[1], gf1);
+ set25519(p[2], gf1);
+ set25519(p[3], gf0);
+ for (i = 255; i >= 0; --i) {
+ b = (s[(i/8)|0] >> (i&7)) & 1;
+ cswap(p, q, b);
+ add(q, p);
+ add(p, p);
+ cswap(p, q, b);
+ }
+}
+
+function scalarbase(p, s) {
+ var q = [gf(), gf(), gf(), gf()];
+ set25519(q[0], X);
+ set25519(q[1], Y);
+ set25519(q[2], gf1);
+ M(q[3], X, Y);
+ scalarmult(p, q, s);
+}
+
+function crypto_sign_keypair(pk, sk, seeded) {
+ var d = new Uint8Array(64);
+ var p = [gf(), gf(), gf(), gf()];
+ var i;
+
+ if (!seeded) randombytes(sk, 32);
+ crypto_hash(d, sk, 32);
+ d[0] &= 248;
+ d[31] &= 127;
+ d[31] |= 64;
+
+ scalarbase(p, d);
+ pack(pk, p);
+
+ for (i = 0; i < 32; i++) sk[i+32] = pk[i];
+ return 0;
+}
+
+var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
+
+function modL(r, x) {
+ var carry, i, j, k;
+ for (i = 63; i >= 32; --i) {
+ carry = 0;
+ for (j = i - 32, k = i - 12; j < k; ++j) {
+ x[j] += carry - 16 * x[i] * L[j - (i - 32)];
+ carry = (x[j] + 128) >> 8;
+ x[j] -= carry * 256;
+ }
+ x[j] += carry;
+ x[i] = 0;
+ }
+ carry = 0;
+ for (j = 0; j < 32; j++) {
+ x[j] += carry - (x[31] >> 4) * L[j];
+ carry = x[j] >> 8;
+ x[j] &= 255;
+ }
+ for (j = 0; j < 32; j++) x[j] -= carry * L[j];
+ for (i = 0; i < 32; i++) {
+ x[i+1] += x[i] >> 8;
+ r[i] = x[i] & 255;
+ }
+}
+
+function reduce(r) {
+ var x = new Float64Array(64), i;
+ for (i = 0; i < 64; i++) x[i] = r[i];
+ for (i = 0; i < 64; i++) r[i] = 0;
+ modL(r, x);
+}
+
+// Note: difference from C - smlen returned, not passed as argument.
+function crypto_sign(sm, m, n, sk) {
+ var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
+ var i, j, x = new Float64Array(64);
+ var p = [gf(), gf(), gf(), gf()];
+
+ crypto_hash(d, sk, 32);
+ d[0] &= 248;
+ d[31] &= 127;
+ d[31] |= 64;
+
+ var smlen = n + 64;
+ for (i = 0; i < n; i++) sm[64 + i] = m[i];
+ for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
+
+ crypto_hash(r, sm.subarray(32), n+32);
+ reduce(r);
+ scalarbase(p, r);
+ pack(sm, p);
+
+ for (i = 32; i < 64; i++) sm[i] = sk[i];
+ crypto_hash(h, sm, n + 64);
+ reduce(h);
+
+ for (i = 0; i < 64; i++) x[i] = 0;
+ for (i = 0; i < 32; i++) x[i] = r[i];
+ for (i = 0; i < 32; i++) {
+ for (j = 0; j < 32; j++) {
+ x[i+j] += h[i] * d[j];
+ }
+ }
+
+ modL(sm.subarray(32), x);
+ return smlen;
+}
+
+function unpackneg(r, p) {
+ var t = gf(), chk = gf(), num = gf(),
+ den = gf(), den2 = gf(), den4 = gf(),
+ den6 = gf();
+
+ set25519(r[2], gf1);
+ unpack25519(r[1], p);
+ S(num, r[1]);
+ M(den, num, D);
+ Z(num, num, r[2]);
+ A(den, r[2], den);
+
+ S(den2, den);
+ S(den4, den2);
+ M(den6, den4, den2);
+ M(t, den6, num);
+ M(t, t, den);
+
+ pow2523(t, t);
+ M(t, t, num);
+ M(t, t, den);
+ M(t, t, den);
+ M(r[0], t, den);
+
+ S(chk, r[0]);
+ M(chk, chk, den);
+ if (neq25519(chk, num)) M(r[0], r[0], I);
+
+ S(chk, r[0]);
+ M(chk, chk, den);
+ if (neq25519(chk, num)) return -1;
+
+ if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
+
+ M(r[3], r[0], r[1]);
+ return 0;
+}
+
+function crypto_sign_open(m, sm, n, pk) {
+ var i, mlen;
+ var t = new Uint8Array(32), h = new Uint8Array(64);
+ var p = [gf(), gf(), gf(), gf()],
+ q = [gf(), gf(), gf(), gf()];
+
+ mlen = -1;
+ if (n < 64) return -1;
+
+ if (unpackneg(q, pk)) return -1;
+
+ for (i = 0; i < n; i++) m[i] = sm[i];
+ for (i = 0; i < 32; i++) m[i+32] = pk[i];
+ crypto_hash(h, m, n);
+ reduce(h);
+ scalarmult(p, q, h);
+
+ scalarbase(q, sm.subarray(32));
+ add(p, q);
+ pack(t, p);
+
+ n -= 64;
+ if (crypto_verify_32(sm, 0, t, 0)) {
+ for (i = 0; i < n; i++) m[i] = 0;
+ return -1;
+ }
+
+ for (i = 0; i < n; i++) m[i] = sm[i + 64];
+ mlen = n;
+ return mlen;
+}
+
+var crypto_secretbox_KEYBYTES = 32,
+ crypto_secretbox_NONCEBYTES = 24,
+ crypto_secretbox_ZEROBYTES = 32,
+ crypto_secretbox_BOXZEROBYTES = 16,
+ crypto_scalarmult_BYTES = 32,
+ crypto_scalarmult_SCALARBYTES = 32,
+ crypto_box_PUBLICKEYBYTES = 32,
+ crypto_box_SECRETKEYBYTES = 32,
+ crypto_box_BEFORENMBYTES = 32,
+ crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
+ crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
+ crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
+ crypto_sign_BYTES = 64,
+ crypto_sign_PUBLICKEYBYTES = 32,
+ crypto_sign_SECRETKEYBYTES = 64,
+ crypto_sign_SEEDBYTES = 32,
+ crypto_hash_BYTES = 64;
+
+nacl.lowlevel = {
+ crypto_core_hsalsa20: crypto_core_hsalsa20,
+ crypto_stream_xor: crypto_stream_xor,
+ crypto_stream: crypto_stream,
+ crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
+ crypto_stream_salsa20: crypto_stream_salsa20,
+ crypto_onetimeauth: crypto_onetimeauth,
+ crypto_onetimeauth_verify: crypto_onetimeauth_verify,
+ crypto_verify_16: crypto_verify_16,
+ crypto_verify_32: crypto_verify_32,
+ crypto_secretbox: crypto_secretbox,
+ crypto_secretbox_open: crypto_secretbox_open,
+ crypto_scalarmult: crypto_scalarmult,
+ crypto_scalarmult_base: crypto_scalarmult_base,
+ crypto_box_beforenm: crypto_box_beforenm,
+ crypto_box_afternm: crypto_box_afternm,
+ crypto_box: crypto_box,
+ crypto_box_open: crypto_box_open,
+ crypto_box_keypair: crypto_box_keypair,
+ crypto_hash: crypto_hash,
+ crypto_sign: crypto_sign,
+ crypto_sign_keypair: crypto_sign_keypair,
+ crypto_sign_open: crypto_sign_open,
+
+ crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
+ crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
+ crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
+ crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
+ crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
+ crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
+ crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
+ crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
+ crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
+ crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
+ crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
+ crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
+ crypto_sign_BYTES: crypto_sign_BYTES,
+ crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
+ crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
+ crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
+ crypto_hash_BYTES: crypto_hash_BYTES
+};
+
+/* High-level API */
+
+function checkLengths(k, n) {
+ if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
+ if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
+}
+
+function checkBoxLengths(pk, sk) {
+ if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
+ if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
+}
+
+function checkArrayTypes() {
+ var t, i;
+ for (i = 0; i < arguments.length; i++) {
+ if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]')
+ throw new TypeError('unexpected type ' + t + ', use Uint8Array');
+ }
+}
+
+function cleanup(arr) {
+ for (var i = 0; i < arr.length; i++) arr[i] = 0;
+}
+
+nacl.util = {};
+
+nacl.util.decodeUTF8 = function(s) {
+ var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
+ for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
+ return b;
+};
+
+nacl.util.encodeUTF8 = function(arr) {
+ var i, s = [];
+ for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
+ return decodeURIComponent(escape(s.join('')));
+};
+
+nacl.util.encodeBase64 = function(arr) {
+ if (typeof btoa === 'undefined') {
+ return (new Buffer(arr)).toString('base64');
+ } else {
+ var i, s = [], len = arr.length;
+ for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
+ return btoa(s.join(''));
+ }
+};
+
+nacl.util.decodeBase64 = function(s) {
+ if (typeof atob === 'undefined') {
+ return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
+ } else {
+ var i, d = atob(s), b = new Uint8Array(d.length);
+ for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
+ return b;
+ }
+};
+
+nacl.randomBytes = function(n) {
+ var b = new Uint8Array(n);
+ randombytes(b, n);
+ return b;
+};
+
+nacl.secretbox = function(msg, nonce, key) {
+ checkArrayTypes(msg, nonce, key);
+ checkLengths(key, nonce);
+ var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
+ var c = new Uint8Array(m.length);
+ for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
+ crypto_secretbox(c, m, m.length, nonce, key);
+ return c.subarray(crypto_secretbox_BOXZEROBYTES);
+};
+
+nacl.secretbox.open = function(box, nonce, key) {
+ checkArrayTypes(box, nonce, key);
+ checkLengths(key, nonce);
+ var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
+ var m = new Uint8Array(c.length);
+ for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
+ if (c.length < 32) return false;
+ if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false;
+ return m.subarray(crypto_secretbox_ZEROBYTES);
+};
+
+nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
+nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
+nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
+
+nacl.scalarMult = function(n, p) {
+ checkArrayTypes(n, p);
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
+ if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
+ crypto_scalarmult(q, n, p);
+ return q;
+};
+
+nacl.scalarMult.base = function(n) {
+ checkArrayTypes(n);
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
+ crypto_scalarmult_base(q, n);
+ return q;
+};
+
+nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
+nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
+
+nacl.box = function(msg, nonce, publicKey, secretKey) {
+ var k = nacl.box.before(publicKey, secretKey);
+ return nacl.secretbox(msg, nonce, k);
+};
+
+nacl.box.before = function(publicKey, secretKey) {
+ checkArrayTypes(publicKey, secretKey);
+ checkBoxLengths(publicKey, secretKey);
+ var k = new Uint8Array(crypto_box_BEFORENMBYTES);
+ crypto_box_beforenm(k, publicKey, secretKey);
+ return k;
+};
+
+nacl.box.after = nacl.secretbox;
+
+nacl.box.open = function(msg, nonce, publicKey, secretKey) {
+ var k = nacl.box.before(publicKey, secretKey);
+ return nacl.secretbox.open(msg, nonce, k);
+};
+
+nacl.box.open.after = nacl.secretbox.open;
+
+nacl.box.keyPair = function() {
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
+ var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
+ crypto_box_keypair(pk, sk);
+ return {publicKey: pk, secretKey: sk};
+};
+
+nacl.box.keyPair.fromSecretKey = function(secretKey) {
+ checkArrayTypes(secretKey);
+ if (secretKey.length !== crypto_box_SECRETKEYBYTES)
+ throw new Error('bad secret key size');
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
+ crypto_scalarmult_base(pk, secretKey);
+ return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
+};
+
+nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
+nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
+nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
+nacl.box.nonceLength = crypto_box_NONCEBYTES;
+nacl.box.overheadLength = nacl.secretbox.overheadLength;
+
+nacl.sign = function(msg, secretKey) {
+ checkArrayTypes(msg, secretKey);
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
+ throw new Error('bad secret key size');
+ var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
+ crypto_sign(signedMsg, msg, msg.length, secretKey);
+ return signedMsg;
+};
+
+nacl.sign.open = function(signedMsg, publicKey) {
+ if (arguments.length !== 2)
+ throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?');
+ checkArrayTypes(signedMsg, publicKey);
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
+ throw new Error('bad public key size');
+ var tmp = new Uint8Array(signedMsg.length);
+ var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
+ if (mlen < 0) return null;
+ var m = new Uint8Array(mlen);
+ for (var i = 0; i < m.length; i++) m[i] = tmp[i];
+ return m;
+};
+
+nacl.sign.detached = function(msg, secretKey) {
+ var signedMsg = nacl.sign(msg, secretKey);
+ var sig = new Uint8Array(crypto_sign_BYTES);
+ for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
+ return sig;
+};
+
+nacl.sign.detached.verify = function(msg, sig, publicKey) {
+ checkArrayTypes(msg, sig, publicKey);
+ if (sig.length !== crypto_sign_BYTES)
+ throw new Error('bad signature size');
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
+ throw new Error('bad public key size');
+ var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
+ var m = new Uint8Array(crypto_sign_BYTES + msg.length);
+ var i;
+ for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
+ for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
+ return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
+};
+
+nacl.sign.keyPair = function() {
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
+ crypto_sign_keypair(pk, sk);
+ return {publicKey: pk, secretKey: sk};
+};
+
+nacl.sign.keyPair.fromSecretKey = function(secretKey) {
+ checkArrayTypes(secretKey);
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
+ throw new Error('bad secret key size');
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
+ for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
+ return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
+};
+
+nacl.sign.keyPair.fromSeed = function(seed) {
+ checkArrayTypes(seed);
+ if (seed.length !== crypto_sign_SEEDBYTES)
+ throw new Error('bad seed size');
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
+ for (var i = 0; i < 32; i++) sk[i] = seed[i];
+ crypto_sign_keypair(pk, sk, true);
+ return {publicKey: pk, secretKey: sk};
+};
+
+nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
+nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
+nacl.sign.seedLength = crypto_sign_SEEDBYTES;
+nacl.sign.signatureLength = crypto_sign_BYTES;
+
+nacl.hash = function(msg) {
+ checkArrayTypes(msg);
+ var h = new Uint8Array(crypto_hash_BYTES);
+ crypto_hash(h, msg, msg.length);
+ return h;
+};
+
+nacl.hash.hashLength = crypto_hash_BYTES;
+
+nacl.verify = function(x, y) {
+ checkArrayTypes(x, y);
+ // Zero length arguments are considered not equal.
+ if (x.length === 0 || y.length === 0) return false;
+ if (x.length !== y.length) return false;
+ return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
+};
+
+nacl.setPRNG = function(fn) {
+ randombytes = fn;
+};
+
+(function() {
+ // Initialize PRNG if environment provides CSPRNG.
+ // If not, methods calling randombytes will throw.
+ var crypto;
+ if (typeof window !== 'undefined') {
+ // Browser.
+ if (window.crypto && window.crypto.getRandomValues) {
+ crypto = window.crypto; // Standard
+ } else if (window.msCrypto && window.msCrypto.getRandomValues) {
+ crypto = window.msCrypto; // Internet Explorer 11+
+ }
+ if (crypto) {
+ nacl.setPRNG(function(x, n) {
+ var i, v = new Uint8Array(n);
+ crypto.getRandomValues(v);
+ for (i = 0; i < n; i++) x[i] = v[i];
+ cleanup(v);
+ });
+ }
+ } else if (typeof require !== 'undefined') {
+ // Node.js.
+ crypto = require('crypto');
+ if (crypto) {
+ nacl.setPRNG(function(x, n) {
+ var i, v = crypto.randomBytes(n);
+ for (i = 0; i < n; i++) x[i] = v[i];
+ cleanup(v);
+ });
+ }
+ }
+})();
+
+})(typeof module !== 'undefined' && module.exports ? module.exports : (window.nacl = window.nacl || {}));
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js
new file mode 100644
index 000000000..7072c2af4
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js
@@ -0,0 +1,2 @@
+!function(r){"use strict";function t(r,t,n,e){r[t]=n>>24&255,r[t+1]=n>>16&255,r[t+2]=n>>8&255,r[t+3]=255&n,r[t+4]=e>>24&255,r[t+5]=e>>16&255,r[t+6]=e>>8&255,r[t+7]=255&e}function n(r,t,n,e,o){var i,h=0;for(i=0;o>i;i++)h|=r[t+i]^n[e+i];return(1&h-1>>>8)-1}function e(r,t,e,o){return n(r,t,e,o,16)}function o(r,t,e,o){return n(r,t,e,o,32)}function i(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,d=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=i,U=h,E=a,x=f,M=s,m=u,B=c,S=y,K=l,T=w,Y=p,k=g,L=v,C=b,R=d,z=A,P=0;20>P;P+=2)o=_+L|0,M^=o<<7|o>>>25,o=M+_|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,_^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,C^=o<<9|o>>>23,o=C+T|0,U^=o<<13|o>>>19,o=U+C|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=z+k|0,x^=o<<7|o>>>25,o=x+z|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,z^=o<<18|o>>>14,o=_+x|0,U^=o<<7|o>>>25,o=U+_|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,_^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=z+R|0,L^=o<<7|o>>>25,o=L+z|0,C^=o<<9|o>>>23,o=C+L|0,R^=o<<13|o>>>19,o=R+C|0,z^=o<<18|o>>>14;_=_+i|0,U=U+h|0,E=E+a|0,x=x+f|0,M=M+s|0,m=m+u|0,B=B+c|0,S=S+y|0,K=K+l|0,T=T+w|0,Y=Y+p|0,k=k+g|0,L=L+v|0,C=C+b|0,R=R+d|0,z=z+A|0,r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=U>>>0&255,r[5]=U>>>8&255,r[6]=U>>>16&255,r[7]=U>>>24&255,r[8]=E>>>0&255,r[9]=E>>>8&255,r[10]=E>>>16&255,r[11]=E>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=M>>>0&255,r[17]=M>>>8&255,r[18]=M>>>16&255,r[19]=M>>>24&255,r[20]=m>>>0&255,r[21]=m>>>8&255,r[22]=m>>>16&255,r[23]=m>>>24&255,r[24]=B>>>0&255,r[25]=B>>>8&255,r[26]=B>>>16&255,r[27]=B>>>24&255,r[28]=S>>>0&255,r[29]=S>>>8&255,r[30]=S>>>16&255,r[31]=S>>>24&255,r[32]=K>>>0&255,r[33]=K>>>8&255,r[34]=K>>>16&255,r[35]=K>>>24&255,r[36]=T>>>0&255,r[37]=T>>>8&255,r[38]=T>>>16&255,r[39]=T>>>24&255,r[40]=Y>>>0&255,r[41]=Y>>>8&255,r[42]=Y>>>16&255,r[43]=Y>>>24&255,r[44]=k>>>0&255,r[45]=k>>>8&255,r[46]=k>>>16&255,r[47]=k>>>24&255,r[48]=L>>>0&255,r[49]=L>>>8&255,r[50]=L>>>16&255,r[51]=L>>>24&255,r[52]=C>>>0&255,r[53]=C>>>8&255,r[54]=C>>>16&255,r[55]=C>>>24&255,r[56]=R>>>0&255,r[57]=R>>>8&255,r[58]=R>>>16&255,r[59]=R>>>24&255,r[60]=z>>>0&255,r[61]=z>>>8&255,r[62]=z>>>16&255,r[63]=z>>>24&255}function h(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,d=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=i,U=h,E=a,x=f,M=s,m=u,B=c,S=y,K=l,T=w,Y=p,k=g,L=v,C=b,R=d,z=A,P=0;20>P;P+=2)o=_+L|0,M^=o<<7|o>>>25,o=M+_|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,_^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,C^=o<<9|o>>>23,o=C+T|0,U^=o<<13|o>>>19,o=U+C|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=z+k|0,x^=o<<7|o>>>25,o=x+z|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,z^=o<<18|o>>>14,o=_+x|0,U^=o<<7|o>>>25,o=U+_|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,_^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=z+R|0,L^=o<<7|o>>>25,o=L+z|0,C^=o<<9|o>>>23,o=C+L|0,R^=o<<13|o>>>19,o=R+C|0,z^=o<<18|o>>>14;r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=m>>>0&255,r[5]=m>>>8&255,r[6]=m>>>16&255,r[7]=m>>>24&255,r[8]=Y>>>0&255,r[9]=Y>>>8&255,r[10]=Y>>>16&255,r[11]=Y>>>24&255,r[12]=z>>>0&255,r[13]=z>>>8&255,r[14]=z>>>16&255,r[15]=z>>>24&255,r[16]=B>>>0&255,r[17]=B>>>8&255,r[18]=B>>>16&255,r[19]=B>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=K>>>0&255,r[25]=K>>>8&255,r[26]=K>>>16&255,r[27]=K>>>24&255,r[28]=T>>>0&255,r[29]=T>>>8&255,r[30]=T>>>16&255,r[31]=T>>>24&255}function a(r,t,n,e){i(r,t,n,e)}function f(r,t,n,e){h(r,t,n,e)}function s(r,t,n,e,o,i,h){var f,s,u=new Uint8Array(16),c=new Uint8Array(64);for(s=0;16>s;s++)u[s]=0;for(s=0;8>s;s++)u[s]=i[s];for(;o>=64;){for(a(c,u,h,cr),s=0;64>s;s++)r[t+s]=n[e+s]^c[s];for(f=1,s=8;16>s;s++)f=f+(255&u[s])|0,u[s]=255&f,f>>>=8;o-=64,t+=64,e+=64}if(o>0)for(a(c,u,h,cr),s=0;o>s;s++)r[t+s]=n[e+s]^c[s];return 0}function u(r,t,n,e,o){var i,h,f=new Uint8Array(16),s=new Uint8Array(64);for(h=0;16>h;h++)f[h]=0;for(h=0;8>h;h++)f[h]=e[h];for(;n>=64;){for(a(s,f,o,cr),h=0;64>h;h++)r[t+h]=s[h];for(i=1,h=8;16>h;h++)i=i+(255&f[h])|0,f[h]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(a(s,f,o,cr),h=0;n>h;h++)r[t+h]=s[h];return 0}function c(r,t,n,e,o){var i=new Uint8Array(32);f(i,e,o,cr);for(var h=new Uint8Array(8),a=0;8>a;a++)h[a]=e[a+16];return u(r,t,n,h,i)}function y(r,t,n,e,o,i,h){var a=new Uint8Array(32);f(a,i,h,cr);for(var u=new Uint8Array(8),c=0;8>c;c++)u[c]=i[c+16];return s(r,t,n,e,o,u,a)}function l(r,t,n,e,o,i){var h=new yr(i);return h.update(n,e,o),h.finish(r,t),0}function w(r,t,n,o,i,h){var a=new Uint8Array(16);return l(a,0,n,o,i,h),e(r,t,a,0)}function p(r,t,n,e,o){var i;if(32>n)return-1;for(y(r,0,t,0,n,e,o),l(r,16,r,32,n-32,r),i=0;16>i;i++)r[i]=0;return 0}function g(r,t,n,e,o){var i,h=new Uint8Array(32);if(32>n)return-1;if(c(h,0,32,e,o),0!==w(t,16,t,32,n-32,h))return-1;for(y(r,0,t,0,n,e,o),i=0;32>i;i++)r[i]=0;return 0}function v(r,t){var n;for(n=0;16>n;n++)r[n]=0|t[n]}function b(r){var t,n,e=1;for(t=0;16>t;t++)n=r[t]+e+65535,e=Math.floor(n/65536),r[t]=n-65536*e;r[0]+=e-1+37*(e-1)}function d(r,t,n){for(var e,o=~(n-1),i=0;16>i;i++)e=o&(r[i]^t[i]),r[i]^=e,t[i]^=e}function A(r,t){var n,e,o,i=$(),h=$();for(n=0;16>n;n++)h[n]=t[n];for(b(h),b(h),b(h),e=0;2>e;e++){for(i[0]=h[0]-65517,n=1;15>n;n++)i[n]=h[n]-65535-(i[n-1]>>16&1),i[n-1]&=65535;i[15]=h[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,d(h,i,1-o)}for(n=0;16>n;n++)r[2*n]=255&h[n],r[2*n+1]=h[n]>>8}function _(r,t){var n=new Uint8Array(32),e=new Uint8Array(32);return A(n,r),A(e,t),o(n,0,e,0)}function U(r){var t=new Uint8Array(32);return A(t,r),1&t[0]}function E(r,t){var n;for(n=0;16>n;n++)r[n]=t[2*n]+(t[2*n+1]<<8);r[15]&=32767}function x(r,t,n){for(var e=0;16>e;e++)r[e]=t[e]+n[e]}function M(r,t,n){for(var e=0;16>e;e++)r[e]=t[e]-n[e]}function m(r,t,n){var e,o,i=0,h=0,a=0,f=0,s=0,u=0,c=0,y=0,l=0,w=0,p=0,g=0,v=0,b=0,d=0,A=0,_=0,U=0,E=0,x=0,M=0,m=0,B=0,S=0,K=0,T=0,Y=0,k=0,L=0,C=0,R=0,z=n[0],P=n[1],O=n[2],N=n[3],F=n[4],I=n[5],j=n[6],G=n[7],Z=n[8],V=n[9],q=n[10],X=n[11],D=n[12],H=n[13],J=n[14],Q=n[15];e=t[0],i+=e*z,h+=e*P,a+=e*O,f+=e*N,s+=e*F,u+=e*I,c+=e*j,y+=e*G,l+=e*Z,w+=e*V,p+=e*q,g+=e*X,v+=e*D,b+=e*H,d+=e*J,A+=e*Q,e=t[1],h+=e*z,a+=e*P,f+=e*O,s+=e*N,u+=e*F,c+=e*I,y+=e*j,l+=e*G,w+=e*Z,p+=e*V,g+=e*q,v+=e*X,b+=e*D,d+=e*H,A+=e*J,_+=e*Q,e=t[2],a+=e*z,f+=e*P,s+=e*O,u+=e*N,c+=e*F,y+=e*I,l+=e*j,w+=e*G,p+=e*Z,g+=e*V,v+=e*q,b+=e*X,d+=e*D,A+=e*H,_+=e*J,U+=e*Q,e=t[3],f+=e*z,s+=e*P,u+=e*O,c+=e*N,y+=e*F,l+=e*I,w+=e*j,p+=e*G,g+=e*Z,v+=e*V,b+=e*q,d+=e*X,A+=e*D,_+=e*H,U+=e*J,E+=e*Q,e=t[4],s+=e*z,u+=e*P,c+=e*O,y+=e*N,l+=e*F,w+=e*I,p+=e*j,g+=e*G,v+=e*Z,b+=e*V,d+=e*q,A+=e*X,_+=e*D,U+=e*H,E+=e*J,x+=e*Q,e=t[5],u+=e*z,c+=e*P,y+=e*O,l+=e*N,w+=e*F,p+=e*I,g+=e*j,v+=e*G,b+=e*Z,d+=e*V,A+=e*q,_+=e*X,U+=e*D,E+=e*H,x+=e*J,M+=e*Q,e=t[6],c+=e*z,y+=e*P,l+=e*O,w+=e*N,p+=e*F,g+=e*I,v+=e*j,b+=e*G,d+=e*Z,A+=e*V,_+=e*q,U+=e*X,E+=e*D,x+=e*H,M+=e*J,m+=e*Q,e=t[7],y+=e*z,l+=e*P,w+=e*O,p+=e*N,g+=e*F,v+=e*I,b+=e*j,d+=e*G,A+=e*Z,_+=e*V,U+=e*q,E+=e*X,x+=e*D,M+=e*H,m+=e*J,B+=e*Q,e=t[8],l+=e*z,w+=e*P,p+=e*O,g+=e*N,v+=e*F,b+=e*I,d+=e*j,A+=e*G,_+=e*Z,U+=e*V,E+=e*q,x+=e*X,M+=e*D,m+=e*H,B+=e*J,S+=e*Q,e=t[9],w+=e*z,p+=e*P,g+=e*O,v+=e*N,b+=e*F,d+=e*I,A+=e*j,_+=e*G,U+=e*Z,E+=e*V,x+=e*q,M+=e*X,m+=e*D,B+=e*H,S+=e*J,K+=e*Q,e=t[10],p+=e*z,g+=e*P,v+=e*O,b+=e*N,d+=e*F,A+=e*I,_+=e*j,U+=e*G,E+=e*Z,x+=e*V,M+=e*q,m+=e*X,B+=e*D,S+=e*H,K+=e*J,T+=e*Q,e=t[11],g+=e*z,v+=e*P,b+=e*O,d+=e*N,A+=e*F,_+=e*I,U+=e*j,E+=e*G,x+=e*Z,M+=e*V,m+=e*q,B+=e*X,S+=e*D,K+=e*H,T+=e*J,Y+=e*Q,e=t[12],v+=e*z,b+=e*P,d+=e*O,A+=e*N,_+=e*F,U+=e*I,E+=e*j,x+=e*G,M+=e*Z,m+=e*V,B+=e*q,S+=e*X,K+=e*D,T+=e*H,Y+=e*J,k+=e*Q,e=t[13],b+=e*z,d+=e*P,A+=e*O,_+=e*N,U+=e*F,E+=e*I,x+=e*j,M+=e*G,m+=e*Z,B+=e*V,S+=e*q,K+=e*X,T+=e*D,Y+=e*H,k+=e*J,L+=e*Q,e=t[14],d+=e*z,A+=e*P,_+=e*O,U+=e*N,E+=e*F,x+=e*I,M+=e*j,m+=e*G,B+=e*Z,S+=e*V,K+=e*q,T+=e*X,Y+=e*D,k+=e*H,L+=e*J,C+=e*Q,e=t[15],A+=e*z,_+=e*P,U+=e*O,E+=e*N,x+=e*F,M+=e*I,m+=e*j,B+=e*G,S+=e*Z,K+=e*V,T+=e*q,Y+=e*X,k+=e*D,L+=e*H,C+=e*J,R+=e*Q,i+=38*_,h+=38*U,a+=38*E,f+=38*x,s+=38*M,u+=38*m,c+=38*B,y+=38*S,l+=38*K,w+=38*T,p+=38*Y,g+=38*k,v+=38*L,b+=38*C,d+=38*R,o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=d+o+65535,o=Math.floor(e/65536),d=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=d+o+65535,o=Math.floor(e/65536),d=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),r[0]=i,r[1]=h,r[2]=a,r[3]=f,r[4]=s,r[5]=u,r[6]=c,r[7]=y,r[8]=l,r[9]=w,r[10]=p,r[11]=g,r[12]=v,r[13]=b,r[14]=d,r[15]=A}function B(r,t){m(r,t,t)}function S(r,t){var n,e=$();for(n=0;16>n;n++)e[n]=t[n];for(n=253;n>=0;n--)B(e,e),2!==n&&4!==n&&m(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function K(r,t){var n,e=$();for(n=0;16>n;n++)e[n]=t[n];for(n=250;n>=0;n--)B(e,e),1!==n&&m(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function T(r,t,n){var e,o,i=new Uint8Array(32),h=new Float64Array(80),a=$(),f=$(),s=$(),u=$(),c=$(),y=$();for(o=0;31>o;o++)i[o]=t[o];for(i[31]=127&t[31]|64,i[0]&=248,E(h,n),o=0;16>o;o++)f[o]=h[o],u[o]=a[o]=s[o]=0;for(a[0]=u[0]=1,o=254;o>=0;--o)e=i[o>>>3]>>>(7&o)&1,d(a,f,e),d(s,u,e),x(c,a,s),M(a,a,s),x(s,f,u),M(f,f,u),B(u,c),B(y,a),m(a,s,a),m(s,f,c),x(c,a,s),M(a,a,s),B(f,a),M(s,u,y),m(a,s,ir),x(a,a,u),m(s,s,a),m(a,u,y),m(u,f,h),B(f,c),d(a,f,e),d(s,u,e);for(o=0;16>o;o++)h[o+16]=a[o],h[o+32]=s[o],h[o+48]=f[o],h[o+64]=u[o];var l=h.subarray(32),w=h.subarray(16);return S(l,l),m(w,w,l),A(r,w),0}function Y(r,t){return T(r,t,nr)}function k(r,t){return rr(t,32),Y(r,t)}function L(r,t,n){var e=new Uint8Array(32);return T(e,n,t),f(r,tr,e,cr)}function C(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),lr(r,t,n,e,h)}function R(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),wr(r,t,n,e,h)}function z(r,t,n,e){for(var o,i,h,a,f,s,u,c,y,l,w,p,g,v,b,d,A,_,U,E,x,M,m,B,S,K,T=new Int32Array(16),Y=new Int32Array(16),k=r[0],L=r[1],C=r[2],R=r[3],z=r[4],P=r[5],O=r[6],N=r[7],F=t[0],I=t[1],j=t[2],G=t[3],Z=t[4],V=t[5],q=t[6],X=t[7],D=0;e>=128;){for(U=0;16>U;U++)E=8*U+D,T[U]=n[E+0]<<24|n[E+1]<<16|n[E+2]<<8|n[E+3],Y[U]=n[E+4]<<24|n[E+5]<<16|n[E+6]<<8|n[E+7];for(U=0;80>U;U++)if(o=k,i=L,h=C,a=R,f=z,s=P,u=O,c=N,y=F,l=I,w=j,p=G,g=Z,v=V,b=q,d=X,x=N,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(z>>>14|Z<<18)^(z>>>18|Z<<14)^(Z>>>9|z<<23),M=(Z>>>14|z<<18)^(Z>>>18|z<<14)^(z>>>9|Z<<23),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=z&P^~z&O,M=Z&V^~Z&q,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=pr[2*U],M=pr[2*U+1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=T[U%16],M=Y[U%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,A=65535&S|K<<16,_=65535&m|B<<16,x=A,M=_,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(k>>>28|F<<4)^(F>>>2|k<<30)^(F>>>7|k<<25),M=(F>>>28|k<<4)^(k>>>2|F<<30)^(k>>>7|F<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=k&L^k&C^L&C,M=F&I^F&j^I&j,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,c=65535&S|K<<16,d=65535&m|B<<16,x=a,M=p,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=A,M=_,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,a=65535&S|K<<16,p=65535&m|B<<16,L=o,C=i,R=h,z=a,P=f,O=s,N=u,k=c,I=y,j=l,G=w,Z=p,V=g,q=v,X=b,F=d,U%16===15)for(E=0;16>E;E++)x=T[E],M=Y[E],m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=T[(E+9)%16],M=Y[(E+9)%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+1)%16],_=Y[(E+1)%16],x=(A>>>1|_<<31)^(A>>>8|_<<24)^A>>>7,M=(_>>>1|A<<31)^(_>>>8|A<<24)^(_>>>7|A<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+14)%16],_=Y[(E+14)%16],x=(A>>>19|_<<13)^(_>>>29|A<<3)^A>>>6,M=(_>>>19|A<<13)^(A>>>29|_<<3)^(_>>>6|A<<26),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,T[E]=65535&S|K<<16,Y[E]=65535&m|B<<16;x=k,M=F,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[0],M=t[0],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[0]=k=65535&S|K<<16,t[0]=F=65535&m|B<<16,x=L,M=I,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[1],M=t[1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[1]=L=65535&S|K<<16,t[1]=I=65535&m|B<<16,x=C,M=j,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[2],M=t[2],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[2]=C=65535&S|K<<16,t[2]=j=65535&m|B<<16,x=R,M=G,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[3],M=t[3],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[3]=R=65535&S|K<<16,t[3]=G=65535&m|B<<16,x=z,M=Z,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[4],M=t[4],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[4]=z=65535&S|K<<16,t[4]=Z=65535&m|B<<16,x=P,M=V,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[5],M=t[5],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[5]=P=65535&S|K<<16,t[5]=V=65535&m|B<<16,x=O,M=q,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[6],M=t[6],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[6]=O=65535&S|K<<16,t[6]=q=65535&m|B<<16,x=N,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[7],M=t[7],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[7]=N=65535&S|K<<16,t[7]=X=65535&m|B<<16,D+=128,e-=128}return e}function P(r,n,e){var o,i=new Int32Array(8),h=new Int32Array(8),a=new Uint8Array(256),f=e;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,h[0]=4089235720,h[1]=2227873595,h[2]=4271175723,h[3]=1595750129,h[4]=2917565137,h[5]=725511199,h[6]=4215389547,h[7]=327033209,z(i,h,n,e),e%=128,o=0;e>o;o++)a[o]=n[f-e+o];for(a[e]=128,e=256-128*(112>e?1:0),a[e-9]=0,t(a,e-8,f/536870912|0,f<<3),z(i,h,a,e),o=0;8>o;o++)t(r,8*o,i[o],h[o]);return 0}function O(r,t){var n=$(),e=$(),o=$(),i=$(),h=$(),a=$(),f=$(),s=$(),u=$();M(n,r[1],r[0]),M(u,t[1],t[0]),m(n,n,u),x(e,r[0],r[1]),x(u,t[0],t[1]),m(e,e,u),m(o,r[3],t[3]),m(o,o,ar),m(i,r[2],t[2]),x(i,i,i),M(h,e,n),M(a,i,o),x(f,i,o),x(s,e,n),m(r[0],h,a),m(r[1],s,f),m(r[2],f,a),m(r[3],h,s)}function N(r,t,n){var e;for(e=0;4>e;e++)d(r[e],t[e],n)}function F(r,t){var n=$(),e=$(),o=$();S(o,t[2]),m(n,t[0],o),m(e,t[1],o),A(r,e),r[31]^=U(n)<<7}function I(r,t,n){var e,o;for(v(r[0],er),v(r[1],or),v(r[2],or),v(r[3],er),o=255;o>=0;--o)e=n[o/8|0]>>(7&o)&1,N(r,t,e),O(t,r),O(r,r),N(r,t,e)}function j(r,t){var n=[$(),$(),$(),$()];v(n[0],fr),v(n[1],sr),v(n[2],or),m(n[3],fr,sr),I(r,n,t)}function G(r,t,n){var e,o=new Uint8Array(64),i=[$(),$(),$(),$()];for(n||rr(t,32),P(o,t,32),o[0]&=248,o[31]&=127,o[31]|=64,j(i,o),F(r,i),e=0;32>e;e++)t[e+32]=r[e];return 0}function Z(r,t){var n,e,o,i;for(e=63;e>=32;--e){for(n=0,o=e-32,i=e-12;i>o;++o)t[o]+=n-16*t[e]*gr[o-(e-32)],n=t[o]+128>>8,t[o]-=256*n;t[o]+=n,t[e]=0}for(n=0,o=0;32>o;o++)t[o]+=n-(t[31]>>4)*gr[o],n=t[o]>>8,t[o]&=255;for(o=0;32>o;o++)t[o]-=n*gr[o];for(e=0;32>e;e++)t[e+1]+=t[e]>>8,r[e]=255&t[e]}function V(r){var t,n=new Float64Array(64);for(t=0;64>t;t++)n[t]=r[t];for(t=0;64>t;t++)r[t]=0;Z(r,n)}function q(r,t,n,e){var o,i,h=new Uint8Array(64),a=new Uint8Array(64),f=new Uint8Array(64),s=new Float64Array(64),u=[$(),$(),$(),$()];P(h,e,32),h[0]&=248,h[31]&=127,h[31]|=64;var c=n+64;for(o=0;n>o;o++)r[64+o]=t[o];for(o=0;32>o;o++)r[32+o]=h[32+o];for(P(f,r.subarray(32),n+32),V(f),j(u,f),F(r,u),o=32;64>o;o++)r[o]=e[o];for(P(a,r,n+64),V(a),o=0;64>o;o++)s[o]=0;for(o=0;32>o;o++)s[o]=f[o];for(o=0;32>o;o++)for(i=0;32>i;i++)s[o+i]+=a[o]*h[i];return Z(r.subarray(32),s),c}function X(r,t){var n=$(),e=$(),o=$(),i=$(),h=$(),a=$(),f=$();return v(r[2],or),E(r[1],t),B(o,r[1]),m(i,o,hr),M(o,o,r[2]),x(i,r[2],i),B(h,i),B(a,h),m(f,a,h),m(n,f,o),m(n,n,i),K(n,n),m(n,n,o),m(n,n,i),m(n,n,i),m(r[0],n,i),B(e,r[0]),m(e,e,i),_(e,o)&&m(r[0],r[0],ur),B(e,r[0]),m(e,e,i),_(e,o)?-1:(U(r[0])===t[31]>>7&&M(r[0],er,r[0]),m(r[3],r[0],r[1]),0)}function D(r,t,n,e){var i,h,a=new Uint8Array(32),f=new Uint8Array(64),s=[$(),$(),$(),$()],u=[$(),$(),$(),$()];if(h=-1,64>n)return-1;if(X(u,e))return-1;for(i=0;n>i;i++)r[i]=t[i];for(i=0;32>i;i++)r[i+32]=e[i];if(P(f,r,n),V(f),I(s,u,f),j(u,t.subarray(32)),O(s,u),F(a,s),n-=64,o(t,0,a,0)){for(i=0;n>i;i++)r[i]=0;return-1}for(i=0;n>i;i++)r[i]=t[i+64];return h=n}function H(r,t){if(r.length!==vr)throw new Error("bad key size");if(t.length!==br)throw new Error("bad nonce size")}function J(r,t){if(r.length!==Er)throw new Error("bad public key size");if(t.length!==xr)throw new Error("bad secret key size")}function Q(){var r,t;for(t=0;t<arguments.length;t++)if("[object Uint8Array]"!==(r=Object.prototype.toString.call(arguments[t])))throw new TypeError("unexpected type "+r+", use Uint8Array")}function W(r){for(var t=0;t<r.length;t++)r[t]=0}var $=function(r){var t,n=new Float64Array(16);if(r)for(t=0;t<r.length;t++)n[t]=r[t];return n},rr=function(){throw new Error("no PRNG")},tr=new Uint8Array(16),nr=new Uint8Array(32);nr[0]=9;var er=$(),or=$([1]),ir=$([56129,1]),hr=$([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),ar=$([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),fr=$([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),sr=$([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),ur=$([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]),cr=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]),yr=function(r){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t,n,e,o,i,h,a,f;t=255&r[0]|(255&r[1])<<8,this.r[0]=8191&t,n=255&r[2]|(255&r[3])<<8,this.r[1]=8191&(t>>>13|n<<3),e=255&r[4]|(255&r[5])<<8,this.r[2]=7939&(n>>>10|e<<6),o=255&r[6]|(255&r[7])<<8,this.r[3]=8191&(e>>>7|o<<9),i=255&r[8]|(255&r[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,h=255&r[10]|(255&r[11])<<8,this.r[6]=8191&(i>>>14|h<<2),a=255&r[12]|(255&r[13])<<8,this.r[7]=8065&(h>>>11|a<<5),f=255&r[14]|(255&r[15])<<8,this.r[8]=8191&(a>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&r[16]|(255&r[17])<<8,this.pad[1]=255&r[18]|(255&r[19])<<8,this.pad[2]=255&r[20]|(255&r[21])<<8,this.pad[3]=255&r[22]|(255&r[23])<<8,this.pad[4]=255&r[24]|(255&r[25])<<8,this.pad[5]=255&r[26]|(255&r[27])<<8,this.pad[6]=255&r[28]|(255&r[29])<<8,this.pad[7]=255&r[30]|(255&r[31])<<8};yr.prototype.blocks=function(r,t,n){for(var e,o,i,h,a,f,s,u,c,y,l,w,p,g,v,b,d,A,_,U=this.fin?0:2048,E=this.h[0],x=this.h[1],M=this.h[2],m=this.h[3],B=this.h[4],S=this.h[5],K=this.h[6],T=this.h[7],Y=this.h[8],k=this.h[9],L=this.r[0],C=this.r[1],R=this.r[2],z=this.r[3],P=this.r[4],O=this.r[5],N=this.r[6],F=this.r[7],I=this.r[8],j=this.r[9];n>=16;)e=255&r[t+0]|(255&r[t+1])<<8,E+=8191&e,o=255&r[t+2]|(255&r[t+3])<<8,x+=8191&(e>>>13|o<<3),i=255&r[t+4]|(255&r[t+5])<<8,M+=8191&(o>>>10|i<<6),h=255&r[t+6]|(255&r[t+7])<<8,m+=8191&(i>>>7|h<<9),a=255&r[t+8]|(255&r[t+9])<<8,B+=8191&(h>>>4|a<<12),S+=a>>>1&8191,f=255&r[t+10]|(255&r[t+11])<<8,K+=8191&(a>>>14|f<<2),s=255&r[t+12]|(255&r[t+13])<<8,T+=8191&(f>>>11|s<<5),u=255&r[t+14]|(255&r[t+15])<<8,Y+=8191&(s>>>8|u<<8),k+=u>>>5|U,c=0,y=c,y+=E*L,y+=5*x*j,y+=5*M*I,y+=5*m*F,y+=5*B*N,c=y>>>13,y&=8191,y+=5*S*O,y+=5*K*P,y+=5*T*z,y+=5*Y*R,y+=5*k*C,c+=y>>>13,y&=8191,l=c,l+=E*C,l+=x*L,l+=5*M*j,l+=5*m*I,l+=5*B*F,c=l>>>13,l&=8191,l+=5*S*N,l+=5*K*O,l+=5*T*P,l+=5*Y*z,l+=5*k*R,c+=l>>>13,l&=8191,w=c,w+=E*R,w+=x*C,w+=M*L,w+=5*m*j,w+=5*B*I,c=w>>>13,w&=8191,w+=5*S*F,w+=5*K*N,w+=5*T*O,w+=5*Y*P,w+=5*k*z,c+=w>>>13,w&=8191,p=c,p+=E*z,p+=x*R,p+=M*C,p+=m*L,p+=5*B*j,c=p>>>13,p&=8191,p+=5*S*I,p+=5*K*F,p+=5*T*N,p+=5*Y*O,p+=5*k*P,c+=p>>>13,p&=8191,g=c,g+=E*P,g+=x*z,g+=M*R,g+=m*C,g+=B*L,c=g>>>13,g&=8191,g+=5*S*j,g+=5*K*I,g+=5*T*F,g+=5*Y*N,g+=5*k*O,c+=g>>>13,g&=8191,v=c,v+=E*O,v+=x*P,v+=M*z,v+=m*R,v+=B*C,c=v>>>13,v&=8191,v+=S*L,v+=5*K*j,v+=5*T*I,v+=5*Y*F,v+=5*k*N,c+=v>>>13,v&=8191,b=c,b+=E*N,b+=x*O,b+=M*P,b+=m*z,b+=B*R,c=b>>>13,b&=8191,b+=S*C,b+=K*L,b+=5*T*j,b+=5*Y*I,b+=5*k*F,c+=b>>>13,b&=8191,d=c,d+=E*F,d+=x*N,d+=M*O,d+=m*P,d+=B*z,c=d>>>13,d&=8191,d+=S*R,d+=K*C,d+=T*L,d+=5*Y*j,d+=5*k*I,c+=d>>>13,d&=8191,A=c,A+=E*I,A+=x*F,A+=M*N,A+=m*O,A+=B*P,c=A>>>13,A&=8191,A+=S*z,A+=K*R,A+=T*C,A+=Y*L,A+=5*k*j,c+=A>>>13,A&=8191,_=c,_+=E*j,_+=x*I,_+=M*F,_+=m*N,_+=B*O,c=_>>>13,_&=8191,_+=S*P,_+=K*z,_+=T*R,_+=Y*C,_+=k*L,c+=_>>>13,_&=8191,c=(c<<2)+c|0,c=c+y|0,y=8191&c,c>>>=13,l+=c,E=y,x=l,M=w,m=p,B=g,S=v,K=b,T=d,Y=A,k=_,t+=16,n-=16;this.h[0]=E,this.h[1]=x,this.h[2]=M,this.h[3]=m,this.h[4]=B,this.h[5]=S,this.h[6]=K,this.h[7]=T,this.h[8]=Y,this.h[9]=k},yr.prototype.finish=function(r,t){var n,e,o,i,h=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;16>i;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;10>i;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,h[0]=this.h[0]+5,n=h[0]>>>13,h[0]&=8191,i=1;10>i;i++)h[i]=this.h[i]+n,n=h[i]>>>13,h[i]&=8191;for(h[9]-=8192,e=(h[9]>>>15)-1,i=0;10>i;i++)h[i]&=e;for(e=~e,i=0;10>i;i++)this.h[i]=this.h[i]&e|h[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;8>i;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;r[t+0]=this.h[0]>>>0&255,r[t+1]=this.h[0]>>>8&255,r[t+2]=this.h[1]>>>0&255,r[t+3]=this.h[1]>>>8&255,r[t+4]=this.h[2]>>>0&255,r[t+5]=this.h[2]>>>8&255,r[t+6]=this.h[3]>>>0&255,r[t+7]=this.h[3]>>>8&255,r[t+8]=this.h[4]>>>0&255,r[t+9]=this.h[4]>>>8&255,r[t+10]=this.h[5]>>>0&255,r[t+11]=this.h[5]>>>8&255,r[t+12]=this.h[6]>>>0&255,r[t+13]=this.h[6]>>>8&255,r[t+14]=this.h[7]>>>0&255,r[t+15]=this.h[7]>>>8&255},yr.prototype.update=function(r,t,n){var e,o;if(this.leftover){for(o=16-this.leftover,o>n&&(o=n),e=0;o>e;e++)this.buffer[this.leftover+e]=r[t+e];if(n-=o,t+=o,this.leftover+=o,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(o=n-n%16,this.blocks(r,t,o),t+=o,n-=o),n){for(e=0;n>e;e++)this.buffer[this.leftover+e]=r[t+e];this.leftover+=n}};var lr=p,wr=g,pr=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],gr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),vr=32,br=24,dr=32,Ar=16,_r=32,Ur=32,Er=32,xr=32,Mr=32,mr=br,Br=dr,Sr=Ar,Kr=64,Tr=32,Yr=64,kr=32,Lr=64;r.lowlevel={crypto_core_hsalsa20:f,crypto_stream_xor:y,crypto_stream:c,crypto_stream_salsa20_xor:s,crypto_stream_salsa20:u,crypto_onetimeauth:l,crypto_onetimeauth_verify:w,crypto_verify_16:e,crypto_verify_32:o,crypto_secretbox:p,crypto_secretbox_open:g,crypto_scalarmult:T,crypto_scalarmult_base:Y,crypto_box_beforenm:L,crypto_box_afternm:lr,crypto_box:C,crypto_box_open:R,crypto_box_keypair:k,crypto_hash:P,crypto_sign:q,crypto_sign_keypair:G,crypto_sign_open:D,crypto_secretbox_KEYBYTES:vr,crypto_secretbox_NONCEBYTES:br,crypto_secretbox_ZEROBYTES:dr,crypto_secretbox_BOXZEROBYTES:Ar,crypto_scalarmult_BYTES:_r,crypto_scalarmult_SCALARBYTES:Ur,crypto_box_PUBLICKEYBYTES:Er,crypto_box_SECRETKEYBYTES:xr,crypto_box_BEFORENMBYTES:Mr,crypto_box_NONCEBYTES:mr,crypto_box_ZEROBYTES:Br,crypto_box_BOXZEROBYTES:Sr,crypto_sign_BYTES:Kr,crypto_sign_PUBLICKEYBYTES:Tr,crypto_sign_SECRETKEYBYTES:Yr,crypto_sign_SEEDBYTES:kr,crypto_hash_BYTES:Lr},r.util={},r.util.decodeUTF8=function(r){var t,n=unescape(encodeURIComponent(r)),e=new Uint8Array(n.length);for(t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e},r.util.encodeUTF8=function(r){var t,n=[];for(t=0;t<r.length;t++)n.push(String.fromCharCode(r[t]));return decodeURIComponent(escape(n.join("")))},r.util.encodeBase64=function(r){if("undefined"==typeof btoa)return new Buffer(r).toString("base64");var t,n=[],e=r.length;for(t=0;e>t;t++)n.push(String.fromCharCode(r[t]));return btoa(n.join(""))},r.util.decodeBase64=function(r){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0));var t,n=atob(r),e=new Uint8Array(n.length);for(t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e},r.randomBytes=function(r){var t=new Uint8Array(r);return rr(t,r),t},r.secretbox=function(r,t,n){Q(r,t,n),H(n,t);for(var e=new Uint8Array(dr+r.length),o=new Uint8Array(e.length),i=0;i<r.length;i++)e[i+dr]=r[i];return p(o,e,e.length,t,n),o.subarray(Ar)},r.secretbox.open=function(r,t,n){Q(r,t,n),H(n,t);for(var e=new Uint8Array(Ar+r.length),o=new Uint8Array(e.length),i=0;i<r.length;i++)e[i+Ar]=r[i];return e.length<32?!1:0!==g(o,e,e.length,t,n)?!1:o.subarray(dr)},r.secretbox.keyLength=vr,r.secretbox.nonceLength=br,r.secretbox.overheadLength=Ar,r.scalarMult=function(r,t){if(Q(r,t),r.length!==Ur)throw new Error("bad n size");if(t.length!==_r)throw new Error("bad p size");var n=new Uint8Array(_r);return T(n,r,t),n},r.scalarMult.base=function(r){if(Q(r),r.length!==Ur)throw new Error("bad n size");var t=new Uint8Array(_r);return Y(t,r),t},r.scalarMult.scalarLength=Ur,r.scalarMult.groupElementLength=_r,r.box=function(t,n,e,o){var i=r.box.before(e,o);return r.secretbox(t,n,i)},r.box.before=function(r,t){Q(r,t),J(r,t);var n=new Uint8Array(Mr);return L(n,r,t),n},r.box.after=r.secretbox,r.box.open=function(t,n,e,o){var i=r.box.before(e,o);return r.secretbox.open(t,n,i)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var r=new Uint8Array(Er),t=new Uint8Array(xr);return k(r,t),{publicKey:r,secretKey:t}},r.box.keyPair.fromSecretKey=function(r){if(Q(r),r.length!==xr)throw new Error("bad secret key size");var t=new Uint8Array(Er);return Y(t,r),{publicKey:t,secretKey:new Uint8Array(r)}},r.box.publicKeyLength=Er,r.box.secretKeyLength=xr,r.box.sharedKeyLength=Mr,r.box.nonceLength=mr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(r,t){if(Q(r,t),t.length!==Yr)throw new Error("bad secret key size");var n=new Uint8Array(Kr+r.length);return q(n,r,r.length,t),n},r.sign.open=function(r,t){if(2!==arguments.length)throw new Error("nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?");if(Q(r,t),t.length!==Tr)throw new Error("bad public key size");var n=new Uint8Array(r.length),e=D(n,r,r.length,t);if(0>e)return null;for(var o=new Uint8Array(e),i=0;i<o.length;i++)o[i]=n[i];return o},r.sign.detached=function(t,n){for(var e=r.sign(t,n),o=new Uint8Array(Kr),i=0;i<o.length;i++)o[i]=e[i];return o},r.sign.detached.verify=function(r,t,n){if(Q(r,t,n),t.length!==Kr)throw new Error("bad signature size");if(n.length!==Tr)throw new Error("bad public key size");var e,o=new Uint8Array(Kr+r.length),i=new Uint8Array(Kr+r.length);for(e=0;Kr>e;e++)o[e]=t[e];for(e=0;e<r.length;e++)o[e+Kr]=r[e];return D(i,o,o.length,n)>=0},r.sign.keyPair=function(){var r=new Uint8Array(Tr),t=new Uint8Array(Yr);return G(r,t),{publicKey:r,secretKey:t}},r.sign.keyPair.fromSecretKey=function(r){if(Q(r),r.length!==Yr)throw new Error("bad secret key size");for(var t=new Uint8Array(Tr),n=0;n<t.length;n++)t[n]=r[32+n];return{publicKey:t,secretKey:new Uint8Array(r)
+}},r.sign.keyPair.fromSeed=function(r){if(Q(r),r.length!==kr)throw new Error("bad seed size");for(var t=new Uint8Array(Tr),n=new Uint8Array(Yr),e=0;32>e;e++)n[e]=r[e];return G(t,n,!0),{publicKey:t,secretKey:n}},r.sign.publicKeyLength=Tr,r.sign.secretKeyLength=Yr,r.sign.seedLength=kr,r.sign.signatureLength=Kr,r.hash=function(r){Q(r);var t=new Uint8Array(Lr);return P(t,r,r.length),t},r.hash.hashLength=Lr,r.verify=function(r,t){return Q(r,t),0===r.length||0===t.length?!1:r.length!==t.length?!1:0===n(r,0,t,0,r.length)?!0:!1},r.setPRNG=function(r){rr=r},function(){var t;"undefined"!=typeof window?(window.crypto&&window.crypto.getRandomValues?t=window.crypto:window.msCrypto&&window.msCrypto.getRandomValues&&(t=window.msCrypto),t&&r.setPRNG(function(r,n){var e,o=new Uint8Array(n);for(t.getRandomValues(o),e=0;n>e;e++)r[e]=o[e];W(o)})):"undefined"!=typeof require&&(t=require("crypto"),t&&r.setPRNG(function(r,n){var e,o=t.randomBytes(n);for(e=0;n>e;e++)r[e]=o[e];W(o)}))}()}("undefined"!=typeof module&&module.exports?module.exports:window.nacl=window.nacl||{}); \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js
new file mode 100644
index 000000000..b8edbbee6
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js
@@ -0,0 +1,1205 @@
+(function(nacl) {
+'use strict';
+
+// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
+// Public domain.
+//
+// Implementation derived from TweetNaCl version 20140427.
+// See for details: http://tweetnacl.cr.yp.to/
+
+var u64 = function(h, l) { this.hi = h|0 >>> 0; this.lo = l|0 >>> 0; };
+var gf = function(init) {
+ var i, r = new Float64Array(16);
+ if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
+ return r;
+};
+
+// Pluggable, initialized in high-level API below.
+var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
+
+var _0 = new Uint8Array(16);
+var _9 = new Uint8Array(32); _9[0] = 9;
+
+var gf0 = gf(),
+ gf1 = gf([1]),
+ _121665 = gf([0xdb41, 1]),
+ D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
+ D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
+ X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
+ Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
+ I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
+
+function L32(x, c) { return (x << c) | (x >>> (32 - c)); }
+
+function ld32(x, i) {
+ var u = x[i+3] & 0xff;
+ u = (u<<8)|(x[i+2] & 0xff);
+ u = (u<<8)|(x[i+1] & 0xff);
+ return (u<<8)|(x[i+0] & 0xff);
+}
+
+function dl64(x, i) {
+ var h = (x[i] << 24) | (x[i+1] << 16) | (x[i+2] << 8) | x[i+3];
+ var l = (x[i+4] << 24) | (x[i+5] << 16) | (x[i+6] << 8) | x[i+7];
+ return new u64(h, l);
+}
+
+function st32(x, j, u) {
+ var i;
+ for (i = 0; i < 4; i++) { x[j+i] = u & 255; u >>>= 8; }
+}
+
+function ts64(x, i, u) {
+ x[i] = (u.hi >> 24) & 0xff;
+ x[i+1] = (u.hi >> 16) & 0xff;
+ x[i+2] = (u.hi >> 8) & 0xff;
+ x[i+3] = u.hi & 0xff;
+ x[i+4] = (u.lo >> 24) & 0xff;
+ x[i+5] = (u.lo >> 16) & 0xff;
+ x[i+6] = (u.lo >> 8) & 0xff;
+ x[i+7] = u.lo & 0xff;
+}
+
+function vn(x, xi, y, yi, n) {
+ var i,d = 0;
+ for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
+ return (1 & ((d - 1) >>> 8)) - 1;
+}
+
+function crypto_verify_16(x, xi, y, yi) {
+ return vn(x,xi,y,yi,16);
+}
+
+function crypto_verify_32(x, xi, y, yi) {
+ return vn(x,xi,y,yi,32);
+}
+
+function core(out,inp,k,c,h) {
+ var w = new Uint32Array(16), x = new Uint32Array(16),
+ y = new Uint32Array(16), t = new Uint32Array(4);
+ var i, j, m;
+
+ for (i = 0; i < 4; i++) {
+ x[5*i] = ld32(c, 4*i);
+ x[1+i] = ld32(k, 4*i);
+ x[6+i] = ld32(inp, 4*i);
+ x[11+i] = ld32(k, 16+4*i);
+ }
+
+ for (i = 0; i < 16; i++) y[i] = x[i];
+
+ for (i = 0; i < 20; i++) {
+ for (j = 0; j < 4; j++) {
+ for (m = 0; m < 4; m++) t[m] = x[(5*j+4*m)%16];
+ t[1] ^= L32((t[0]+t[3])|0, 7);
+ t[2] ^= L32((t[1]+t[0])|0, 9);
+ t[3] ^= L32((t[2]+t[1])|0,13);
+ t[0] ^= L32((t[3]+t[2])|0,18);
+ for (m = 0; m < 4; m++) w[4*j+(j+m)%4] = t[m];
+ }
+ for (m = 0; m < 16; m++) x[m] = w[m];
+ }
+
+ if (h) {
+ for (i = 0; i < 16; i++) x[i] = (x[i] + y[i]) | 0;
+ for (i = 0; i < 4; i++) {
+ x[5*i] = (x[5*i] - ld32(c, 4*i)) | 0;
+ x[6+i] = (x[6+i] - ld32(inp, 4*i)) | 0;
+ }
+ for (i = 0; i < 4; i++) {
+ st32(out,4*i,x[5*i]);
+ st32(out,16+4*i,x[6+i]);
+ }
+ } else {
+ for (i = 0; i < 16; i++) st32(out, 4 * i, (x[i] + y[i]) | 0);
+ }
+}
+
+function crypto_core_salsa20(out,inp,k,c) {
+ core(out,inp,k,c,false);
+ return 0;
+}
+
+function crypto_core_hsalsa20(out,inp,k,c) {
+ core(out,inp,k,c,true);
+ return 0;
+}
+
+var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
+ // "expand 32-byte k"
+
+function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
+ var z = new Uint8Array(16), x = new Uint8Array(64);
+ var u, i;
+ if (!b) return 0;
+ for (i = 0; i < 16; i++) z[i] = 0;
+ for (i = 0; i < 8; i++) z[i] = n[i];
+ while (b >= 64) {
+ crypto_core_salsa20(x,z,k,sigma);
+ for (i = 0; i < 64; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i];
+ u = 1;
+ for (i = 8; i < 16; i++) {
+ u = u + (z[i] & 0xff) | 0;
+ z[i] = u & 0xff;
+ u >>>= 8;
+ }
+ b -= 64;
+ cpos += 64;
+ if (m) mpos += 64;
+ }
+ if (b > 0) {
+ crypto_core_salsa20(x,z,k,sigma);
+ for (i = 0; i < b; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i];
+ }
+ return 0;
+}
+
+function crypto_stream_salsa20(c,cpos,d,n,k) {
+ return crypto_stream_salsa20_xor(c,cpos,null,0,d,n,k);
+}
+
+function crypto_stream(c,cpos,d,n,k) {
+ var s = new Uint8Array(32);
+ crypto_core_hsalsa20(s,n,k,sigma);
+ return crypto_stream_salsa20(c,cpos,d,n.subarray(16),s);
+}
+
+function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
+ var s = new Uint8Array(32);
+ crypto_core_hsalsa20(s,n,k,sigma);
+ return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,n.subarray(16),s);
+}
+
+function add1305(h, c) {
+ var j, u = 0;
+ for (j = 0; j < 17; j++) {
+ u = (u + ((h[j] + c[j]) | 0)) | 0;
+ h[j] = u & 255;
+ u >>>= 8;
+ }
+}
+
+var minusp = new Uint32Array([
+ 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252
+]);
+
+function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
+ var s, i, j, u;
+ var x = new Uint32Array(17), r = new Uint32Array(17),
+ h = new Uint32Array(17), c = new Uint32Array(17),
+ g = new Uint32Array(17);
+ for (j = 0; j < 17; j++) r[j]=h[j]=0;
+ for (j = 0; j < 16; j++) r[j]=k[j];
+ r[3]&=15;
+ r[4]&=252;
+ r[7]&=15;
+ r[8]&=252;
+ r[11]&=15;
+ r[12]&=252;
+ r[15]&=15;
+
+ while (n > 0) {
+ for (j = 0; j < 17; j++) c[j] = 0;
+ for (j = 0; (j < 16) && (j < n); ++j) c[j] = m[mpos+j];
+ c[j] = 1;
+ mpos += j; n -= j;
+ add1305(h,c);
+ for (i = 0; i < 17; i++) {
+ x[i] = 0;
+ for (j = 0; j < 17; j++) x[i] = (x[i] + (h[j] * ((j <= i) ? r[i - j] : ((320 * r[i + 17 - j])|0))) | 0) | 0;
+ }
+ for (i = 0; i < 17; i++) h[i] = x[i];
+ u = 0;
+ for (j = 0; j < 16; j++) {
+ u = (u + h[j]) | 0;
+ h[j] = u & 255;
+ u >>>= 8;
+ }
+ u = (u + h[16]) | 0; h[16] = u & 3;
+ u = (5 * (u >>> 2)) | 0;
+ for (j = 0; j < 16; j++) {
+ u = (u + h[j]) | 0;
+ h[j] = u & 255;
+ u >>>= 8;
+ }
+ u = (u + h[16]) | 0; h[16] = u;
+ }
+
+ for (j = 0; j < 17; j++) g[j] = h[j];
+ add1305(h,minusp);
+ s = (-(h[16] >>> 7) | 0);
+ for (j = 0; j < 17; j++) h[j] ^= s & (g[j] ^ h[j]);
+
+ for (j = 0; j < 16; j++) c[j] = k[j + 16];
+ c[16] = 0;
+ add1305(h,c);
+ for (j = 0; j < 16; j++) out[outpos+j] = h[j];
+ return 0;
+}
+
+function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
+ var x = new Uint8Array(16);
+ crypto_onetimeauth(x,0,m,mpos,n,k);
+ return crypto_verify_16(h,hpos,x,0);
+}
+
+function crypto_secretbox(c,m,d,n,k) {
+ var i;
+ if (d < 32) return -1;
+ crypto_stream_xor(c,0,m,0,d,n,k);
+ crypto_onetimeauth(c, 16, c, 32, d - 32, c);
+ for (i = 0; i < 16; i++) c[i] = 0;
+ return 0;
+}
+
+function crypto_secretbox_open(m,c,d,n,k) {
+ var i;
+ var x = new Uint8Array(32);
+ if (d < 32) return -1;
+ crypto_stream(x,0,32,n,k);
+ if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
+ crypto_stream_xor(m,0,c,0,d,n,k);
+ for (i = 0; i < 32; i++) m[i] = 0;
+ return 0;
+}
+
+function set25519(r, a) {
+ var i;
+ for (i = 0; i < 16; i++) r[i] = a[i]|0;
+}
+
+function car25519(o) {
+ var c;
+ var i;
+ for (i = 0; i < 16; i++) {
+ o[i] += 65536;
+ c = Math.floor(o[i] / 65536);
+ o[(i+1)*(i<15?1:0)] += c - 1 + 37 * (c-1) * (i===15?1:0);
+ o[i] -= (c * 65536);
+ }
+}
+
+function sel25519(p, q, b) {
+ var t, c = ~(b-1);
+ for (var i = 0; i < 16; i++) {
+ t = c & (p[i] ^ q[i]);
+ p[i] ^= t;
+ q[i] ^= t;
+ }
+}
+
+function pack25519(o, n) {
+ var i, j, b;
+ var m = gf(), t = gf();
+ for (i = 0; i < 16; i++) t[i] = n[i];
+ car25519(t);
+ car25519(t);
+ car25519(t);
+ for (j = 0; j < 2; j++) {
+ m[0] = t[0] - 0xffed;
+ for (i = 1; i < 15; i++) {
+ m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
+ m[i-1] &= 0xffff;
+ }
+ m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
+ b = (m[15]>>16) & 1;
+ m[14] &= 0xffff;
+ sel25519(t, m, 1-b);
+ }
+ for (i = 0; i < 16; i++) {
+ o[2*i] = t[i] & 0xff;
+ o[2*i+1] = t[i]>>8;
+ }
+}
+
+function neq25519(a, b) {
+ var c = new Uint8Array(32), d = new Uint8Array(32);
+ pack25519(c, a);
+ pack25519(d, b);
+ return crypto_verify_32(c, 0, d, 0);
+}
+
+function par25519(a) {
+ var d = new Uint8Array(32);
+ pack25519(d, a);
+ return d[0] & 1;
+}
+
+function unpack25519(o, n) {
+ var i;
+ for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
+ o[15] &= 0x7fff;
+}
+
+function A(o, a, b) {
+ var i;
+ for (i = 0; i < 16; i++) o[i] = (a[i] + b[i])|0;
+}
+
+function Z(o, a, b) {
+ var i;
+ for (i = 0; i < 16; i++) o[i] = (a[i] - b[i])|0;
+}
+
+function M(o, a, b) {
+ var i, j, t = new Float64Array(31);
+ for (i = 0; i < 31; i++) t[i] = 0;
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < 16; j++) {
+ t[i+j] += a[i] * b[j];
+ }
+ }
+ for (i = 0; i < 15; i++) {
+ t[i] += 38 * t[i+16];
+ }
+ for (i = 0; i < 16; i++) o[i] = t[i];
+ car25519(o);
+ car25519(o);
+}
+
+function S(o, a) {
+ M(o, a, a);
+}
+
+function inv25519(o, i) {
+ var c = gf();
+ var a;
+ for (a = 0; a < 16; a++) c[a] = i[a];
+ for (a = 253; a >= 0; a--) {
+ S(c, c);
+ if(a !== 2 && a !== 4) M(c, c, i);
+ }
+ for (a = 0; a < 16; a++) o[a] = c[a];
+}
+
+function pow2523(o, i) {
+ var c = gf();
+ var a;
+ for (a = 0; a < 16; a++) c[a] = i[a];
+ for (a = 250; a >= 0; a--) {
+ S(c, c);
+ if(a !== 1) M(c, c, i);
+ }
+ for (a = 0; a < 16; a++) o[a] = c[a];
+}
+
+function crypto_scalarmult(q, n, p) {
+ var z = new Uint8Array(32);
+ var x = new Float64Array(80), r, i;
+ var a = gf(), b = gf(), c = gf(),
+ d = gf(), e = gf(), f = gf();
+ for (i = 0; i < 31; i++) z[i] = n[i];
+ z[31]=(n[31]&127)|64;
+ z[0]&=248;
+ unpack25519(x,p);
+ for (i = 0; i < 16; i++) {
+ b[i]=x[i];
+ d[i]=a[i]=c[i]=0;
+ }
+ a[0]=d[0]=1;
+ for (i=254; i>=0; --i) {
+ r=(z[i>>>3]>>>(i&7))&1;
+ sel25519(a,b,r);
+ sel25519(c,d,r);
+ A(e,a,c);
+ Z(a,a,c);
+ A(c,b,d);
+ Z(b,b,d);
+ S(d,e);
+ S(f,a);
+ M(a,c,a);
+ M(c,b,e);
+ A(e,a,c);
+ Z(a,a,c);
+ S(b,a);
+ Z(c,d,f);
+ M(a,c,_121665);
+ A(a,a,d);
+ M(c,c,a);
+ M(a,d,f);
+ M(d,b,x);
+ S(b,e);
+ sel25519(a,b,r);
+ sel25519(c,d,r);
+ }
+ for (i = 0; i < 16; i++) {
+ x[i+16]=a[i];
+ x[i+32]=c[i];
+ x[i+48]=b[i];
+ x[i+64]=d[i];
+ }
+ var x32 = x.subarray(32);
+ var x16 = x.subarray(16);
+ inv25519(x32,x32);
+ M(x16,x16,x32);
+ pack25519(q,x16);
+ return 0;
+}
+
+function crypto_scalarmult_base(q, n) {
+ return crypto_scalarmult(q, n, _9);
+}
+
+function crypto_box_keypair(y, x) {
+ randombytes(x, 32);
+ return crypto_scalarmult_base(y, x);
+}
+
+function crypto_box_beforenm(k, y, x) {
+ var s = new Uint8Array(32);
+ crypto_scalarmult(s, x, y);
+ return crypto_core_hsalsa20(k, _0, s, sigma);
+}
+
+var crypto_box_afternm = crypto_secretbox;
+var crypto_box_open_afternm = crypto_secretbox_open;
+
+function crypto_box(c, m, d, n, y, x) {
+ var k = new Uint8Array(32);
+ crypto_box_beforenm(k, y, x);
+ return crypto_box_afternm(c, m, d, n, k);
+}
+
+function crypto_box_open(m, c, d, n, y, x) {
+ var k = new Uint8Array(32);
+ crypto_box_beforenm(k, y, x);
+ return crypto_box_open_afternm(m, c, d, n, k);
+}
+
+function add64() {
+ var a = 0, b = 0, c = 0, d = 0, m16 = 65535, l, h, i;
+ for (i = 0; i < arguments.length; i++) {
+ l = arguments[i].lo;
+ h = arguments[i].hi;
+ a += (l & m16); b += (l >>> 16);
+ c += (h & m16); d += (h >>> 16);
+ }
+
+ b += (a >>> 16);
+ c += (b >>> 16);
+ d += (c >>> 16);
+
+ return new u64((c & m16) | (d << 16), (a & m16) | (b << 16));
+}
+
+function shr64(x, c) {
+ return new u64((x.hi >>> c), (x.lo >>> c) | (x.hi << (32 - c)));
+}
+
+function xor64() {
+ var l = 0, h = 0, i;
+ for (i = 0; i < arguments.length; i++) {
+ l ^= arguments[i].lo;
+ h ^= arguments[i].hi;
+ }
+ return new u64(h, l);
+}
+
+function R(x, c) {
+ var h, l, c1 = 32 - c;
+ if (c < 32) {
+ h = (x.hi >>> c) | (x.lo << c1);
+ l = (x.lo >>> c) | (x.hi << c1);
+ } else if (c < 64) {
+ h = (x.lo >>> c) | (x.hi << c1);
+ l = (x.hi >>> c) | (x.lo << c1);
+ }
+ return new u64(h, l);
+}
+
+function Ch(x, y, z) {
+ var h = (x.hi & y.hi) ^ (~x.hi & z.hi),
+ l = (x.lo & y.lo) ^ (~x.lo & z.lo);
+ return new u64(h, l);
+}
+
+function Maj(x, y, z) {
+ var h = (x.hi & y.hi) ^ (x.hi & z.hi) ^ (y.hi & z.hi),
+ l = (x.lo & y.lo) ^ (x.lo & z.lo) ^ (y.lo & z.lo);
+ return new u64(h, l);
+}
+
+function Sigma0(x) { return xor64(R(x,28), R(x,34), R(x,39)); }
+function Sigma1(x) { return xor64(R(x,14), R(x,18), R(x,41)); }
+function sigma0(x) { return xor64(R(x, 1), R(x, 8), shr64(x,7)); }
+function sigma1(x) { return xor64(R(x,19), R(x,61), shr64(x,6)); }
+
+var K = [
+ new u64(0x428a2f98, 0xd728ae22), new u64(0x71374491, 0x23ef65cd),
+ new u64(0xb5c0fbcf, 0xec4d3b2f), new u64(0xe9b5dba5, 0x8189dbbc),
+ new u64(0x3956c25b, 0xf348b538), new u64(0x59f111f1, 0xb605d019),
+ new u64(0x923f82a4, 0xaf194f9b), new u64(0xab1c5ed5, 0xda6d8118),
+ new u64(0xd807aa98, 0xa3030242), new u64(0x12835b01, 0x45706fbe),
+ new u64(0x243185be, 0x4ee4b28c), new u64(0x550c7dc3, 0xd5ffb4e2),
+ new u64(0x72be5d74, 0xf27b896f), new u64(0x80deb1fe, 0x3b1696b1),
+ new u64(0x9bdc06a7, 0x25c71235), new u64(0xc19bf174, 0xcf692694),
+ new u64(0xe49b69c1, 0x9ef14ad2), new u64(0xefbe4786, 0x384f25e3),
+ new u64(0x0fc19dc6, 0x8b8cd5b5), new u64(0x240ca1cc, 0x77ac9c65),
+ new u64(0x2de92c6f, 0x592b0275), new u64(0x4a7484aa, 0x6ea6e483),
+ new u64(0x5cb0a9dc, 0xbd41fbd4), new u64(0x76f988da, 0x831153b5),
+ new u64(0x983e5152, 0xee66dfab), new u64(0xa831c66d, 0x2db43210),
+ new u64(0xb00327c8, 0x98fb213f), new u64(0xbf597fc7, 0xbeef0ee4),
+ new u64(0xc6e00bf3, 0x3da88fc2), new u64(0xd5a79147, 0x930aa725),
+ new u64(0x06ca6351, 0xe003826f), new u64(0x14292967, 0x0a0e6e70),
+ new u64(0x27b70a85, 0x46d22ffc), new u64(0x2e1b2138, 0x5c26c926),
+ new u64(0x4d2c6dfc, 0x5ac42aed), new u64(0x53380d13, 0x9d95b3df),
+ new u64(0x650a7354, 0x8baf63de), new u64(0x766a0abb, 0x3c77b2a8),
+ new u64(0x81c2c92e, 0x47edaee6), new u64(0x92722c85, 0x1482353b),
+ new u64(0xa2bfe8a1, 0x4cf10364), new u64(0xa81a664b, 0xbc423001),
+ new u64(0xc24b8b70, 0xd0f89791), new u64(0xc76c51a3, 0x0654be30),
+ new u64(0xd192e819, 0xd6ef5218), new u64(0xd6990624, 0x5565a910),
+ new u64(0xf40e3585, 0x5771202a), new u64(0x106aa070, 0x32bbd1b8),
+ new u64(0x19a4c116, 0xb8d2d0c8), new u64(0x1e376c08, 0x5141ab53),
+ new u64(0x2748774c, 0xdf8eeb99), new u64(0x34b0bcb5, 0xe19b48a8),
+ new u64(0x391c0cb3, 0xc5c95a63), new u64(0x4ed8aa4a, 0xe3418acb),
+ new u64(0x5b9cca4f, 0x7763e373), new u64(0x682e6ff3, 0xd6b2b8a3),
+ new u64(0x748f82ee, 0x5defb2fc), new u64(0x78a5636f, 0x43172f60),
+ new u64(0x84c87814, 0xa1f0ab72), new u64(0x8cc70208, 0x1a6439ec),
+ new u64(0x90befffa, 0x23631e28), new u64(0xa4506ceb, 0xde82bde9),
+ new u64(0xbef9a3f7, 0xb2c67915), new u64(0xc67178f2, 0xe372532b),
+ new u64(0xca273ece, 0xea26619c), new u64(0xd186b8c7, 0x21c0c207),
+ new u64(0xeada7dd6, 0xcde0eb1e), new u64(0xf57d4f7f, 0xee6ed178),
+ new u64(0x06f067aa, 0x72176fba), new u64(0x0a637dc5, 0xa2c898a6),
+ new u64(0x113f9804, 0xbef90dae), new u64(0x1b710b35, 0x131c471b),
+ new u64(0x28db77f5, 0x23047d84), new u64(0x32caab7b, 0x40c72493),
+ new u64(0x3c9ebe0a, 0x15c9bebc), new u64(0x431d67c4, 0x9c100d4c),
+ new u64(0x4cc5d4be, 0xcb3e42b6), new u64(0x597f299c, 0xfc657e2a),
+ new u64(0x5fcb6fab, 0x3ad6faec), new u64(0x6c44198c, 0x4a475817)
+];
+
+function crypto_hashblocks(x, m, n) {
+ var z = [], b = [], a = [], w = [], t, i, j;
+
+ for (i = 0; i < 8; i++) z[i] = a[i] = dl64(x, 8*i);
+
+ var pos = 0;
+ while (n >= 128) {
+ for (i = 0; i < 16; i++) w[i] = dl64(m, 8*i+pos);
+ for (i = 0; i < 80; i++) {
+ for (j = 0; j < 8; j++) b[j] = a[j];
+ t = add64(a[7], Sigma1(a[4]), Ch(a[4], a[5], a[6]), K[i], w[i%16]);
+ b[7] = add64(t, Sigma0(a[0]), Maj(a[0], a[1], a[2]));
+ b[3] = add64(b[3], t);
+ for (j = 0; j < 8; j++) a[(j+1)%8] = b[j];
+ if (i%16 === 15) {
+ for (j = 0; j < 16; j++) {
+ w[j] = add64(w[j], w[(j+9)%16], sigma0(w[(j+1)%16]), sigma1(w[(j+14)%16]));
+ }
+ }
+ }
+
+ for (i = 0; i < 8; i++) {
+ a[i] = add64(a[i], z[i]);
+ z[i] = a[i];
+ }
+
+ pos += 128;
+ n -= 128;
+ }
+
+ for (i = 0; i < 8; i++) ts64(x, 8*i, z[i]);
+ return n;
+}
+
+var iv = new Uint8Array([
+ 0x6a,0x09,0xe6,0x67,0xf3,0xbc,0xc9,0x08,
+ 0xbb,0x67,0xae,0x85,0x84,0xca,0xa7,0x3b,
+ 0x3c,0x6e,0xf3,0x72,0xfe,0x94,0xf8,0x2b,
+ 0xa5,0x4f,0xf5,0x3a,0x5f,0x1d,0x36,0xf1,
+ 0x51,0x0e,0x52,0x7f,0xad,0xe6,0x82,0xd1,
+ 0x9b,0x05,0x68,0x8c,0x2b,0x3e,0x6c,0x1f,
+ 0x1f,0x83,0xd9,0xab,0xfb,0x41,0xbd,0x6b,
+ 0x5b,0xe0,0xcd,0x19,0x13,0x7e,0x21,0x79
+]);
+
+function crypto_hash(out, m, n) {
+ var h = new Uint8Array(64), x = new Uint8Array(256);
+ var i, b = n;
+
+ for (i = 0; i < 64; i++) h[i] = iv[i];
+
+ crypto_hashblocks(h, m, n);
+ n %= 128;
+
+ for (i = 0; i < 256; i++) x[i] = 0;
+ for (i = 0; i < n; i++) x[i] = m[b-n+i];
+ x[n] = 128;
+
+ n = 256-128*(n<112?1:0);
+ x[n-9] = 0;
+ ts64(x, n-8, new u64((b / 0x20000000) | 0, b << 3));
+ crypto_hashblocks(h, x, n);
+
+ for (i = 0; i < 64; i++) out[i] = h[i];
+
+ return 0;
+}
+
+function add(p, q) {
+ var a = gf(), b = gf(), c = gf(),
+ d = gf(), e = gf(), f = gf(),
+ g = gf(), h = gf(), t = gf();
+
+ Z(a, p[1], p[0]);
+ Z(t, q[1], q[0]);
+ M(a, a, t);
+ A(b, p[0], p[1]);
+ A(t, q[0], q[1]);
+ M(b, b, t);
+ M(c, p[3], q[3]);
+ M(c, c, D2);
+ M(d, p[2], q[2]);
+ A(d, d, d);
+ Z(e, b, a);
+ Z(f, d, c);
+ A(g, d, c);
+ A(h, b, a);
+
+ M(p[0], e, f);
+ M(p[1], h, g);
+ M(p[2], g, f);
+ M(p[3], e, h);
+}
+
+function cswap(p, q, b) {
+ var i;
+ for (i = 0; i < 4; i++) {
+ sel25519(p[i], q[i], b);
+ }
+}
+
+function pack(r, p) {
+ var tx = gf(), ty = gf(), zi = gf();
+ inv25519(zi, p[2]);
+ M(tx, p[0], zi);
+ M(ty, p[1], zi);
+ pack25519(r, ty);
+ r[31] ^= par25519(tx) << 7;
+}
+
+function scalarmult(p, q, s) {
+ var b, i;
+ set25519(p[0], gf0);
+ set25519(p[1], gf1);
+ set25519(p[2], gf1);
+ set25519(p[3], gf0);
+ for (i = 255; i >= 0; --i) {
+ b = (s[(i/8)|0] >> (i&7)) & 1;
+ cswap(p, q, b);
+ add(q, p);
+ add(p, p);
+ cswap(p, q, b);
+ }
+}
+
+function scalarbase(p, s) {
+ var q = [gf(), gf(), gf(), gf()];
+ set25519(q[0], X);
+ set25519(q[1], Y);
+ set25519(q[2], gf1);
+ M(q[3], X, Y);
+ scalarmult(p, q, s);
+}
+
+function crypto_sign_keypair(pk, sk, seeded) {
+ var d = new Uint8Array(64);
+ var p = [gf(), gf(), gf(), gf()];
+ var i;
+
+ if (!seeded) randombytes(sk, 32);
+ crypto_hash(d, sk, 32);
+ d[0] &= 248;
+ d[31] &= 127;
+ d[31] |= 64;
+
+ scalarbase(p, d);
+ pack(pk, p);
+
+ for (i = 0; i < 32; i++) sk[i+32] = pk[i];
+ return 0;
+}
+
+var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
+
+function modL(r, x) {
+ var carry, i, j, k;
+ for (i = 63; i >= 32; --i) {
+ carry = 0;
+ for (j = i - 32, k = i - 12; j < k; ++j) {
+ x[j] += carry - 16 * x[i] * L[j - (i - 32)];
+ carry = (x[j] + 128) >> 8;
+ x[j] -= carry * 256;
+ }
+ x[j] += carry;
+ x[i] = 0;
+ }
+ carry = 0;
+ for (j = 0; j < 32; j++) {
+ x[j] += carry - (x[31] >> 4) * L[j];
+ carry = x[j] >> 8;
+ x[j] &= 255;
+ }
+ for (j = 0; j < 32; j++) x[j] -= carry * L[j];
+ for (i = 0; i < 32; i++) {
+ x[i+1] += x[i] >> 8;
+ r[i] = x[i] & 255;
+ }
+}
+
+function reduce(r) {
+ var x = new Float64Array(64), i;
+ for (i = 0; i < 64; i++) x[i] = r[i];
+ for (i = 0; i < 64; i++) r[i] = 0;
+ modL(r, x);
+}
+
+// Note: difference from C - smlen returned, not passed as argument.
+function crypto_sign(sm, m, n, sk) {
+ var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
+ var i, j, x = new Float64Array(64);
+ var p = [gf(), gf(), gf(), gf()];
+
+ crypto_hash(d, sk, 32);
+ d[0] &= 248;
+ d[31] &= 127;
+ d[31] |= 64;
+
+ var smlen = n + 64;
+ for (i = 0; i < n; i++) sm[64 + i] = m[i];
+ for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
+
+ crypto_hash(r, sm.subarray(32), n+32);
+ reduce(r);
+ scalarbase(p, r);
+ pack(sm, p);
+
+ for (i = 32; i < 64; i++) sm[i] = sk[i];
+ crypto_hash(h, sm, n + 64);
+ reduce(h);
+
+ for (i = 0; i < 64; i++) x[i] = 0;
+ for (i = 0; i < 32; i++) x[i] = r[i];
+ for (i = 0; i < 32; i++) {
+ for (j = 0; j < 32; j++) {
+ x[i+j] += h[i] * d[j];
+ }
+ }
+
+ modL(sm.subarray(32), x);
+ return smlen;
+}
+
+function unpackneg(r, p) {
+ var t = gf(), chk = gf(), num = gf(),
+ den = gf(), den2 = gf(), den4 = gf(),
+ den6 = gf();
+
+ set25519(r[2], gf1);
+ unpack25519(r[1], p);
+ S(num, r[1]);
+ M(den, num, D);
+ Z(num, num, r[2]);
+ A(den, r[2], den);
+
+ S(den2, den);
+ S(den4, den2);
+ M(den6, den4, den2);
+ M(t, den6, num);
+ M(t, t, den);
+
+ pow2523(t, t);
+ M(t, t, num);
+ M(t, t, den);
+ M(t, t, den);
+ M(r[0], t, den);
+
+ S(chk, r[0]);
+ M(chk, chk, den);
+ if (neq25519(chk, num)) M(r[0], r[0], I);
+
+ S(chk, r[0]);
+ M(chk, chk, den);
+ if (neq25519(chk, num)) return -1;
+
+ if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
+
+ M(r[3], r[0], r[1]);
+ return 0;
+}
+
+function crypto_sign_open(m, sm, n, pk) {
+ var i, mlen;
+ var t = new Uint8Array(32), h = new Uint8Array(64);
+ var p = [gf(), gf(), gf(), gf()],
+ q = [gf(), gf(), gf(), gf()];
+
+ mlen = -1;
+ if (n < 64) return -1;
+
+ if (unpackneg(q, pk)) return -1;
+
+ for (i = 0; i < n; i++) m[i] = sm[i];
+ for (i = 0; i < 32; i++) m[i+32] = pk[i];
+ crypto_hash(h, m, n);
+ reduce(h);
+ scalarmult(p, q, h);
+
+ scalarbase(q, sm.subarray(32));
+ add(p, q);
+ pack(t, p);
+
+ n -= 64;
+ if (crypto_verify_32(sm, 0, t, 0)) {
+ for (i = 0; i < n; i++) m[i] = 0;
+ return -1;
+ }
+
+ for (i = 0; i < n; i++) m[i] = sm[i + 64];
+ mlen = n;
+ return mlen;
+}
+
+var crypto_secretbox_KEYBYTES = 32,
+ crypto_secretbox_NONCEBYTES = 24,
+ crypto_secretbox_ZEROBYTES = 32,
+ crypto_secretbox_BOXZEROBYTES = 16,
+ crypto_scalarmult_BYTES = 32,
+ crypto_scalarmult_SCALARBYTES = 32,
+ crypto_box_PUBLICKEYBYTES = 32,
+ crypto_box_SECRETKEYBYTES = 32,
+ crypto_box_BEFORENMBYTES = 32,
+ crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
+ crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
+ crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
+ crypto_sign_BYTES = 64,
+ crypto_sign_PUBLICKEYBYTES = 32,
+ crypto_sign_SECRETKEYBYTES = 64,
+ crypto_sign_SEEDBYTES = 32,
+ crypto_hash_BYTES = 64;
+
+nacl.lowlevel = {
+ crypto_core_hsalsa20: crypto_core_hsalsa20,
+ crypto_stream_xor: crypto_stream_xor,
+ crypto_stream: crypto_stream,
+ crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
+ crypto_stream_salsa20: crypto_stream_salsa20,
+ crypto_onetimeauth: crypto_onetimeauth,
+ crypto_onetimeauth_verify: crypto_onetimeauth_verify,
+ crypto_verify_16: crypto_verify_16,
+ crypto_verify_32: crypto_verify_32,
+ crypto_secretbox: crypto_secretbox,
+ crypto_secretbox_open: crypto_secretbox_open,
+ crypto_scalarmult: crypto_scalarmult,
+ crypto_scalarmult_base: crypto_scalarmult_base,
+ crypto_box_beforenm: crypto_box_beforenm,
+ crypto_box_afternm: crypto_box_afternm,
+ crypto_box: crypto_box,
+ crypto_box_open: crypto_box_open,
+ crypto_box_keypair: crypto_box_keypair,
+ crypto_hash: crypto_hash,
+ crypto_sign: crypto_sign,
+ crypto_sign_keypair: crypto_sign_keypair,
+ crypto_sign_open: crypto_sign_open,
+
+ crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
+ crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
+ crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
+ crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
+ crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
+ crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
+ crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
+ crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
+ crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
+ crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
+ crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
+ crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
+ crypto_sign_BYTES: crypto_sign_BYTES,
+ crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
+ crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
+ crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
+ crypto_hash_BYTES: crypto_hash_BYTES
+};
+
+/* High-level API */
+
+function checkLengths(k, n) {
+ if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
+ if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
+}
+
+function checkBoxLengths(pk, sk) {
+ if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
+ if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
+}
+
+function checkArrayTypes() {
+ var t, i;
+ for (i = 0; i < arguments.length; i++) {
+ if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]')
+ throw new TypeError('unexpected type ' + t + ', use Uint8Array');
+ }
+}
+
+function cleanup(arr) {
+ for (var i = 0; i < arr.length; i++) arr[i] = 0;
+}
+
+nacl.util = {};
+
+nacl.util.decodeUTF8 = function(s) {
+ var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
+ for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
+ return b;
+};
+
+nacl.util.encodeUTF8 = function(arr) {
+ var i, s = [];
+ for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
+ return decodeURIComponent(escape(s.join('')));
+};
+
+nacl.util.encodeBase64 = function(arr) {
+ if (typeof btoa === 'undefined') {
+ return (new Buffer(arr)).toString('base64');
+ } else {
+ var i, s = [], len = arr.length;
+ for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
+ return btoa(s.join(''));
+ }
+};
+
+nacl.util.decodeBase64 = function(s) {
+ if (typeof atob === 'undefined') {
+ return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
+ } else {
+ var i, d = atob(s), b = new Uint8Array(d.length);
+ for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
+ return b;
+ }
+};
+
+nacl.randomBytes = function(n) {
+ var b = new Uint8Array(n);
+ randombytes(b, n);
+ return b;
+};
+
+nacl.secretbox = function(msg, nonce, key) {
+ checkArrayTypes(msg, nonce, key);
+ checkLengths(key, nonce);
+ var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
+ var c = new Uint8Array(m.length);
+ for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
+ crypto_secretbox(c, m, m.length, nonce, key);
+ return c.subarray(crypto_secretbox_BOXZEROBYTES);
+};
+
+nacl.secretbox.open = function(box, nonce, key) {
+ checkArrayTypes(box, nonce, key);
+ checkLengths(key, nonce);
+ var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
+ var m = new Uint8Array(c.length);
+ for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
+ if (c.length < 32) return false;
+ if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false;
+ return m.subarray(crypto_secretbox_ZEROBYTES);
+};
+
+nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
+nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
+nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
+
+nacl.scalarMult = function(n, p) {
+ checkArrayTypes(n, p);
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
+ if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
+ crypto_scalarmult(q, n, p);
+ return q;
+};
+
+nacl.scalarMult.base = function(n) {
+ checkArrayTypes(n);
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
+ crypto_scalarmult_base(q, n);
+ return q;
+};
+
+nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
+nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
+
+nacl.box = function(msg, nonce, publicKey, secretKey) {
+ var k = nacl.box.before(publicKey, secretKey);
+ return nacl.secretbox(msg, nonce, k);
+};
+
+nacl.box.before = function(publicKey, secretKey) {
+ checkArrayTypes(publicKey, secretKey);
+ checkBoxLengths(publicKey, secretKey);
+ var k = new Uint8Array(crypto_box_BEFORENMBYTES);
+ crypto_box_beforenm(k, publicKey, secretKey);
+ return k;
+};
+
+nacl.box.after = nacl.secretbox;
+
+nacl.box.open = function(msg, nonce, publicKey, secretKey) {
+ var k = nacl.box.before(publicKey, secretKey);
+ return nacl.secretbox.open(msg, nonce, k);
+};
+
+nacl.box.open.after = nacl.secretbox.open;
+
+nacl.box.keyPair = function() {
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
+ var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
+ crypto_box_keypair(pk, sk);
+ return {publicKey: pk, secretKey: sk};
+};
+
+nacl.box.keyPair.fromSecretKey = function(secretKey) {
+ checkArrayTypes(secretKey);
+ if (secretKey.length !== crypto_box_SECRETKEYBYTES)
+ throw new Error('bad secret key size');
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
+ crypto_scalarmult_base(pk, secretKey);
+ return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
+};
+
+nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
+nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
+nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
+nacl.box.nonceLength = crypto_box_NONCEBYTES;
+nacl.box.overheadLength = nacl.secretbox.overheadLength;
+
+nacl.sign = function(msg, secretKey) {
+ checkArrayTypes(msg, secretKey);
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
+ throw new Error('bad secret key size');
+ var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
+ crypto_sign(signedMsg, msg, msg.length, secretKey);
+ return signedMsg;
+};
+
+nacl.sign.open = function(signedMsg, publicKey) {
+ if (arguments.length !== 2)
+ throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?');
+ checkArrayTypes(signedMsg, publicKey);
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
+ throw new Error('bad public key size');
+ var tmp = new Uint8Array(signedMsg.length);
+ var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
+ if (mlen < 0) return null;
+ var m = new Uint8Array(mlen);
+ for (var i = 0; i < m.length; i++) m[i] = tmp[i];
+ return m;
+};
+
+nacl.sign.detached = function(msg, secretKey) {
+ var signedMsg = nacl.sign(msg, secretKey);
+ var sig = new Uint8Array(crypto_sign_BYTES);
+ for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
+ return sig;
+};
+
+nacl.sign.detached.verify = function(msg, sig, publicKey) {
+ checkArrayTypes(msg, sig, publicKey);
+ if (sig.length !== crypto_sign_BYTES)
+ throw new Error('bad signature size');
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
+ throw new Error('bad public key size');
+ var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
+ var m = new Uint8Array(crypto_sign_BYTES + msg.length);
+ var i;
+ for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
+ for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
+ return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
+};
+
+nacl.sign.keyPair = function() {
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
+ crypto_sign_keypair(pk, sk);
+ return {publicKey: pk, secretKey: sk};
+};
+
+nacl.sign.keyPair.fromSecretKey = function(secretKey) {
+ checkArrayTypes(secretKey);
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
+ throw new Error('bad secret key size');
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
+ for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
+ return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
+};
+
+nacl.sign.keyPair.fromSeed = function(seed) {
+ checkArrayTypes(seed);
+ if (seed.length !== crypto_sign_SEEDBYTES)
+ throw new Error('bad seed size');
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
+ for (var i = 0; i < 32; i++) sk[i] = seed[i];
+ crypto_sign_keypair(pk, sk, true);
+ return {publicKey: pk, secretKey: sk};
+};
+
+nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
+nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
+nacl.sign.seedLength = crypto_sign_SEEDBYTES;
+nacl.sign.signatureLength = crypto_sign_BYTES;
+
+nacl.hash = function(msg) {
+ checkArrayTypes(msg);
+ var h = new Uint8Array(crypto_hash_BYTES);
+ crypto_hash(h, msg, msg.length);
+ return h;
+};
+
+nacl.hash.hashLength = crypto_hash_BYTES;
+
+nacl.verify = function(x, y) {
+ checkArrayTypes(x, y);
+ // Zero length arguments are considered not equal.
+ if (x.length === 0 || y.length === 0) return false;
+ if (x.length !== y.length) return false;
+ return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
+};
+
+nacl.setPRNG = function(fn) {
+ randombytes = fn;
+};
+
+(function() {
+ // Initialize PRNG if environment provides CSPRNG.
+ // If not, methods calling randombytes will throw.
+ var crypto;
+ if (typeof window !== 'undefined') {
+ // Browser.
+ if (window.crypto && window.crypto.getRandomValues) {
+ crypto = window.crypto; // Standard
+ } else if (window.msCrypto && window.msCrypto.getRandomValues) {
+ crypto = window.msCrypto; // Internet Explorer 11+
+ }
+ if (crypto) {
+ nacl.setPRNG(function(x, n) {
+ var i, v = new Uint8Array(n);
+ crypto.getRandomValues(v);
+ for (i = 0; i < n; i++) x[i] = v[i];
+ cleanup(v);
+ });
+ }
+ } else if (typeof require !== 'undefined') {
+ // Node.js.
+ crypto = require('crypto');
+ if (crypto) {
+ nacl.setPRNG(function(x, n) {
+ var i, v = crypto.randomBytes(n);
+ for (i = 0; i < n; i++) x[i] = v[i];
+ cleanup(v);
+ });
+ }
+ }
+})();
+
+})(typeof module !== 'undefined' && module.exports ? module.exports : (window.nacl = window.nacl || {}));
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js
new file mode 100644
index 000000000..95d869502
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js
@@ -0,0 +1 @@
+!function(r){"use strict";function n(r,n){return r<<n|r>>>32-n}function e(r,n){var e=255&r[n+3];return e=e<<8|255&r[n+2],e=e<<8|255&r[n+1],e<<8|255&r[n+0]}function t(r,n){var e=r[n]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3],t=r[n+4]<<24|r[n+5]<<16|r[n+6]<<8|r[n+7];return new lr(e,t)}function o(r,n,e){var t;for(t=0;4>t;t++)r[n+t]=255&e,e>>>=8}function i(r,n,e){r[n]=e.hi>>24&255,r[n+1]=e.hi>>16&255,r[n+2]=e.hi>>8&255,r[n+3]=255&e.hi,r[n+4]=e.lo>>24&255,r[n+5]=e.lo>>16&255,r[n+6]=e.lo>>8&255,r[n+7]=255&e.lo}function a(r,n,e,t,o){var i,a=0;for(i=0;o>i;i++)a|=r[n+i]^e[t+i];return(1&a-1>>>8)-1}function f(r,n,e,t){return a(r,n,e,t,16)}function u(r,n,e,t){return a(r,n,e,t,32)}function c(r,t,i,a,f){var u,c,w,y=new Uint32Array(16),s=new Uint32Array(16),l=new Uint32Array(16),h=new Uint32Array(4);for(u=0;4>u;u++)s[5*u]=e(a,4*u),s[1+u]=e(i,4*u),s[6+u]=e(t,4*u),s[11+u]=e(i,16+4*u);for(u=0;16>u;u++)l[u]=s[u];for(u=0;20>u;u++){for(c=0;4>c;c++){for(w=0;4>w;w++)h[w]=s[(5*c+4*w)%16];for(h[1]^=n(h[0]+h[3]|0,7),h[2]^=n(h[1]+h[0]|0,9),h[3]^=n(h[2]+h[1]|0,13),h[0]^=n(h[3]+h[2]|0,18),w=0;4>w;w++)y[4*c+(c+w)%4]=h[w]}for(w=0;16>w;w++)s[w]=y[w]}if(f){for(u=0;16>u;u++)s[u]=s[u]+l[u]|0;for(u=0;4>u;u++)s[5*u]=s[5*u]-e(a,4*u)|0,s[6+u]=s[6+u]-e(t,4*u)|0;for(u=0;4>u;u++)o(r,4*u,s[5*u]),o(r,16+4*u,s[6+u])}else for(u=0;16>u;u++)o(r,4*u,s[u]+l[u]|0)}function w(r,n,e,t){return c(r,n,e,t,!1),0}function y(r,n,e,t){return c(r,n,e,t,!0),0}function s(r,n,e,t,o,i,a){var f,u,c=new Uint8Array(16),y=new Uint8Array(64);if(!o)return 0;for(u=0;16>u;u++)c[u]=0;for(u=0;8>u;u++)c[u]=i[u];for(;o>=64;){for(w(y,c,a,Br),u=0;64>u;u++)r[n+u]=(e?e[t+u]:0)^y[u];for(f=1,u=8;16>u;u++)f=f+(255&c[u])|0,c[u]=255&f,f>>>=8;o-=64,n+=64,e&&(t+=64)}if(o>0)for(w(y,c,a,Br),u=0;o>u;u++)r[n+u]=(e?e[t+u]:0)^y[u];return 0}function l(r,n,e,t,o){return s(r,n,null,0,e,t,o)}function h(r,n,e,t,o){var i=new Uint8Array(32);return y(i,t,o,Br),l(r,n,e,t.subarray(16),i)}function g(r,n,e,t,o,i,a){var f=new Uint8Array(32);return y(f,i,a,Br),s(r,n,e,t,o,i.subarray(16),f)}function p(r,n){var e,t=0;for(e=0;17>e;e++)t=t+(r[e]+n[e]|0)|0,r[e]=255&t,t>>>=8}function v(r,n,e,t,o,i){var a,f,u,c,w=new Uint32Array(17),y=new Uint32Array(17),s=new Uint32Array(17),l=new Uint32Array(17),h=new Uint32Array(17);for(u=0;17>u;u++)y[u]=s[u]=0;for(u=0;16>u;u++)y[u]=i[u];for(y[3]&=15,y[4]&=252,y[7]&=15,y[8]&=252,y[11]&=15,y[12]&=252,y[15]&=15;o>0;){for(u=0;17>u;u++)l[u]=0;for(u=0;16>u&&o>u;++u)l[u]=e[t+u];for(l[u]=1,t+=u,o-=u,p(s,l),f=0;17>f;f++)for(w[f]=0,u=0;17>u;u++)w[f]=w[f]+s[u]*(f>=u?y[f-u]:320*y[f+17-u]|0)|0|0;for(f=0;17>f;f++)s[f]=w[f];for(c=0,u=0;16>u;u++)c=c+s[u]|0,s[u]=255&c,c>>>=8;for(c=c+s[16]|0,s[16]=3&c,c=5*(c>>>2)|0,u=0;16>u;u++)c=c+s[u]|0,s[u]=255&c,c>>>=8;c=c+s[16]|0,s[16]=c}for(u=0;17>u;u++)h[u]=s[u];for(p(s,Sr),a=0|-(s[16]>>>7),u=0;17>u;u++)s[u]^=a&(h[u]^s[u]);for(u=0;16>u;u++)l[u]=i[u+16];for(l[16]=0,p(s,l),u=0;16>u;u++)r[n+u]=s[u];return 0}function b(r,n,e,t,o,i){var a=new Uint8Array(16);return v(a,0,e,t,o,i),f(r,n,a,0)}function A(r,n,e,t,o){var i;if(32>e)return-1;for(g(r,0,n,0,e,t,o),v(r,16,r,32,e-32,r),i=0;16>i;i++)r[i]=0;return 0}function U(r,n,e,t,o){var i,a=new Uint8Array(32);if(32>e)return-1;if(h(a,0,32,t,o),0!==b(n,16,n,32,e-32,a))return-1;for(g(r,0,n,0,e,t,o),i=0;32>i;i++)r[i]=0;return 0}function _(r,n){var e;for(e=0;16>e;e++)r[e]=0|n[e]}function d(r){var n,e;for(e=0;16>e;e++)r[e]+=65536,n=Math.floor(r[e]/65536),r[(e+1)*(15>e?1:0)]+=n-1+37*(n-1)*(15===e?1:0),r[e]-=65536*n}function E(r,n,e){for(var t,o=~(e-1),i=0;16>i;i++)t=o&(r[i]^n[i]),r[i]^=t,n[i]^=t}function x(r,n){var e,t,o,i=hr(),a=hr();for(e=0;16>e;e++)a[e]=n[e];for(d(a),d(a),d(a),t=0;2>t;t++){for(i[0]=a[0]-65517,e=1;15>e;e++)i[e]=a[e]-65535-(i[e-1]>>16&1),i[e-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,E(a,i,1-o)}for(e=0;16>e;e++)r[2*e]=255&a[e],r[2*e+1]=a[e]>>8}function m(r,n){var e=new Uint8Array(32),t=new Uint8Array(32);return x(e,r),x(t,n),u(e,0,t,0)}function B(r){var n=new Uint8Array(32);return x(n,r),1&n[0]}function S(r,n){var e;for(e=0;16>e;e++)r[e]=n[2*e]+(n[2*e+1]<<8);r[15]&=32767}function K(r,n,e){var t;for(t=0;16>t;t++)r[t]=n[t]+e[t]|0}function T(r,n,e){var t;for(t=0;16>t;t++)r[t]=n[t]-e[t]|0}function Y(r,n,e){var t,o,i=new Float64Array(31);for(t=0;31>t;t++)i[t]=0;for(t=0;16>t;t++)for(o=0;16>o;o++)i[t+o]+=n[t]*e[o];for(t=0;15>t;t++)i[t]+=38*i[t+16];for(t=0;16>t;t++)r[t]=i[t];d(r),d(r)}function L(r,n){Y(r,n,n)}function C(r,n){var e,t=hr();for(e=0;16>e;e++)t[e]=n[e];for(e=253;e>=0;e--)L(t,t),2!==e&&4!==e&&Y(t,t,n);for(e=0;16>e;e++)r[e]=t[e]}function R(r,n){var e,t=hr();for(e=0;16>e;e++)t[e]=n[e];for(e=250;e>=0;e--)L(t,t),1!==e&&Y(t,t,n);for(e=0;16>e;e++)r[e]=t[e]}function k(r,n,e){var t,o,i=new Uint8Array(32),a=new Float64Array(80),f=hr(),u=hr(),c=hr(),w=hr(),y=hr(),s=hr();for(o=0;31>o;o++)i[o]=n[o];for(i[31]=127&n[31]|64,i[0]&=248,S(a,e),o=0;16>o;o++)u[o]=a[o],w[o]=f[o]=c[o]=0;for(f[0]=w[0]=1,o=254;o>=0;--o)t=i[o>>>3]>>>(7&o)&1,E(f,u,t),E(c,w,t),K(y,f,c),T(f,f,c),K(c,u,w),T(u,u,w),L(w,y),L(s,f),Y(f,c,f),Y(c,u,y),K(y,f,c),T(f,f,c),L(u,f),T(c,w,s),Y(f,c,Ur),K(f,f,w),Y(c,c,f),Y(f,w,s),Y(w,u,a),L(u,y),E(f,u,t),E(c,w,t);for(o=0;16>o;o++)a[o+16]=f[o],a[o+32]=c[o],a[o+48]=u[o],a[o+64]=w[o];var l=a.subarray(32),h=a.subarray(16);return C(l,l),Y(h,h,l),x(r,h),0}function z(r,n){return k(r,n,vr)}function P(r,n){return gr(n,32),z(r,n)}function O(r,n,e){var t=new Uint8Array(32);return k(t,e,n),y(r,pr,t,Br)}function F(r,n,e,t,o,i){var a=new Uint8Array(32);return O(a,o,i),Kr(r,n,e,t,a)}function N(r,n,e,t,o,i){var a=new Uint8Array(32);return O(a,o,i),Tr(r,n,e,t,a)}function M(){var r,n,e,t=0,o=0,i=0,a=0,f=65535;for(e=0;e<arguments.length;e++)r=arguments[e].lo,n=arguments[e].hi,t+=r&f,o+=r>>>16,i+=n&f,a+=n>>>16;return o+=t>>>16,i+=o>>>16,a+=i>>>16,new lr(i&f|a<<16,t&f|o<<16)}function j(r,n){return new lr(r.hi>>>n,r.lo>>>n|r.hi<<32-n)}function G(){var r,n=0,e=0;for(r=0;r<arguments.length;r++)n^=arguments[r].lo,e^=arguments[r].hi;return new lr(e,n)}function I(r,n){var e,t,o=32-n;return 32>n?(e=r.hi>>>n|r.lo<<o,t=r.lo>>>n|r.hi<<o):64>n&&(e=r.lo>>>n|r.hi<<o,t=r.hi>>>n|r.lo<<o),new lr(e,t)}function Z(r,n,e){var t=r.hi&n.hi^~r.hi&e.hi,o=r.lo&n.lo^~r.lo&e.lo;return new lr(t,o)}function V(r,n,e){var t=r.hi&n.hi^r.hi&e.hi^n.hi&e.hi,o=r.lo&n.lo^r.lo&e.lo^n.lo&e.lo;return new lr(t,o)}function q(r){return G(I(r,28),I(r,34),I(r,39))}function X(r){return G(I(r,14),I(r,18),I(r,41))}function D(r){return G(I(r,1),I(r,8),j(r,7))}function H(r){return G(I(r,19),I(r,61),j(r,6))}function J(r,n,e){var o,a,f,u=[],c=[],w=[],y=[];for(a=0;8>a;a++)u[a]=w[a]=t(r,8*a);for(var s=0;e>=128;){for(a=0;16>a;a++)y[a]=t(n,8*a+s);for(a=0;80>a;a++){for(f=0;8>f;f++)c[f]=w[f];for(o=M(w[7],X(w[4]),Z(w[4],w[5],w[6]),Yr[a],y[a%16]),c[7]=M(o,q(w[0]),V(w[0],w[1],w[2])),c[3]=M(c[3],o),f=0;8>f;f++)w[(f+1)%8]=c[f];if(a%16===15)for(f=0;16>f;f++)y[f]=M(y[f],y[(f+9)%16],D(y[(f+1)%16]),H(y[(f+14)%16]))}for(a=0;8>a;a++)w[a]=M(w[a],u[a]),u[a]=w[a];s+=128,e-=128}for(a=0;8>a;a++)i(r,8*a,u[a]);return e}function Q(r,n,e){var t,o=new Uint8Array(64),a=new Uint8Array(256),f=e;for(t=0;64>t;t++)o[t]=Lr[t];for(J(o,n,e),e%=128,t=0;256>t;t++)a[t]=0;for(t=0;e>t;t++)a[t]=n[f-e+t];for(a[e]=128,e=256-128*(112>e?1:0),a[e-9]=0,i(a,e-8,new lr(f/536870912|0,f<<3)),J(o,a,e),t=0;64>t;t++)r[t]=o[t];return 0}function W(r,n){var e=hr(),t=hr(),o=hr(),i=hr(),a=hr(),f=hr(),u=hr(),c=hr(),w=hr();T(e,r[1],r[0]),T(w,n[1],n[0]),Y(e,e,w),K(t,r[0],r[1]),K(w,n[0],n[1]),Y(t,t,w),Y(o,r[3],n[3]),Y(o,o,dr),Y(i,r[2],n[2]),K(i,i,i),T(a,t,e),T(f,i,o),K(u,i,o),K(c,t,e),Y(r[0],a,f),Y(r[1],c,u),Y(r[2],u,f),Y(r[3],a,c)}function $(r,n,e){var t;for(t=0;4>t;t++)E(r[t],n[t],e)}function rr(r,n){var e=hr(),t=hr(),o=hr();C(o,n[2]),Y(e,n[0],o),Y(t,n[1],o),x(r,t),r[31]^=B(e)<<7}function nr(r,n,e){var t,o;for(_(r[0],br),_(r[1],Ar),_(r[2],Ar),_(r[3],br),o=255;o>=0;--o)t=e[o/8|0]>>(7&o)&1,$(r,n,t),W(n,r),W(r,r),$(r,n,t)}function er(r,n){var e=[hr(),hr(),hr(),hr()];_(e[0],Er),_(e[1],xr),_(e[2],Ar),Y(e[3],Er,xr),nr(r,e,n)}function tr(r,n,e){var t,o=new Uint8Array(64),i=[hr(),hr(),hr(),hr()];for(e||gr(n,32),Q(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,er(i,o),rr(r,i),t=0;32>t;t++)n[t+32]=r[t];return 0}function or(r,n){var e,t,o,i;for(t=63;t>=32;--t){for(e=0,o=t-32,i=t-12;i>o;++o)n[o]+=e-16*n[t]*Cr[o-(t-32)],e=n[o]+128>>8,n[o]-=256*e;n[o]+=e,n[t]=0}for(e=0,o=0;32>o;o++)n[o]+=e-(n[31]>>4)*Cr[o],e=n[o]>>8,n[o]&=255;for(o=0;32>o;o++)n[o]-=e*Cr[o];for(t=0;32>t;t++)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function ir(r){var n,e=new Float64Array(64);for(n=0;64>n;n++)e[n]=r[n];for(n=0;64>n;n++)r[n]=0;or(r,e)}function ar(r,n,e,t){var o,i,a=new Uint8Array(64),f=new Uint8Array(64),u=new Uint8Array(64),c=new Float64Array(64),w=[hr(),hr(),hr(),hr()];Q(a,t,32),a[0]&=248,a[31]&=127,a[31]|=64;var y=e+64;for(o=0;e>o;o++)r[64+o]=n[o];for(o=0;32>o;o++)r[32+o]=a[32+o];for(Q(u,r.subarray(32),e+32),ir(u),er(w,u),rr(r,w),o=32;64>o;o++)r[o]=t[o];for(Q(f,r,e+64),ir(f),o=0;64>o;o++)c[o]=0;for(o=0;32>o;o++)c[o]=u[o];for(o=0;32>o;o++)for(i=0;32>i;i++)c[o+i]+=f[o]*a[i];return or(r.subarray(32),c),y}function fr(r,n){var e=hr(),t=hr(),o=hr(),i=hr(),a=hr(),f=hr(),u=hr();return _(r[2],Ar),S(r[1],n),L(o,r[1]),Y(i,o,_r),T(o,o,r[2]),K(i,r[2],i),L(a,i),L(f,a),Y(u,f,a),Y(e,u,o),Y(e,e,i),R(e,e),Y(e,e,o),Y(e,e,i),Y(e,e,i),Y(r[0],e,i),L(t,r[0]),Y(t,t,i),m(t,o)&&Y(r[0],r[0],mr),L(t,r[0]),Y(t,t,i),m(t,o)?-1:(B(r[0])===n[31]>>7&&T(r[0],br,r[0]),Y(r[3],r[0],r[1]),0)}function ur(r,n,e,t){var o,i,a=new Uint8Array(32),f=new Uint8Array(64),c=[hr(),hr(),hr(),hr()],w=[hr(),hr(),hr(),hr()];if(i=-1,64>e)return-1;if(fr(w,t))return-1;for(o=0;e>o;o++)r[o]=n[o];for(o=0;32>o;o++)r[o+32]=t[o];if(Q(f,r,e),ir(f),nr(c,w,f),er(w,n.subarray(32)),W(c,w),rr(a,c),e-=64,u(n,0,a,0)){for(o=0;e>o;o++)r[o]=0;return-1}for(o=0;e>o;o++)r[o]=n[o+64];return i=e}function cr(r,n){if(r.length!==Rr)throw new Error("bad key size");if(n.length!==kr)throw new Error("bad nonce size")}function wr(r,n){if(r.length!==Nr)throw new Error("bad public key size");if(n.length!==Mr)throw new Error("bad secret key size")}function yr(){var r,n;for(n=0;n<arguments.length;n++)if("[object Uint8Array]"!==(r=Object.prototype.toString.call(arguments[n])))throw new TypeError("unexpected type "+r+", use Uint8Array")}function sr(r){for(var n=0;n<r.length;n++)r[n]=0}var lr=function(r,n){this.hi=0|r,this.lo=0|n},hr=function(r){var n,e=new Float64Array(16);if(r)for(n=0;n<r.length;n++)e[n]=r[n];return e},gr=function(){throw new Error("no PRNG")},pr=new Uint8Array(16),vr=new Uint8Array(32);vr[0]=9;var br=hr(),Ar=hr([1]),Ur=hr([56129,1]),_r=hr([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),dr=hr([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Er=hr([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),xr=hr([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),mr=hr([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]),Br=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]),Sr=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]),Kr=A,Tr=U,Yr=[new lr(1116352408,3609767458),new lr(1899447441,602891725),new lr(3049323471,3964484399),new lr(3921009573,2173295548),new lr(961987163,4081628472),new lr(1508970993,3053834265),new lr(2453635748,2937671579),new lr(2870763221,3664609560),new lr(3624381080,2734883394),new lr(310598401,1164996542),new lr(607225278,1323610764),new lr(1426881987,3590304994),new lr(1925078388,4068182383),new lr(2162078206,991336113),new lr(2614888103,633803317),new lr(3248222580,3479774868),new lr(3835390401,2666613458),new lr(4022224774,944711139),new lr(264347078,2341262773),new lr(604807628,2007800933),new lr(770255983,1495990901),new lr(1249150122,1856431235),new lr(1555081692,3175218132),new lr(1996064986,2198950837),new lr(2554220882,3999719339),new lr(2821834349,766784016),new lr(2952996808,2566594879),new lr(3210313671,3203337956),new lr(3336571891,1034457026),new lr(3584528711,2466948901),new lr(113926993,3758326383),new lr(338241895,168717936),new lr(666307205,1188179964),new lr(773529912,1546045734),new lr(1294757372,1522805485),new lr(1396182291,2643833823),new lr(1695183700,2343527390),new lr(1986661051,1014477480),new lr(2177026350,1206759142),new lr(2456956037,344077627),new lr(2730485921,1290863460),new lr(2820302411,3158454273),new lr(3259730800,3505952657),new lr(3345764771,106217008),new lr(3516065817,3606008344),new lr(3600352804,1432725776),new lr(4094571909,1467031594),new lr(275423344,851169720),new lr(430227734,3100823752),new lr(506948616,1363258195),new lr(659060556,3750685593),new lr(883997877,3785050280),new lr(958139571,3318307427),new lr(1322822218,3812723403),new lr(1537002063,2003034995),new lr(1747873779,3602036899),new lr(1955562222,1575990012),new lr(2024104815,1125592928),new lr(2227730452,2716904306),new lr(2361852424,442776044),new lr(2428436474,593698344),new lr(2756734187,3733110249),new lr(3204031479,2999351573),new lr(3329325298,3815920427),new lr(3391569614,3928383900),new lr(3515267271,566280711),new lr(3940187606,3454069534),new lr(4118630271,4000239992),new lr(116418474,1914138554),new lr(174292421,2731055270),new lr(289380356,3203993006),new lr(460393269,320620315),new lr(685471733,587496836),new lr(852142971,1086792851),new lr(1017036298,365543100),new lr(1126000580,2618297676),new lr(1288033470,3409855158),new lr(1501505948,4234509866),new lr(1607167915,987167468),new lr(1816402316,1246189591)],Lr=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]),Cr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Rr=32,kr=24,zr=32,Pr=16,Or=32,Fr=32,Nr=32,Mr=32,jr=32,Gr=kr,Ir=zr,Zr=Pr,Vr=64,qr=32,Xr=64,Dr=32,Hr=64;r.lowlevel={crypto_core_hsalsa20:y,crypto_stream_xor:g,crypto_stream:h,crypto_stream_salsa20_xor:s,crypto_stream_salsa20:l,crypto_onetimeauth:v,crypto_onetimeauth_verify:b,crypto_verify_16:f,crypto_verify_32:u,crypto_secretbox:A,crypto_secretbox_open:U,crypto_scalarmult:k,crypto_scalarmult_base:z,crypto_box_beforenm:O,crypto_box_afternm:Kr,crypto_box:F,crypto_box_open:N,crypto_box_keypair:P,crypto_hash:Q,crypto_sign:ar,crypto_sign_keypair:tr,crypto_sign_open:ur,crypto_secretbox_KEYBYTES:Rr,crypto_secretbox_NONCEBYTES:kr,crypto_secretbox_ZEROBYTES:zr,crypto_secretbox_BOXZEROBYTES:Pr,crypto_scalarmult_BYTES:Or,crypto_scalarmult_SCALARBYTES:Fr,crypto_box_PUBLICKEYBYTES:Nr,crypto_box_SECRETKEYBYTES:Mr,crypto_box_BEFORENMBYTES:jr,crypto_box_NONCEBYTES:Gr,crypto_box_ZEROBYTES:Ir,crypto_box_BOXZEROBYTES:Zr,crypto_sign_BYTES:Vr,crypto_sign_PUBLICKEYBYTES:qr,crypto_sign_SECRETKEYBYTES:Xr,crypto_sign_SEEDBYTES:Dr,crypto_hash_BYTES:Hr},r.util={},r.util.decodeUTF8=function(r){var n,e=unescape(encodeURIComponent(r)),t=new Uint8Array(e.length);for(n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t},r.util.encodeUTF8=function(r){var n,e=[];for(n=0;n<r.length;n++)e.push(String.fromCharCode(r[n]));return decodeURIComponent(escape(e.join("")))},r.util.encodeBase64=function(r){if("undefined"==typeof btoa)return new Buffer(r).toString("base64");var n,e=[],t=r.length;for(n=0;t>n;n++)e.push(String.fromCharCode(r[n]));return btoa(e.join(""))},r.util.decodeBase64=function(r){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0));var n,e=atob(r),t=new Uint8Array(e.length);for(n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t},r.randomBytes=function(r){var n=new Uint8Array(r);return gr(n,r),n},r.secretbox=function(r,n,e){yr(r,n,e),cr(e,n);for(var t=new Uint8Array(zr+r.length),o=new Uint8Array(t.length),i=0;i<r.length;i++)t[i+zr]=r[i];return A(o,t,t.length,n,e),o.subarray(Pr)},r.secretbox.open=function(r,n,e){yr(r,n,e),cr(e,n);for(var t=new Uint8Array(Pr+r.length),o=new Uint8Array(t.length),i=0;i<r.length;i++)t[i+Pr]=r[i];return t.length<32?!1:0!==U(o,t,t.length,n,e)?!1:o.subarray(zr)},r.secretbox.keyLength=Rr,r.secretbox.nonceLength=kr,r.secretbox.overheadLength=Pr,r.scalarMult=function(r,n){if(yr(r,n),r.length!==Fr)throw new Error("bad n size");if(n.length!==Or)throw new Error("bad p size");var e=new Uint8Array(Or);return k(e,r,n),e},r.scalarMult.base=function(r){if(yr(r),r.length!==Fr)throw new Error("bad n size");var n=new Uint8Array(Or);return z(n,r),n},r.scalarMult.scalarLength=Fr,r.scalarMult.groupElementLength=Or,r.box=function(n,e,t,o){var i=r.box.before(t,o);return r.secretbox(n,e,i)},r.box.before=function(r,n){yr(r,n),wr(r,n);var e=new Uint8Array(jr);return O(e,r,n),e},r.box.after=r.secretbox,r.box.open=function(n,e,t,o){var i=r.box.before(t,o);return r.secretbox.open(n,e,i)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var r=new Uint8Array(Nr),n=new Uint8Array(Mr);return P(r,n),{publicKey:r,secretKey:n}},r.box.keyPair.fromSecretKey=function(r){if(yr(r),r.length!==Mr)throw new Error("bad secret key size");var n=new Uint8Array(Nr);return z(n,r),{publicKey:n,secretKey:new Uint8Array(r)}},r.box.publicKeyLength=Nr,r.box.secretKeyLength=Mr,r.box.sharedKeyLength=jr,r.box.nonceLength=Gr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(r,n){if(yr(r,n),n.length!==Xr)throw new Error("bad secret key size");var e=new Uint8Array(Vr+r.length);return ar(e,r,r.length,n),e},r.sign.open=function(r,n){if(2!==arguments.length)throw new Error("nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?");if(yr(r,n),n.length!==qr)throw new Error("bad public key size");var e=new Uint8Array(r.length),t=ur(e,r,r.length,n);if(0>t)return null;for(var o=new Uint8Array(t),i=0;i<o.length;i++)o[i]=e[i];return o},r.sign.detached=function(n,e){for(var t=r.sign(n,e),o=new Uint8Array(Vr),i=0;i<o.length;i++)o[i]=t[i];return o},r.sign.detached.verify=function(r,n,e){if(yr(r,n,e),n.length!==Vr)throw new Error("bad signature size");if(e.length!==qr)throw new Error("bad public key size");var t,o=new Uint8Array(Vr+r.length),i=new Uint8Array(Vr+r.length);for(t=0;Vr>t;t++)o[t]=n[t];for(t=0;t<r.length;t++)o[t+Vr]=r[t];return ur(i,o,o.length,e)>=0},r.sign.keyPair=function(){var r=new Uint8Array(qr),n=new Uint8Array(Xr);return tr(r,n),{publicKey:r,secretKey:n}},r.sign.keyPair.fromSecretKey=function(r){if(yr(r),r.length!==Xr)throw new Error("bad secret key size");for(var n=new Uint8Array(qr),e=0;e<n.length;e++)n[e]=r[32+e];return{publicKey:n,secretKey:new Uint8Array(r)}},r.sign.keyPair.fromSeed=function(r){if(yr(r),r.length!==Dr)throw new Error("bad seed size");for(var n=new Uint8Array(qr),e=new Uint8Array(Xr),t=0;32>t;t++)e[t]=r[t];return tr(n,e,!0),{publicKey:n,secretKey:e}},r.sign.publicKeyLength=qr,r.sign.secretKeyLength=Xr,r.sign.seedLength=Dr,r.sign.signatureLength=Vr,r.hash=function(r){yr(r);var n=new Uint8Array(Hr);return Q(n,r,r.length),n},r.hash.hashLength=Hr,r.verify=function(r,n){return yr(r,n),0===r.length||0===n.length?!1:r.length!==n.length?!1:0===a(r,0,n,0,r.length)?!0:!1},r.setPRNG=function(r){gr=r},function(){var n;"undefined"!=typeof window?(window.crypto&&window.crypto.getRandomValues?n=window.crypto:window.msCrypto&&window.msCrypto.getRandomValues&&(n=window.msCrypto),n&&r.setPRNG(function(r,e){var t,o=new Uint8Array(e);for(n.getRandomValues(o),t=0;e>t;t++)r[t]=o[t];sr(o)})):"undefined"!=typeof require&&(n=require("crypto"),n&&r.setPRNG(function(r,e){var t,o=n.randomBytes(e);for(t=0;e>t;t++)r[t]=o[t];sr(o)}))}()}("undefined"!=typeof module&&module.exports?module.exports:window.nacl=window.nacl||{}); \ No newline at end of file
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json
new file mode 100644
index 000000000..fb2b119df
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json
@@ -0,0 +1,120 @@
+{
+ "_args": [
+ [
+ "tweetnacl@>=0.13.0 <1.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk"
+ ]
+ ],
+ "_from": "tweetnacl@>=0.13.0 <1.0.0",
+ "_id": "tweetnacl@0.13.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk/tweetnacl",
+ "_nodeVersion": "0.12.7",
+ "_npmUser": {
+ "email": "dmitry@codingrobots.com",
+ "name": "dchest"
+ },
+ "_npmVersion": "2.12.1",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "tweetnacl",
+ "raw": "tweetnacl@>=0.13.0 <1.0.0",
+ "rawSpec": ">=0.13.0 <1.0.0",
+ "scope": null,
+ "spec": ">=0.13.0 <1.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature/sshpk"
+ ],
+ "_resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.13.2.tgz",
+ "_shasum": "453161770469d45cd266c36404e2bc99a8fa9944",
+ "_shrinkwrap": null,
+ "_spec": "tweetnacl@>=0.13.0 <1.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk",
+ "author": {
+ "name": "TweetNaCl-js contributors"
+ },
+ "browser": {
+ "buffer": false,
+ "crypto": false
+ },
+ "bugs": {
+ "url": "https://github.com/dchest/tweetnacl-js/issues"
+ },
+ "dependencies": {},
+ "description": "Port of TweetNaCl cryptographic library to JavaScript",
+ "devDependencies": {
+ "browserify": "^10.1.3",
+ "eslint": "^1.4.3",
+ "faucet": "0.0.1",
+ "tap-browser-color": "^0.1.2",
+ "tape": "^4.0.0",
+ "testling": "^1.7.1",
+ "uglify-js": "^2.4.21"
+ },
+ "directories": {
+ "test": "test"
+ },
+ "dist": {
+ "shasum": "453161770469d45cd266c36404e2bc99a8fa9944",
+ "tarball": "http://registry.npmjs.org/tweetnacl/-/tweetnacl-0.13.2.tgz"
+ },
+ "gitHead": "f093f0c34fbab5caf51f3ed9a48149c37041abb3",
+ "homepage": "https://dchest.github.io/tweetnacl-js",
+ "keywords": [
+ "crypto",
+ "cryptography",
+ "curve25519",
+ "ed25519",
+ "encrypt",
+ "hash",
+ "key",
+ "nacl",
+ "poly1305",
+ "public",
+ "salsa20",
+ "signatures"
+ ],
+ "license": "CC0-1.0",
+ "main": "nacl-fast.js",
+ "maintainers": [
+ {
+ "name": "dchest",
+ "email": "dmitry@codingrobots.com"
+ }
+ ],
+ "name": "tweetnacl",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/dchest/tweetnacl-js.git"
+ },
+ "scripts": {
+ "bench": "node test/benchmark/bench.js",
+ "browser": "browserify test/browser/init.js test/*.js | uglifyjs -c -m -o test/browser/_bundle.js 2>/dev/null",
+ "browser-quick": "browserify test/browser/init.js test/*.quick.js | uglifyjs -c -m -o test/browser/_bundle-quick.js 2>/dev/null",
+ "build": "uglifyjs nacl.js -c -m -o nacl.min.js && uglifyjs nacl-fast.js -c -m -o nacl-fast.min.js",
+ "chrome": "browserify test/browser/testling_init.js test/*.js | testling -x google-chrome | faucet",
+ "firefox": "browserify test/browser/testling_init.js test/*.js | testling -x firefox | faucet",
+ "lint": "eslint nacl.js nacl-fast.js test/*.js test/benchmark/*.js",
+ "test": "tape test/*.js | faucet",
+ "testall": "make -C test/c && tape test/*.js test/c/*.js | faucet",
+ "testling": "browserify test/browser/testling_init.js test/*.js | testling | faucet"
+ },
+ "testling": {
+ "browsers": [
+ "android-browser/latest",
+ "chrome/22..latest",
+ "firefox/16..latest",
+ "ipad/6..latest",
+ "iphone/6..latest",
+ "opera/11.0..latest",
+ "safari/latest"
+ ],
+ "files": "test/*.js"
+ },
+ "version": "0.13.2"
+}
diff --git a/node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json b/node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json
new file mode 100644
index 000000000..8639c1a6a
--- /dev/null
+++ b/node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json
@@ -0,0 +1,111 @@
+{
+ "_args": [
+ [
+ "sshpk@^1.7.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature"
+ ]
+ ],
+ "_from": "sshpk@>=1.7.0 <2.0.0",
+ "_id": "sshpk@1.7.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature/sshpk",
+ "_nodeVersion": "0.12.7",
+ "_npmUser": {
+ "email": "alex@cooperi.net",
+ "name": "arekinath"
+ },
+ "_npmVersion": "2.14.4",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "sshpk",
+ "raw": "sshpk@^1.7.0",
+ "rawSpec": "^1.7.0",
+ "scope": null,
+ "spec": ">=1.7.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/http-signature"
+ ],
+ "_resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.7.1.tgz",
+ "_shasum": "565e386c42a77e6062fbd14c0472ff21cd53398c",
+ "_shrinkwrap": null,
+ "_spec": "sshpk@^1.7.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/http-signature",
+ "author": {
+ "name": "Joyent, Inc"
+ },
+ "bin": {
+ "sshpk-conv": "bin/sshpk-conv"
+ },
+ "bugs": {
+ "url": "https://github.com/arekinath/node-sshpk/issues"
+ },
+ "contributors": [
+ {
+ "name": "Dave Eddy",
+ "email": "dave@daveeddy.com"
+ },
+ {
+ "name": "Mark Cavage",
+ "email": "mcavage@gmail.com"
+ },
+ {
+ "name": "Alex Wilson",
+ "email": "alex@cooperi.net"
+ }
+ ],
+ "dependencies": {
+ "asn1": ">=0.2.3 <0.3.0",
+ "assert-plus": ">=0.2.0 <0.3.0",
+ "dashdash": ">=1.10.1 <2.0.0",
+ "ecc-jsbn": ">=0.0.1 <1.0.0",
+ "jodid25519": ">=1.0.0 <2.0.0",
+ "jsbn": ">=0.1.0 <0.2.0",
+ "tweetnacl": ">=0.13.0 <1.0.0"
+ },
+ "description": "A library for finding and using SSH public keys",
+ "devDependencies": {
+ "benchmark": ">=1.0.0 <2.0.0",
+ "sinon": ">=1.17.2 <2.0.0",
+ "tape": ">=3.5.0 <4.0.0"
+ },
+ "directories": {
+ "bin": "./bin",
+ "lib": "./lib"
+ },
+ "dist": {
+ "shasum": "565e386c42a77e6062fbd14c0472ff21cd53398c",
+ "tarball": "http://registry.npmjs.org/sshpk/-/sshpk-1.7.1.tgz"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "gitHead": "71dd768e94d6214a0b8e1196ca78297b582c6fb0",
+ "homepage": "https://github.com/arekinath/node-sshpk#readme",
+ "license": "MIT",
+ "main": "lib/index.js",
+ "maintainers": [
+ {
+ "name": "arekinath",
+ "email": "alex@cooperi.net"
+ }
+ ],
+ "name": "sshpk",
+ "optionalDependencies": {
+ "ecc-jsbn": ">=0.0.1 <1.0.0",
+ "jodid25519": ">=1.0.0 <2.0.0",
+ "jsbn": ">=0.1.0 <0.2.0",
+ "tweetnacl": ">=0.13.0 <1.0.0"
+ },
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/arekinath/node-sshpk.git"
+ },
+ "scripts": {
+ "test": "tape test/*.js"
+ },
+ "version": "1.7.1"
+}
diff --git a/node_modules/request/node_modules/http-signature/package.json b/node_modules/request/node_modules/http-signature/package.json
index 47d76cffc..136df23b6 100644
--- a/node_modules/request/node_modules/http-signature/package.json
+++ b/node_modules/request/node_modules/http-signature/package.json
@@ -1,11 +1,44 @@
{
- "name": "http-signature",
- "description": "Reference implementation of Joyent's HTTP Signature scheme.",
- "version": "0.11.0",
- "license": "MIT",
+ "_args": [
+ [
+ "http-signature@~1.1.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "http-signature@>=1.1.0 <1.2.0",
+ "_id": "http-signature@1.1.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/http-signature",
+ "_nodeVersion": "0.12.7",
+ "_npmUser": {
+ "email": "alex@cooperi.net",
+ "name": "arekinath"
+ },
+ "_npmVersion": "2.14.4",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "http-signature",
+ "raw": "http-signature@~1.1.0",
+ "rawSpec": "~1.1.0",
+ "scope": null,
+ "spec": ">=1.1.0 <1.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request"
+ ],
+ "_resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.0.tgz",
+ "_shasum": "5d2d7e9b6ef49980ad5b128d8e4ef09a31c90d95",
+ "_shrinkwrap": null,
+ "_spec": "http-signature@~1.1.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
"author": {
"name": "Joyent, Inc"
},
+ "bugs": {
+ "url": "https://github.com/joyent/node-http-signature/issues"
+ },
"contributors": [
{
"name": "Mark Cavage",
@@ -20,46 +53,39 @@
"email": "patrick.f.mooney@gmail.com"
}
],
- "repository": {
- "type": "git",
- "url": "git://github.com/joyent/node-http-signature.git"
- },
- "homepage": "https://github.com/joyent/node-http-signature/",
- "bugs": {
- "url": "https://github.com/joyent/node-http-signature/issues"
- },
- "keywords": [
- "https",
- "request"
- ],
- "engines": {
- "node": ">=0.8"
- },
- "main": "lib/index.js",
- "scripts": {
- "test": "tap test/*.js"
- },
"dependencies": {
"assert-plus": "^0.1.5",
- "asn1": "0.1.11",
- "ctype": "0.5.3"
+ "jsprim": "^1.2.2",
+ "sshpk": "^1.7.0"
},
+ "description": "Reference implementation of Joyent's HTTP Signature scheme.",
"devDependencies": {
"node-uuid": "^1.4.1",
"tap": "0.4.2"
},
- "_id": "http-signature@0.11.0",
- "_shasum": "1796cf67a001ad5cd6849dca0991485f09089fe6",
- "_resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.11.0.tgz",
- "_from": "http-signature@>=0.11.0 <0.12.0",
- "_npmVersion": "2.5.1",
- "_nodeVersion": "0.10.36",
- "_npmUser": {
- "name": "pfmooney",
- "email": "patrick.f.mooney@gmail.com"
+ "directories": {},
+ "dist": {
+ "shasum": "5d2d7e9b6ef49980ad5b128d8e4ef09a31c90d95",
+ "tarball": "http://registry.npmjs.org/http-signature/-/http-signature-1.1.0.tgz"
},
+ "engines": {
+ "node": ">=0.8",
+ "npm": ">=1.3.7"
+ },
+ "gitHead": "162c2f0144b0645a57517d6d91fafcde3840cde2",
+ "homepage": "https://github.com/joyent/node-http-signature/",
+ "keywords": [
+ "https",
+ "request"
+ ],
+ "license": "MIT",
+ "main": "lib/index.js",
"maintainers": [
{
+ "name": "arekinath",
+ "email": "alex@cooperi.net"
+ },
+ {
"name": "mcavage",
"email": "mcavage@gmail.com"
},
@@ -68,10 +94,15 @@
"email": "patrick.f.mooney@gmail.com"
}
],
- "dist": {
- "shasum": "1796cf67a001ad5cd6849dca0991485f09089fe6",
- "tarball": "http://registry.npmjs.org/http-signature/-/http-signature-0.11.0.tgz"
+ "name": "http-signature",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/joyent/node-http-signature.git"
},
- "directories": {},
- "readme": "ERROR: No README data found!"
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "version": "1.1.0"
}
diff --git a/node_modules/request/node_modules/is-typedarray/LICENSE.md b/node_modules/request/node_modules/is-typedarray/LICENSE.md
new file mode 100644
index 000000000..ee27ba4b4
--- /dev/null
+++ b/node_modules/request/node_modules/is-typedarray/LICENSE.md
@@ -0,0 +1,18 @@
+This software is released under the MIT license:
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/request/node_modules/is-typedarray/README.md b/node_modules/request/node_modules/is-typedarray/README.md
new file mode 100644
index 000000000..275286391
--- /dev/null
+++ b/node_modules/request/node_modules/is-typedarray/README.md
@@ -0,0 +1,16 @@
+# is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges)
+
+Detect whether or not an object is a
+[Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays).
+
+## Usage
+
+[![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/)
+
+### isTypedArray(array)
+
+Returns `true` when array is a Typed Array, and `false` when it is not.
+
+## License
+
+MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details.
diff --git a/node_modules/request/node_modules/is-typedarray/index.js b/node_modules/request/node_modules/is-typedarray/index.js
new file mode 100644
index 000000000..58596036c
--- /dev/null
+++ b/node_modules/request/node_modules/is-typedarray/index.js
@@ -0,0 +1,41 @@
+module.exports = isTypedArray
+isTypedArray.strict = isStrictTypedArray
+isTypedArray.loose = isLooseTypedArray
+
+var toString = Object.prototype.toString
+var names = {
+ '[object Int8Array]': true
+ , '[object Int16Array]': true
+ , '[object Int32Array]': true
+ , '[object Uint8Array]': true
+ , '[object Uint8ClampedArray]': true
+ , '[object Uint16Array]': true
+ , '[object Uint32Array]': true
+ , '[object Float32Array]': true
+ , '[object Float64Array]': true
+}
+
+function isTypedArray(arr) {
+ return (
+ isStrictTypedArray(arr)
+ || isLooseTypedArray(arr)
+ )
+}
+
+function isStrictTypedArray(arr) {
+ return (
+ arr instanceof Int8Array
+ || arr instanceof Int16Array
+ || arr instanceof Int32Array
+ || arr instanceof Uint8Array
+ || arr instanceof Uint8ClampedArray
+ || arr instanceof Uint16Array
+ || arr instanceof Uint32Array
+ || arr instanceof Float32Array
+ || arr instanceof Float64Array
+ )
+}
+
+function isLooseTypedArray(arr) {
+ return names[toString.call(arr)]
+}
diff --git a/node_modules/request/node_modules/is-typedarray/package.json b/node_modules/request/node_modules/is-typedarray/package.json
new file mode 100644
index 000000000..863afc516
--- /dev/null
+++ b/node_modules/request/node_modules/is-typedarray/package.json
@@ -0,0 +1,82 @@
+{
+ "_args": [
+ [
+ "is-typedarray@~1.0.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "is-typedarray@>=1.0.0 <1.1.0",
+ "_id": "is-typedarray@1.0.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/is-typedarray",
+ "_nodeVersion": "0.10.36",
+ "_npmUser": {
+ "email": "hughskennedy@gmail.com",
+ "name": "hughsk"
+ },
+ "_npmVersion": "2.7.5",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "is-typedarray",
+ "raw": "is-typedarray@~1.0.0",
+ "rawSpec": "~1.0.0",
+ "scope": null,
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request"
+ ],
+ "_resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+ "_shasum": "e479c80858df0c1b11ddda6940f96011fcda4a9a",
+ "_shrinkwrap": null,
+ "_spec": "is-typedarray@~1.0.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
+ "author": {
+ "email": "hughskennedy@gmail.com",
+ "name": "Hugh Kennedy",
+ "url": "http://hughsk.io/"
+ },
+ "bugs": {
+ "url": "https://github.com/hughsk/is-typedarray/issues"
+ },
+ "dependencies": {},
+ "description": "Detect whether or not an object is a Typed Array",
+ "devDependencies": {
+ "tape": "^2.13.1"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "e479c80858df0c1b11ddda6940f96011fcda4a9a",
+ "tarball": "http://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz"
+ },
+ "gitHead": "0617cfa871686cf541af62b144f130488f44f6fe",
+ "homepage": "https://github.com/hughsk/is-typedarray",
+ "keywords": [
+ "array",
+ "detect",
+ "is",
+ "typed",
+ "util"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "hughsk",
+ "email": "hughskennedy@gmail.com"
+ }
+ ],
+ "name": "is-typedarray",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/hughsk/is-typedarray.git"
+ },
+ "scripts": {
+ "test": "node test"
+ },
+ "version": "1.0.0"
+}
diff --git a/node_modules/request/node_modules/is-typedarray/test.js b/node_modules/request/node_modules/is-typedarray/test.js
new file mode 100644
index 000000000..b0c176fa3
--- /dev/null
+++ b/node_modules/request/node_modules/is-typedarray/test.js
@@ -0,0 +1,34 @@
+var test = require('tape')
+var ista = require('./')
+
+test('strict', function(t) {
+ t.ok(ista.strict(new Int8Array), 'Int8Array')
+ t.ok(ista.strict(new Int16Array), 'Int16Array')
+ t.ok(ista.strict(new Int32Array), 'Int32Array')
+ t.ok(ista.strict(new Uint8Array), 'Uint8Array')
+ t.ok(ista.strict(new Uint16Array), 'Uint16Array')
+ t.ok(ista.strict(new Uint32Array), 'Uint32Array')
+ t.ok(ista.strict(new Float32Array), 'Float32Array')
+ t.ok(ista.strict(new Float64Array), 'Float64Array')
+
+ t.ok(!ista.strict(new Array), 'Array')
+ t.ok(!ista.strict([]), '[]')
+
+ t.end()
+})
+
+test('loose', function(t) {
+ t.ok(ista.loose(new Int8Array), 'Int8Array')
+ t.ok(ista.loose(new Int16Array), 'Int16Array')
+ t.ok(ista.loose(new Int32Array), 'Int32Array')
+ t.ok(ista.loose(new Uint8Array), 'Uint8Array')
+ t.ok(ista.loose(new Uint16Array), 'Uint16Array')
+ t.ok(ista.loose(new Uint32Array), 'Uint32Array')
+ t.ok(ista.loose(new Float32Array), 'Float32Array')
+ t.ok(ista.loose(new Float64Array), 'Float64Array')
+
+ t.ok(!ista.loose(new Array), 'Array')
+ t.ok(!ista.loose([]), '[]')
+
+ t.end()
+})
diff --git a/node_modules/request/node_modules/mime-types/HISTORY.md b/node_modules/request/node_modules/mime-types/HISTORY.md
index 3057e4940..64241d971 100644
--- a/node_modules/request/node_modules/mime-types/HISTORY.md
+++ b/node_modules/request/node_modules/mime-types/HISTORY.md
@@ -1,3 +1,9 @@
+2.1.8 / 2015-11-30
+==================
+
+ * deps: mime-db@~1.20.0
+ - Add new mime types
+
2.1.7 / 2015-09-20
==================
diff --git a/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md b/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md
index 3088a726f..c7f8b5a3e 100644
--- a/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md
+++ b/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md
@@ -1,3 +1,16 @@
+1.20.0 / 2015-11-10
+===================
+
+ * Add `application/cdni`
+ * Add `application/csvm+json`
+ * Add `application/rfc+xml`
+ * Add `application/vnd.3gpp.access-transfer-events+xml`
+ * Add `application/vnd.3gpp.srvcc-ext+xml`
+ * Add `application/vnd.ms-windows.wsd.oob`
+ * Add `application/vnd.oxli.countgraph`
+ * Add `application/vnd.pagerduty+json`
+ * Add `text/x-suse-ymp`
+
1.19.0 / 2015-09-17
===================
diff --git a/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json b/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json
index f5b1a8c51..123e7f951 100644
--- a/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json
+++ b/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json
@@ -158,6 +158,9 @@
"source": "iana",
"extensions": ["cdmiq"]
},
+ "application/cdni": {
+ "source": "iana"
+ },
"application/cea": {
"source": "iana"
},
@@ -198,6 +201,10 @@
"application/cstadata+xml": {
"source": "iana"
},
+ "application/csvm+json": {
+ "source": "iana",
+ "compressible": true
+ },
"application/cu-seeme": {
"source": "apache",
"extensions": ["cu"]
@@ -882,6 +889,9 @@
"source": "iana",
"extensions": ["rld"]
},
+ "application/rfc+xml": {
+ "source": "iana"
+ },
"application/riscos": {
"source": "iana"
},
@@ -1157,6 +1167,9 @@
"application/vnd.3gpp-prose-pc3ch+xml": {
"source": "iana"
},
+ "application/vnd.3gpp.access-transfer-events+xml": {
+ "source": "iana"
+ },
"application/vnd.3gpp.bsf+xml": {
"source": "iana"
},
@@ -1178,6 +1191,9 @@
"application/vnd.3gpp.sms": {
"source": "iana"
},
+ "application/vnd.3gpp.srvcc-ext+xml": {
+ "source": "iana"
+ },
"application/vnd.3gpp.srvcc-info+xml": {
"source": "iana"
},
@@ -2645,6 +2661,9 @@
"application/vnd.ms-windows.printerpairing": {
"source": "iana"
},
+ "application/vnd.ms-windows.wsd.oob": {
+ "source": "iana"
+ },
"application/vnd.ms-wmdrm.lic-chlg-req": {
"source": "iana"
},
@@ -3343,6 +3362,13 @@
"application/vnd.otps.ct-kip+xml": {
"source": "iana"
},
+ "application/vnd.oxli.countgraph": {
+ "source": "iana"
+ },
+ "application/vnd.pagerduty+json": {
+ "source": "iana",
+ "compressible": true
+ },
"application/vnd.palm": {
"source": "iana",
"extensions": ["pdb","pqa","oprc"]
@@ -6132,6 +6158,10 @@
"source": "apache",
"extensions": ["sfv"]
},
+ "text/x-suse-ymp": {
+ "compressible": true,
+ "extensions": ["ymp"]
+ },
"text/x-uuencode": {
"source": "apache",
"extensions": ["uu"]
diff --git a/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json b/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json
index 573cfa53e..16fa6c1ae 100644
--- a/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json
+++ b/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json
@@ -1,7 +1,40 @@
{
- "name": "mime-db",
- "description": "Media Type Database",
- "version": "1.19.0",
+ "_args": [
+ [
+ "mime-db@~1.20.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/mime-types"
+ ]
+ ],
+ "_from": "mime-db@>=1.20.0 <1.21.0",
+ "_id": "mime-db@1.20.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/mime-types/mime-db",
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "mime-db",
+ "raw": "mime-db@~1.20.0",
+ "rawSpec": "~1.20.0",
+ "scope": null,
+ "spec": ">=1.20.0 <1.21.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request/mime-types"
+ ],
+ "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.20.0.tgz",
+ "_shasum": "496f90fd01fe0e031c8823ec3aa9450ffda18ed8",
+ "_shrinkwrap": null,
+ "_spec": "mime-db@~1.20.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request/node_modules/mime-types",
+ "bugs": {
+ "url": "https://github.com/jshttp/mime-db/issues"
+ },
"contributors": [
{
"name": "Douglas Christopher Wilson",
@@ -18,30 +51,26 @@
"url": "http://github.com/broofa"
}
],
- "license": "MIT",
- "keywords": [
- "mime",
- "db",
- "type",
- "types",
- "database",
- "charset",
- "charsets"
- ],
- "repository": {
- "type": "git",
- "url": "git+https://github.com/jshttp/mime-db.git"
- },
+ "dependencies": {},
+ "description": "Media Type Database",
"devDependencies": {
"bluebird": "2.10.0",
"co": "4.6.0",
"cogent": "1.0.1",
"csv-parse": "1.0.0",
"gnode": "0.1.1",
- "istanbul": "0.3.20",
+ "istanbul": "0.4.0",
"mocha": "1.21.5",
- "raw-body": "2.1.3",
- "stream-to-array": "2"
+ "raw-body": "2.1.4",
+ "stream-to-array": "2.2.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "496f90fd01fe0e031c8823ec3aa9450ffda18ed8",
+ "tarball": "http://registry.npmjs.org/mime-db/-/mime-db-1.20.0.tgz"
+ },
+ "engines": {
+ "node": ">= 0.6"
},
"files": [
"HISTORY.md",
@@ -50,8 +79,34 @@
"db.json",
"index.js"
],
- "engines": {
- "node": ">= 0.6"
+ "gitHead": "20c99312645c05ab8466701ede01bd5cd3ac7bc4",
+ "homepage": "https://github.com/jshttp/mime-db",
+ "keywords": [
+ "charset",
+ "charsets",
+ "database",
+ "db",
+ "mime",
+ "type",
+ "types"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ },
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "name": "mime-db",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/jshttp/mime-db.git"
},
"scripts": {
"build": "node scripts/build",
@@ -61,14 +116,5 @@
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
"update": "npm run fetch && npm run build"
},
- "readme": "# mime-db\n\n[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][npm-url]\n[![Node.js Version][node-image]][node-url]\n[![Build Status][travis-image]][travis-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n\nThis is a database of all mime types.\nIt consists of a single, public JSON file and does not include any logic,\nallowing it to remain as un-opinionated as possible with an API.\nIt aggregates data from the following sources:\n\n- http://www.iana.org/assignments/media-types/media-types.xhtml\n- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types\n- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types\n\n## Installation\n\n```bash\nnpm install mime-db\n```\n\n### Database Download\n\nIf you're crazy enough to use this in the browser, you can just grab the\nJSON file using [RawGit](https://rawgit.com/). It is recommended to replace\n`master` with [a release tag](https://github.com/jshttp/mime-db/tags) as the\nJSON format may change in the future.\n\n```\nhttps://cdn.rawgit.com/jshttp/mime-db/master/db.json\n```\n\n## Usage\n\n```js\nvar db = require('mime-db');\n\n// grab data on .js files\nvar data = db['application/javascript'];\n```\n\n## Data Structure\n\nThe JSON file is a map lookup for lowercased mime types.\nEach mime type has the following properties:\n\n- `.source` - where the mime type is defined.\n If not set, it's probably a custom media type.\n - `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)\n - `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml)\n - `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types)\n- `.extensions[]` - known extensions associated with this mime type.\n- `.compressible` - whether a file of this type is can be gzipped.\n- `.charset` - the default charset associated with this type, if any.\n\nIf unknown, every property could be `undefined`.\n\n## Contributing\n\nTo edit the database, only make PRs against `src/custom.json` or\n`src/custom-suffix.json`.\n\nTo update the build, run `npm run build`.\n\n## Adding Custom Media Types\n\nThe best way to get new media types included in this library is to register\nthem with the IANA. The community registration procedure is outlined in\n[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types\nregistered with the IANA are automatically pulled into this library.\n\n[npm-version-image]: https://img.shields.io/npm/v/mime-db.svg\n[npm-downloads-image]: https://img.shields.io/npm/dm/mime-db.svg\n[npm-url]: https://npmjs.org/package/mime-db\n[travis-image]: https://img.shields.io/travis/jshttp/mime-db/master.svg\n[travis-url]: https://travis-ci.org/jshttp/mime-db\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master\n[node-image]: https://img.shields.io/node/v/mime-db.svg\n[node-url]: http://nodejs.org/download/\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/jshttp/mime-db/issues"
- },
- "homepage": "https://github.com/jshttp/mime-db#readme",
- "_id": "mime-db@1.19.0",
- "_shasum": "496a18198a7ce8244534e25bb102b74fb420fd56",
- "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.19.0.tgz",
- "_from": "mime-db@>=1.19.0 <1.20.0"
+ "version": "1.20.0"
}
diff --git a/node_modules/request/node_modules/mime-types/package.json b/node_modules/request/node_modules/mime-types/package.json
index 3292c714c..2e8262823 100644
--- a/node_modules/request/node_modules/mime-types/package.json
+++ b/node_modules/request/node_modules/mime-types/package.json
@@ -1,7 +1,41 @@
{
- "name": "mime-types",
- "description": "The ultimate javascript content-type utility.",
- "version": "2.1.7",
+ "_args": [
+ [
+ "mime-types@~2.1.7",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "mime-types@>=2.1.7 <2.2.0",
+ "_id": "mime-types@2.1.8",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/mime-types",
+ "_npmUser": {
+ "email": "doug@somethingdoug.com",
+ "name": "dougwilson"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "mime-types",
+ "raw": "mime-types@~2.1.7",
+ "rawSpec": "~2.1.7",
+ "scope": null,
+ "spec": ">=2.1.7 <2.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request",
+ "/request/form-data"
+ ],
+ "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.8.tgz",
+ "_shasum": "faf57823de04bc7cbff4ee82c6b63946e812ae72",
+ "_shrinkwrap": null,
+ "_spec": "mime-types@~2.1.7",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
+ "bugs": {
+ "url": "https://github.com/jshttp/mime-types/issues"
+ },
"contributors": [
{
"name": "Douglas Christopher Wilson",
@@ -18,43 +52,59 @@
"url": "http://jongleberry.com"
}
],
- "license": "MIT",
- "keywords": [
- "mime",
- "types"
- ],
- "repository": {
- "type": "git",
- "url": "git+https://github.com/jshttp/mime-types.git"
- },
"dependencies": {
- "mime-db": "~1.19.0"
+ "mime-db": "~1.20.0"
},
+ "description": "The ultimate javascript content-type utility.",
"devDependencies": {
- "istanbul": "0.3.20",
+ "istanbul": "0.4.1",
"mocha": "~1.21.5"
},
+ "directories": {},
+ "dist": {
+ "shasum": "faf57823de04bc7cbff4ee82c6b63946e812ae72",
+ "tarball": "http://registry.npmjs.org/mime-types/-/mime-types-2.1.8.tgz"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ },
"files": [
"HISTORY.md",
"LICENSE",
"index.js"
],
- "engines": {
- "node": ">= 0.6"
+ "gitHead": "100876a23fab896d8cf0d904fc9778dbdfc1695b",
+ "homepage": "https://github.com/jshttp/mime-types",
+ "keywords": [
+ "mime",
+ "types"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ },
+ {
+ "name": "fishrock123",
+ "email": "fishrock123@rocketmail.com"
+ },
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "name": "mime-types",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/jshttp/mime-types.git"
},
"scripts": {
"test": "mocha --reporter spec test/test.js",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"
},
- "readme": "# mime-types\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nThe ultimate javascript content-type utility.\n\nSimilar to [node-mime](https://github.com/broofa/node-mime), except:\n\n- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`,\n so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.\n- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.\n- Additional mime types are added such as jade and stylus via [mime-db](https://github.com/jshttp/mime-db)\n- No `.define()` functionality\n\nOtherwise, the API is compatible.\n\n## Install\n\n```sh\n$ npm install mime-types\n```\n\n## Adding Types\n\nAll mime types are based on [mime-db](https://github.com/jshttp/mime-db),\nso open a PR there if you'd like to add mime types.\n\n## API\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json') // 'application/json'\nmime.lookup('.md') // 'text/x-markdown'\nmime.lookup('file.html') // 'text/html'\nmime.lookup('folder/file.js') // 'application/javascript'\nmime.lookup('folder/.htaccess') // false\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\n\n```js\nmime.contentType('markdown') // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\n\n// from a full path\nmime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/x-markdown') // 'UTF-8'\n```\n\n### var type = mime.types[extension]\n\nA map of content-types by extension.\n\n### [extensions...] = mime.extensions[type]\n\nA map of extensions by content-type.\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/mime-types.svg\n[npm-url]: https://npmjs.org/package/mime-types\n[node-version-image]: https://img.shields.io/node/v/mime-types.svg\n[node-version-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/jshttp/mime-types/master.svg\n[travis-url]: https://travis-ci.org/jshttp/mime-types\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/mime-types\n[downloads-image]: https://img.shields.io/npm/dm/mime-types.svg\n[downloads-url]: https://npmjs.org/package/mime-types\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/jshttp/mime-types/issues"
- },
- "homepage": "https://github.com/jshttp/mime-types#readme",
- "_id": "mime-types@2.1.7",
- "_shasum": "ff603970e3c731ef6f7f4df3c9a0f463a13c2755",
- "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.7.tgz",
- "_from": "mime-types@>=2.1.7 <2.2.0"
+ "version": "2.1.8"
}
diff --git a/node_modules/request/node_modules/node-uuid/.npmignore b/node_modules/request/node_modules/node-uuid/.npmignore
index fd4f2b066..888613938 100644
--- a/node_modules/request/node_modules/node-uuid/.npmignore
+++ b/node_modules/request/node_modules/node-uuid/.npmignore
@@ -1,2 +1,4 @@
node_modules
.DS_Store
+.nyc_output
+coverage
diff --git a/node_modules/request/node_modules/node-uuid/README.md b/node_modules/request/node_modules/node-uuid/README.md
index b7d04c940..5cd855508 100644
--- a/node_modules/request/node_modules/node-uuid/README.md
+++ b/node_modules/request/node_modules/node-uuid/README.md
@@ -7,7 +7,9 @@ Features:
* Generate RFC4122 version 1 or version 4 UUIDs
* Runs in node.js and all browsers.
* Registered as a [ComponentJS](https://github.com/component/component) [component](https://github.com/component/component/wiki/Components) ('broofa/node-uuid').
-* Cryptographically strong random # generation on supporting platforms
+* Cryptographically strong random # generation
+ * `crypto.randomBytes(n)` in node.js
+ * `window.crypto.getRandomValues(ta)` in [supported browsers](https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues#Browser_Compatibility)
* 1.1K minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! )
* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html)
* Comes with a Command Line Interface for generating uuids on the command line
@@ -226,6 +228,15 @@ For browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-
## Release notes
+### 1.4.6
+
+* Properly detect node crypto and whatwg crypto
+* Workaround phantomjs/browserify bug
+* Explicit check for `window` rather implicit this-global
+* Issue warning if Math.random() is being used
+* "use strict";
+* A few jshint / stylistic updates (=== and such)
+
### 1.4.0
* Improved module context detection
diff --git a/node_modules/request/node_modules/node-uuid/bower.json b/node_modules/request/node_modules/node-uuid/bower.json
index 1656dc819..c0925e190 100644
--- a/node_modules/request/node_modules/node-uuid/bower.json
+++ b/node_modules/request/node_modules/node-uuid/bower.json
@@ -1,6 +1,6 @@
{
"name": "node-uuid",
- "version": "1.4.3",
+ "version": "1.4.7",
"homepage": "https://github.com/broofa/node-uuid",
"authors": [
"Robert Kieffer <robert@broofa.com>"
diff --git a/node_modules/request/node_modules/node-uuid/component.json b/node_modules/request/node_modules/node-uuid/component.json
index 149f84b22..3ff463366 100644
--- a/node_modules/request/node_modules/node-uuid/component.json
+++ b/node_modules/request/node_modules/node-uuid/component.json
@@ -2,12 +2,19 @@
"name": "node-uuid",
"repo": "broofa/node-uuid",
"description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
- "version": "1.4.3",
+ "version": "1.4.7",
"author": "Robert Kieffer <robert@broofa.com>",
"contributors": [
- {"name": "Christoph Tavan <dev@tavan.de>", "github": "https://github.com/ctavan"}
+ {
+ "name": "Christoph Tavan <dev@tavan.de>",
+ "github": "https://github.com/ctavan"
+ }
+ ],
+ "keywords": [
+ "uuid",
+ "guid",
+ "rfc4122"
],
- "keywords": ["uuid", "guid", "rfc4122"],
"dependencies": {},
"development": {},
"main": "uuid.js",
@@ -15,4 +22,4 @@
"uuid.js"
],
"license": "MIT"
-}
+} \ No newline at end of file
diff --git a/node_modules/request/node_modules/node-uuid/package.json b/node_modules/request/node_modules/node-uuid/package.json
index 076eaa154..44c585893 100644
--- a/node_modules/request/node_modules/node-uuid/package.json
+++ b/node_modules/request/node_modules/node-uuid/package.json
@@ -1,49 +1,105 @@
{
- "name": "node-uuid",
- "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
- "url": "http://github.com/broofa/node-uuid",
- "keywords": [
- "uuid",
- "guid",
- "rfc4122"
+ "_args": [
+ [
+ "node-uuid@~1.4.7",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
],
+ "_from": "node-uuid@>=1.4.7 <1.5.0",
+ "_id": "node-uuid@1.4.7",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/node-uuid",
+ "_nodeVersion": "5.0.0",
+ "_npmUser": {
+ "email": "coolaj86@gmail.com",
+ "name": "coolaj86"
+ },
+ "_npmVersion": "3.3.6",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "node-uuid",
+ "raw": "node-uuid@~1.4.7",
+ "rawSpec": "~1.4.7",
+ "scope": null,
+ "spec": ">=1.4.7 <1.5.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request"
+ ],
+ "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz",
+ "_shasum": "6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f",
+ "_shrinkwrap": null,
+ "_spec": "node-uuid@~1.4.7",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
"author": {
- "name": "Robert Kieffer",
- "email": "robert@broofa.com"
+ "email": "robert@broofa.com",
+ "name": "Robert Kieffer"
+ },
+ "bin": {
+ "uuid": "./bin/uuid"
+ },
+ "bugs": {
+ "url": "https://github.com/broofa/node-uuid/issues"
},
"contributors": [
{
+ "name": "AJ ONeal",
+ "email": "coolaj86@gmail.com"
+ },
+ {
"name": "Christoph Tavan",
"email": "dev@tavan.de"
}
],
- "bin": {
- "uuid": "./bin/uuid"
+ "dependencies": {},
+ "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
+ "devDependencies": {
+ "nyc": "^2.2.0"
},
- "scripts": {
- "test": "node test/test.js"
+ "directories": {},
+ "dist": {
+ "shasum": "6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f",
+ "tarball": "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz"
},
+ "gitHead": "309512573ec1c60143c257157479a20f7f1f51cd",
+ "homepage": "https://github.com/broofa/node-uuid",
+ "installable": true,
+ "keywords": [
+ "guid",
+ "rfc4122",
+ "uuid"
+ ],
"lib": ".",
- "main": "./uuid.js",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/broofa/node-uuid.git"
- },
- "version": "1.4.3",
"licenses": [
{
"type": "MIT",
"url": "https://raw.github.com/broofa/node-uuid/master/LICENSE.md"
}
],
- "readme": "# node-uuid\n\nSimple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.\n\nFeatures:\n\n* Generate RFC4122 version 1 or version 4 UUIDs\n* Runs in node.js and all browsers.\n* Registered as a [ComponentJS](https://github.com/component/component) [component](https://github.com/component/component/wiki/Components) ('broofa/node-uuid').\n* Cryptographically strong random # generation on supporting platforms\n* 1.1K minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! )\n* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html)\n* Comes with a Command Line Interface for generating uuids on the command line\n\n## Getting Started\n\nInstall it in your browser:\n\n```html\n<script src=\"uuid.js\"></script>\n```\n\nOr in node.js:\n\n```\nnpm install node-uuid\n```\n\n```javascript\nvar uuid = require('node-uuid');\n```\n\nThen create some ids ...\n\n```javascript\n// Generate a v1 (time-based) id\nuuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'\n\n// Generate a v4 (random) id\nuuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'\n```\n\n## API\n\n### uuid.v1([`options` [, `buffer` [, `offset`]]])\n\nGenerate and return a RFC4122 v1 (timestamp-based) UUID.\n\n* `options` - (Object) Optional uuid state to apply. Properties may include:\n\n * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.\n * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.\n * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used.\n * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.\n\n* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.\n* `offset` - (Number) Starting index in `buffer` at which to begin writing.\n\nReturns `buffer`, if specified, otherwise the string form of the UUID\n\nNotes:\n\n1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)\n\nExample: Generate string UUID with fully-specified options\n\n```javascript\nuuid.v1({\n node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],\n clockseq: 0x1234,\n msecs: new Date('2011-11-01').getTime(),\n nsecs: 5678\n}); // -> \"710b962e-041c-11e1-9234-0123456789ab\"\n```\n\nExample: In-place generation of two binary IDs\n\n```javascript\n// Generate two ids in an array\nvar arr = new Array(32); // -> []\nuuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15]\nuuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]\n\n// Optionally use uuid.unparse() to get stringify the ids\nuuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'\nuuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'\n```\n\n### uuid.v4([`options` [, `buffer` [, `offset`]]])\n\nGenerate and return a RFC4122 v4 UUID.\n\n* `options` - (Object) Optional uuid state to apply. Properties may include:\n\n * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values\n * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values.\n\n* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.\n* `offset` - (Number) Starting index in `buffer` at which to begin writing.\n\nReturns `buffer`, if specified, otherwise the string form of the UUID\n\nExample: Generate string UUID with fully-specified options\n\n```javascript\nuuid.v4({\n random: [\n 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,\n 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36\n ]\n});\n// -> \"109156be-c4fb-41ea-b1b4-efe1671c5836\"\n```\n\nExample: Generate two IDs in a single buffer\n\n```javascript\nvar buffer = new Array(32); // (or 'new Buffer' in node.js)\nuuid.v4(null, buffer, 0);\nuuid.v4(null, buffer, 16);\n```\n\n### uuid.parse(id[, buffer[, offset]])\n### uuid.unparse(buffer[, offset])\n\nParse and unparse UUIDs\n\n * `id` - (String) UUID(-like) string\n * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used\n * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0\n\nExample parsing and unparsing a UUID string\n\n```javascript\nvar bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> <Buffer 79 7f f0 43 11 eb 11 e1 80 d6 51 09 98 75 5d 10>\nvar string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10'\n```\n\n### uuid.noConflict()\n\n(Browsers only) Set `uuid` property back to it's previous value.\n\nReturns the node-uuid object.\n\nExample:\n\n```javascript\nvar myUuid = uuid.noConflict();\nmyUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'\n```\n\n## Deprecated APIs\n\nSupport for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version.\n\n### uuid([format [, buffer [, offset]]])\n\nuuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary).\n\n### uuid.BufferClass\n\nThe class of container created when generating binary uuid data if no buffer argument is specified. This is expected to go away, with no replacement API.\n\n## Command Line Interface\n\nTo use the executable, it's probably best to install this library globally.\n\n`npm install -g node-uuid`\n\nUsage:\n\n```\nUSAGE: uuid [version] [options]\n\n\noptions:\n\n--help Display this message and exit\n```\n\n`version` must be an RFC4122 version that is supported by this library, which is currently version 1 and version 4 (denoted by \"v1\" and \"v4\", respectively). `version` defaults to version 4 when not supplied.\n\n### Examples\n\n```\n> uuid\n3a91f950-dec8-4688-ba14-5b7bbfc7a563\n```\n\n```\n> uuid v1\n9d0b43e0-7696-11e3-964b-250efa37a98e\n```\n\n```\n> uuid v4\n6790ac7c-24ac-4f98-8464-42f6d98a53ae\n```\n\n## Testing\n\nIn node.js\n\n```\nnpm test\n```\n\nIn Browser\n\n```\nopen test/test.html\n```\n\n### Benchmarking\n\nRequires node.js\n\n```\nnpm install uuid uuid-js\nnode benchmark/benchmark.js\n```\n\nFor a more complete discussion of node-uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/node-uuid/wiki/Benchmark)\n\nFor browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance).\n\n## Release notes\n\n### 1.4.0\n\n* Improved module context detection\n* Removed public RNG functions\n\n### 1.3.2\n\n* Improve tests and handling of v1() options (Issue #24)\n* Expose RNG option to allow for perf testing with different generators\n\n### 1.3.0\n\n* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!\n* Support for node.js crypto API\n* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/broofa/node-uuid/issues"
+ "main": "./uuid.js",
+ "maintainers": [
+ {
+ "name": "broofa",
+ "email": "robert@broofa.com"
+ },
+ {
+ "name": "coolaj86",
+ "email": "coolaj86@gmail.com"
+ }
+ ],
+ "name": "node-uuid",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/broofa/node-uuid.git"
},
- "homepage": "https://github.com/broofa/node-uuid#readme",
- "_id": "node-uuid@1.4.3",
- "_shasum": "319bb7a56e7cb63f00b5c0cd7851cd4b4ddf1df9",
- "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.3.tgz",
- "_from": "node-uuid@>=1.4.3 <1.5.0"
+ "scripts": {
+ "coverage": "nyc npm test && nyc report",
+ "test": "node test/test.js"
+ },
+ "url": "http://github.com/broofa/node-uuid",
+ "version": "1.4.7"
}
diff --git a/node_modules/request/node_modules/node-uuid/test/test.js b/node_modules/request/node_modules/node-uuid/test/test.js
index 246922561..5f1113d85 100644
--- a/node_modules/request/node_modules/node-uuid/test/test.js
+++ b/node_modules/request/node_modules/node-uuid/test/test.js
@@ -1,6 +1,9 @@
if (!this.uuid) {
// node.js
uuid = require('../uuid');
+ if (!/_rb/.test(uuid._rng.toString())) {
+ throw new Error("should use crypto for node.js");
+ }
}
//
diff --git a/node_modules/request/node_modules/node-uuid/uuid.js b/node_modules/request/node_modules/node-uuid/uuid.js
index 0a6176979..89c5b8fb6 100644
--- a/node_modules/request/node_modules/node-uuid/uuid.js
+++ b/node_modules/request/node_modules/node-uuid/uuid.js
@@ -3,53 +3,74 @@
// Copyright (c) 2010-2012 Robert Kieffer
// MIT License - http://opensource.org/licenses/mit-license.php
-(function() {
- var _global = this;
+/*global window, require, define */
+(function(_window) {
+ 'use strict';
// Unique ID creation requires a high quality random # generator. We feature
// detect to determine the best RNG source, normalizing to a function that
// returns 128-bits of randomness, since that's what's usually required
- var _rng;
+ var _rng, _mathRNG, _nodeRNG, _whatwgRNG, _previousRoot;
+
+ function setupBrowser() {
+ // Allow for MSIE11 msCrypto
+ var _crypto = _window.crypto || _window.msCrypto;
+
+ if (!_rng && _crypto && _crypto.getRandomValues) {
+ // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
+ //
+ // Moderately fast, high quality
+ try {
+ var _rnds8 = new Uint8Array(16);
+ _whatwgRNG = _rng = function whatwgRNG() {
+ _crypto.getRandomValues(_rnds8);
+ return _rnds8;
+ };
+ _rng();
+ } catch(e) {}
+ }
- // Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
- //
- // Moderately fast, high quality
- if (typeof(_global.require) == 'function') {
- try {
- var _rb = _global.require('crypto').randomBytes;
- _rng = _rb && function() {return _rb(16);};
- } catch(e) {}
+ if (!_rng) {
+ // Math.random()-based (RNG)
+ //
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
+ // quality.
+ var _rnds = new Array(16);
+ _mathRNG = _rng = function() {
+ for (var i = 0, r; i < 16; i++) {
+ if ((i & 0x03) === 0) { r = Math.random() * 0x100000000; }
+ _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
+ }
+
+ return _rnds;
+ };
+ if ('undefined' !== typeof console && console.warn) {
+ console.warn("[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()");
+ }
+ }
}
- if (!_rng && _global.crypto && crypto.getRandomValues) {
- // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
+ function setupNode() {
+ // Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
//
// Moderately fast, high quality
- var _rnds8 = new Uint8Array(16);
- _rng = function whatwgRNG() {
- crypto.getRandomValues(_rnds8);
- return _rnds8;
- };
+ if ('function' === typeof require) {
+ try {
+ var _rb = require('crypto').randomBytes;
+ _nodeRNG = _rng = _rb && function() {return _rb(16);};
+ _rng();
+ } catch(e) {}
+ }
}
- if (!_rng) {
- // Math.random()-based (RNG)
- //
- // If all else fails, use Math.random(). It's fast, but is of unspecified
- // quality.
- var _rnds = new Array(16);
- _rng = function() {
- for (var i = 0, r; i < 16; i++) {
- if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
- _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
- }
-
- return _rnds;
- };
+ if (_window) {
+ setupBrowser();
+ } else {
+ setupNode();
}
// Buffer class to use
- var BufferClass = typeof(_global.Buffer) == 'function' ? _global.Buffer : Array;
+ var BufferClass = ('function' === typeof Buffer) ? Buffer : Array;
// Maps for number <-> hex string conversion
var _byteToHex = [];
@@ -118,17 +139,17 @@
options = options || {};
- var clockseq = options.clockseq != null ? options.clockseq : _clockseq;
+ var clockseq = (options.clockseq != null) ? options.clockseq : _clockseq;
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
- var msecs = options.msecs != null ? options.msecs : new Date().getTime();
+ var msecs = (options.msecs != null) ? options.msecs : new Date().getTime();
// Per 4.2.1.2, use count of uuid's generated during the current clock
// cycle to simulate higher resolution clock
- var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1;
+ var nsecs = (options.nsecs != null) ? options.nsecs : _lastNSecs + 1;
// Time since last uuid creation (in msecs)
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
@@ -194,8 +215,8 @@
// Deprecated - 'format' argument, as supported in v1.2
var i = buf && offset || 0;
- if (typeof(options) == 'string') {
- buf = options == 'binary' ? new BufferClass(16) : null;
+ if (typeof(options) === 'string') {
+ buf = (options === 'binary') ? new BufferClass(16) : null;
options = null;
}
options = options || {};
@@ -223,25 +244,29 @@
uuid.parse = parse;
uuid.unparse = unparse;
uuid.BufferClass = BufferClass;
+ uuid._rng = _rng;
+ uuid._mathRNG = _mathRNG;
+ uuid._nodeRNG = _nodeRNG;
+ uuid._whatwgRNG = _whatwgRNG;
- if (typeof(module) != 'undefined' && module.exports) {
+ if (('undefined' !== typeof module) && module.exports) {
// Publish as node.js module
module.exports = uuid;
- } else if (typeof define === 'function' && define.amd) {
+ } else if (typeof define === 'function' && define.amd) {
// Publish as AMD module
define(function() {return uuid;});
-
+
} else {
// Publish as global (in browsers)
- var _previousRoot = _global.uuid;
+ _previousRoot = _window.uuid;
// **`noConflict()` - (browser only) to reset global 'uuid' var**
uuid.noConflict = function() {
- _global.uuid = _previousRoot;
+ _window.uuid = _previousRoot;
return uuid;
};
- _global.uuid = uuid;
+ _window.uuid = uuid;
}
-}).call(this);
+})('undefined' !== typeof window ? window : null);
diff --git a/node_modules/request/node_modules/stringstream/LICENSE.txt b/node_modules/request/node_modules/stringstream/LICENSE.txt
index eac188156..ab861acdc 100644
--- a/node_modules/request/node_modules/stringstream/LICENSE.txt
+++ b/node_modules/request/node_modules/stringstream/LICENSE.txt
@@ -1,4 +1,22 @@
-Copyright 2012 Michael Hart (michael.hart.au@gmail.com)
+Copyright (c) 2012 Michael Hart (michael.hart.au@gmail.com)
-This project is free software released under the MIT license:
-http://www.opensource.org/licenses/mit-license.php
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/request/node_modules/stringstream/package.json b/node_modules/request/node_modules/stringstream/package.json
index 37b7bec83..9ab3d820d 100644
--- a/node_modules/request/node_modules/stringstream/package.json
+++ b/node_modules/request/node_modules/stringstream/package.json
@@ -1,32 +1,77 @@
{
- "name": "stringstream",
- "version": "0.0.4",
- "description": "Encode and decode streams into string streams",
+ "_args": [
+ [
+ "stringstream@~0.0.4",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "stringstream@>=0.0.4 <0.1.0",
+ "_id": "stringstream@0.0.5",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/stringstream",
+ "_nodeVersion": "4.2.1",
+ "_npmUser": {
+ "email": "michael.hart.au@gmail.com",
+ "name": "hichaelmart"
+ },
+ "_npmVersion": "2.14.8",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "stringstream",
+ "raw": "stringstream@~0.0.4",
+ "rawSpec": "~0.0.4",
+ "scope": null,
+ "spec": ">=0.0.4 <0.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request"
+ ],
+ "_resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
+ "_shasum": "4e484cd4de5a0bbbee18e46307710a8a81621878",
+ "_shrinkwrap": null,
+ "_spec": "stringstream@~0.0.4",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
"author": {
- "name": "Michael Hart",
"email": "michael.hart.au@gmail.com",
+ "name": "Michael Hart",
"url": "http://github.com/mhart"
},
- "main": "stringstream.js",
+ "bugs": {
+ "url": "https://github.com/mhart/StringStream/issues"
+ },
+ "dependencies": {},
+ "description": "Encode and decode streams into string streams",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "4e484cd4de5a0bbbee18e46307710a8a81621878",
+ "tarball": "http://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz"
+ },
+ "gitHead": "1efe3bf507bf3a1161f8473908b60e881d41422b",
+ "homepage": "https://github.com/mhart/StringStream#readme",
"keywords": [
- "string",
- "stream",
"base64",
- "gzip"
+ "gzip",
+ "stream",
+ "string"
+ ],
+ "license": "MIT",
+ "main": "stringstream.js",
+ "maintainers": [
+ {
+ "name": "hichaelmart",
+ "email": "michael.hart.au@gmail.com"
+ }
],
+ "name": "stringstream",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/mhart/StringStream.git"
},
- "license": "MIT",
- "readme": "# Decode streams into strings The Right Way(tm)\n\n```javascript\nvar fs = require('fs')\nvar zlib = require('zlib')\nvar strs = require('stringstream')\n\nvar utf8Stream = fs.createReadStream('massiveLogFile.gz')\n .pipe(zlib.createGunzip())\n .pipe(strs('utf8'))\n```\n\nNo need to deal with `setEncoding()` weirdness, just compose streams\nlike they were supposed to be!\n\nHandles input and output encoding:\n\n```javascript\n// Stream from utf8 to hex to base64... Why not, ay.\nvar hex64Stream = fs.createReadStream('myFile')\n .pipe(strs('utf8', 'hex'))\n .pipe(strs('hex', 'base64'))\n```\n\nAlso deals with `base64` output correctly by aligning each emitted data\nchunk so that there are no dangling `=` characters:\n\n```javascript\nvar stream = fs.createReadStream('myFile').pipe(strs('base64'))\n\nvar base64Str = ''\n\nstream.on('data', function(data) { base64Str += data })\nstream.on('end', function() {\n console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding()\n console.log('Original file is: ' + new Buffer(base64Str, 'base64'))\n})\n```\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/mhart/StringStream/issues"
- },
- "homepage": "https://github.com/mhart/StringStream#readme",
- "_id": "stringstream@0.0.4",
- "_shasum": "0f0e3423f942960b5692ac324a57dd093bc41a92",
- "_resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz",
- "_from": "stringstream@>=0.0.4 <0.1.0"
+ "scripts": {},
+ "version": "0.0.5"
}
diff --git a/node_modules/request/node_modules/tough-cookie/lib/cookie.js b/node_modules/request/node_modules/tough-cookie/lib/cookie.js
index f1cb5e287..0afe4a2a9 100644
--- a/node_modules/request/node_modules/tough-cookie/lib/cookie.js
+++ b/node_modules/request/node_modules/tough-cookie/lib/cookie.js
@@ -1265,7 +1265,6 @@ CookieJar.deserialize = function(strOrObj, store, cb) {
});
};
-CookieJar.fromJSON = CookieJar.deserializeSync;
CookieJar.deserializeSync = function(strOrObj, store) {
var serialized = typeof strOrObj === 'string' ?
JSON.parse(strOrObj) : strOrObj;
@@ -1279,6 +1278,7 @@ CookieJar.deserializeSync = function(strOrObj, store) {
jar._importCookiesSync(serialized);
return jar;
};
+CookieJar.fromJSON = CookieJar.deserializeSync;
CAN_BE_SYNC.push('clone');
CookieJar.prototype.clone = function(newStore, cb) {
diff --git a/node_modules/request/node_modules/tough-cookie/package.json b/node_modules/request/node_modules/tough-cookie/package.json
index 4a6920dd5..24c18e2ec 100644
--- a/node_modules/request/node_modules/tough-cookie/package.json
+++ b/node_modules/request/node_modules/tough-cookie/package.json
@@ -1,7 +1,44 @@
{
+ "_args": [
+ [
+ "tough-cookie@~2.2.0",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "tough-cookie@>=2.2.0 <2.3.0",
+ "_id": "tough-cookie@2.2.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/tough-cookie",
+ "_nodeVersion": "0.12.5",
+ "_npmUser": {
+ "email": "jstash@gmail.com",
+ "name": "jstash"
+ },
+ "_npmVersion": "2.11.2",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "tough-cookie",
+ "raw": "tough-cookie@~2.2.0",
+ "rawSpec": "~2.2.0",
+ "scope": null,
+ "spec": ">=2.2.0 <2.3.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request"
+ ],
+ "_resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.1.tgz",
+ "_shasum": "3b0516b799e70e8164436a1446e7e5877fda118e",
+ "_shrinkwrap": null,
+ "_spec": "tough-cookie@~2.2.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
"author": {
- "name": "Jeremy Stashewsky",
- "email": "jstashewsky@salesforce.com"
+ "email": "jstashewsky@salesforce.com",
+ "name": "Jeremy Stashewsky"
+ },
+ "bugs": {
+ "url": "https://github.com/SalesforceEng/tough-cookie/issues"
},
"contributors": [
{
@@ -23,57 +60,37 @@
"name": "Sebastian Mayr"
}
],
- "license": "BSD-3-Clause",
- "name": "tough-cookie",
+ "dependencies": {},
"description": "RFC6265 Cookies and Cookie Jar for node.js",
+ "devDependencies": {
+ "async": "^1.4.2",
+ "vows": "^0.8.1"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "3b0516b799e70e8164436a1446e7e5877fda118e",
+ "tarball": "http://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.1.tgz"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "files": [
+ "lib"
+ ],
+ "gitHead": "f1055655ea56c85bd384aaf7d5b740b916700b6f",
+ "homepage": "https://github.com/SalesforceEng/tough-cookie",
"keywords": [
"HTTP",
+ "RFC2965",
+ "RFC6265",
"cookie",
- "cookies",
- "set-cookie",
"cookiejar",
+ "cookies",
"jar",
- "RFC6265",
- "RFC2965"
+ "set-cookie"
],
- "version": "2.2.0",
- "homepage": "https://github.com/SalesforceEng/tough-cookie",
- "repository": {
- "type": "git",
- "url": "git://github.com/SalesforceEng/tough-cookie.git"
- },
- "bugs": {
- "url": "https://github.com/SalesforceEng/tough-cookie/issues"
- },
+ "license": "BSD-3-Clause",
"main": "./lib/cookie",
- "files": [
- "lib"
- ],
- "scripts": {
- "suffixup": "curl -o public_suffix_list.dat https://publicsuffix.org/list/public_suffix_list.dat && ./generate-pubsuffix.js",
- "test": "vows test/*_test.js"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "devDependencies": {
- "async": "^1.4.2",
- "vows": "^0.8.1"
- },
- "gitHead": "fb1456177c9b51445afa34656eb314c70c2adcd2",
- "_id": "tough-cookie@2.2.0",
- "_shasum": "d4ce661075e5fddb7f20341d3f9931a6fbbadde0",
- "_from": "tough-cookie@>=2.2.0 <2.3.0",
- "_npmVersion": "2.11.2",
- "_nodeVersion": "0.12.5",
- "_npmUser": {
- "name": "jstash",
- "email": "jstash@gmail.com"
- },
- "dist": {
- "shasum": "d4ce661075e5fddb7f20341d3f9931a6fbbadde0",
- "tarball": "http://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.0.tgz"
- },
"maintainers": [
{
"name": "jstash",
@@ -84,7 +101,16 @@
"email": "services@goinstant.com"
}
],
- "directories": {},
- "_resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.0.tgz",
- "readme": "ERROR: No README data found!"
+ "name": "tough-cookie",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/SalesforceEng/tough-cookie.git"
+ },
+ "scripts": {
+ "suffixup": "curl -o public_suffix_list.dat https://publicsuffix.org/list/public_suffix_list.dat && ./generate-pubsuffix.js",
+ "test": "vows test/*_test.js"
+ },
+ "version": "2.2.1"
}
diff --git a/node_modules/request/node_modules/tunnel-agent/index.js b/node_modules/request/node_modules/tunnel-agent/index.js
index da516ec43..68013ac1f 100644
--- a/node_modules/request/node_modules/tunnel-agent/index.js
+++ b/node_modules/request/node_modules/tunnel-agent/index.js
@@ -25,6 +25,7 @@ function httpsOverHttp(options) {
var agent = new TunnelingAgent(options)
agent.request = http.request
agent.createSocket = createSecureSocket
+ agent.defaultPort = 443
return agent
}
@@ -38,6 +39,7 @@ function httpsOverHttps(options) {
var agent = new TunnelingAgent(options)
agent.request = https.request
agent.createSocket = createSecureSocket
+ agent.defaultPort = 443
return agent
}
diff --git a/node_modules/request/node_modules/tunnel-agent/package.json b/node_modules/request/node_modules/tunnel-agent/package.json
index 265089b64..0b2f3110a 100644
--- a/node_modules/request/node_modules/tunnel-agent/package.json
+++ b/node_modules/request/node_modules/tunnel-agent/package.json
@@ -1,30 +1,85 @@
{
+ "_args": [
+ [
+ "tunnel-agent@~0.4.1",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/request"
+ ]
+ ],
+ "_from": "tunnel-agent@>=0.4.1 <0.5.0",
+ "_id": "tunnel-agent@0.4.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request/tunnel-agent",
+ "_nodeVersion": "5.0.0",
+ "_npmUser": {
+ "email": "simeonvelichkov@gmail.com",
+ "name": "simov"
+ },
+ "_npmVersion": "3.3.12",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "tunnel-agent",
+ "raw": "tunnel-agent@~0.4.1",
+ "rawSpec": "~0.4.1",
+ "scope": null,
+ "spec": ">=0.4.1 <0.5.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/request"
+ ],
+ "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.2.tgz",
+ "_shasum": "1104e3f36ac87125c287270067d582d18133bfee",
+ "_shrinkwrap": null,
+ "_spec": "tunnel-agent@~0.4.1",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/request",
"author": {
- "name": "Mikeal Rogers",
"email": "mikeal.rogers@gmail.com",
+ "name": "Mikeal Rogers",
"url": "http://www.futurealoof.com"
},
- "name": "tunnel-agent",
- "description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.",
- "version": "0.4.1",
- "repository": {
- "url": "git+https://github.com/mikeal/tunnel-agent.git"
+ "bugs": {
+ "url": "https://github.com/mikeal/tunnel-agent/issues"
},
- "main": "index.js",
"dependencies": {},
+ "description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.",
"devDependencies": {},
- "optionalDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "1104e3f36ac87125c287270067d582d18133bfee",
+ "tarball": "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.2.tgz"
+ },
"engines": {
"node": "*"
},
- "readme": "tunnel-agent\n============\n\nHTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/mikeal/tunnel-agent/issues"
- },
+ "gitHead": "449634d1054949f9f145f4925985a8dea0f46b0f",
"homepage": "https://github.com/mikeal/tunnel-agent#readme",
- "_id": "tunnel-agent@0.4.1",
- "_shasum": "bbeecff4d679ce753db9462761a88dfcec3c5ab3",
- "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.1.tgz",
- "_from": "tunnel-agent@>=0.4.1 <0.5.0"
+ "license": "Apache-2.0",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ {
+ "name": "nylen",
+ "email": "jnylen@gmail.com"
+ },
+ {
+ "name": "fredkschott",
+ "email": "fkschott@gmail.com"
+ },
+ {
+ "name": "simov",
+ "email": "simeonvelichkov@gmail.com"
+ }
+ ],
+ "name": "tunnel-agent",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "url": "git+https://github.com/mikeal/tunnel-agent.git"
+ },
+ "scripts": {},
+ "version": "0.4.2"
}
diff --git a/node_modules/request/package.json b/node_modules/request/package.json
index 69c6f1ba1..025c965d4 100644
--- a/node_modules/request/package.json
+++ b/node_modules/request/package.json
@@ -1,89 +1,109 @@
{
- "name": "request",
- "description": "Simplified HTTP request client.",
- "tags": [
- "http",
- "simple",
- "util",
- "utility"
+ "_args": [
+ [
+ "request@~2.67.0",
+ "/Users/ogd/Documents/projects/npm/npm"
+ ]
],
- "version": "2.65.0",
- "author": {
- "name": "Mikeal Rogers",
- "email": "mikeal.rogers@gmail.com"
+ "_from": "request@>=2.67.0 <2.68.0",
+ "_id": "request@2.67.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/request",
+ "_nodeVersion": "5.0.0",
+ "_npmUser": {
+ "email": "simeonvelichkov@gmail.com",
+ "name": "simov"
},
- "repository": {
- "type": "git",
- "url": "git+https://github.com/request/request.git"
+ "_npmVersion": "3.3.12",
+ "_phantomChildren": {
+ "ansi-regex": "2.0.0",
+ "readable-stream": "2.0.4",
+ "strip-ansi": "3.0.0"
+ },
+ "_requested": {
+ "name": "request",
+ "raw": "request@~2.67.0",
+ "rawSpec": "~2.67.0",
+ "scope": null,
+ "spec": ">=2.67.0 <2.68.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/",
+ "/node-gyp",
+ "/npm-registry-client",
+ "/npm-registry-couchapp/couchapp",
+ "/npm-registry-couchapp/couchapp/nano"
+ ],
+ "_resolved": "https://registry.npmjs.org/request/-/request-2.67.0.tgz",
+ "_shasum": "8af74780e2bf11ea0ae9aa965c11f11afd272742",
+ "_shrinkwrap": null,
+ "_spec": "request@~2.67.0",
+ "_where": "/Users/ogd/Documents/projects/npm/npm",
+ "author": {
+ "email": "mikeal.rogers@gmail.com",
+ "name": "Mikeal Rogers"
},
"bugs": {
"url": "http://github.com/request/request/issues"
},
- "license": "Apache-2.0",
- "engines": {
- "node": ">=0.8.0"
- },
- "main": "index.js",
"dependencies": {
+ "aws-sign2": "~0.6.0",
"bl": "~1.0.0",
"caseless": "~0.11.0",
+ "combined-stream": "~1.0.5",
"extend": "~3.0.0",
"forever-agent": "~0.6.1",
"form-data": "~1.0.0-rc3",
+ "har-validator": "~2.0.2",
+ "hawk": "~3.1.0",
+ "http-signature": "~1.1.0",
+ "is-typedarray": "~1.0.0",
+ "isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.7",
- "node-uuid": "~1.4.3",
- "qs": "~5.2.0",
- "tunnel-agent": "~0.4.1",
- "tough-cookie": "~2.2.0",
- "http-signature": "~0.11.0",
+ "node-uuid": "~1.4.7",
"oauth-sign": "~0.8.0",
- "hawk": "~3.1.0",
- "aws-sign2": "~0.6.0",
+ "qs": "~5.2.0",
"stringstream": "~0.0.4",
- "combined-stream": "~1.0.5",
- "isstream": "~0.1.2",
- "har-validator": "~2.0.2"
- },
- "scripts": {
- "test": "npm run lint && npm run test-ci && npm run test-browser",
- "test-ci": "taper tests/test-*.js",
- "test-cov": "istanbul cover tape tests/test-*.js",
- "test-browser": "node tests/browser/start.js",
- "lint": "eslint lib/ *.js tests/ && echo Lint passed."
+ "tough-cookie": "~2.2.0",
+ "tunnel-agent": "~0.4.1"
},
+ "description": "Simplified HTTP request client.",
"devDependencies": {
+ "bluebird": "^3.0.2",
+ "browserify": "^12.0.1",
"browserify-istanbul": "^0.1.5",
- "browserify": "^11.2.0",
"buffer-equal": "^0.0.1",
"codecov.io": "^0.1.6",
"coveralls": "^2.11.4",
- "eslint": "0.18.0",
+ "eslint": "1.9.0",
"function-bind": "^1.0.2",
- "istanbul": "^0.3.21",
- "karma-browserify": "^4.4.0",
+ "istanbul": "^0.4.0",
"karma": "^0.13.10",
+ "karma-browserify": "^4.4.0",
"karma-cli": "^0.1.1",
- "karma-coverage": "^0.2.6",
+ "karma-coverage": "^0.5.3",
"karma-phantomjs-launcher": "^0.1.4",
"karma-tap": "^1.0.3",
"rimraf": "^2.2.8",
"server-destroy": "^1.0.1",
"tape": "^4.2.0",
- "taper": "^0.4.0",
- "bluebird": "^2.10.1"
+ "taper": "^0.4.0"
},
- "gitHead": "8a7a37835c600f5006a6679aa23a0db504003ecd",
- "homepage": "https://github.com/request/request#readme",
- "_id": "request@2.65.0",
- "_shasum": "cc1a3bc72b96254734fc34296da322f9486ddeba",
- "_from": "request@2.65.0",
- "_npmVersion": "2.14.3",
- "_nodeVersion": "4.1.0",
- "_npmUser": {
- "name": "simov",
- "email": "simeonvelichkov@gmail.com"
+ "directories": {},
+ "dist": {
+ "shasum": "8af74780e2bf11ea0ae9aa965c11f11afd272742",
+ "tarball": "http://registry.npmjs.org/request/-/request-2.67.0.tgz"
+ },
+ "engines": {
+ "node": ">=0.8.0"
},
+ "gitHead": "76f0655befbe8b37fa246bdca1107cbf57798d9a",
+ "homepage": "https://github.com/request/request#readme",
+ "license": "Apache-2.0",
+ "main": "index.js",
"maintainers": [
{
"name": "mikeal",
@@ -102,11 +122,25 @@
"email": "simeonvelichkov@gmail.com"
}
],
- "dist": {
- "shasum": "cc1a3bc72b96254734fc34296da322f9486ddeba",
- "tarball": "http://registry.npmjs.org/request/-/request-2.65.0.tgz"
+ "name": "request",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/request/request.git"
},
- "directories": {},
- "_resolved": "https://registry.npmjs.org/request/-/request-2.65.0.tgz",
- "readme": "ERROR: No README data found!"
+ "scripts": {
+ "lint": "eslint lib/ *.js tests/ && echo Lint passed.",
+ "test": "npm run lint && npm run test-ci && npm run test-browser",
+ "test-browser": "node tests/browser/start.js",
+ "test-ci": "taper tests/test-*.js",
+ "test-cov": "istanbul cover tape tests/test-*.js"
+ },
+ "tags": [
+ "http",
+ "simple",
+ "util",
+ "utility"
+ ],
+ "version": "2.67.0"
}
diff --git a/node_modules/request/request.js b/node_modules/request/request.js
index 824f9386e..19c1b92f3 100644
--- a/node_modules/request/request.js
+++ b/node_modules/request/request.js
@@ -15,6 +15,7 @@ var http = require('http')
, caseless = require('caseless')
, ForeverAgent = require('forever-agent')
, FormData = require('form-data')
+ , isTypedArray = require('is-typedarray').strict
, helpers = require('./lib/helpers')
, cookies = require('./lib/cookies')
, getProxyFromURI = require('./lib/getProxyFromURI')
@@ -122,7 +123,6 @@ function Request (options) {
var reserved = Object.keys(Request.prototype)
var nonReserved = filterForNonReserved(reserved, options)
- stream.Stream.call(self)
util._extend(self, nonReserved)
options = filterOutReservedFunctions(reserved, options)
@@ -249,6 +249,11 @@ Request.prototype.init = function (options) {
self.uri = url.parse(self.uri)
}
+ // Some URL objects are not from a URL parsed string and need href added
+ if (!self.uri.href) {
+ self.uri.href = url.format(self.uri)
+ }
+
// DEPRECATED: Warning for users of the old Unix Sockets URL Scheme
if (self.uri.protocol === 'unix:') {
return self.emit('error', new Error('`unix://` URL scheme is no longer supported. Please use the format `http://unix:SOCKET:PATH`'))
@@ -277,6 +282,7 @@ Request.prototype.init = function (options) {
message += '. This can be caused by a crappy redirection.'
}
// This error was fatal
+ self.abort()
return self.emit('error', new Error(message))
}
@@ -284,7 +290,7 @@ Request.prototype.init = function (options) {
self.proxy = getProxyFromURI(self.uri)
}
- self.tunnel = self._tunnel.isEnabled(options)
+ self.tunnel = self._tunnel.isEnabled()
if (self.proxy) {
self._tunnel.setup(options)
}
@@ -422,6 +428,10 @@ Request.prototype.init = function (options) {
}
function setContentLength () {
+ if (isTypedArray(self.body)) {
+ self.body = new Buffer(self.body)
+ }
+
if (!self.hasHeader('content-length')) {
var length
if (typeof self.body === 'string') {
@@ -583,63 +593,6 @@ Request.prototype.init = function (options) {
}
-// Must call this when following a redirect from https to http or vice versa
-// Attempts to keep everything as identical as possible, but update the
-// httpModule, Tunneling agent, and/or Forever Agent in use.
-Request.prototype._updateProtocol = function () {
- var self = this
- var protocol = self.uri.protocol
-
- if (protocol === 'https:' || self.tunnel) {
- // previously was doing http, now doing https
- // if it's https, then we might need to tunnel now.
- if (self.proxy) {
- if (self._tunnel.setup()) {
- return
- }
- }
-
- self.httpModule = https
- switch (self.agentClass) {
- case ForeverAgent:
- self.agentClass = ForeverAgent.SSL
- break
- case http.Agent:
- self.agentClass = https.Agent
- break
- default:
- // nothing we can do. Just hope for the best.
- return
- }
-
- // if there's an agent, we need to get a new one.
- if (self.agent) {
- self.agent = self.getNewAgent()
- }
-
- } else {
- // previously was doing https, now doing http
- self.httpModule = http
- switch (self.agentClass) {
- case ForeverAgent.SSL:
- self.agentClass = ForeverAgent
- break
- case https.Agent:
- self.agentClass = http.Agent
- break
- default:
- // nothing we can do. just hope for the best
- return
- }
-
- // if there's an agent, then get a new one.
- if (self.agent) {
- self.agent = null
- self.agent = self.getNewAgent()
- }
- }
-}
-
Request.prototype.getNewAgent = function () {
var self = this
var Agent = self.agentClass
@@ -1386,6 +1339,8 @@ Request.prototype.pipe = function (dest, opts) {
}
Request.prototype.write = function () {
var self = this
+ if (self._aborted) {return}
+
if (!self._started) {
self.start()
}
@@ -1393,6 +1348,8 @@ Request.prototype.write = function () {
}
Request.prototype.end = function (chunk) {
var self = this
+ if (self._aborted) {return}
+
if (chunk) {
self.write(chunk)
}