http_signatures 1.0.1 → 1.0.2
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.
- checksums.yaml +4 -4
- data/lib/http_signatures.rb +0 -1
- data/lib/http_signatures/algorithm.rb +0 -1
- data/lib/http_signatures/version.rb +1 -1
- data/spec/algorithm_spec.rb +0 -1
- data/spec/context_spec.rb +4 -4
- data/spec/signer_spec.rb +6 -6
- metadata +2 -3
- data/lib/http_signatures/algorithm/null.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a264bdc74bd252c38f2327f6152b7ac67ddac76
|
4
|
+
data.tar.gz: 86193ad941a2f492e16ce8a20a9938e6e561442b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e1dd75f46c8dd1c82b878a893c9b94bee453c2ef33fdfb170ee34fc52151a8e61004dbdecf208c28197af76ff337db7a1dc4a76d39feead2b03b2b5f9bcb45
|
7
|
+
data.tar.gz: 3df85e7bcd62cba2167211a7379f77662238b4a8ea87a7b64e933e8a77a580e40ce3c536d48a1286e68d9995086642734db2b6922805590f9fd0f25d1731fc93
|
data/lib/http_signatures.rb
CHANGED
data/spec/algorithm_spec.rb
CHANGED
@@ -6,7 +6,6 @@ RSpec.describe HttpSignatures::Algorithm do
|
|
6
6
|
let(:input) { "the string\nto sign" }
|
7
7
|
|
8
8
|
{
|
9
|
-
"null" => "bnVsbA==", # "null"
|
10
9
|
"hmac-sha1" => "bXPeVc5ySIyeUapN7mpMsJRnxVg=",
|
11
10
|
"hmac-sha256" => "hRQ5zpbGudR1hokS4PqeAkveKmz2dd8SCgV8OHcramI=",
|
12
11
|
}.each do |name, base64_signature|
|
data/spec/context_spec.rb
CHANGED
@@ -8,7 +8,7 @@ RSpec.describe HttpSignatures::Context do
|
|
8
8
|
subject(:context) do
|
9
9
|
HttpSignatures::Context.new(
|
10
10
|
keys: {"hello" => "world"},
|
11
|
-
algorithm: "
|
11
|
+
algorithm: "hmac-sha256",
|
12
12
|
headers: %w{(request-target) date content-length},
|
13
13
|
)
|
14
14
|
end
|
@@ -17,7 +17,7 @@ RSpec.describe HttpSignatures::Context do
|
|
17
17
|
it "instantiates Signer with key, algorithm, headers" do
|
18
18
|
expect(HttpSignatures::Signer).to receive(:new) do |args|
|
19
19
|
expect(args[:key]).to eq(HttpSignatures::Key.new(id: "hello", secret: "world"))
|
20
|
-
expect(args[:algorithm].name).to eq("
|
20
|
+
expect(args[:algorithm].name).to eq("hmac-sha256")
|
21
21
|
expect(args[:header_list].to_a).to eq(%w{(request-target) date content-length})
|
22
22
|
end
|
23
23
|
context.signer
|
@@ -40,7 +40,7 @@ RSpec.describe HttpSignatures::Context do
|
|
40
40
|
HttpSignatures::Context.new(
|
41
41
|
keys: {"hello" => "world", "another" => "key"},
|
42
42
|
signing_key_id: "another",
|
43
|
-
algorithm: "
|
43
|
+
algorithm: "hmac-sha256",
|
44
44
|
headers: %w{(request-target) date content-length},
|
45
45
|
)
|
46
46
|
end
|
@@ -49,7 +49,7 @@ RSpec.describe HttpSignatures::Context do
|
|
49
49
|
it "instantiates Signer with key, algorithm, headers" do
|
50
50
|
expect(HttpSignatures::Signer).to receive(:new) do |args|
|
51
51
|
expect(args[:key]).to eq(HttpSignatures::Key.new(id: "another", secret: "key"))
|
52
|
-
expect(args[:algorithm].name).to eq("
|
52
|
+
expect(args[:algorithm].name).to eq("hmac-sha256")
|
53
53
|
expect(args[:header_list].to_a).to eq(%w{(request-target) date content-length})
|
54
54
|
end
|
55
55
|
context.signer
|
data/spec/signer_spec.rb
CHANGED
@@ -8,7 +8,7 @@ RSpec.describe HttpSignatures::Signer do
|
|
8
8
|
HttpSignatures::Signer.new(key: key, algorithm: algorithm, header_list: header_list)
|
9
9
|
end
|
10
10
|
let(:key) { HttpSignatures::Key.new(id: "pda", secret: "sh") }
|
11
|
-
let(:algorithm) { HttpSignatures::Algorithm::
|
11
|
+
let(:algorithm) { HttpSignatures::Algorithm::Hmac.new("sha256") }
|
12
12
|
let(:header_list) { HttpSignatures::HeaderList.new(["date", "content-type"]) }
|
13
13
|
|
14
14
|
let(:message) do
|
@@ -49,7 +49,7 @@ RSpec.describe HttpSignatures::Signer do
|
|
49
49
|
expect(algorithm).to receive(:sign).with(
|
50
50
|
"sh",
|
51
51
|
["date: #{EXAMPLE_DATE}", "content-type: text/plain"].join("\n")
|
52
|
-
).at_least(:once).and_return("
|
52
|
+
).at_least(:once).and_return("static")
|
53
53
|
signer.sign(message)
|
54
54
|
end
|
55
55
|
it "returns reference to the mutated input" do
|
@@ -67,14 +67,14 @@ RSpec.describe HttpSignatures::Signer do
|
|
67
67
|
end
|
68
68
|
it "matches expected Authorization header" do
|
69
69
|
expect(message["Authorization"]).to eq(
|
70
|
-
'Signature keyId="pda",algorithm="
|
71
|
-
'headers="date content-type",signature="
|
70
|
+
'Signature keyId="pda",algorithm="hmac-sha256",' +
|
71
|
+
'headers="date content-type",signature="0ZoJq6cxYZRXe+TN85whSuQgJsam1tRyIal7ni+RMXA="'
|
72
72
|
)
|
73
73
|
end
|
74
74
|
it "matches expected Signature header" do
|
75
75
|
expect(message["Signature"]).to eq(
|
76
|
-
'keyId="pda",algorithm="
|
77
|
-
'headers="date content-type",signature="
|
76
|
+
'keyId="pda",algorithm="hmac-sha256",' +
|
77
|
+
'headers="date content-type",signature="0ZoJq6cxYZRXe+TN85whSuQgJsam1tRyIal7ni+RMXA="'
|
78
78
|
)
|
79
79
|
end
|
80
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_signatures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Annesley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- lib/http_signatures.rb
|
71
71
|
- lib/http_signatures/algorithm.rb
|
72
72
|
- lib/http_signatures/algorithm/hmac.rb
|
73
|
-
- lib/http_signatures/algorithm/null.rb
|
74
73
|
- lib/http_signatures/context.rb
|
75
74
|
- lib/http_signatures/header_list.rb
|
76
75
|
- lib/http_signatures/key.rb
|