aliquot-pay 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aliquot-pay/util.rb +7 -2
- data/lib/aliquot-pay.rb +7 -7
- 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: d6ef1cc665eda9098620eba68b1ad54f84fbf95a7451000aed962e955df683bc
|
4
|
+
data.tar.gz: a6126ced2a1928849052ebed350163990d5f74aff97d26100f54a60189bb092f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ad4156b308d5f0cb263f0ceb2b64db99ec373f073bb71339cb0866812979448345cfee99beddebeaf816cdd38e0d17cb793c39832f366dfa108c9d368a257a8
|
7
|
+
data.tar.gz: 87a621a3d085c84cec0b393a737a3d05ae5d7afa5b144cfecac0babd1e8ce55d06727428b7fabad9f247c3191a2b26c6ae3369b9c2137e0930d4a9fb8f7ab362
|
data/lib/aliquot-pay/util.rb
CHANGED
@@ -12,8 +12,13 @@ module AliquotPay
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.derive_keys(ephemeral_public_key, shared_secret, info)
|
15
|
-
|
16
|
-
|
15
|
+
input_keying_material = ephemeral_public_key + shared_secret
|
16
|
+
if OpenSSL.const_defined?(:KDF) && OpenSSL::KDF.respond_to?(:hkdf)
|
17
|
+
h = OpenSSL::Digest::SHA256.new
|
18
|
+
hbytes = OpenSSL::KDF.hkdf(input_keying_material, hash: h, salt: '', length: 32, info: info)
|
19
|
+
else
|
20
|
+
hbytes = HKDF.new(input_keying_material, algorithm: 'SHA256', info: info).next_bytes(32)
|
21
|
+
end
|
17
22
|
|
18
23
|
{
|
19
24
|
aes_key: hbytes[0..15],
|
data/lib/aliquot-pay.rb
CHANGED
@@ -90,18 +90,18 @@ module AliquotPay
|
|
90
90
|
end
|
91
91
|
|
92
92
|
# payment:: Google Pay token as a ruby Hash
|
93
|
-
# signing_key::
|
94
|
-
# recipient::
|
95
|
-
#
|
96
|
-
def self.generate_token(payment, signing_key, recipient,
|
97
|
-
|
93
|
+
# signing_key:: OpenSSL::PKEY::EC
|
94
|
+
# recipient:: OpenSSL::PKey::EC
|
95
|
+
# encrypted_message:: SignedMessage
|
96
|
+
def self.generate_token(payment, signing_key, recipient, signed_message = nil)
|
97
|
+
signed_message ||= JSON.unparse(AliquotPay.encrypt(JSON.unparse(payment), recipient))
|
98
98
|
|
99
|
-
signature_string = AliquotPay.signature_string(
|
99
|
+
signature_string = AliquotPay.signature_string(signed_message)
|
100
100
|
|
101
101
|
{
|
102
102
|
'protocolVersion' => 'ECv1',
|
103
103
|
'signature' => AliquotPay.sign(signing_key, signature_string),
|
104
|
-
'signedMessage' =>
|
104
|
+
'signedMessage' => signed_message,
|
105
105
|
}
|
106
106
|
end
|
107
107
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliquot-pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clearhaus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hkdf
|