ey-hmac 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +35 -0
- data/Gemfile +4 -2
- data/ey-hmac.gemspec +18 -14
- data/lib/ey-hmac/version.rb +1 -1
- data/lib/ey-hmac.rb +4 -6
- data/spec/faraday_spec.rb +6 -10
- data/spec/spec_helper.rb +1 -0
- metadata +20 -21
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 780a6fcc90418a0389166a31e520337dced06873038bb0a9e71a6f3b70996835
|
4
|
+
data.tar.gz: 073f26a6c11bd06036e23a49b50e8ffea15ca70c608d05e0e7be1a0b7547cda7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0b5f2b1827e7a180b35ffa2d3b2e2918a470d008735dbb5b5b79430ac2201c7d58a5abcf124f5ee69119ab83b2b882f9802b70e0f00208df130f9974fc82e2f
|
7
|
+
data.tar.gz: 8d5b959e371034a6a436f7bfec4602e4e477a9830b6d67a6fc2e23378d5002fb2fbbd3714a635b8efe579bcf4f07316176be42ae90985317a86f72e2d7c57a15
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.5', '2.6', '2.7', '3.0']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
+
# uses: ruby/setup-ruby@v1
|
30
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rspec
|
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in ey-hmac.gemspec
|
@@ -10,11 +12,11 @@ end
|
|
10
12
|
|
11
13
|
group(:rack) do
|
12
14
|
gem 'rack'
|
13
|
-
gem 'rack-test'
|
14
15
|
gem 'rack-client'
|
16
|
+
gem 'rack-test'
|
15
17
|
end
|
16
18
|
|
17
19
|
group(:faraday) do
|
18
|
-
gem 'faraday', '~>
|
20
|
+
gem 'faraday', '~> 1.3'
|
19
21
|
gem 'faraday_middleware'
|
20
22
|
end
|
data/ey-hmac.gemspec
CHANGED
@@ -1,21 +1,25 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'English'
|
4
|
+
require File.expand_path('lib/ey-hmac/version', __dir__)
|
3
5
|
|
4
6
|
Gem::Specification.new do |gem|
|
5
|
-
gem.name =
|
7
|
+
gem.name = 'ey-hmac'
|
6
8
|
gem.version = Ey::Hmac::VERSION
|
7
|
-
gem.authors = [
|
8
|
-
gem.email = [
|
9
|
-
gem.description =
|
10
|
-
gem.summary =
|
11
|
-
gem.homepage =
|
9
|
+
gem.authors = ['Josh Lane']
|
10
|
+
gem.email = ['me@joshualane.com']
|
11
|
+
gem.description = 'Lightweight HMAC signing libraries and middleware for Farday and Rack'
|
12
|
+
gem.summary = 'Lightweight HMAC signing libraries and middleware for Farday and Rack'
|
13
|
+
gem.homepage = ''
|
12
14
|
|
13
|
-
gem.files = `git ls-files`.split(
|
14
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
15
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
-
gem.require_paths = [
|
17
|
-
gem.license =
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
gem.license = 'MIT'
|
20
|
+
|
21
|
+
gem.required_ruby_version = '>= 2.5'
|
18
22
|
|
19
|
-
gem.add_development_dependency
|
20
|
-
gem.add_development_dependency
|
23
|
+
gem.add_development_dependency 'bundler', '~> 2.3'
|
24
|
+
gem.add_development_dependency 'rake'
|
21
25
|
end
|
data/lib/ey-hmac/version.rb
CHANGED
data/lib/ey-hmac.rb
CHANGED
@@ -23,12 +23,10 @@ module Ey
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.default_adapter
|
26
|
-
@default_adapter ||=
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Ey::Hmac::Adapter::Rails
|
31
|
-
end
|
26
|
+
@default_adapter ||= if defined?(::Rack) || defined?(::Rails)
|
27
|
+
Ey::Hmac::Adapter::Rack
|
28
|
+
elsif defined?(::Faraday)
|
29
|
+
Ey::Hmac::Adapter::Faraday
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
data/spec/faraday_spec.rb
CHANGED
@@ -38,8 +38,7 @@ describe "faraday" do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "signs and reads a request" do
|
41
|
-
request = Faraday::Request.
|
42
|
-
r.method = :get
|
41
|
+
request = Faraday::Request.create(:get) { |r|
|
43
42
|
r.path = "/auth"
|
44
43
|
r.body = "{1: 2}"
|
45
44
|
r.headers = {"Content-Type" => "application/xml"}
|
@@ -49,8 +48,8 @@ describe "faraday" do
|
|
49
48
|
|
50
49
|
Ey::Hmac.sign!(request, key_id, key_secret, adapter: adapter)
|
51
50
|
|
52
|
-
expect(request[:request_headers]['Authorization']).to
|
53
|
-
expect(request[:request_headers]['Content-Digest']).to
|
51
|
+
expect(request[:request_headers]['Authorization']).to start_with("EyHmac")
|
52
|
+
expect(request[:request_headers]['Content-Digest']).to eq(Digest::MD5.hexdigest(request[:body]))
|
54
53
|
expect(Time.parse(request[:request_headers]['Date'])).not_to be_nil
|
55
54
|
|
56
55
|
yielded = false
|
@@ -65,8 +64,7 @@ describe "faraday" do
|
|
65
64
|
end
|
66
65
|
|
67
66
|
it "does not set Content-Digest if body is nil" do
|
68
|
-
request = Faraday::Request.
|
69
|
-
r.method = :get
|
67
|
+
request = Faraday::Request.create(:get) { |r|
|
70
68
|
r.path = "/auth"
|
71
69
|
r.body = nil
|
72
70
|
r.headers = {"Content-Type" => "application/xml"}
|
@@ -92,8 +90,7 @@ describe "faraday" do
|
|
92
90
|
end
|
93
91
|
|
94
92
|
it "does not set Content-Digest if body is empty" do
|
95
|
-
request = Faraday::Request.
|
96
|
-
r.method = :get
|
93
|
+
request = Faraday::Request.create(:get) do |r|
|
97
94
|
r.path = "/auth"
|
98
95
|
r.body = ""
|
99
96
|
r.headers = {"Content-Type" => "application/xml"}
|
@@ -118,8 +115,7 @@ describe "faraday" do
|
|
118
115
|
|
119
116
|
context "with a request" do
|
120
117
|
let!(:request) do
|
121
|
-
Faraday::Request.
|
122
|
-
r.method = :get
|
118
|
+
Faraday::Request.create(:get) do |r|
|
123
119
|
r.path = "/auth"
|
124
120
|
r.body = "{1: 2}"
|
125
121
|
r.headers = {"Content-Type" => "application/xml"}
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,52 +1,52 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey-hmac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Josh Lane
|
8
|
-
autorequire:
|
7
|
+
- Josh Lane
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
description: Lightweight HMAC signing libraries and middleware for Farday and Rack
|
42
42
|
email:
|
43
|
-
-
|
43
|
+
- me@joshualane.com
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".github/workflows/ruby.yml"
|
48
49
|
- ".gitignore"
|
49
|
-
- ".travis.yml"
|
50
50
|
- CHANGELOG.md
|
51
51
|
- Gemfile
|
52
52
|
- LICENSE.txt
|
@@ -68,7 +68,7 @@ homepage: ''
|
|
68
68
|
licenses:
|
69
69
|
- MIT
|
70
70
|
metadata: {}
|
71
|
-
post_install_message:
|
71
|
+
post_install_message:
|
72
72
|
rdoc_options: []
|
73
73
|
require_paths:
|
74
74
|
- lib
|
@@ -76,16 +76,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
requirements:
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
79
|
+
version: '2.5'
|
80
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
87
|
-
|
88
|
-
signing_key:
|
86
|
+
rubygems_version: 3.1.6
|
87
|
+
signing_key:
|
89
88
|
specification_version: 4
|
90
89
|
summary: Lightweight HMAC signing libraries and middleware for Farday and Rack
|
91
90
|
test_files:
|