class Itamae::Secrets::Keychain
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/itamae/secrets/keychain.rb, line 9 def initialize(path) @path = Pathname.new(path) end
Public Instance Methods
exist?(name)
click to toggle source
# File lib/itamae/secrets/keychain.rb, line 15 def exist?(name) @path.join(name).exist? end
load(name)
click to toggle source
# File lib/itamae/secrets/keychain.rb, line 19 def load(name) AesKey.load_json @path.join(name).read rescue Errno::ENOENT raise KeyNotFound, "Couldn't find key #{name.inspect}" end
save(key)
click to toggle source
# File lib/itamae/secrets/keychain.rb, line 25 def save(key) open(@path.join(key.name), 'w', 0600) do |io| io.puts key.to_json end end