aliquot-pay 2.0.0 → 2.1.2
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 +1 -1
- data/lib/aliquot-pay.rb +17 -16
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c5bffd61e042fd964cca3d4c766cd63ce6e5434602f28cf17e54a70db6001e1
|
4
|
+
data.tar.gz: 0b4c0729cba721c98abe88b1bd7ef70a1205acf71f6eba6f03d77e66bc01f252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e095b875006d99d6e95d6768d482848ba7c304241f72653be631386ac6c2b56b01a79e4d2980c098e6329e2e34635ab11f8569f576389456439d3bf9760e4f3c
|
7
|
+
data.tar.gz: b9f02b833e505701d13262d0888168b195f0672d29ab4df64e437189e7d9302765885e0a74bdd992fada5793a4b60006b1febdfa77769aa3c36ee73a84d587ee
|
data/lib/aliquot-pay/util.rb
CHANGED
data/lib/aliquot-pay.rb
CHANGED
@@ -34,7 +34,7 @@ class AliquotPay
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def extract_root_signing_keys
|
37
|
-
key = Base64.strict_encode64(eckey_to_public(ensure_root_key)
|
37
|
+
key = Base64.strict_encode64(eckey_to_public(ensure_root_key))
|
38
38
|
{
|
39
39
|
'keys' => [
|
40
40
|
'protocolVersion' => @protocol_version,
|
@@ -43,16 +43,19 @@ class AliquotPay
|
|
43
43
|
}.to_json
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
if OpenSSL::VERSION >= '3'
|
47
|
+
# pkeys are immutable on OpenSSL >=3.0
|
48
|
+
def eckey_to_public(key)
|
49
|
+
key.public_to_der
|
50
|
+
end
|
51
|
+
else
|
52
|
+
def eckey_to_public(key)
|
53
|
+
k = OpenSSL::PKey::EC.new(EC_CURVE)
|
54
|
+
k.public_key = key.public_key
|
55
|
+
k.to_der
|
56
|
+
end
|
52
57
|
end
|
53
58
|
|
54
|
-
#private
|
55
|
-
|
56
59
|
def sign(key, message)
|
57
60
|
d = OpenSSL::Digest::SHA256.new
|
58
61
|
def key.private?; private_key?; end
|
@@ -60,7 +63,7 @@ class AliquotPay
|
|
60
63
|
end
|
61
64
|
|
62
65
|
def encrypt(cleartext_message)
|
63
|
-
@recipient ||= OpenSSL::PKey::EC.
|
66
|
+
@recipient ||= OpenSSL::PKey::EC.generate('prime256v1')
|
64
67
|
@info ||= 'Google'
|
65
68
|
|
66
69
|
eph = AliquotPay::Util.generate_ephemeral_key
|
@@ -143,13 +146,11 @@ class AliquotPay
|
|
143
146
|
return @signed_key if @signed_key
|
144
147
|
ensure_intermediate_key
|
145
148
|
|
146
|
-
if
|
147
|
-
public_key = eckey_to_public(@intermediate_key)
|
148
|
-
else
|
149
|
+
if !@intermediate_key.private_key? && !@intermediate_key.public_key?
|
149
150
|
fail 'Intermediate key must be public and private key'
|
150
151
|
end
|
151
152
|
|
152
|
-
default_key_value = Base64.strict_encode64(
|
153
|
+
default_key_value = Base64.strict_encode64(eckey_to_public(@intermediate_key))
|
153
154
|
default_key_expiration = "#{Time.now.to_i + 3600}000"
|
154
155
|
|
155
156
|
@signed_key = {
|
@@ -163,11 +164,11 @@ class AliquotPay
|
|
163
164
|
end
|
164
165
|
|
165
166
|
def ensure_root_key
|
166
|
-
@root_key ||= OpenSSL::PKey::EC.
|
167
|
+
@root_key ||= OpenSSL::PKey::EC.generate(EC_CURVE)
|
167
168
|
end
|
168
169
|
|
169
170
|
def ensure_intermediate_key
|
170
|
-
@intermediate_key ||= OpenSSL::PKey::EC.
|
171
|
+
@intermediate_key ||= OpenSSL::PKey::EC.generate(EC_CURVE)
|
171
172
|
end
|
172
173
|
|
173
174
|
def build_signature
|
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: 2.
|
4
|
+
version: 2.1.2
|
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: 2023-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hkdf
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.1.
|
82
|
+
rubygems_version: 3.1.6
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Generates Google Pay test dummy tokens
|