gala 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +6 -6
- data/README.md +6 -0
- data/gala.gemspec +2 -2
- data/lib/gala/version.rb +1 -1
- data/test/fixtures/certificate.pem +23 -22
- data/test/fixtures/private_key.pem +3 -3
- data/test/fixtures/token.json +9 -9
- data/test/payment_token_test.rb +10 -9
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 93b93339726eda34b17a867a4f6b70798b1c78694f877fe4ba8cef1d06fc1571
|
4
|
+
data.tar.gz: 0550f14686b92763f783ad2d41c24573cf7fde32b2ce2b56f6c8743ae98301c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6516487b176ac874ba4d893a8ae769c46d6d8b1613a859a2d09cefea7dccc0216d9875aa175f0fc174e5bf372a6ca9e7c390c40be35aef91e1c8f9df5bba1959
|
7
|
+
data.tar.gz: 9d85d6d765b8f66a8088834217c5e09d1f440b8d16bca4ddaddf523563b72cee434a3022f2a1a40f3cb42dca8d99fbb8082debc2e2b747a0d1e8c567fced37b0
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gala (0.
|
5
|
-
openssl (
|
4
|
+
gala (0.4.0)
|
5
|
+
openssl (= 3.1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
minitest (5.
|
11
|
-
openssl (
|
12
|
-
rake (12.3.
|
10
|
+
minitest (5.18.0)
|
11
|
+
openssl (3.1.0)
|
12
|
+
rake (12.3.3)
|
13
13
|
|
14
14
|
PLATFORMS
|
15
15
|
ruby
|
@@ -21,4 +21,4 @@ DEPENDENCIES
|
|
21
21
|
rake (~> 12.0)
|
22
22
|
|
23
23
|
BUNDLED WITH
|
24
|
-
1.
|
24
|
+
1.17.3
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Gala
|
2
2
|
|
3
|
+
[![CircleCI](https://circleci.com/gh/spreedly/gala.svg?style=svg)](https://circleci.com/gh/spreedly/gala)
|
4
|
+
|
3
5
|
Named after the [Gala apple](http://en.wikipedia.org/wiki/Gala_(apple)), Gala is a Ruby library for decrypting [Apple Pay payment tokens](https://developer.apple.com/library/ios/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html).
|
4
6
|
|
5
7
|
Gala is available under the MIT License.
|
@@ -94,6 +96,10 @@ $ rake release
|
|
94
96
|
|
95
97
|
## Changelog
|
96
98
|
|
99
|
+
### v0.5.0
|
100
|
+
|
101
|
+
*Update Openssl to support Ruby 3
|
102
|
+
|
97
103
|
### v0.4.0
|
98
104
|
|
99
105
|
* Remove unmaintained `aead` gem dependency
|
data/gala.gemspec
CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.required_ruby_version = '>= 2.
|
22
|
+
spec.required_ruby_version = '>= 2.6.0'
|
23
23
|
|
24
|
-
spec.add_runtime_dependency 'openssl', '
|
24
|
+
spec.add_runtime_dependency 'openssl', '3.1.0'
|
25
25
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
27
27
|
spec.add_development_dependency 'rake', '~> 12.0'
|
data/lib/gala/version.rb
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
2
|
+
MIIEhTCCBCugAwIBAgIIaw5PZcTrT70wCgYIKoZIzj0EAwIwgYAxNDAyBgNVBAMM
|
3
3
|
K0FwcGxlIFdvcmxk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DSqOrfQq7UXlQgA==
|
5
5
|
-----END EC PRIVATE KEY-----
|
data/test/fixtures/token.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
}
|
2
|
+
"version": "EC_v1",
|
3
|
+
"data": "98K9zY2CVmVzD/9A9mq7EtYOLda1LUWn1bDZM8Cy/ABPBok2B630eG9eZJUrlMYwJeaedYTpSgS3OZWX4dSnGquZ2S5I9Me44OmiirRwU4rZ/J4NBK+zwtmxv4OonZYjTmbKACTahSG0IylGWC0ah6hOTSfOTOzn2KIHs+B5i1bVDHfoq8o41gBoxvfS26kUfFiH8HtQBbZ+2Cea8/7NxCwSpGUADEUqmEar0ZIS9ndK+XGLyICwSgP8J1wJpoOndscXHi3wkY7MgpOfrA5Z/wCR3RbSGZtD94por+bwv0N8OgcTXAnDnDVXBWuj8rSU+imWEtY0C+rl/Ro/btPbAE4WjkElxsmVEWY14cb8EQFmmdbx3kRF9emTxs6ssAEhqZrdiUTmu9nynuu0",
|
4
|
+
"signature": "MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID4zCCA4igAwIBAgIITDBBSVGdVDYwCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE5MDUxODAxMzI1N1oXDTI0MDUxNjAxMzI1N1owXzElMCMGA1UEAwwcZWNjLXNtcC1icm9rZXItc2lnbl9VQzQtUFJPRDEUMBIGA1UECwwLaU9TIFN5c3RlbXMxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkw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AYTAlVTAghMMEFJUZ1UNjANBglghkgBZQMEAgEFAKCBlTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0yMTA5MDExOTAzMDZaMCoGCSqGSIb3DQEJNDEdMBswDQYJYIZIAWUDBAIBBQChCgYIKoZIzj0EAwIwLwYJKoZIhvcNAQkEMSIEIJp5MA0izHSXJb0IZHNgCPFTzNVvCl93e6CLM+iDGmfjMAoGCCqGSM49BAMCBEgwRgIhAPpny9Qbxe1wpRcRK6kW8hfaT2G8L0cK55frTPNOjiw+AiEA1na4JJngB+yKCLij5V5JH2daE7Xcc91YbYywWL7QVSgAAAAAAAA=",
|
5
|
+
"header": {
|
6
|
+
"ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHqqqjg3xlLn9YH2fEN1Gq3Z0IUJY1KZrX9/ZSzzYnFu3EDP4PGdPBpp6gzlHIb9vr9Tbz1HuMixBCfVMWhAvmw==",
|
7
|
+
"publicKeyHash": "+9VwJrqieiPF2ZRB0xHFYhgQ6RYza5hfrVLpdB1KtKI=",
|
8
|
+
"transactionId": "f7f133694685bab2f44ae3a7b54e2c0d0d39a3bc73fa2e6b14a2baf628d6ce87"
|
9
|
+
}
|
10
|
+
}
|
data/test/payment_token_test.rb
CHANGED
@@ -11,9 +11,10 @@ class Gala::PaymentTokenTest < Minitest::Test
|
|
11
11
|
@certificate = File.read(fixtures + "certificate.pem")
|
12
12
|
@private_key = File.read(fixtures + "private_key.pem")
|
13
13
|
@payment_token = Gala::PaymentToken.new(@token_attrs)
|
14
|
-
@merchant_id = "
|
15
|
-
@shared_secret = Base64.decode64("
|
16
|
-
@symmetric_key = Base64.decode64("
|
14
|
+
@merchant_id = "358DA5890B9555C0A9EFB84B5CD6FF04BFDCD5AABF5DC14B9872D8DF51EAF439"
|
15
|
+
@shared_secret = Base64.decode64("yCUzDuNYTnUnANZEdxC7+DvPmqNslB2YWYn68SBsJHU=")
|
16
|
+
@symmetric_key = Base64.decode64("3GTXJ4RuP/IhS23hsdOw2J2ecAZmC0RasbPIFdC3nQM=")
|
17
|
+
|
17
18
|
end
|
18
19
|
|
19
20
|
def test_initialize
|
@@ -40,16 +41,16 @@ class Gala::PaymentTokenTest < Minitest::Test
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def test_decrypt
|
43
|
-
|
44
|
-
|
45
|
-
assert_equal "
|
44
|
+
temp = @payment_token.decrypt(@certificate, @private_key)
|
45
|
+
payment_data = JSON.parse(temp)
|
46
|
+
assert_equal "5353756319181169", payment_data["applicationPrimaryAccountNumber"]
|
47
|
+
assert_equal "240930", payment_data["applicationExpirationDate"]
|
46
48
|
assert_equal "840", payment_data["currencyCode"]
|
47
49
|
assert_equal 100, payment_data["transactionAmount"]
|
48
50
|
assert_nil payment_data["cardholderName"]
|
49
|
-
assert_equal "
|
51
|
+
assert_equal "050110030273", payment_data["deviceManufacturerIdentifier"]
|
50
52
|
assert_equal "3DSecure", payment_data["paymentDataType"]
|
51
|
-
assert_equal "
|
52
|
-
assert_equal "5", payment_data["paymentData"]["eciIndicator"]
|
53
|
+
assert_equal "AMwBRjPWDnAgAA7Rls7mAoABFA==", payment_data["paymentData"]["onlinePaymentCryptogram"]
|
53
54
|
end
|
54
55
|
|
55
56
|
def test_failed_decrypt
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Bennett
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: openssl
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 3.1.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 3.1.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,15 +103,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements:
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 2.
|
106
|
+
version: 2.6.0
|
107
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
|
-
|
114
|
-
rubygems_version: 2.6.11
|
113
|
+
rubygems_version: 3.1.6
|
115
114
|
signing_key:
|
116
115
|
specification_version: 4
|
117
116
|
summary: Apple Pay payment token decryption library
|