11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/tokenifier/cli.rb', line 11
def optparse
OptionParser.new do |opts|
opts.banner =<<-USAGE
Usage:
tokenifier [options] COMMAND 'custom string'
Commands:
s|secret - Generates secret string
e|encrypt - Does data encryption of any string data
d|decrypt - Does data decryption from hashed data.
NOTE: You have to use a permanent secret to decrypt a data.
Tokinifier generates random secret string each execution time instead.
Examples:
tokenifier encrypt "CUSTOM DATA"
tokenifier decrypt "CUSTOM DATA"
tokenifier --secret MYSECRET e "CUSTOM DATA"
tokenifier --secret MYSECRET d "ENCRYPTED DATA"
USAGE
opts.on('-s', '--secret SECRET', 'Using custom secret phrase') do |secret|
options[:secret] = secret
end
opts.on('-h', '--help', 'Display this screen') do
puts opts
exit
end
end
end
|