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:
parent
923977ba04
commit
b6fb5cd486
1 changed files with 7 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue