signpost-signer 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03ec990f21112ed52f8b82c9e6c193583e5ca374
4
- data.tar.gz: fe6d1975f70a60c401e025a15413f23e2be71f18
3
+ metadata.gz: 56ebc583666ccaab5ff91eebcebdcfd2e045c01a
4
+ data.tar.gz: a57bbb4d8d6a022c3e2f1417354be0a34e8387ff
5
5
  SHA512:
6
- metadata.gz: e1c1a0d4730f71514446691e8cc478e3261a6ee8a84bd4e684054212a8544fb0c077e7a7dd51a8fc26df684ba48d704662753919584aa3897315f6f3ae659b2d
7
- data.tar.gz: a8cc56c26b93a84b920fafb4716490cb95639738f662326ff39d7d896b4b1558c0fc42c998247bbac77654e94bbbe3438521b12bd1b90031af235492e291c0ef
6
+ metadata.gz: 73a7ba5dec6b10e196e2057d4cd6f8394db4595447897327598966e3fd08ee9341008217a669d7ff225e606dd37759b6287cba5e7b30f441f30d55b38002e429
7
+ data.tar.gz: 1b7551916a0da7c64ec9d38fb2329d7da873419ce352b66cc4ec37ba912e8b6db63ded5457d178d9b96d5dca0b035349d5c350b2a63e95810ae742e599fde901
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  module Signpost
2
2
  module Signer
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -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
- KEYFILE_CANDIDATES = [
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, keyfile)
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, keyfile)
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.2
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-09-15 00:00:00.000000000 Z
11
+ date: 2016-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler