Class: Match::Encryption::OpenSSL
- Defined in:
- match/lib/match/encryption/openssl.rb
Instance Attribute Summary collapse
-
#keychain_name ⇒ Object
Returns the value of attribute keychain_name.
-
#working_directory ⇒ Object
Returns the value of attribute working_directory.
Class Method Summary collapse
Instance Method Summary collapse
-
#clear_password ⇒ Object
removes the password from the keychain again.
- #decrypt_files ⇒ Object
- #encrypt_files ⇒ Object
-
#initialize(keychain_name: nil, working_directory: nil) ⇒ OpenSSL
constructor
A new instance of OpenSSL.
- #store_password(password) ⇒ Object
Constructor Details
#initialize(keychain_name: nil, working_directory: nil) ⇒ OpenSSL
Returns a new instance of OpenSSL.
26 27 28 29 |
# File 'match/lib/match/encryption/openssl.rb', line 26 def initialize(keychain_name: nil, working_directory: nil) self.keychain_name = keychain_name self.working_directory = working_directory end |
Instance Attribute Details
#keychain_name ⇒ Object
Returns the value of attribute keychain_name.
13 14 15 |
# File 'match/lib/match/encryption/openssl.rb', line 13 def keychain_name @keychain_name end |
#working_directory ⇒ Object
Returns the value of attribute working_directory.
15 16 17 |
# File 'match/lib/match/encryption/openssl.rb', line 15 def working_directory @working_directory end |
Class Method Details
.configure(params) ⇒ Object
17 18 19 20 21 22 |
# File 'match/lib/match/encryption/openssl.rb', line 17 def self.configure(params) return self.new( keychain_name: params[:keychain_name], working_directory: params[:working_directory] ) end |
Instance Method Details
#clear_password ⇒ Object
removes the password from the keychain again
67 68 69 |
# File 'match/lib/match/encryption/openssl.rb', line 67 def clear_password Security::InternetPassword.delete(server: server_name(self.keychain_name)) end |
#decrypt_files ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'match/lib/match/encryption/openssl.rb', line 42 def decrypt_files files = [] 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 return end UI.success("🔓 Decrypted '#{File.basename(current)}'") if FastlaneCore::Globals.verbose? end UI.success("🔓 Successfully decrypted certificates repo") return files end |
#encrypt_files ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'match/lib/match/encryption/openssl.rb', line 31 def encrypt_files files = [] 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 UI.success("🔒 Successfully encrypted certificates repo") return files end |
#store_password(password) ⇒ Object
62 63 64 |
# File 'match/lib/match/encryption/openssl.rb', line 62 def store_password(password) Security::InternetPassword.add(server_name(self.keychain_name), "", password) end |