Class: Peatio::Command::Security::KeyGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/peatio/command/security.rb

Instance Method Summary collapse

Methods inherited from Base

#say, #sql_client

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/peatio/command/security.rb', line 9

def execute
  keypair = Peatio::Security::KeyGenerator.new

  if print?
    puts keypair.private, keypair.public
    puts "-----BASE64 ENCODED-----"
    puts Base64.urlsafe_encode64(keypair.public)
  else
    begin
      keypair.save(path)
      puts "Files saved in #{File.join(path, 'rsa-key')}"

    rescue IOError => e
      abort('Failed saving files')	
    end
  end
end