fastlane-plugin-samsungknox 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 687b05c8ca644f58b824440eb3432392a52c5fa773de88bfe372c736568b5cf8
4
- data.tar.gz: '08b1eede7d6c7141ce4e503c8417d77a5ab6ee91c1de7a9890f7a28fec80f450'
3
+ metadata.gz: 13f339b3a0c91bae5b4367b52ddb51edc1677ffb4d648cb4d2bc2ea4edbdb59f
4
+ data.tar.gz: a473a896843e29ac7ba7c4e35fadeb4b887f6cd0c8d02306bfbccda9679b92b5
5
5
  SHA512:
6
- metadata.gz: 1c7a159f8251cac45b64f7b34a64064dabbc7154c6ce85562aa8324000bfa765b87b4b04d286e1405d09ba27dec76ae89dcaa19ef4a6130a16a47c068a9630d0
7
- data.tar.gz: 0c636b4e3f83bea1cd84d3b9163800db4aadca4b4a5b2d3fb02866c88215ea3c4fa97b36def2a245448bc9841377666b2a420adb0b02cf0e2d28c46bf04057b3
6
+ metadata.gz: f55918dc6f651cb7206f0b3bbf83e1f8a209db04877d328e7b4ff2fdc485a3da056f4d8d5b321b7e7792e39f7a11794f9ccc3dd2dc84a435f84d7b91b514431b
7
+ data.tar.gz: 4a619558aaee807883d1ab61560d56b4e50301bd7f0ea7a0060112e704b0b315b2c9fb310524f60f88dc1e148d2bb89f6c8c337d920da881018f3f3fa7f2da58
@@ -7,16 +7,14 @@ module Fastlane
7
7
  module Actions
8
8
  class KnoxConfigureLibraryUploadAppAction < Action
9
9
  def self.run(params)
10
- UI.message("Welcome to Knox Configure Library Application Upload Fastlane!")
10
+ UI.header("Step: KC Upload App")
11
11
 
12
- credential = {
12
+ access_token = KnoxTokenGenerator.generate_knox_access_token({
13
13
  path: params[:credential_path],
14
14
  key: params[:credential_key]
15
- }
16
-
17
- access_token = KnoxTokenGenerator.generate_knox_access_token(
18
- credential,
19
- params[:clientIdentifierJwtToken]
15
+ },
16
+ params[:clientIdentifierJwtToken],
17
+ params[:api_region].downcase
20
18
  )
21
19
 
22
20
  # application_info = KnoxConfigureLibraryAlreadyExistsAppVersionCheck.search_by_package_name(
@@ -26,11 +24,9 @@ module Fastlane
26
24
 
27
25
  KnoxConfigureLibraryUploadApp.upload_app(
28
26
  access_token[:token],
29
- params[:app_file_path]
27
+ params[:app_file_path],
28
+ params[:app_description]
30
29
  )
31
-
32
- UI.success(access_token)
33
-
34
30
  end
35
31
 
36
32
  def self.description
@@ -42,7 +38,6 @@ module Fastlane
42
38
  end
43
39
 
44
40
  def self.return_value
45
- # If your method provides a return value, you can describe here what it does
46
41
  end
47
42
 
48
43
  def self.details
@@ -59,7 +54,9 @@ module Fastlane
59
54
  # env_name: "KC_PACKAGE_NAME",
60
55
  # description: "",
61
56
  # optional: false),
62
- FastlaneCore::ConfigItem.new(key: :description,
57
+
58
+ # App Configuretion
59
+ FastlaneCore::ConfigItem.new(key: :app_description,
63
60
  env_name: "KC_APP_DESCRIPTION",
64
61
  description: "",
65
62
  optional: true),
@@ -67,6 +64,16 @@ module Fastlane
67
64
  env_name: "KC_APP_FILE_PATH",
68
65
  description: "Path to your APK file",
69
66
  optional: true),
67
+
68
+ # Knox Credential Configuration
69
+ FastlaneCore::ConfigItem.new(key: :api_region,
70
+ env_name: "KC_API_REGION",
71
+ description: "",
72
+ optional: false,
73
+ verify_block: proc do |value|
74
+ UI.user_error!("No API region for Knox Credential given, pass using `api_region: 'value'`") unless (value and not value.empty?)
75
+ end
76
+ ),
70
77
  FastlaneCore::ConfigItem.new(key: :credential_key,
71
78
  env_name: "KNOX_CREDENTIAL_KEY",
72
79
  description: "",
@@ -5,7 +5,7 @@ module Fastlane
5
5
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
6
 
7
7
  module KnoxConfigureLibraryUploadApp
8
- def self.upload_app(access_token, app_file_path)
8
+ def self.upload_app(access_token, app_file_path, app_description)
9
9
  uri = URI('https://eu-kcs-api.samsungknox.com/kcs/v1/kc/applications/upload')
10
10
 
11
11
  File.open(app_file_path) do |file|
@@ -54,8 +54,8 @@ module Fastlane
54
54
  base64_public_key
55
55
  end
56
56
 
57
- def self.get_access_token(validity_for_access_token_in_minutes, base64_encoded_string_public_key, client_identifier_jwt)
58
- uri = URI('https://eu-kcs-api.samsungknox.com/ams/v1/users/accesstoken')
57
+ def self.get_access_token(validity_for_access_token_in_minutes, base64_encoded_string_public_key, client_identifier_jwt, api_region)
58
+ uri = URI("https://#{api_region}-kcs-api.samsungknox.com/ams/v1/users/accesstoken")
59
59
 
60
60
  request_body = {
61
61
  base64EncodedStringPublicKey: base64_encoded_string_public_key,
@@ -74,8 +74,8 @@ module Fastlane
74
74
  end
75
75
  end
76
76
 
77
- def self.generate_knox_access_token(credential, clientIdentifierJwtToken)
78
- UI.header('Step: 🔐 KNOX ACCESS TOKEN GENERATE STEP 🔐 ')
77
+ def self.generate_knox_access_token(credential, clientIdentifierJwtToken, api_region)
78
+ UI.header('Step: 🔐 KNOX ACCESS TOKEN GENERATE 🔐 ')
79
79
 
80
80
  UI.message('⏳ Sign the knox token using the credential...')
81
81
  generate_signed_jwt_result = generate_signed_jwt(credential, clientIdentifierJwtToken, true)
@@ -84,7 +84,7 @@ module Fastlane
84
84
  sign_by_client_identifier_jwt_token = generate_signed_jwt_result[:token]
85
85
 
86
86
  UI.message('⏳ Request the knox client identifier jwt ams access token...')
87
- ams_access_token = get_access_token(30, base64_encoding_public_Key, sign_by_client_identifier_jwt_token)
87
+ ams_access_token = get_access_token(30, base64_encoding_public_Key, sign_by_client_identifier_jwt_token, api_region)
88
88
  UI.message('⏳ Sign the knox token using the ams access token and private key...')
89
89
  token = generate_signed_jwt(credential, ams_access_token, false)
90
90
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Samsungknox
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-samsungknox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jieey1140
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2023-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -163,7 +163,6 @@ files:
163
163
  - lib/fastlane/plugin/samsungknox/helper/knox_configure_error_message.rb
164
164
  - lib/fastlane/plugin/samsungknox/helper/knox_configure_library_already_exists_app_version_check.rb
165
165
  - lib/fastlane/plugin/samsungknox/helper/knox_configure_library_upload_app.rb
166
- - lib/fastlane/plugin/samsungknox/helper/knox_configure_upload_application_to_library.rb
167
166
  - lib/fastlane/plugin/samsungknox/helper/knox_token_generator.rb
168
167
  - lib/fastlane/plugin/samsungknox/version.rb
169
168
  homepage: https://github.com/REDREDGROUP/samsungknox