aliquot-pay 0.7.2 → 0.8.0
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/lib/aliquot-pay.rb +12 -8
- 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: ac0940b9a875b2ab9a701f8119a16d3a6c23dc0364f75d43a95f6d3b5322d933
|
4
|
+
data.tar.gz: a797dd4244f1588b268bf6897c2f3767ab96fbbf2ad2e6ac12480e9608d40561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0188e39eec0d9758e300d4ab782a1d1b4cadab2d5afee6c146a4b8e06123dfa481bbf3ad656586a33a3485f8fed9570007aa9cf6f7479b97100a6e33936b44b9'
|
7
|
+
data.tar.gz: 334e18c73fefb6f667107104cc0d297a176db3a2dd59b2ae668211e7daf377a50f5ea72958e7875ac596fa90395df2130438354b69fe52daca1caa23c791c2aa
|
data/lib/aliquot-pay.rb
CHANGED
@@ -80,9 +80,9 @@ module AliquotPay
|
|
80
80
|
|
81
81
|
def self.signature_string(
|
82
82
|
message,
|
83
|
-
recipient_id
|
84
|
-
sender_id
|
85
|
-
protocol_version
|
83
|
+
recipient_id: DEFAULTS[:merchant_id],
|
84
|
+
sender_id: DEFAULTS[:info],
|
85
|
+
protocol_version: 'ECv1'
|
86
86
|
)
|
87
87
|
|
88
88
|
generate_signature(sender_id, recipient_id, protocol_version, message)
|
@@ -104,14 +104,18 @@ module AliquotPay
|
|
104
104
|
}
|
105
105
|
end
|
106
106
|
|
107
|
-
def self.generate_token_ecv2(payment, signing_key, intermediate_key, recipient,
|
107
|
+
def self.generate_token_ecv2(payment, signing_key, intermediate_key, recipient,
|
108
|
+
signed_message: nil, expire_time: "#{Time.now.to_i + 3600}000")
|
108
109
|
cipher = OpenSSL::Cipher::AES256.new(:CTR)
|
109
110
|
signed_message ||= JSON.unparse(encrypt(JSON.unparse(payment), recipient, cipher))
|
110
|
-
|
111
|
+
sig = signature_string(signed_message, protocol_version: 'ECv2')
|
112
|
+
|
113
|
+
intermediate_pub = OpenSSL::PKey::EC.new(EC_CURVE)
|
114
|
+
intermediate_pub.public_key = intermediate_key.public_key
|
111
115
|
|
112
116
|
signed_key = JSON.unparse(
|
113
|
-
'keyExpiration' =>
|
114
|
-
'keyValue' => Base64.strict_encode64(
|
117
|
+
'keyExpiration' => expire_time,
|
118
|
+
'keyValue' => Base64.strict_encode64(intermediate_pub.to_der)
|
115
119
|
)
|
116
120
|
|
117
121
|
ik_signature_string = generate_signature('Google', 'ECv2', signed_key)
|
@@ -119,7 +123,7 @@ module AliquotPay
|
|
119
123
|
|
120
124
|
{
|
121
125
|
'protocolVersion' => 'ECv2',
|
122
|
-
'signature' => sign(intermediate_key,
|
126
|
+
'signature' => sign(intermediate_key, sig),
|
123
127
|
'signedMessage' => signed_message,
|
124
128
|
'intermediateSigningKey' => {
|
125
129
|
'signedKey' => signed_key,
|