1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-23 13:57:52 +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| Gem::Package::TarReader.new(File.open(@wallet_file)) do |tar|
tar.each do |f| tar.each do |f|
case f.full_name case f.full_name
when 'wallet/config.yml' when 'wallet/config.gpg'
@config = YAML.load(f.read) @config = YAML.load(decrypt(f.read))
check_config check_config
when 'wallet/meta.gpg' when 'wallet/meta.gpg'
@ -109,6 +109,11 @@ class MPW
io.write(data_encrypt) io.write(data_encrypt)
end 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| @passwords.each do |id, password|
tar.add_file_simple("wallet/passwords/#{id}.gpg", 0400, password.length) do |io| tar.add_file_simple("wallet/passwords/#{id}.gpg", 0400, password.length) do |io|
io.write(password) io.write(password)