Class: Shhh::App::PrivateKey::Handler
- Inherits:
-
Object
- Object
- Shhh::App::PrivateKey::Handler
- Includes:
- Shhh
- Defined in:
- lib/shhh/app/private_key/handler.rb
Overview
This class figures out what is the private key that is provided to be used.
Constant Summary
Constants included from Shhh
Instance Attribute Summary collapse
-
#input_handler ⇒ Object
Returns the value of attribute input_handler.
-
#key ⇒ String
Key Private key detected.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#password_cache ⇒ Object
Returns the value of attribute password_cache.
Instance Method Summary collapse
-
#initialize(opts, input_handler, password_cache) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(opts, input_handler, password_cache) ⇒ Handler
Returns a new instance of Handler.
16 17 18 19 20 |
# File 'lib/shhh/app/private_key/handler.rb', line 16 def initialize(opts, input_handler, password_cache) self.opts = opts self.input_handler = input_handler self.password_cache = password_cache end |
Instance Attribute Details
#input_handler ⇒ Object
Returns the value of attribute input_handler.
13 14 15 |
# File 'lib/shhh/app/private_key/handler.rb', line 13 def input_handler @input_handler end |
#key ⇒ String
Returns key Private key detected.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/shhh/app/private_key/handler.rb', line 24 def key return @key if @key @key = begin Detector.new(opts, input_handler).key rescue Shhh::Errors::Error => e if Shhh::App::Args.new(opts).specify_key? && key.nil? raise e end end if @key && @key.length > 45 @key = Decryptor.new(Base64Decoder.new(key).key, input_handler, password_cache).key end @key end |
#opts ⇒ Object
Returns the value of attribute opts.
13 14 15 |
# File 'lib/shhh/app/private_key/handler.rb', line 13 def opts @opts end |
#password_cache ⇒ Object
Returns the value of attribute password_cache.
13 14 15 |
# File 'lib/shhh/app/private_key/handler.rb', line 13 def password_cache @password_cache end |