diff options
author | Azul <azul@riseup.net> | 2017-09-23 11:07:32 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2017-09-23 16:53:27 +0200 |
commit | 40916407517f4bdb75a295caf29e02d4f403349b (patch) | |
tree | 8219567c0ecdf583fdd916594ec7915ab9eb2f19 /lib/nickserver/hkp/parse_key_info.rb | |
parent | 22c6c80310a8d3d3abbd1006598b4fbaec98ffd0 (diff) |
style: rubocop mostly auto-correct
Diffstat (limited to 'lib/nickserver/hkp/parse_key_info.rb')
-rw-r--r-- | lib/nickserver/hkp/parse_key_info.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/nickserver/hkp/parse_key_info.rb b/lib/nickserver/hkp/parse_key_info.rb index 2f928a0..09dc69e 100644 --- a/lib/nickserver/hkp/parse_key_info.rb +++ b/lib/nickserver/hkp/parse_key_info.rb @@ -5,9 +5,8 @@ # Parsing a response with 12 keys and validating them takes 2ms. # So no need for memoization and making things more complex. # -module Nickserver; module Hkp +module Nickserver::Hkp class ParseKeyInfo - # for this regexp to work, the source text must end in a trailing "\n", # which the output of sks does. MATCH_PUB_KEY = /(^pub:.+?\n(^uid:.+?\n)+)/m @@ -47,7 +46,7 @@ module Nickserver; module Hkp if errors(uid).any? error_messages(uid).join "\n" else - "Could not fetch keyinfo." + 'Could not fetch keyinfo.' end end @@ -63,7 +62,7 @@ module Nickserver; module Hkp end def errors(uid) - key_infos(uid).map{|key| error_for_key(key) }.compact + key_infos(uid).map { |key| error_for_key(key) }.compact end def error_messages(uid) @@ -97,16 +96,16 @@ module Nickserver; module Hkp def error_for_key(key) if key.keylen < 2048 - "key length is too short." + 'key length is too short.' elsif key.expired? - "key expired." + 'key expired.' elsif key.revoked? - "key revoked." + 'key revoked.' elsif key.disabled? - "key disabled." + 'key disabled.' elsif key.expirationdate && key.expirationdate < Time.now - "key expired" + 'key expired' end end end -end; end +end |