mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-21 10:20:05 +00:00
fix recipients for encrypt
This commit is contained in:
parent
e45c528a3f
commit
1681db0edb
2 changed files with 5 additions and 6 deletions
|
@ -79,9 +79,6 @@ class Cli
|
||||||
# Setup a new GPG key
|
# Setup a new GPG key
|
||||||
# @args: gpg_key -> the key name
|
# @args: gpg_key -> the key name
|
||||||
def setup_gpg_key(gpg_key)
|
def setup_gpg_key(gpg_key)
|
||||||
puts I18n.t('form.setup_gpg_key.title')
|
|
||||||
puts '--------------------'
|
|
||||||
ask = ask(I18n.t('form.setup_gpg_key.ask')).to_s
|
|
||||||
password = ask(I18n.t('form.setup_gpg_key.password')) {|q| q.echo = false}
|
password = ask(I18n.t('form.setup_gpg_key.password')) {|q| q.echo = false}
|
||||||
confirm = ask(I18n.t('form.setup_gpg_key.confirm_password')) {|q| q.echo = false}
|
confirm = ask(I18n.t('form.setup_gpg_key.confirm_password')) {|q| q.echo = false}
|
||||||
|
|
||||||
|
@ -294,6 +291,8 @@ class Cli
|
||||||
# Display the wallet
|
# Display the wallet
|
||||||
# @args: wallet -> the wallet name
|
# @args: wallet -> the wallet name
|
||||||
def get_wallet(wallet=nil)
|
def get_wallet(wallet=nil)
|
||||||
|
@config.is_valid?
|
||||||
|
|
||||||
if wallet.to_s.empty?
|
if wallet.to_s.empty?
|
||||||
wallets = Dir.glob("#{@config.wallet_dir}/*.mpw")
|
wallets = Dir.glob("#{@config.wallet_dir}/*.mpw")
|
||||||
|
|
||||||
|
@ -390,7 +389,7 @@ class Cli
|
||||||
@mpw.sync(true) if @sync
|
@mpw.sync(true) if @sync
|
||||||
|
|
||||||
puts "#{I18n.t('form.add_item.valid')}".green
|
puts "#{I18n.t('form.add_item.valid')}".green
|
||||||
#rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #13: #{e}".red
|
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -500,12 +500,12 @@ class MPW
|
||||||
recipients = []
|
recipients = []
|
||||||
crypto = GPGME::Crypto.new(armor: true, always_trust: true)
|
crypto = GPGME::Crypto.new(armor: true, always_trust: true)
|
||||||
|
|
||||||
|
recipients.push(@key)
|
||||||
@keys.each_key do |key|
|
@keys.each_key do |key|
|
||||||
|
next if key == @key
|
||||||
recipients.push(key)
|
recipients.push(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
recipients.push(@key) if not recipients.index(@key).nil?
|
|
||||||
|
|
||||||
return crypto.encrypt(data, recipients: recipients).read
|
return crypto.encrypt(data, recipients: recipients).read
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
raise "#{I18n.t('error.gpg_file.encrypt')}\n#{e}"
|
raise "#{I18n.t('error.gpg_file.encrypt')}\n#{e}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue