match/lib/match/encryption/openssl.rb in fastlane_hotfix-2.165.1 vs match/lib/match/encryption/openssl.rb in fastlane_hotfix-2.187.0

- old
+ new

@@ -26,12 +26,13 @@ def initialize(keychain_name: nil, working_directory: nil) self.keychain_name = keychain_name self.working_directory = working_directory end - def encrypt_files + def encrypt_files(password: nil) files = [] + password ||= fetch_password! iterate(self.working_directory) do |current| files << current encrypt_specific_file(path: current, password: password) UI.success("🔒 Encrypted '#{File.basename(current)}'") if FastlaneCore::Globals.verbose? end @@ -39,20 +40,21 @@ return files end def decrypt_files files = [] + password = fetch_password! iterate(self.working_directory) do |current| files << current begin decrypt_specific_file(path: current, password: password) rescue => ex UI.verbose(ex.to_s) UI.error("Couldn't decrypt the repo, please make sure you enter the right password!") UI.user_error!("Invalid password passed via 'MATCH_PASSWORD'") if ENV["MATCH_PASSWORD"] clear_password - self.decrypt_files # call itself + self.decrypt_files # Call itself return end UI.success("🔓 Decrypted '#{File.basename(current)}'") if FastlaneCore::Globals.verbose? end UI.success("🔓 Successfully decrypted certificates repo") @@ -81,10 +83,10 @@ def server_name(keychain_name) ["match", keychain_name].join("_") end # Access the MATCH_PASSWORD, either from ENV variable, Keychain or user input - def password + def fetch_password! password = ENV["MATCH_PASSWORD"] unless password item = Security::InternetPassword.find(server: server_name(self.keychain_name)) password = item.password if item end