class DynamoSecret::Gpg
Public Instance Methods
decrypt(data)
click to toggle source
# File lib/dynamo_secret/gpg.rb, line 3 def decrypt(data) crypto.decrypt(data).read rescue GPGME::Error::NoData $stderr.puts 'Key was found but GPG decrypt failed - skipping' data end
encrypt(data)
click to toggle source
# File lib/dynamo_secret/gpg.rb, line 10 def encrypt(data) crypto.encrypt(data, recipients: [key.uids.first.name]).read end
key()
click to toggle source
# File lib/dynamo_secret/gpg.rb, line 14 def key @gpg_key ||= GPGME::Key.find(:secret).map { |k| k if k.expires > Date.today.to_time }.first end
Private Instance Methods
crypto()
click to toggle source
# File lib/dynamo_secret/gpg.rb, line 20 def crypto @crypto ||= GPGME::Crypto.new end