Class: Akero::Cli

Inherits:
Optix::Cli
  • Object
show all
Defined in:
lib/akero/cli.rb

Overview

Akero Cli

Instance Method Summary collapse

Instance Method Details

#encrypt(_cmd, opts, argv) ⇒ Object

Raises:

  • (Optix::HelpNeeded)


49
50
51
52
53
54
55
56
# File 'lib/akero/cli.rb', line 49

def encrypt(_cmd, opts, argv)
  raise Optix::HelpNeeded if argv.empty?
  recipients = []
  argv.each do |path|
    recipients << File.read(path)
  end
  puts opts[:akero_instance].encrypt(recipients, STDIN.read, opts[:armor])
end

#id(_cmd, opts, _argv) ⇒ Object



38
39
40
# File 'lib/akero/cli.rb', line 38

def id(_cmd, opts, _argv)
  puts opts[:akero_instance].id
end

#pk(_cmd, opts, _argv) ⇒ Object



32
33
34
# File 'lib/akero/cli.rb', line 32

def pk(_cmd, opts, _argv)
  puts opts[:akero_instance].public_key
end

#receive(_cmd, opts, _argv) ⇒ Object



68
69
70
71
72
# File 'lib/akero/cli.rb', line 68

def receive(_cmd, opts, _argv)
  msg = opts[:akero_instance].receive(STDIN.read)
  puts msg.body
  STDERR.puts msg.from_pk if opts[:key]
end

#sign(_cmd, opts, _argv) ⇒ Object



61
62
63
# File 'lib/akero/cli.rb', line 61

def sign(_cmd, opts, _argv)
  puts opts[:akero_instance].sign(STDIN.read, opts[:armor])
end