rack-signature 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,11 +15,10 @@ module Rack
15
15
  # ==== Attributes
16
16
  #
17
17
  # * +app+ - A Rack app
18
- # * +key+ - A class is passed that response to +get_signature_key+ to
19
- # get the shared key used for verifying the signature
18
+ # * +key+ - The shared key used as a salt.
20
19
  #
21
- def initialize(app, klass)
22
- @app, @key = app, klass.get_signature_key
20
+ def initialize(app, key)
21
+ @app, @key = app, key
23
22
  end
24
23
 
25
24
  def call(env)
@@ -2,7 +2,7 @@ module Rack
2
2
  module Signature
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 3
5
+ PATCH = 5
6
6
 
7
7
  def self.version
8
8
  [MAJOR, MINOR, PATCH].join('.')
@@ -5,8 +5,8 @@ require_relative 'signature/verify'
5
5
 
6
6
  module Rack
7
7
  module Signature
8
- def self.new(app, klass)
9
- Verify.new(app, klass)
8
+ def self.new(app, key)
9
+ Verify.new(app, key)
10
10
  end
11
11
  end
12
12
  end
data/test/test_helper.rb CHANGED
@@ -2,4 +2,3 @@ require 'minitest/autorun'
2
2
  require 'rack/test'
3
3
  require 'rack/mock'
4
4
  require 'digest/sha2'
5
- require 'ostruct'
data/test/verify_test.rb CHANGED
@@ -5,13 +5,12 @@ describe "Verifying a signed request" do
5
5
  include Rack::Test::Methods
6
6
 
7
7
  def setup
8
- @klass = client_klass
9
8
  @shared_key = key
10
9
  @signature = expected_signature
11
10
  end
12
11
 
13
12
  let(:app) { lambda { |env| [200, {}, ['Hello World']] } }
14
- let(:rack_signature) { Rack::Signature.new(app, @klass) }
13
+ let(:rack_signature) { Rack::Signature.new(app, @shared_key) }
15
14
  let(:mock_request) { Rack::MockRequest.new(rack_signature) }
16
15
 
17
16
  describe "when a request is made without a signature" do
@@ -81,8 +80,4 @@ describe "Verifying a signed request" do
81
80
  "Z0qY8Hy4a/gJkGZI0gklzM6vZztsAVVDjA18vb1BvHg="
82
81
  end
83
82
 
84
- def client_klass
85
- OpenStruct.new(get_signature_key: key)
86
- end
87
-
88
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-signature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: