class HrrRbSsh::Authentication::Method::KeyboardInteractive::InfoRequest
Public Class Methods
new(name, instruction, language_tag, prompts, logger: nil)
click to toggle source
# File lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_request.rb, line 14 def initialize name, instruction, language_tag, prompts, logger: nil self.logger = logger @name = name @instruction = instruction @language_tag = language_tag @prompts = prompts end
Public Instance Methods
to_message()
click to toggle source
# File lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_request.rb, line 22 def to_message message = { :'message number' => Message::SSH_MSG_USERAUTH_INFO_REQUEST::VALUE, :'name' => @name, :'instruction' => @instruction, :'language tag' => @language_tag, :'num-prompts' => @prompts.size, } message_prompts = @prompts.map.with_index{ |(prompt, echo), i| [ [:"prompt[#{i+1}]", prompt], [:"echo[#{i+1}]", echo], ].inject(Hash.new){ |h, (k, v)| h.update({k => v}) } }.inject(Hash.new){ |a, b| a.merge(b) } message.merge(message_prompts) end
to_payload()
click to toggle source
# File lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_request.rb, line 39 def to_payload Message::SSH_MSG_USERAUTH_INFO_REQUEST.new(logger: logger).encode self.to_message end