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/wkd/source.rb | |
parent | 22c6c80310a8d3d3abbd1006598b4fbaec98ffd0 (diff) |
style: rubocop mostly auto-correct
Diffstat (limited to 'lib/nickserver/wkd/source.rb')
-rw-r--r-- | lib/nickserver/wkd/source.rb | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/lib/nickserver/wkd/source.rb b/lib/nickserver/wkd/source.rb index 750d3fa..b994c6c 100644 --- a/lib/nickserver/wkd/source.rb +++ b/lib/nickserver/wkd/source.rb @@ -3,33 +3,31 @@ require 'nickserver/response' require 'nickserver/wkd/url' require 'nickserver/hkp/response' -module Nickserver - module Wkd - class Source < Nickserver::Source - - def query(email) - url = Url.new(email) - status, blob = adapter.get url - Hkp::Response.new(email.to_s, armor_key(blob)) if status == 200 - end +module Nickserver::Wkd + # Query the web key directory for a given email address + class Source < Nickserver::Source + def query(email) + url = Url.new(email) + status, blob = adapter.get url + Hkp::Response.new(email.to_s, armor_key(blob)) if status == 200 + end - protected + protected - def armor_key(blob) - header + encode(blob) + footer - end + def armor_key(blob) + header + encode(blob) + footer + end - def encode(blob) - Base64.strict_encode64(blob).scan(/.{1,64}/).join "\n" - end + def encode(blob) + Base64.strict_encode64(blob).scan(/.{1,64}/).join "\n" + end - def header - "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n" - end + def header + "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n" + end - def footer - "\n-----END PGP PUBLIC KEY BLOCK-----\n" - end + def footer + "\n-----END PGP PUBLIC KEY BLOCK-----\n" end end end |