Class: RijnCLI
- Inherits:
-
Thor
- Object
- Thor
- RijnCLI
- Defined in:
- lib/rijn_cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
10 11 12 |
# File 'lib/rijn_cli.rb', line 10 def self.exit_on_failure? true end |
Instance Method Details
#decrypt ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/rijn_cli.rb', line 22 def decrypt value = [:value] || prompt_ask("What's the value?") key = [:key] || prompt_mask("What's the key?") write_info(Rijn.decrypt(value, key)) rescue Rijn::InvalidKeyError, Rijn::AuthenticationError => e write_error(e.) exit 1 end |
#encrypt ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/rijn_cli.rb', line 35 def encrypt value = [:value] || prompt_ask("What's the value?") key = [:key] || prompt_mask("What's the key?") write_info(Rijn.encrypt(value, key)) rescue Rijn::InvalidKeyError, Rijn::AuthenticationError => e write_error(e.) exit 1 end |
#keygen ⇒ Object
47 48 49 50 51 52 |
# File 'lib/rijn_cli.rb', line 47 def keygen write_info(Rijn.generate_key([:bits])) rescue Rijn::InvalidKeyError => e write_error(e.) exit 1 end |