Class: Fastlane::Actions::RemoveItemFromKeychainAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/secret_keeper/actions/remove_item_from_keychain_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



22
23
24
# File 'lib/fastlane/plugin/secret_keeper/actions/remove_item_from_keychain_action.rb', line 22

def self.authors
  ["Daniel Jankowski"]
end

.available_optionsObject



26
27
28
29
30
31
32
33
34
# File 'lib/fastlane/plugin/secret_keeper/actions/remove_item_from_keychain_action.rb', line 26

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :item_name,
                            env_name: "SECRET_KEEPER_ITEM_NAME",
                         description: "Item name to be removed from the keychain",
                            optional: false,
                                type: String)
  ]
end

.descriptionObject



18
19
20
# File 'lib/fastlane/plugin/secret_keeper/actions/remove_item_from_keychain_action.rb', line 18

def self.description
  "Removes the credentials from the keychain on behalf of the user"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fastlane/plugin/secret_keeper/actions/remove_item_from_keychain_action.rb', line 36

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fastlane/plugin/secret_keeper/actions/remove_item_from_keychain_action.rb', line 6

def self.run(params)
  item_name = params[:item_name]

  success = Security::InternetPassword.delete(server: item_name)
  if success 
    UI.success("Sucessfully removed an item from the keychain 🎉")
  else
    UI.error("Could not remove an item from the keychain ❌")
    UI.user_error!("Could not remove an item from the keychain. This can happen if an item you are trying to remove could not be found in the keychain.")
  end
end