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.
Instance Method Summary collapse
-
#initialize(opts, input_handler) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(opts, input_handler) ⇒ Handler
Returns a new instance of Handler.
16 17 18 19 |
# File 'lib/shhh/app/private_key/handler.rb', line 16 def initialize(opts, input_handler) self.opts = opts self.input_handler = input_handler 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.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/shhh/app/private_key/handler.rb', line 23 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). && key.nil? raise e end end if @key && @key.length > 45 @key = Decryptor.new(Base64Decoder.new(key).key, input_handler).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 |