Class: Leeloo::SecretController
Instance Method Summary
collapse
#initialize
Instance Method Details
#display ⇒ Object
98
99
100
|
# File 'lib/leeloo/controller.rb', line 98
def display
@output.render_secret @secret
end
|
#read(name) ⇒ Object
76
77
78
|
# File 'lib/leeloo/controller.rb', line 76
def read name
@secret = @keystore.secret_from_name(name)
end
|
#remove(name) ⇒ Object
94
95
96
97
|
# File 'lib/leeloo/controller.rb', line 94
def remove name
@secret = @keystore.secret_from_name(name)
@secret.erase
end
|
#write(name) ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/leeloo/controller.rb', line 79
def write name
phrase = nil
phrase = STDIN.read if @options.stdin
phrase = SecureRandom.base64(32).truncate(@options.generate.to_i) if @options.generate
unless phrase
phrase = password "secret"
confirm = password "confirm it"
abort "not the same secret" unless phrase == confirm
end
@secret = @keystore.secret_from_name(name)
@secret.write(phrase)
end
|