diff options
author | Tim Smith <tsmith@chef.io> | 2019-08-06 20:39:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-06 20:39:37 -0700 |
commit | 32a8c4ae7122d793adc4df308393fcb2cbc99cd0 (patch) | |
tree | 421e2e242290c407e2014e8ae03257fba559adc1 | |
parent | a338f147c50c1248a4aeee84cd093470e34d4171 (diff) | |
parent | c3746ef86c6f0f94bd75ab83e34d1810ab9a0e59 (diff) | |
download | mixlib-authentication-32a8c4ae7122d793adc4df308393fcb2cbc99cd0.tar.gz |
Merge pull request #48 from chef/bk
Update project owner + Remove Travis CI
-rw-r--r-- | .expeditor/config.yml | 2 | ||||
-rw-r--r-- | .expeditor/verify.pipeline.yml | 27 | ||||
-rw-r--r-- | .github/PULL_REQUEST_TEMPLATE.md | 15 | ||||
-rw-r--r-- | .rubocop.yml | 2 | ||||
-rw-r--r-- | .travis.yml | 26 | ||||
-rw-r--r-- | Gemfile | 8 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | Rakefile | 23 | ||||
-rw-r--r-- | appveyor.yml | 43 | ||||
-rw-r--r-- | lib/mixlib/authentication.rb | 2 | ||||
-rw-r--r-- | lib/mixlib/authentication/http_authentication_request.rb | 2 | ||||
-rw-r--r-- | lib/mixlib/authentication/signatureverification.rb | 2 | ||||
-rw-r--r-- | lib/mixlib/authentication/signedheaderauth.rb | 54 | ||||
-rw-r--r-- | lib/mixlib/authentication/version.rb | 2 | ||||
-rw-r--r-- | spec/mixlib/authentication/digester_spec.rb | 6 | ||||
-rw-r--r-- | spec/mixlib/authentication/http_authentication_request_spec.rb | 16 | ||||
-rw-r--r-- | spec/mixlib/authentication/mixlib_authentication_spec.rb | 125 |
17 files changed, 149 insertions, 208 deletions
diff --git a/.expeditor/config.yml b/.expeditor/config.yml index 10cc24b..18f4252 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -11,6 +11,8 @@ rubygems: github: # This deletes the GitHub PR branch after successfully merged into the release branch delete_branch_on_merge: true + # The tag format to use (e.g. v1.0.0) + version_tag_format: "v{{version}}" # allow bumping the minor release via label minor_bump_labels: - "Expeditor: Bump Version Minor" diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index a3efc1c..7865325 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -1,28 +1,43 @@ +--- +expeditor: + defaults: + buildkite: + timeout_in_minutes: 30 + steps: - label: run-lint-and-specs-ruby-2.4 command: - - asdf local ruby 2.4.5 - - bundle install --jobs=7 --retry=3 + - bundle install --jobs=7 --retry=3 --without docs debug - bundle exec rake expeditor: executor: docker: + image: ruby:2.4-stretch - label: run-lint-and-specs-ruby-2.5 command: - - asdf local ruby 2.5.5 - - bundle install --jobs=7 --retry=3 + - bundle install --jobs=7 --retry=3 --without docs debug - bundle exec rake expeditor: executor: docker: + image: ruby:2.5-stretch - label: run-lint-and-specs-ruby-2.6 command: - - asdf local ruby 2.6.3 - - bundle install --jobs=7 --retry=3 + - bundle install --jobs=7 --retry=3 --without docs debug + - bundle exec rake + expeditor: + executor: + docker: + image: ruby:2.6-stretch + +- label: run-specs-windows + command: + - bundle install --jobs=7 --retry=3 --without docs debug - bundle exec rake expeditor: executor: docker: + host_os: windows diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 0df03f8..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ -### Description - -[Please describe what this change achieves] - -### Issues Resolved - -[List any existing issues this PR resolves, or any Discourse or -StackOverflow discussions that are relevant] - -### Check List - -- [ ] New functionality includes tests -- [ ] All tests pass -- [ ] All commits have been signed-off for the Developer Certificate of Origin. See <https://github.com/chef/chef/blob/master/CONTRIBUTING.md#developer-certification-of-origin-dco> -- [ ] PR title is a worthy inclusion in the CHANGELOG
\ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index 5b837e2..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,2 +0,0 @@ -Style/HashSyntax: - Enabled: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4a40d95..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: ruby -cache: bundler -dist: xenial - -before_install: - - gem install bundler || true - - bundle --version - - gem update --system - - gem --version - -matrix: - include: - - rvm: 2.4.5 - - rvm: 2.5.5 - - rvm: 2.6.2 - - rvm: ruby-head - allow_failures: - - rvm: ruby-head - -branches: - only: - - master - -bundler_args: --without docs development - -script: bundle exec rake @@ -3,13 +3,13 @@ source "https://rubygems.org" gemspec group :docs do - gem "yard" - gem "redcarpet" gem "github-markup" + gem "redcarpet" + gem "yard" end group :test do - gem "chefstyle", "=0.4.0" # pin needed until we drop Ruby 2.0/2.1 support + gem "chefstyle" gem "rspec-core", "~> 3.2" gem "rspec-mocks", "~> 3.2" gem "rspec-expectations", "~> 3.2" @@ -18,7 +18,7 @@ group :test do gem "net-ssh" end -group :development do +group :debug do gem "pry" gem "pry-byebug" gem "pry-stack_explorer" @@ -1,5 +1,5 @@ # Mixlib::Authentication -[](https://travis-ci.org/chef/mixlib-authentication) [](https://badge.fury.io/rb/mixlib-authentication) +[](https://badge.fury.io/rb/mixlib-authentication) **Umbrella Project**: [Chef Foundation](https://github.com/chef/chef-oss-practices/blob/master/projects/chef-foundation.md) @@ -1,23 +1,26 @@ require "bundler/gem_tasks" -require "rspec/core/rake_task" -task default: [:style, :spec] - -Bundler::GemHelper.install_tasks - -desc "Run specs" -RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = "spec/**/*_spec.rb" +begin + require "rspec/core/rake_task" + RSpec::Core::RakeTask.new do |t| + t.pattern = "spec/**/*_spec.rb" + end +rescue LoadError + desc "rspec is not installed, this task is disabled" + task :spec do + abort "rspec is not installed. bundle install first to make sure all dependencies are installed." + end end begin require "chefstyle" require "rubocop/rake_task" + desc "Run Chefstyle tests" RuboCop::RakeTask.new(:style) do |task| task.options += ["--display-cop-names", "--no-color"] end rescue LoadError - puts "chefstyle/rubocop is not available. bundle install first to make sure all dependencies are installed." + puts "chefstyle gem is not installed. bundle install first to make sure all dependencies are installed." end begin @@ -34,3 +37,5 @@ task :console do ARGV.clear IRB.start end + +task default: %i{spec style} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 86331cf..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,43 +0,0 @@ -version: "master-{build}" - -os: Visual Studio 2017 -platform: - - x64 - -cache: - - vendor/bundle - -environment: - matrix: - - ruby_version: "24-x64" - - ruby_version: "25-x64" - - ruby_version: "26-x64" - -clone_depth: 1 -skip_tags: true -skip_branch_with_pr: true -branches: - only: - - master - -install: - - systeminfo - - SET PATH=C:\Ruby%ruby_version%\bin;%PATH% - - echo %PATH% - - appveyor DownloadFile http://curl.haxx.se/ca/cacert.pem -FileName C:\cacert.pem - - set SSL_CERT_FILE=C:\cacert.pem - - SET BUNDLE_WITHOUT=server:docgen:maintenance:pry:travis:integration:ci - - bundle config --local path vendor/bundle # use the cache we define above - - bundle install || bundle install || bundle install - -build: off - -before_test: - - ruby --version - - gem --version - - bundler --version - - bundle env - -test_script: - - SET SPEC_OPTS=--format progress - - bundle exec rake diff --git a/lib/mixlib/authentication.rb b/lib/mixlib/authentication.rb index 167ed22..b2019ee 100644 --- a/lib/mixlib/authentication.rb +++ b/lib/mixlib/authentication.rb @@ -18,7 +18,7 @@ module Mixlib module Authentication - DEFAULT_SERVER_API_VERSION = "0" + DEFAULT_SERVER_API_VERSION = "0".freeze attr_accessor :logger module_function :logger, :logger= diff --git a/lib/mixlib/authentication/http_authentication_request.rb b/lib/mixlib/authentication/http_authentication_request.rb index 967c0e3..16907d1 100644 --- a/lib/mixlib/authentication/http_authentication_request.rb +++ b/lib/mixlib/authentication/http_authentication_request.rb @@ -22,7 +22,7 @@ module Mixlib module Authentication class HTTPAuthenticationRequest - MANDATORY_HEADERS = [:x_ops_sign, :x_ops_userid, :x_ops_timestamp, :host, :x_ops_content_hash] + MANDATORY_HEADERS = %i{x_ops_sign x_ops_userid x_ops_timestamp host x_ops_content_hash}.freeze attr_reader :request diff --git a/lib/mixlib/authentication/signatureverification.rb b/lib/mixlib/authentication/signatureverification.rb index 1dfafd6..3231214 100644 --- a/lib/mixlib/authentication/signatureverification.rb +++ b/lib/mixlib/authentication/signatureverification.rb @@ -203,7 +203,7 @@ module Mixlib # No file_param; we're running in Merb, or it's just not there.. if file_param.nil? hash_param = request.params.values.find { |value| value.respond_to?(:has_key?) } # Hash responds to :has_key? . - if !hash_param.nil? + unless hash_param.nil? file_param = hash_param.values.find { |value| value.respond_to?(:read) } # File/Tempfile responds to :read. end end diff --git a/lib/mixlib/authentication/signedheaderauth.rb b/lib/mixlib/authentication/signedheaderauth.rb index 2a54c76..0ca74c4 100644 --- a/lib/mixlib/authentication/signedheaderauth.rb +++ b/lib/mixlib/authentication/signedheaderauth.rb @@ -34,7 +34,7 @@ module Mixlib "1.0" => "sha1", "1.1" => "sha1", "1.3" => "sha256", - }.freeze() + }.freeze # Use of SUPPORTED_ALGORITHMS and SUPPORTED_VERSIONS is deprecated. Use # ALGORITHM_FOR_VERSION instead @@ -74,15 +74,14 @@ module Mixlib # * `:host`: The host part of the URI def self.signing_object(args = {}) SigningObject.new(args[:http_method], - args[:path], - args[:body], - args[:host], - args[:timestamp], - args[:user_id], - args[:file], - args[:proto_version], - args[:headers] - ) + args[:path], + args[:body], + args[:host], + args[:timestamp], + args[:user_id], + args[:file], + args[:proto_version], + args[:headers]) end def algorithm @@ -175,7 +174,7 @@ module Mixlib # ====Parameters # def canonical_path - p = path.gsub(/\/+/, "/") + p = path.gsub(%r{/+}, "/") p.length > 1 ? p.chomp("/") : p end @@ -191,6 +190,7 @@ module Mixlib else @hashed_body_digest = digest end + # Hash the file object if it was passed in, otherwise hash based on # the body. # TODO: tim 2009-12-28: It'd be nice to just remove this special case, @@ -283,11 +283,13 @@ module Mixlib do_sign_ssh_agent(rsa_key, string_to_sign) else raise AuthenticationError, "RSA private key is required to sign requests, but a public key was provided" unless rsa_key.private? + rsa_key.sign(digest.new, string_to_sign) end else raise AuthenticationError, "Agent signing mode requires signing protocol version 1.3 or newer" if use_ssh_agent raise AuthenticationError, "RSA private key is required to sign requests, but a public key was provided" unless rsa_key.private? + rsa_key.private_encrypt(string_to_sign) end end @@ -339,25 +341,25 @@ module Mixlib # generate a request signature. `SignedHeaderAuth.signing_object()` # provides a more convenient interface to the constructor. SigningObject = Struct.new(:http_method, :path, :body, :host, - :timestamp, :user_id, :file, :proto_version, - :headers) do + :timestamp, :user_id, :file, :proto_version, + :headers) do - include SignedHeaderAuth + include SignedHeaderAuth - def proto_version - (self[:proto_version] || SignedHeaderAuth::DEFAULT_PROTO_VERSION).to_s - end + def proto_version + (self[:proto_version] || SignedHeaderAuth::DEFAULT_PROTO_VERSION).to_s + end - def server_api_version - key = (self[:headers] || {}).keys.select do |k| - k.casecmp("x-ops-server-api-version") == 0 - end.first - if key - self[:headers][key] - else - DEFAULT_SERVER_API_VERSION + def server_api_version + key = (self[:headers] || {}).keys.select do |k| + k.casecmp("x-ops-server-api-version") == 0 + end.first + if key + self[:headers][key] + else + DEFAULT_SERVER_API_VERSION + end end end - end end end diff --git a/lib/mixlib/authentication/version.rb b/lib/mixlib/authentication/version.rb index 99d74d0..cade16a 100644 --- a/lib/mixlib/authentication/version.rb +++ b/lib/mixlib/authentication/version.rb @@ -16,6 +16,6 @@ module Mixlib module Authentication - VERSION = "3.0.2" + VERSION = "3.0.2".freeze end end diff --git a/spec/mixlib/authentication/digester_spec.rb b/spec/mixlib/authentication/digester_spec.rb index c54efa5..d094f40 100644 --- a/spec/mixlib/authentication/digester_spec.rb +++ b/spec/mixlib/authentication/digester_spec.rb @@ -27,14 +27,16 @@ describe Mixlib::Authentication::Digester do describe "#hash_file" do it "should default to use SHA1" do expect(described_class.hash_file(StringIO.new(test_string))).to( - eq(test_string_checksum)) + eq(test_string_checksum) + ) end end describe "#hash_string" do it "should default to use SHA1" do expect(described_class.hash_string(test_string)).to( - eq(test_string_checksum)) + eq(test_string_checksum) + ) end end end diff --git a/spec/mixlib/authentication/http_authentication_request_spec.rb b/spec/mixlib/authentication/http_authentication_request_spec.rb index d62d67e..bd265bb 100644 --- a/spec/mixlib/authentication/http_authentication_request_spec.rb +++ b/spec/mixlib/authentication/http_authentication_request_spec.rb @@ -115,14 +115,14 @@ describe Mixlib::Authentication::HTTPAuthenticationRequest do end it "rebuilds the request signature from the headers" do - expected = <<-SIG -jVHrNniWzpbez/eGWjFnO6lINRIuKOg40ZTIQudcFe47Z9e/HvrszfVXlKG4 -NMzYZgyooSvU85qkIUmKuCqgG2AIlvYa2Q/2ctrMhoaHhLOCWWoqYNMaEqPc -3tKHE+CfvP+WuPdWk4jv4wpIkAz6ZLxToxcGhXmZbXpk56YTmqgBW2cbbw4O -IWPZDHSiPcw//AYNgW1CCDptt+UFuaFYbtqZegcBd2n/jzcWODA7zL4KWEUy -9q4rlh/+1tBReg60QdsmDRsw/cdO1GZrKtuCwbuD4+nbRdVBKv72rqHX9cu0 -utju9jzczCyB+sSAQWrxSsXB/b8vV2qs0l4VD2ML+w== -SIG + expected = <<~SIG + jVHrNniWzpbez/eGWjFnO6lINRIuKOg40ZTIQudcFe47Z9e/HvrszfVXlKG4 + NMzYZgyooSvU85qkIUmKuCqgG2AIlvYa2Q/2ctrMhoaHhLOCWWoqYNMaEqPc + 3tKHE+CfvP+WuPdWk4jv4wpIkAz6ZLxToxcGhXmZbXpk56YTmqgBW2cbbw4O + IWPZDHSiPcw//AYNgW1CCDptt+UFuaFYbtqZegcBd2n/jzcWODA7zL4KWEUy + 9q4rlh/+1tBReg60QdsmDRsw/cdO1GZrKtuCwbuD4+nbRdVBKv72rqHX9cu0 + utju9jzczCyB+sSAQWrxSsXB/b8vV2qs0l4VD2ML+w== + SIG expect(@http_authentication_request.request_signature).to eq(expected.chomp) end diff --git a/spec/mixlib/authentication/mixlib_authentication_spec.rb b/spec/mixlib/authentication/mixlib_authentication_spec.rb index 7d9b484..5a17d5c 100644 --- a/spec/mixlib/authentication/mixlib_authentication_spec.rb +++ b/spec/mixlib/authentication/mixlib_authentication_spec.rb @@ -1,3 +1,4 @@ +# rubocop: disable Style/MutableConstant # # Author:: Tim Hinderliter (<tim@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) @@ -64,7 +65,7 @@ class MockFile end # Uncomment this to get some more info from the methods we're testing. -#Mixlib::Authentication.logger.level = :trace +# Mixlib::Authentication.logger.level = :trace describe "Mixlib::Authentication::SignedHeaderAuth" do @@ -233,7 +234,7 @@ describe "Mixlib::Authentication::SignatureVerification" do mock_request = MockRequest.new(PATH, MERB_REQUEST_PARAMS, headers, BODY) allow(Time).to receive(:now).and_return(TIMESTAMP_OBJ) - #Time.stub!(:now).and_return(TIMESTAMP_OBJ) + # Time.stub!(:now).and_return(TIMESTAMP_OBJ) auth_req = Mixlib::Authentication::SignatureVerification.new expect { auth_req.authenticate_user_request(mock_request, @user_private_key) }.to raise_error(Mixlib::Authentication::AuthenticationError) @@ -344,7 +345,7 @@ V1_3_ARGS_SHA256 = { proto_version: "1.3", headers: { "X-OpS-SeRvEr-ApI-VerSiOn" => "1", - } + }, # This defaults to sha256 } @@ -502,7 +503,7 @@ MERB_HEADERS_V1_0 = { PASSENGER_REQUEST_PARAMS = { "action" => "create", - #"tarball"=>#<File:/tmp/RackMultipart20091120-25570-mgq2sa-0>, + # "tarball"=>#<File:/tmp/RackMultipart20091120-25570-mgq2sa-0>, "controller" => "api/v1/cookbooks", "cookbook" => "{\"category\":\"databases\"}", } @@ -542,78 +543,78 @@ PASSENGER_HEADERS_V1_0 = { # generated with # openssl genrsa -out private.pem 2048 # openssl rsa -in private.pem -out public.pem -pubout -PUBLIC_KEY_DATA = <<EOS ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ueqo76MXuP6XqZBILFz -iH/9AI7C6PaN5W0dSvkr9yInyGHSz/IR1+4tqvP2qlfKVKI4CP6BFH251Ft9qMUB -uAsnlAVQ1z0exDtIFFOyQCdR7iXmjBIWMSS4buBwRQXwDK7id1OxtU23qVJv+xwE -V0IzaaSJmaGLIbvRBD+qatfUuQJBMU/04DdJIwvLtZBYdC2219m5dUBQaa4bimL+ -YN9EcsDzD9h9UxQo5ReK7b3cNMzJBKJWLzFBcJuePMzAnLFktr/RufX4wpXe6XJx -oVPaHo72GorLkwnQ0HYMTY8rehT4mDi1FI969LHCFFaFHSAaRnwdXaQkJmSfcxzC -YQIDAQAB ------END PUBLIC KEY----- +PUBLIC_KEY_DATA = <<~EOS + -----BEGIN PUBLIC KEY----- + MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ueqo76MXuP6XqZBILFz + iH/9AI7C6PaN5W0dSvkr9yInyGHSz/IR1+4tqvP2qlfKVKI4CP6BFH251Ft9qMUB + uAsnlAVQ1z0exDtIFFOyQCdR7iXmjBIWMSS4buBwRQXwDK7id1OxtU23qVJv+xwE + V0IzaaSJmaGLIbvRBD+qatfUuQJBMU/04DdJIwvLtZBYdC2219m5dUBQaa4bimL+ + YN9EcsDzD9h9UxQo5ReK7b3cNMzJBKJWLzFBcJuePMzAnLFktr/RufX4wpXe6XJx + oVPaHo72GorLkwnQ0HYMTY8rehT4mDi1FI969LHCFFaFHSAaRnwdXaQkJmSfcxzC + YQIDAQAB + -----END PUBLIC KEY----- EOS PUBLIC_KEY = OpenSSL::PKey::RSA.new(PUBLIC_KEY_DATA) -PRIVATE_KEY_DATA = <<EOS ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEA0ueqo76MXuP6XqZBILFziH/9AI7C6PaN5W0dSvkr9yInyGHS -z/IR1+4tqvP2qlfKVKI4CP6BFH251Ft9qMUBuAsnlAVQ1z0exDtIFFOyQCdR7iXm -jBIWMSS4buBwRQXwDK7id1OxtU23qVJv+xwEV0IzaaSJmaGLIbvRBD+qatfUuQJB -MU/04DdJIwvLtZBYdC2219m5dUBQaa4bimL+YN9EcsDzD9h9UxQo5ReK7b3cNMzJ -BKJWLzFBcJuePMzAnLFktr/RufX4wpXe6XJxoVPaHo72GorLkwnQ0HYMTY8rehT4 -mDi1FI969LHCFFaFHSAaRnwdXaQkJmSfcxzCYQIDAQABAoIBAQCW3I4sKN5B9jOe -xq/pkeWBq4OvhW8Ys1yW0zFT8t6nHbB1XrwscQygd8gE9BPqj3e0iIEqtdphbPmj -VHqTYbC0FI6QDClifV7noTwTBjeIOlgZ0NSUN0/WgVzIOxUz2mZ2vBZUovKILPqG -TOi7J7RXMoySMdcXpP1f+PgvYNcnKsT72UcWaSXEV8/zo+Zm/qdGPVWwJonri5Mp -DVm5EQSENBiRyt028rU6ElXORNmoQpVjDVqZ1gipzXkifdjGyENw2rt4V/iKYD7V -5iqXOsvP6Cemf4gbrjunAgDG08S00kiUgvVWcdXW+dlsR2nCvH4DOEe3AYYh/aH8 -DxEE7FbtAoGBAPcNO8fJ56mNw0ow4Qg38C+Zss/afhBOCfX4O/SZKv/roRn5+gRM -KRJYSVXNnsjPI1plzqR4OCyOrjAhtuvL4a0DinDzf1+fiztyNohwYsW1vYmqn3ti -EN0GhSgE7ppZjqvLQ3f3LUTxynhA0U+k9wflb4irIlViTUlCsOPkrNJDAoGBANqL -Q+vvuGSsmRLU/Cenjy+Mjj6+QENg51dz34o8JKuVKIPKU8pNnyeLa5fat0qD2MHm -OB9opeQOcw0dStodxr6DB3wi83bpjeU6BWUGITNiWEaZEBrQ0aiqNJJKrrHm8fAZ -9o4l4oHc4hI0kYVYYDuxtKuVJrzZiEapTwoOcYiLAoGBAI/EWbeIHZIj9zOjgjEA -LHvm25HtulLOtyk2jd1njQhlHNk7CW2azIPqcLLH99EwCYi/miNH+pijZ2aHGCXb -/bZrSxM0ADmrZKDxdB6uGCyp+GS2sBxjEyEsfCyvwhJ8b3Q100tqwiNO+d5FCglp -HICx2dgUjuRVUliBwOK93nx1AoGAUI8RhIEjOYkeDAESyhNMBr0LGjnLOosX+/as -qiotYkpjWuFULbibOFp+WMW41vDvD9qrSXir3fstkeIAW5KqVkO6mJnRoT3Knnra -zjiKOITCAZQeiaP8BO5o3pxE9TMqb9VCO3ffnPstIoTaN4syPg7tiGo8k1SklVeH -2S8lzq0CgYAKG2fljIYWQvGH628rp4ZcXS4hWmYohOxsnl1YrszbJ+hzR+IQOhGl -YlkUQYXhy9JixmUUKtH+NXkKX7Lyc8XYw5ETr7JBT3ifs+G7HruDjVG78EJVojbd -8uLA+DdQm5mg4vd1GTiSK65q/3EeoBlUaVor3HhLFki+i9qpT8CBsg== ------END RSA PRIVATE KEY----- +PRIVATE_KEY_DATA = <<~EOS + -----BEGIN RSA PRIVATE KEY----- + MIIEpAIBAAKCAQEA0ueqo76MXuP6XqZBILFziH/9AI7C6PaN5W0dSvkr9yInyGHS + z/IR1+4tqvP2qlfKVKI4CP6BFH251Ft9qMUBuAsnlAVQ1z0exDtIFFOyQCdR7iXm + jBIWMSS4buBwRQXwDK7id1OxtU23qVJv+xwEV0IzaaSJmaGLIbvRBD+qatfUuQJB + MU/04DdJIwvLtZBYdC2219m5dUBQaa4bimL+YN9EcsDzD9h9UxQo5ReK7b3cNMzJ + BKJWLzFBcJuePMzAnLFktr/RufX4wpXe6XJxoVPaHo72GorLkwnQ0HYMTY8rehT4 + mDi1FI969LHCFFaFHSAaRnwdXaQkJmSfcxzCYQIDAQABAoIBAQCW3I4sKN5B9jOe + xq/pkeWBq4OvhW8Ys1yW0zFT8t6nHbB1XrwscQygd8gE9BPqj3e0iIEqtdphbPmj + VHqTYbC0FI6QDClifV7noTwTBjeIOlgZ0NSUN0/WgVzIOxUz2mZ2vBZUovKILPqG + TOi7J7RXMoySMdcXpP1f+PgvYNcnKsT72UcWaSXEV8/zo+Zm/qdGPVWwJonri5Mp + DVm5EQSENBiRyt028rU6ElXORNmoQpVjDVqZ1gipzXkifdjGyENw2rt4V/iKYD7V + 5iqXOsvP6Cemf4gbrjunAgDG08S00kiUgvVWcdXW+dlsR2nCvH4DOEe3AYYh/aH8 + DxEE7FbtAoGBAPcNO8fJ56mNw0ow4Qg38C+Zss/afhBOCfX4O/SZKv/roRn5+gRM + KRJYSVXNnsjPI1plzqR4OCyOrjAhtuvL4a0DinDzf1+fiztyNohwYsW1vYmqn3ti + EN0GhSgE7ppZjqvLQ3f3LUTxynhA0U+k9wflb4irIlViTUlCsOPkrNJDAoGBANqL + Q+vvuGSsmRLU/Cenjy+Mjj6+QENg51dz34o8JKuVKIPKU8pNnyeLa5fat0qD2MHm + OB9opeQOcw0dStodxr6DB3wi83bpjeU6BWUGITNiWEaZEBrQ0aiqNJJKrrHm8fAZ + 9o4l4oHc4hI0kYVYYDuxtKuVJrzZiEapTwoOcYiLAoGBAI/EWbeIHZIj9zOjgjEA + LHvm25HtulLOtyk2jd1njQhlHNk7CW2azIPqcLLH99EwCYi/miNH+pijZ2aHGCXb + /bZrSxM0ADmrZKDxdB6uGCyp+GS2sBxjEyEsfCyvwhJ8b3Q100tqwiNO+d5FCglp + HICx2dgUjuRVUliBwOK93nx1AoGAUI8RhIEjOYkeDAESyhNMBr0LGjnLOosX+/as + qiotYkpjWuFULbibOFp+WMW41vDvD9qrSXir3fstkeIAW5KqVkO6mJnRoT3Knnra + zjiKOITCAZQeiaP8BO5o3pxE9TMqb9VCO3ffnPstIoTaN4syPg7tiGo8k1SklVeH + 2S8lzq0CgYAKG2fljIYWQvGH628rp4ZcXS4hWmYohOxsnl1YrszbJ+hzR+IQOhGl + YlkUQYXhy9JixmUUKtH+NXkKX7Lyc8XYw5ETr7JBT3ifs+G7HruDjVG78EJVojbd + 8uLA+DdQm5mg4vd1GTiSK65q/3EeoBlUaVor3HhLFki+i9qpT8CBsg== + -----END RSA PRIVATE KEY----- EOS PRIVATE_KEY = OpenSSL::PKey::RSA.new(PRIVATE_KEY_DATA) -V1_0_CANONICAL_REQUEST_DATA = <<EOS -Method:POST -Hashed Path:#{HASHED_CANONICAL_PATH} -X-Ops-Content-Hash:#{HASHED_BODY} -X-Ops-Timestamp:#{TIMESTAMP_ISO8601} -X-Ops-UserId:#{USER_ID} +V1_0_CANONICAL_REQUEST_DATA = <<~EOS + Method:POST + Hashed Path:#{HASHED_CANONICAL_PATH} + X-Ops-Content-Hash:#{HASHED_BODY} + X-Ops-Timestamp:#{TIMESTAMP_ISO8601} + X-Ops-UserId:#{USER_ID} EOS V1_0_CANONICAL_REQUEST = V1_0_CANONICAL_REQUEST_DATA.chomp -V1_1_CANONICAL_REQUEST_DATA = <<EOS -Method:POST -Hashed Path:#{HASHED_CANONICAL_PATH} -X-Ops-Content-Hash:#{HASHED_BODY} -X-Ops-Timestamp:#{TIMESTAMP_ISO8601} -X-Ops-UserId:#{DIGESTED_USER_ID} +V1_1_CANONICAL_REQUEST_DATA = <<~EOS + Method:POST + Hashed Path:#{HASHED_CANONICAL_PATH} + X-Ops-Content-Hash:#{HASHED_BODY} + X-Ops-Timestamp:#{TIMESTAMP_ISO8601} + X-Ops-UserId:#{DIGESTED_USER_ID} EOS V1_1_CANONICAL_REQUEST = V1_1_CANONICAL_REQUEST_DATA.chomp -V1_3_SHA256_CANONICAL_REQUEST_DATA = <<EOS -Method:POST -Path:#{PATH} -X-Ops-Content-Hash:#{HASHED_BODY_SHA256} -X-Ops-Sign:version=1.3 -X-Ops-Timestamp:#{TIMESTAMP_ISO8601} -X-Ops-UserId:#{USER_ID} -X-Ops-Server-API-Version:1 +V1_3_SHA256_CANONICAL_REQUEST_DATA = <<~EOS + Method:POST + Path:#{PATH} + X-Ops-Content-Hash:#{HASHED_BODY_SHA256} + X-Ops-Sign:version=1.3 + X-Ops-Timestamp:#{TIMESTAMP_ISO8601} + X-Ops-UserId:#{USER_ID} + X-Ops-Server-API-Version:1 EOS V1_3_SHA256_CANONICAL_REQUEST = V1_3_SHA256_CANONICAL_REQUEST_DATA.chomp |