asca 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/asca/token.rb +18 -10
- data/lib/asca/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d496e61191c933bb7036dbcd8ad090c6fdada312cbe6dc79afeb5f03d1199bfb
|
4
|
+
data.tar.gz: e6dc4d154574a92f0e61416ac3a8fe4dd9639da3756f1d63bfd1282ab8e31277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82397db647083d9278a796875ea5bf1cd9709075009f9c185e7b36ba4c756fb07f3eef81c4689b184f429ed2fcecb0cd0a3fd23bf188287dad638b79bfaa7bd9
|
7
|
+
data.tar.gz: 4632557caa586822a4abd5fb8e146ce39549f6a68fc6db52832fd6fbdcb203835fa0db01824818875c3aed3a0f2ec8fa974f28803377e69e5aa3669ed5b541e0
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Asca
|
2
2
|
|
3
3
|
[](https://github.com/xueminghao/appstoreconnectapi/blob/master/LICENSE.txt)
|
4
|
-
[](https://rubygems.org/gems/asca)
|
5
5
|
|
6
6
|
An apple app store connect api wrapper based on ruby!!!
|
7
7
|
|
data/lib/asca/token.rb
CHANGED
@@ -16,37 +16,37 @@ module Asca
|
|
16
16
|
# get kid
|
17
17
|
kid = Asca::Configuration.get_config('kid')
|
18
18
|
if !kid
|
19
|
-
|
19
|
+
Asca::Log.info "Before generating a jwt token, please enter your kid:"
|
20
20
|
kid = gets.chomp
|
21
21
|
Asca::Configuration.update_config('kid', kid)
|
22
22
|
end
|
23
23
|
if !kid
|
24
|
-
|
24
|
+
Asca::Log.error "Error: no kid!"
|
25
25
|
return
|
26
26
|
end
|
27
27
|
|
28
28
|
# get issuer id
|
29
29
|
iss = Asca::Configuration.get_config('iss')
|
30
30
|
if !iss
|
31
|
-
|
31
|
+
Asca::Log.info "Before generating a jwt token, please enter your issuer id:"
|
32
32
|
iss = gets.chomp
|
33
33
|
Asca::Configuration.update_config('iss', iss)
|
34
34
|
end
|
35
35
|
if !iss
|
36
|
-
|
36
|
+
Asca::Log.error "Error: no issuer id!"
|
37
37
|
return
|
38
38
|
end
|
39
39
|
|
40
40
|
# get private key
|
41
41
|
private_key = Asca::Configuration.get_config('private_key')
|
42
42
|
if !private_key
|
43
|
-
|
43
|
+
Asca::Log.info "Before generating a jwt token, please enter your private key path:"
|
44
44
|
private_key_path = gets.chomp
|
45
45
|
private_key = File.read private_key_path
|
46
46
|
Asca::Configuration.update_config('private_key', private_key)
|
47
47
|
end
|
48
48
|
if !private_key
|
49
|
-
|
49
|
+
Asca::Log.error "Error: no private key!"
|
50
50
|
return
|
51
51
|
end
|
52
52
|
|
@@ -65,14 +65,22 @@ module Asca
|
|
65
65
|
"aud": "appstoreconnect-v1"
|
66
66
|
}
|
67
67
|
|
68
|
-
|
68
|
+
begin
|
69
|
+
es_key = OpenSSL::PKey::EC.new private_key
|
70
|
+
rescue => exception
|
71
|
+
Asca::Log.info "Invalid private key, please enter your correct private key path:"
|
72
|
+
private_key_path = gets.chomp
|
73
|
+
private_key = File.read private_key_path
|
74
|
+
Asca::Configuration.update_config('private_key', private_key)
|
75
|
+
es_key = OpenSSL::PKey::EC.new private_key
|
76
|
+
end
|
69
77
|
|
70
78
|
token = JWT.encode jwt_payload, es_key, 'ES256', jwt_header
|
71
79
|
Asca::Configuration.update_config('cache_token_time', exp)
|
72
80
|
Asca::Configuration.update_config('cache_token', token)
|
73
|
-
|
74
|
-
|
75
|
-
|
81
|
+
Asca::Log.info "==== New token generated ===="
|
82
|
+
Asca::Log.info token
|
83
|
+
Asca::Log.info "============================="
|
76
84
|
return token
|
77
85
|
end
|
78
86
|
|
data/lib/asca/version.rb
CHANGED