freezerwatch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/freezerwatch +9 -0
- data/bin/setup +7 -0
- data/freezerwatch.gemspec +23 -0
- data/lib/freezerwatch.rb +5 -0
- data/lib/freezerwatch/version.rb +3 -0
- data/node_modules/.bin/freezerwatch +139 -0
- data/node_modules/freezerwatch/.npmignore +3 -0
- data/node_modules/freezerwatch/.ruby-version +1 -0
- data/node_modules/freezerwatch/Gemfile +4 -0
- data/node_modules/freezerwatch/Gemfile.lock +79 -0
- data/node_modules/freezerwatch/LICENSE +23 -0
- data/node_modules/freezerwatch/README.md +41 -0
- data/node_modules/freezerwatch/Rakefile +13 -0
- data/node_modules/freezerwatch/freezerwatch.js +139 -0
- data/node_modules/freezerwatch/metrics/bigfiles_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/cane_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/flay_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/flog_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/punchlist_high_water_mark +2 -0
- data/node_modules/freezerwatch/metrics/reek_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/rubocop_high_water_mark +1 -0
- data/node_modules/freezerwatch/node_modules/async/.jshintrc +25 -0
- data/node_modules/freezerwatch/node_modules/async/.travis.yml +6 -0
- data/node_modules/freezerwatch/node_modules/async/CHANGELOG.md +65 -0
- data/node_modules/freezerwatch/node_modules/async/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/async/README.md +1803 -0
- data/node_modules/freezerwatch/node_modules/async/bower.json +43 -0
- data/node_modules/freezerwatch/node_modules/async/component.json +17 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/base.css +182 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/base.css +182 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/async.js.html +3900 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.css +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.js +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sorter.js +156 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov.info +1452 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lib/async.js.html +3597 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lib/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/prettify.css +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/prettify.js +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/sort-arrow-sprite.png +0 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/sorter.js +156 -0
- data/node_modules/freezerwatch/node_modules/async/lib/async.js +1191 -0
- data/node_modules/freezerwatch/node_modules/async/nyc_output/5074.json +1 -0
- data/node_modules/freezerwatch/node_modules/async/package.json +96 -0
- data/node_modules/freezerwatch/node_modules/async/support/sync-package-managers.js +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/.npmignore +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/Client.js +60 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/Device.js +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceRawReadStream.js +36 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceSingleRawReadStream.js +29 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceStream.js +35 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/LICENSE +23 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/README.md +25 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.travis.yml +12 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/README.md +364 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/index.js +156 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/copy.js +8 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/debug.js +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/getSafe.js +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/optional.js +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/.bin/uuid +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/index.js +202 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/package.json +46 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/index.js +119 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/Readme.md +175 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/lib/form_data.js +351 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/README.md +1647 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/bower.json +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/component.json +16 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js +1123 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/package.json +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/support/sync-package-managers.js +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md +132 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +188 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +154 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +99 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js +21 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js +14 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js +48 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +60 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/package.json +80 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/Makefile +10 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/README.md +627 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/example/usage.js +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/hawk.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/logo.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/browser.js +485 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/client.js +367 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/crypto.js +111 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/index.js +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/server.js +524 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/utils.js +183 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/README.md +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js +207 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/package.json +64 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js +101 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE +33 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile +10 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/README.md +436 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js +132 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js +585 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js +86 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js +1078 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/README.md +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js +16 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js +25 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js +409 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js +359 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/browser.js +771 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/client.js +206 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/crypto.js +86 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/index.js +316 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/message.js +246 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/readme.js +98 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/server.js +686 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/uri.js +456 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/utils.js +120 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.dir-locals.el +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.npmignore +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/LICENSE +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/README.md +79 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/http_signing.md +296 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/index.js +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/parser.js +304 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/signer.js +178 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/util.js +304 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/verify.js +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md +50 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js +27 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js +267 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js +36 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js +317 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js +20 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js +172 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js +296 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md +126 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README +82 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old +298 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js +1485 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js +944 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype +241 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf +129 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle +839 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/package.json +72 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/.npmignore +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md +14 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/LICENSE +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/Makefile +35 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/README.md +52 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/package.json +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/stringify.js +27 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js +246 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/README.md +66 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/mime.js +114 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/package.json +57 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/test.js +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/mime.types +1588 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/node.types +77 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/LICENSE.md +21 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/README.md +243 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/README.md +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu +174 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.sh +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bin/uuid +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bower.json +23 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/component.json +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/compare_v1.js +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.html +17 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.js +228 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/uuid.js +247 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/index.js +43 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/package.json +48 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/test.js +49 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.gitmodules +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.npmignore +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/Readme.md +58 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/index.js +366 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/package.json +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.jshintrc +72 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.npmignore +3 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/LICENSE +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/README.md +380 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/generate-pubsuffix.js +230 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/cookie.js +947 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/memstore.js +102 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js +69 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/LICENSE-MIT.txt +20 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/README.md +176 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/package.json +81 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/punycode.js +530 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/package.json +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/public-suffix.txt +5229 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/test.js +1340 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/index.js +227 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/package.json +74 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/request.js +1244 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/package.json +34 -0
- data/node_modules/freezerwatch/node_modules/optparse/README.md +163 -0
- data/node_modules/freezerwatch/node_modules/optparse/TODO +1 -0
- data/node_modules/freezerwatch/node_modules/optparse/examples/browser-test.html +75 -0
- data/node_modules/freezerwatch/node_modules/optparse/examples/nodejs-test.js +86 -0
- data/node_modules/freezerwatch/node_modules/optparse/lib/optparse.js +309 -0
- data/node_modules/freezerwatch/node_modules/optparse/package.json +46 -0
- data/node_modules/freezerwatch/node_modules/optparse/seed.yml +5 -0
- data/node_modules/freezerwatch/node_modules/osenv/.npmignore +13 -0
- data/node_modules/freezerwatch/node_modules/osenv/.travis.yml +9 -0
- data/node_modules/freezerwatch/node_modules/osenv/LICENSE +15 -0
- data/node_modules/freezerwatch/node_modules/osenv/README.md +63 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/index.js +24 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/license +21 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/readme.md +33 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/index.js +25 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/license +21 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/readme.md +36 -0
- data/node_modules/freezerwatch/node_modules/osenv/osenv.js +72 -0
- data/node_modules/freezerwatch/node_modules/osenv/package.json +76 -0
- data/node_modules/freezerwatch/node_modules/osenv/test/unix.js +71 -0
- data/node_modules/freezerwatch/node_modules/osenv/test/windows.js +74 -0
- data/node_modules/freezerwatch/node_modules/osenv/x.tap +39 -0
- data/node_modules/freezerwatch/package.json +37 -0
- metadata +384 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
// Copyright 2011 Joyent, Inc. All rights reserved.
|
2
|
+
|
3
|
+
var parser = require('./parser');
|
4
|
+
var signer = require('./signer');
|
5
|
+
var verify = require('./verify');
|
6
|
+
var util = require('./util');
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
///--- API
|
11
|
+
|
12
|
+
module.exports = {
|
13
|
+
|
14
|
+
parse: parser.parseRequest,
|
15
|
+
parseRequest: parser.parseRequest,
|
16
|
+
|
17
|
+
sign: signer.signRequest,
|
18
|
+
signRequest: signer.signRequest,
|
19
|
+
|
20
|
+
sshKeyToPEM: util.sshKeyToPEM,
|
21
|
+
sshKeyFingerprint: util.fingerprint,
|
22
|
+
pemToRsaSSHKey: util.pemToRsaSSHKey,
|
23
|
+
|
24
|
+
verify: verify.verifySignature,
|
25
|
+
verifySignature: verify.verifySignature
|
26
|
+
};
|
@@ -0,0 +1,304 @@
|
|
1
|
+
// Copyright 2012 Joyent, Inc. All rights reserved.
|
2
|
+
|
3
|
+
var assert = require('assert-plus');
|
4
|
+
var util = require('util');
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
///--- Globals
|
9
|
+
|
10
|
+
var Algorithms = {
|
11
|
+
'rsa-sha1': true,
|
12
|
+
'rsa-sha256': true,
|
13
|
+
'rsa-sha512': true,
|
14
|
+
'dsa-sha1': true,
|
15
|
+
'hmac-sha1': true,
|
16
|
+
'hmac-sha256': true,
|
17
|
+
'hmac-sha512': true
|
18
|
+
};
|
19
|
+
|
20
|
+
var State = {
|
21
|
+
New: 0,
|
22
|
+
Params: 1
|
23
|
+
};
|
24
|
+
|
25
|
+
var ParamsState = {
|
26
|
+
Name: 0,
|
27
|
+
Quote: 1,
|
28
|
+
Value: 2,
|
29
|
+
Comma: 3
|
30
|
+
};
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
///--- Specific Errors
|
35
|
+
|
36
|
+
function HttpSignatureError(message, caller) {
|
37
|
+
if (Error.captureStackTrace)
|
38
|
+
Error.captureStackTrace(this, caller || HttpSignatureError);
|
39
|
+
|
40
|
+
this.message = message;
|
41
|
+
this.name = caller.name;
|
42
|
+
}
|
43
|
+
util.inherits(HttpSignatureError, Error);
|
44
|
+
|
45
|
+
function ExpiredRequestError(message) {
|
46
|
+
HttpSignatureError.call(this, message, ExpiredRequestError);
|
47
|
+
}
|
48
|
+
util.inherits(ExpiredRequestError, HttpSignatureError);
|
49
|
+
|
50
|
+
|
51
|
+
function InvalidHeaderError(message) {
|
52
|
+
HttpSignatureError.call(this, message, InvalidHeaderError);
|
53
|
+
}
|
54
|
+
util.inherits(InvalidHeaderError, HttpSignatureError);
|
55
|
+
|
56
|
+
|
57
|
+
function InvalidParamsError(message) {
|
58
|
+
HttpSignatureError.call(this, message, InvalidParamsError);
|
59
|
+
}
|
60
|
+
util.inherits(InvalidParamsError, HttpSignatureError);
|
61
|
+
|
62
|
+
|
63
|
+
function MissingHeaderError(message) {
|
64
|
+
HttpSignatureError.call(this, message, MissingHeaderError);
|
65
|
+
}
|
66
|
+
util.inherits(MissingHeaderError, HttpSignatureError);
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
///--- Exported API
|
71
|
+
|
72
|
+
module.exports = {
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Parses the 'Authorization' header out of an http.ServerRequest object.
|
76
|
+
*
|
77
|
+
* Note that this API will fully validate the Authorization header, and throw
|
78
|
+
* on any error. It will not however check the signature, or the keyId format
|
79
|
+
* as those are specific to your environment. You can use the options object
|
80
|
+
* to pass in extra constraints.
|
81
|
+
*
|
82
|
+
* As a response object you can expect this:
|
83
|
+
*
|
84
|
+
* {
|
85
|
+
* "scheme": "Signature",
|
86
|
+
* "params": {
|
87
|
+
* "keyId": "foo",
|
88
|
+
* "algorithm": "rsa-sha256",
|
89
|
+
* "headers": [
|
90
|
+
* "date" or "x-date",
|
91
|
+
* "content-md5"
|
92
|
+
* ],
|
93
|
+
* "signature": "base64"
|
94
|
+
* },
|
95
|
+
* "signingString": "ready to be passed to crypto.verify()"
|
96
|
+
* }
|
97
|
+
*
|
98
|
+
* @param {Object} request an http.ServerRequest.
|
99
|
+
* @param {Object} options an optional options object with:
|
100
|
+
* - clockSkew: allowed clock skew in seconds (default 300).
|
101
|
+
* - headers: required header names (def: date or x-date)
|
102
|
+
* - algorithms: algorithms to support (default: all).
|
103
|
+
* @return {Object} parsed out object (see above).
|
104
|
+
* @throws {TypeError} on invalid input.
|
105
|
+
* @throws {InvalidHeaderError} on an invalid Authorization header error.
|
106
|
+
* @throws {InvalidParamsError} if the params in the scheme are invalid.
|
107
|
+
* @throws {MissingHeaderError} if the params indicate a header not present,
|
108
|
+
* either in the request headers from the params,
|
109
|
+
* or not in the params from a required header
|
110
|
+
* in options.
|
111
|
+
* @throws {ExpiredRequestError} if the value of date or x-date exceeds skew.
|
112
|
+
*/
|
113
|
+
parseRequest: function parseRequest(request, options) {
|
114
|
+
assert.object(request, 'request');
|
115
|
+
assert.object(request.headers, 'request.headers');
|
116
|
+
if (options === undefined) {
|
117
|
+
options = {};
|
118
|
+
}
|
119
|
+
if (options.headers === undefined) {
|
120
|
+
options.headers = [request.headers['x-date'] ? 'x-date' : 'date'];
|
121
|
+
}
|
122
|
+
assert.object(options, 'options');
|
123
|
+
assert.arrayOfString(options.headers, 'options.headers');
|
124
|
+
assert.optionalNumber(options.clockSkew, 'options.clockSkew');
|
125
|
+
|
126
|
+
if (!request.headers.authorization)
|
127
|
+
throw new MissingHeaderError('no authorization header present in ' +
|
128
|
+
'the request');
|
129
|
+
|
130
|
+
options.clockSkew = options.clockSkew || 300;
|
131
|
+
|
132
|
+
|
133
|
+
var i = 0;
|
134
|
+
var state = State.New;
|
135
|
+
var substate = ParamsState.Name;
|
136
|
+
var tmpName = '';
|
137
|
+
var tmpValue = '';
|
138
|
+
|
139
|
+
var parsed = {
|
140
|
+
scheme: '',
|
141
|
+
params: {},
|
142
|
+
signingString: '',
|
143
|
+
|
144
|
+
get algorithm() {
|
145
|
+
return this.params.algorithm.toUpperCase();
|
146
|
+
},
|
147
|
+
|
148
|
+
get keyId() {
|
149
|
+
return this.params.keyId;
|
150
|
+
}
|
151
|
+
|
152
|
+
};
|
153
|
+
|
154
|
+
var authz = request.headers.authorization;
|
155
|
+
for (i = 0; i < authz.length; i++) {
|
156
|
+
var c = authz.charAt(i);
|
157
|
+
|
158
|
+
switch (Number(state)) {
|
159
|
+
|
160
|
+
case State.New:
|
161
|
+
if (c !== ' ') parsed.scheme += c;
|
162
|
+
else state = State.Params;
|
163
|
+
break;
|
164
|
+
|
165
|
+
case State.Params:
|
166
|
+
switch (Number(substate)) {
|
167
|
+
|
168
|
+
case ParamsState.Name:
|
169
|
+
var code = c.charCodeAt(0);
|
170
|
+
// restricted name of A-Z / a-z
|
171
|
+
if ((code >= 0x41 && code <= 0x5a) || // A-Z
|
172
|
+
(code >= 0x61 && code <= 0x7a)) { // a-z
|
173
|
+
tmpName += c;
|
174
|
+
} else if (c === '=') {
|
175
|
+
if (tmpName.length === 0)
|
176
|
+
throw new InvalidHeaderError('bad param format');
|
177
|
+
substate = ParamsState.Quote;
|
178
|
+
} else {
|
179
|
+
throw new InvalidHeaderError('bad param format');
|
180
|
+
}
|
181
|
+
break;
|
182
|
+
|
183
|
+
case ParamsState.Quote:
|
184
|
+
if (c === '"') {
|
185
|
+
tmpValue = '';
|
186
|
+
substate = ParamsState.Value;
|
187
|
+
} else {
|
188
|
+
throw new InvalidHeaderError('bad param format');
|
189
|
+
}
|
190
|
+
break;
|
191
|
+
|
192
|
+
case ParamsState.Value:
|
193
|
+
if (c === '"') {
|
194
|
+
parsed.params[tmpName] = tmpValue;
|
195
|
+
substate = ParamsState.Comma;
|
196
|
+
} else {
|
197
|
+
tmpValue += c;
|
198
|
+
}
|
199
|
+
break;
|
200
|
+
|
201
|
+
case ParamsState.Comma:
|
202
|
+
if (c === ',') {
|
203
|
+
tmpName = '';
|
204
|
+
substate = ParamsState.Name;
|
205
|
+
} else {
|
206
|
+
throw new InvalidHeaderError('bad param format');
|
207
|
+
}
|
208
|
+
break;
|
209
|
+
|
210
|
+
default:
|
211
|
+
throw new Error('Invalid substate');
|
212
|
+
}
|
213
|
+
break;
|
214
|
+
|
215
|
+
default:
|
216
|
+
throw new Error('Invalid substate');
|
217
|
+
}
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
if (!parsed.params.headers || parsed.params.headers === '') {
|
222
|
+
if (request.headers['x-date']) {
|
223
|
+
parsed.params.headers = ['x-date'];
|
224
|
+
} else {
|
225
|
+
parsed.params.headers = ['date'];
|
226
|
+
}
|
227
|
+
} else {
|
228
|
+
parsed.params.headers = parsed.params.headers.split(' ');
|
229
|
+
}
|
230
|
+
|
231
|
+
// Minimally validate the parsed object
|
232
|
+
if (!parsed.scheme || parsed.scheme !== 'Signature')
|
233
|
+
throw new InvalidHeaderError('scheme was not "Signature"');
|
234
|
+
|
235
|
+
if (!parsed.params.keyId)
|
236
|
+
throw new InvalidHeaderError('keyId was not specified');
|
237
|
+
|
238
|
+
if (!parsed.params.algorithm)
|
239
|
+
throw new InvalidHeaderError('algorithm was not specified');
|
240
|
+
|
241
|
+
if (!parsed.params.signature)
|
242
|
+
throw new InvalidHeaderError('signature was not specified');
|
243
|
+
|
244
|
+
// Check the algorithm against the official list
|
245
|
+
parsed.params.algorithm = parsed.params.algorithm.toLowerCase();
|
246
|
+
if (!Algorithms[parsed.params.algorithm])
|
247
|
+
throw new InvalidParamsError(parsed.params.algorithm +
|
248
|
+
' is not supported');
|
249
|
+
|
250
|
+
// Build the signingString
|
251
|
+
for (i = 0; i < parsed.params.headers.length; i++) {
|
252
|
+
var h = parsed.params.headers[i].toLowerCase();
|
253
|
+
parsed.params.headers[i] = h;
|
254
|
+
|
255
|
+
if (h !== 'request-line') {
|
256
|
+
var value = request.headers[h];
|
257
|
+
if (!value)
|
258
|
+
throw new MissingHeaderError(h + ' was not in the request');
|
259
|
+
parsed.signingString += h + ': ' + value;
|
260
|
+
} else {
|
261
|
+
parsed.signingString +=
|
262
|
+
request.method + ' ' + request.url + ' HTTP/' + request.httpVersion;
|
263
|
+
}
|
264
|
+
|
265
|
+
if ((i + 1) < parsed.params.headers.length)
|
266
|
+
parsed.signingString += '\n';
|
267
|
+
}
|
268
|
+
|
269
|
+
// Check against the constraints
|
270
|
+
var date;
|
271
|
+
if (request.headers.date || request.headers['x-date']) {
|
272
|
+
if (request.headers['x-date']) {
|
273
|
+
date = new Date(request.headers['x-date']);
|
274
|
+
} else {
|
275
|
+
date = new Date(request.headers.date);
|
276
|
+
}
|
277
|
+
var now = new Date();
|
278
|
+
var skew = Math.abs(now.getTime() - date.getTime());
|
279
|
+
|
280
|
+
if (skew > options.clockSkew * 1000) {
|
281
|
+
throw new ExpiredRequestError('clock skew of ' +
|
282
|
+
(skew / 1000) +
|
283
|
+
's was greater than ' +
|
284
|
+
options.clockSkew + 's');
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
options.headers.forEach(function (hdr) {
|
289
|
+
// Remember that we already checked any headers in the params
|
290
|
+
// were in the request, so if this passes we're good.
|
291
|
+
if (parsed.params.headers.indexOf(hdr) < 0)
|
292
|
+
throw new MissingHeaderError(hdr + ' was not a signed header');
|
293
|
+
});
|
294
|
+
|
295
|
+
if (options.algorithms) {
|
296
|
+
if (options.algorithms.indexOf(parsed.params.algorithm) === -1)
|
297
|
+
throw new InvalidParamsError(parsed.params.algorithm +
|
298
|
+
' is not a supported algorithm');
|
299
|
+
}
|
300
|
+
|
301
|
+
return parsed;
|
302
|
+
}
|
303
|
+
|
304
|
+
};
|
@@ -0,0 +1,178 @@
|
|
1
|
+
// Copyright 2012 Joyent, Inc. All rights reserved.
|
2
|
+
|
3
|
+
var assert = require('assert-plus');
|
4
|
+
var crypto = require('crypto');
|
5
|
+
var http = require('http');
|
6
|
+
|
7
|
+
var sprintf = require('util').format;
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
///--- Globals
|
12
|
+
|
13
|
+
var Algorithms = {
|
14
|
+
'rsa-sha1': true,
|
15
|
+
'rsa-sha256': true,
|
16
|
+
'rsa-sha512': true,
|
17
|
+
'dsa-sha1': true,
|
18
|
+
'hmac-sha1': true,
|
19
|
+
'hmac-sha256': true,
|
20
|
+
'hmac-sha512': true
|
21
|
+
};
|
22
|
+
|
23
|
+
var Authorization =
|
24
|
+
'Signature keyId="%s",algorithm="%s",headers="%s",signature="%s"';
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
///--- Specific Errors
|
29
|
+
|
30
|
+
function MissingHeaderError(message) {
|
31
|
+
this.name = 'MissingHeaderError';
|
32
|
+
this.message = message;
|
33
|
+
this.stack = (new Error()).stack;
|
34
|
+
}
|
35
|
+
MissingHeaderError.prototype = new Error();
|
36
|
+
|
37
|
+
|
38
|
+
function InvalidAlgorithmError(message) {
|
39
|
+
this.name = 'InvalidAlgorithmError';
|
40
|
+
this.message = message;
|
41
|
+
this.stack = (new Error()).stack;
|
42
|
+
}
|
43
|
+
InvalidAlgorithmError.prototype = new Error();
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
///--- Internal Functions
|
48
|
+
|
49
|
+
function _pad(val) {
|
50
|
+
if (parseInt(val, 10) < 10) {
|
51
|
+
val = '0' + val;
|
52
|
+
}
|
53
|
+
return val;
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
function _rfc1123() {
|
58
|
+
var date = new Date();
|
59
|
+
|
60
|
+
var months = ['Jan',
|
61
|
+
'Feb',
|
62
|
+
'Mar',
|
63
|
+
'Apr',
|
64
|
+
'May',
|
65
|
+
'Jun',
|
66
|
+
'Jul',
|
67
|
+
'Aug',
|
68
|
+
'Sep',
|
69
|
+
'Oct',
|
70
|
+
'Nov',
|
71
|
+
'Dec'];
|
72
|
+
var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
73
|
+
return days[date.getUTCDay()] + ', ' +
|
74
|
+
_pad(date.getUTCDate()) + ' ' +
|
75
|
+
months[date.getUTCMonth()] + ' ' +
|
76
|
+
date.getUTCFullYear() + ' ' +
|
77
|
+
_pad(date.getUTCHours()) + ':' +
|
78
|
+
_pad(date.getUTCMinutes()) + ':' +
|
79
|
+
_pad(date.getUTCSeconds()) +
|
80
|
+
' GMT';
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
///--- Exported API
|
86
|
+
|
87
|
+
module.exports = {
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Adds an 'Authorization' header to an http.ClientRequest object.
|
91
|
+
*
|
92
|
+
* Note that this API will add a Date header if it's not already set. Any
|
93
|
+
* other headers in the options.headers array MUST be present, or this
|
94
|
+
* will throw.
|
95
|
+
*
|
96
|
+
* You shouldn't need to check the return type; it's just there if you want
|
97
|
+
* to be pedantic.
|
98
|
+
*
|
99
|
+
* @param {Object} request an instance of http.ClientRequest.
|
100
|
+
* @param {Object} options signing parameters object:
|
101
|
+
* - {String} keyId required.
|
102
|
+
* - {String} key required (either a PEM or HMAC key).
|
103
|
+
* - {Array} headers optional; defaults to ['date'].
|
104
|
+
* - {String} algorithm optional; defaults to 'rsa-sha256'.
|
105
|
+
* - {String} httpVersion optional; defaults to '1.1'.
|
106
|
+
* @return {Boolean} true if Authorization (and optionally Date) were added.
|
107
|
+
* @throws {TypeError} on bad parameter types (input).
|
108
|
+
* @throws {InvalidAlgorithmError} if algorithm was bad.
|
109
|
+
* @throws {MissingHeaderError} if a header to be signed was specified but
|
110
|
+
* was not present.
|
111
|
+
*/
|
112
|
+
signRequest: function signRequest(request, options) {
|
113
|
+
assert.object(request, 'request');
|
114
|
+
assert.object(options, 'options');
|
115
|
+
assert.optionalString(options.algorithm, 'options.algorithm');
|
116
|
+
assert.string(options.keyId, 'options.keyId');
|
117
|
+
assert.optionalArrayOfString(options.headers, 'options.headers');
|
118
|
+
assert.optionalString(options.httpVersion, 'options.httpVersion');
|
119
|
+
|
120
|
+
if (!request.getHeader('Date'))
|
121
|
+
request.setHeader('Date', _rfc1123());
|
122
|
+
if (!options.headers)
|
123
|
+
options.headers = ['date'];
|
124
|
+
if (!options.algorithm)
|
125
|
+
options.algorithm = 'rsa-sha256';
|
126
|
+
if (!options.httpVersion)
|
127
|
+
options.httpVersion = '1.1';
|
128
|
+
|
129
|
+
options.algorithm = options.algorithm.toLowerCase();
|
130
|
+
|
131
|
+
if (!Algorithms[options.algorithm])
|
132
|
+
throw new InvalidAlgorithmError(options.algorithm + ' is not supported');
|
133
|
+
|
134
|
+
var i;
|
135
|
+
var stringToSign = '';
|
136
|
+
for (i = 0; i < options.headers.length; i++) {
|
137
|
+
if (typeof (options.headers[i]) !== 'string')
|
138
|
+
throw new TypeError('options.headers must be an array of Strings');
|
139
|
+
|
140
|
+
var h = options.headers[i].toLowerCase();
|
141
|
+
|
142
|
+
if (h !== 'request-line') {
|
143
|
+
var value = request.getHeader(h);
|
144
|
+
if (!value) {
|
145
|
+
throw new MissingHeaderError(h + ' was not in the request');
|
146
|
+
}
|
147
|
+
stringToSign += h + ': ' + value;
|
148
|
+
} else {
|
149
|
+
stringToSign +=
|
150
|
+
request.method + ' ' + request.path + ' HTTP/' + options.httpVersion;
|
151
|
+
}
|
152
|
+
|
153
|
+
if ((i + 1) < options.headers.length)
|
154
|
+
stringToSign += '\n';
|
155
|
+
}
|
156
|
+
|
157
|
+
var alg = options.algorithm.match(/(hmac|rsa)-(\w+)/);
|
158
|
+
var signature;
|
159
|
+
if (alg[1] === 'hmac') {
|
160
|
+
var hmac = crypto.createHmac(alg[2].toUpperCase(), options.key);
|
161
|
+
hmac.update(stringToSign);
|
162
|
+
signature = hmac.digest('base64');
|
163
|
+
} else {
|
164
|
+
var signer = crypto.createSign(options.algorithm.toUpperCase());
|
165
|
+
signer.update(stringToSign);
|
166
|
+
signature = signer.sign(options.key, 'base64');
|
167
|
+
}
|
168
|
+
|
169
|
+
request.setHeader('Authorization', sprintf(Authorization,
|
170
|
+
options.keyId,
|
171
|
+
options.algorithm,
|
172
|
+
options.headers.join(' '),
|
173
|
+
signature));
|
174
|
+
|
175
|
+
return true;
|
176
|
+
}
|
177
|
+
|
178
|
+
};
|