1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-27 07:33:05 +00:00

encrypt config wallet

This commit is contained in:
nishiki 2016-05-08 22:06:25 +02:00
parent 923977ba04
commit b6fb5cd486

View file

@ -37,8 +37,8 @@ class MPW
Gem::Package::TarReader.new(File.open(@wallet_file)) do |tar|
tar.each do |f|
case f.full_name
when 'wallet/config.yml'
@config = YAML.load(f.read)
when 'wallet/config.gpg'
@config = YAML.load(decrypt(f.read))
check_config
when 'wallet/meta.gpg'
@ -109,6 +109,11 @@ class MPW
io.write(data_encrypt)
end
config = @config.to_yaml
tar.add_file_simple('wallet/config.gpg', 0400, config.length) do |io|
io.write(config)
end
@passwords.each do |id, password|
tar.add_file_simple("wallet/passwords/#{id}.gpg", 0400, password.length) do |io|
io.write(password)