fastlane-plugin-samsungknox 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/samsungknox/actions/knox_configure_library_upload_app_action.rb +2 -1
- data/lib/fastlane/plugin/samsungknox/helper/knox_configure_library_upload_app.rb +16 -7
- data/lib/fastlane/plugin/samsungknox/helper/knox_token_generator.rb +5 -5
- data/lib/fastlane/plugin/samsungknox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a54952079f4f11fcee99287b11a0ebd08c8828671e2cd71a0266cdb3af286d7a
|
4
|
+
data.tar.gz: fe1ad89fa1f341bfd0c1cb040fede24a143b0d95c8657e09151d2b60b6b8e7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c14c149b851b5755ecbe5a429a6f0fe590f0666047c2c234c80f274e4f612ad94a9feedd2ae188a2edd0f4d8d687e695b0388cd4dabe1a58a4383fa4de8d86c
|
7
|
+
data.tar.gz: a0f21411d2e4410266834e8991026f4709bfaf323f65377892c56bedbd4037c6ed20516d3afdaba508f70ca815a473adf8a64ceeec67448416c58e4f3eeabaf8
|
@@ -5,8 +5,10 @@ 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, app_description)
|
9
|
-
|
8
|
+
def self.upload_app(access_token, app_file_path, app_description, api_region)
|
9
|
+
UI.header('Step: 📲 Upload Application to Knox Configure Library 📲 ')
|
10
|
+
|
11
|
+
uri = URI("https://#{api_region}-kcs-api.samsungknox.com/kcs/v1/kc/applications/upload")
|
10
12
|
|
11
13
|
File.open(app_file_path) do |file|
|
12
14
|
request = Net::HTTP::Post::Multipart.new uri,
|
@@ -14,17 +16,24 @@ module Fastlane
|
|
14
16
|
|
15
17
|
request['X-KNOX-APITOKEN'] = access_token
|
16
18
|
|
17
|
-
UI.message("⌛ Uploading the
|
19
|
+
UI.message("⌛ Uploading the Application. Please wait a moment...")
|
18
20
|
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
19
21
|
http.request(request)
|
20
22
|
end
|
21
23
|
|
22
24
|
if response.is_a?(Net::HTTPSuccess)
|
23
|
-
|
24
|
-
|
25
|
+
uploadResponseBody = JSON.parse(response.body)
|
26
|
+
successResponse = uploadResponseBody['successResponse'][0]
|
27
|
+
appInfo = successResponse['appInfo'][0]
|
28
|
+
UI.success("🎉 Uploaded Application [#{appInfo['name']}] v#{appInfo['packageVersion']} successfully!")
|
25
29
|
else
|
26
|
-
|
27
|
-
|
30
|
+
uploadResponseBody = JSON.parse(response.body)
|
31
|
+
if uploadResponseBody['data'].strip == 'APP_BINARY_EXISTS'
|
32
|
+
UI.success("✅ The same Application was found in release with no changes, skipping.")
|
33
|
+
else
|
34
|
+
raise "Request failed with response: #{response.body}"
|
35
|
+
end
|
36
|
+
end
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
@@ -67,7 +67,7 @@ module Fastlane
|
|
67
67
|
|
68
68
|
if response.is_a?(Net::HTTPSuccess)
|
69
69
|
data = JSON.parse(response.body)
|
70
|
-
UI.success('✅ ams accessToken generated successfully
|
70
|
+
UI.success('✅ ams accessToken generated successfully')
|
71
71
|
return data["accessToken"]
|
72
72
|
else
|
73
73
|
raise "Request failed with response: #{response.body}"
|
@@ -77,15 +77,15 @@ module Fastlane
|
|
77
77
|
def self.generate_knox_access_token(credential, clientIdentifierJwtToken, api_region)
|
78
78
|
UI.header('Step: 🔐 KNOX ACCESS TOKEN GENERATE 🔐 ')
|
79
79
|
|
80
|
-
UI.message('
|
80
|
+
UI.message('🔐 Sign in the knox token using the credential...')
|
81
81
|
generate_signed_jwt_result = generate_signed_jwt(credential, clientIdentifierJwtToken, true)
|
82
82
|
|
83
83
|
base64_encoding_public_Key = generate_signed_jwt_result[:public_key]
|
84
84
|
sign_by_client_identifier_jwt_token = generate_signed_jwt_result[:token]
|
85
85
|
|
86
|
-
UI.message('⏳ Request the knox client identifier jwt ams access token
|
86
|
+
UI.message('⏳ Request the knox client identifier jwt ams access token.')
|
87
87
|
ams_access_token = get_access_token(30, base64_encoding_public_Key, sign_by_client_identifier_jwt_token, api_region)
|
88
|
-
UI.message('
|
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
|
|
91
91
|
return { token: token[:token] }
|
@@ -114,7 +114,7 @@ module Fastlane
|
|
114
114
|
|
115
115
|
token = JWT.encode(payload, private_key, 'RS512')
|
116
116
|
|
117
|
-
UI.success('✅ token generated successfully
|
117
|
+
UI.success('✅ token generated successfully')
|
118
118
|
return { public_key: public_key, token: token }
|
119
119
|
end
|
120
120
|
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.1.
|
4
|
+
version: 0.1.1
|
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-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|