Sha256: 880e9548804077e2f29126ab6a65ece29406bb24ece484c96fc1cb65b81d06fd
Contents?: true
Size: 743 Bytes
Versions: 1
Compression:
Stored size: 743 Bytes
Contents
module Lockness class MasterKey def read ensure_exists File.read(path) end def generate ensure_does_not_exist master_key = SecureRandom.hex File.write(path, master_key) puts "Generated master key and saved at #{path}" end def path "#{Dir.pwd}/master.key" end def exist? File.exist?(path) end private def ensure_exists return if exist? puts "Expected to find #{path}" puts 'Run `lockness init` to generate a master.key' exit 1 end def ensure_does_not_exist return unless exist? puts "Master key already exists at #{path}!" puts 'Please delete and try again' exit 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lockness-0.1.0 | lib/lockness/master_key.rb |