aliquot 1.0.0 → 2.0.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/error.rb +2 -1
- data/lib/aliquot/payment.rb +9 -8
- metadata +23 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4b575c575e5104e23692cbf9ddf45fd40555862d306a88995d33c7c2fa2085b
|
4
|
+
data.tar.gz: b2be001378fea01010ae490230d8cd14c0767b6fec3155a7a4d6c24c95262c7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e6616072916a6bf54baa76e62e8e9ccd07afc5056f7bcbf3886292d941f66c451f434924837e667592543184c91089f7032b25a1bb9daf646d9a69ef647529
|
7
|
+
data.tar.gz: adfe0fe58146dd4824c1677a482e948b4405973d6c18b7bcd31f516d446921f3b6266b8600148ec05b7c03ba78650c7f33de39f100e93eed8587abcee28999c2
|
data/lib/aliquot/error.rb
CHANGED
data/lib/aliquot/payment.rb
CHANGED
@@ -10,16 +10,16 @@ module Aliquot
|
|
10
10
|
##
|
11
11
|
# A Payment represents a single payment using Google Pay.
|
12
12
|
# It is used to verify/decrypt the supplied token by using the shared secret,
|
13
|
-
# thus avoiding having knowledge of
|
13
|
+
# thus avoiding having knowledge of any private keys involved.
|
14
14
|
class Payment
|
15
15
|
SUPPORTED_PROTOCOL_VERSIONS = %w[ECv1 ECv2].freeze
|
16
16
|
##
|
17
17
|
# Parameters:
|
18
18
|
# token_string:: Google Pay token (JSON string)
|
19
19
|
# shared_secret:: Base64 encoded shared secret
|
20
|
-
#
|
20
|
+
# recipient_id:: Google Pay recipient ID
|
21
21
|
# signing_keys:: Signing keys fetched from Google
|
22
|
-
def initialize(token_string, shared_secret,
|
22
|
+
def initialize(token_string, shared_secret, recipient_id,
|
23
23
|
signing_keys: ENV['GOOGLE_SIGNING_KEYS'])
|
24
24
|
|
25
25
|
begin
|
@@ -32,7 +32,7 @@ module Aliquot
|
|
32
32
|
@token = validation.output
|
33
33
|
|
34
34
|
@shared_secret = shared_secret
|
35
|
-
@
|
35
|
+
@recipient_id = recipient_id
|
36
36
|
@signing_keys = signing_keys
|
37
37
|
end
|
38
38
|
|
@@ -43,7 +43,7 @@ module Aliquot
|
|
43
43
|
raise Error, "supported protocol versions are #{SUPPORTED_PROTOCOL_VERSIONS.join(', ')}"
|
44
44
|
end
|
45
45
|
|
46
|
-
@recipient_id =
|
46
|
+
@recipient_id = validate_recipient_id
|
47
47
|
|
48
48
|
check_shared_secret
|
49
49
|
|
@@ -102,9 +102,10 @@ module Aliquot
|
|
102
102
|
@intermediate_key[:keyExpiration].to_i < cur_millis
|
103
103
|
end
|
104
104
|
|
105
|
-
def
|
106
|
-
raise
|
107
|
-
|
105
|
+
def validate_recipient_id
|
106
|
+
raise InvalidRecipientIDError, 'recipient_id must be alphanumeric and punctuation' unless /\A[[:graph:]]+\z/ =~ @recipient_id
|
107
|
+
|
108
|
+
@recipient_id
|
108
109
|
end
|
109
110
|
|
110
111
|
def check_shared_secret
|
metadata
CHANGED
@@ -1,71 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliquot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clearhaus
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-validation
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.11.0
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
22
|
+
version: '0.13'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.11.0
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
32
|
+
version: '0.13'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: excon
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
39
|
+
version: 0.71.0
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 0.71.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: hkdf
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
53
|
+
version: '0.3'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
60
|
+
version: '0.3'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: aliquot-pay
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
67
|
+
version: 2.0.0
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
74
|
+
version: 2.0.0
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rspec
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +86,7 @@ dependencies:
|
|
80
86
|
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '3'
|
83
|
-
description:
|
89
|
+
description:
|
84
90
|
email: hello@clearhaus.com
|
85
91
|
executables: []
|
86
92
|
extensions: []
|
@@ -94,7 +100,7 @@ homepage: https://github.com/clearhaus/aliquot
|
|
94
100
|
licenses:
|
95
101
|
- MIT
|
96
102
|
metadata: {}
|
97
|
-
post_install_message:
|
103
|
+
post_install_message:
|
98
104
|
rdoc_options: []
|
99
105
|
require_paths:
|
100
106
|
- lib
|
@@ -109,8 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
115
|
- !ruby/object:Gem::Version
|
110
116
|
version: '0'
|
111
117
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
118
|
+
rubygems_version: 3.1.4
|
119
|
+
signing_key:
|
114
120
|
specification_version: 4
|
115
121
|
summary: Validates Google Pay tokens
|
116
122
|
test_files: []
|