Class: Lockness::MasterKey
- Inherits:
-
Object
- Object
- Lockness::MasterKey
- Defined in:
- lib/lockness/master_key.rb
Instance Method Summary collapse
Instance Method Details
#exist? ⇒ Boolean
24 25 26 |
# File 'lib/lockness/master_key.rb', line 24 def exist? File.exist?(path) end |
#generate ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/lockness/master_key.rb', line 10 def generate ensure_does_not_exist master_key = SecureRandom.hex File.write(path, master_key) puts "Generated master key and saved at #{path}" end |
#path ⇒ Object
20 21 22 |
# File 'lib/lockness/master_key.rb', line 20 def path "#{Dir.pwd}/master.key" end |
#read ⇒ Object
4 5 6 7 8 |
# File 'lib/lockness/master_key.rb', line 4 def read ensure_exists File.read(path).strip end |