class Fastlane::Actions::ReadItemFromKeychainAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/secret_keeper/actions/read_item_from_keychain_action.rb, line 23
def self.authors
  ["Daniel Jankowski"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/secret_keeper/actions/read_item_from_keychain_action.rb, line 31
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :item_name,
                            env_name: "SECRET_KEEPER_ITEM_NAME",
                         description: "Item name for a given password stored in the keychain",
                            optional: false,
                                type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/secret_keeper/actions/read_item_from_keychain_action.rb, line 19
def self.description
  "Reads the password from the keychain for a given item"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/secret_keeper/actions/read_item_from_keychain_action.rb, line 41
def self.is_supported?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/secret_keeper/actions/read_item_from_keychain_action.rb, line 27
def self.return_value
  "Returns password as a plain text"
end
run(params) click to toggle source
# File lib/fastlane/plugin/secret_keeper/actions/read_item_from_keychain_action.rb, line 6
def self.run(params)
  item_name = params[:item_name]

  item = Security::InternetPassword.find(server: item_name)
  if item 
    UI.success("Sucessfully read an item from the keychain 🎉")
    return item.password 
  else
    UI.error("Could not read an item from the keychain. Please make sure '#{item_name}' item exists in the keychain ❌")
    return nil
  end
end