signpost-signer 0.1.2 → 0.1.3
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/bin/signpost-sign-darwin +0 -0
- data/bin/signpost-sign-linux +0 -0
- data/lib/signpost/signer/version.rb +1 -1
- data/lib/signpost/signer.rb +4 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56ebc583666ccaab5ff91eebcebdcfd2e045c01a
|
4
|
+
data.tar.gz: a57bbb4d8d6a022c3e2f1417354be0a34e8387ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73a7ba5dec6b10e196e2057d4cd6f8394db4595447897327598966e3fd08ee9341008217a669d7ff225e606dd37759b6287cba5e7b30f441f30d55b38002e429
|
7
|
+
data.tar.gz: 1b7551916a0da7c64ec9d38fb2329d7da873419ce352b66cc4ec37ba912e8b6db63ded5457d178d9b96d5dca0b035349d5c350b2a63e95810ae742e599fde901
|
data/bin/signpost-sign-darwin
CHANGED
Binary file
|
data/bin/signpost-sign-linux
CHANGED
Binary file
|
data/lib/signpost/signer.rb
CHANGED
@@ -16,28 +16,14 @@ module Signpost # :nodoc:
|
|
16
16
|
end
|
17
17
|
|
18
18
|
SignatureFailed = Class.new(Signpost::SignpostError)
|
19
|
-
SSHKeyError = Class.new(Signpost::SignpostError)
|
20
19
|
|
21
|
-
|
22
|
-
File.expand_path('~/.ssh/id_ed25519'),
|
23
|
-
File.expand_path('~/.ssh/id_rsa')
|
24
|
-
].freeze
|
25
|
-
|
26
|
-
def self.sign_request(request, keyfile = find_keyfile)
|
20
|
+
def self.sign_request(request)
|
27
21
|
request['Date'] = Time.now.httpdate unless request['Date']
|
28
22
|
canonical = canonicalize(request)
|
29
|
-
request['X-Signpost-Signature'] = sign(canonical
|
23
|
+
request['X-Signpost-Signature'] = sign(canonical)
|
30
24
|
request
|
31
25
|
end
|
32
26
|
|
33
|
-
def self.find_keyfile
|
34
|
-
if kf = ENV['SIGNPOST_KEYFILE']
|
35
|
-
return File.expand_path(kf)
|
36
|
-
end
|
37
|
-
KEYFILE_CANDIDATES.each { |kf| return kf if File.exist?(kf) }
|
38
|
-
raise(SSHKeyError, "couldn't find a usable SSH key")
|
39
|
-
end
|
40
|
-
|
41
27
|
def self.canonicalize(request)
|
42
28
|
verb = request.method
|
43
29
|
date = request.fetch('Date')
|
@@ -47,10 +33,8 @@ module Signpost # :nodoc:
|
|
47
33
|
[verb, date, host, path].join("\n") + "\n"
|
48
34
|
end
|
49
35
|
|
50
|
-
def self.sign(message
|
51
|
-
out, err, stat = Open3.capture3(
|
52
|
-
BIN_SIGNER, keyfile, stdin_data: message
|
53
|
-
)
|
36
|
+
def self.sign(message)
|
37
|
+
out, err, stat = Open3.capture3(BIN_SIGNER, stdin_data: message)
|
54
38
|
return out.strip if stat.success?
|
55
39
|
raise(SignatureFailed, "signpost-sign failed: #{err.strip}")
|
56
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signpost-signer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|