spaceship/lib/spaceship/connect_api/token.rb in fastlane-2.162.0 vs spaceship/lib/spaceship/connect_api/token.rb in fastlane-2.163.0
- old
+ new
@@ -1,6 +1,7 @@
require 'jwt'
+require 'base64'
require 'openssl'
# extract pem from .p8
# openssl pkcs8 -topk8 -outform PEM -in AuthKey.p8 -out key.pem -nocrypt
@@ -37,20 +38,24 @@
end
self.create(json)
end
- def self.create(key_id: nil, issuer_id: nil, filepath: nil, key: nil, duration: nil, in_house: nil)
+ def self.create(key_id: nil, issuer_id: nil, filepath: nil, key: nil, is_key_content_base64: false, duration: nil, in_house: nil)
key_id ||= ENV['SPACESHIP_CONNECT_API_KEY_ID']
issuer_id ||= ENV['SPACESHIP_CONNECT_API_ISSUER_ID']
filepath ||= ENV['SPACESHIP_CONNECT_API_KEY_FILEPATH']
duration ||= ENV['SPACESHIP_CONNECT_API_TOKEN_DURATION']
in_house_env = ENV['SPACESHIP_CONNECT_API_IN_HOUSE']
in_house ||= !["", "no", "false", "off", "0"].include?(in_house_env) if in_house_env
key ||= ENV['SPACESHIP_CONNECT_API_KEY']
key ||= File.binread(filepath)
+
+ if !key.nil? && is_key_content_base64
+ key = Base64.decode64(key)
+ end
self.new(
key_id: key_id,
issuer_id: issuer_id,
key: OpenSSL::PKey::EC.new(key),