class Conceal::CLI
Protected Class Methods
exit_on_failure?()
click to toggle source
# File lib/conceal/cli.rb, line 50 def self.exit_on_failure? true end
Public Instance Methods
decrypt(key_file)
click to toggle source
# File lib/conceal/cli.rb, line 11 def decrypt(key_file) require 'conceal' # load the key raise Thor::Error, 'ERROR: key file is not readable or does not exist' unless File.readable?(key_file) key = IO.read(key_file) # decrypt from stdin encrypted_data = $stdin.read plaintext = Conceal.decrypt(encrypted_data, key: key) $stdout.write(plaintext) $stdout.write("\n") if options[:newline] end
encrypt(key_file)
click to toggle source
# File lib/conceal/cli.rb, line 28 def encrypt(key_file) require 'conceal' # load the key raise Thor::Error, 'ERROR: key file is not readable or does not exist' unless File.readable?(key_file) key = IO.read(key_file) # encrypt from stdin plaintext = $stdin.read encrypted_data = Conceal.encrypt(plaintext, key: key) $stdout.write(encrypted_data) $stdout.write("\n") if options[:newline] end
version()
click to toggle source
# File lib/conceal/cli.rb, line 44 def version require 'conceal/version' puts VERSION end