Method: GPGME::KeyCommon#usable_for?

Defined in:
lib/gpgme/key_common.rb

#usable_for?(purposes) ⇒ Boolean

Checks if the key is capable of all of these actions. If empty array is passed then will return true.

Returns false if the keys trust has been invalidated.

Returns:

  • (Boolean)


31
32
33
34
35
36
37
# File 'lib/gpgme/key_common.rb', line 31

def usable_for?(purposes)
  unless purposes.kind_of? Array
    purposes = [purposes]
  end
  return false if [:revoked, :expired, :disabled, :invalid].include? trust
  return (purposes - capability).empty?
end