mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-23 13:57:52 +00:00
auto import public key in mpw file
This commit is contained in:
parent
0bf8d4e4ba
commit
855640c932
1 changed files with 7 additions and 2 deletions
|
@ -45,7 +45,13 @@ class MPW
|
|||
data = decrypt(f.read)
|
||||
|
||||
when /^wallet\/keys\/(?<key>.+)\.pub$/
|
||||
@keys[Regexp.last_match('key')] = f.read
|
||||
key = Regexp.last_match('key')
|
||||
|
||||
if GPGME::Key.find(:public, key).length == 0
|
||||
GPGME::Key.import(f.read, armor: true)
|
||||
end
|
||||
|
||||
@keys[key] = f.read
|
||||
|
||||
when /^wallet\/passwords\/(?<id>[a-zA-Z0-9]+)\.gpg$/
|
||||
@passwords[Regexp.last_match('id')] = f.read
|
||||
|
@ -143,7 +149,6 @@ class MPW
|
|||
if not file.nil? and File.exists?(file)
|
||||
data = File.open(file).read
|
||||
GPGME::Key.import(data, armor: true)
|
||||
puts GPGME::Key.find(key)[0].trust
|
||||
else
|
||||
data = GPGME::Key.export(key, armor: true).read
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue