nubank_sdk 0.7.1 → 0.7.2
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/Gemfile.lock +1 -1
- data/lib/nubank_sdk/auth.rb +4 -19
- data/lib/nubank_sdk/version.rb +1 -1
- 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: acb3d7fcfc4212b5b535b127b93caf6659da30a516adf5a339078a9b2571a3e9
|
|
4
|
+
data.tar.gz: 9fa55b75d3076c6251a709cb065f70752e27765dbaa0a1c7eb0f11cdb653248c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0701f569a4dac7ac8060eecefe458d842233ae4a35c1687aeb29f444a0b1919575a55f5f781c15e37f29976967bbf96c8b9a1414f61b6353d068becdf1044ae
|
|
7
|
+
data.tar.gz: f196c47c07437300f91d1f5d4d08b30c070bf5bbc822b5526b2b6d794d89ed91d8e797d618b03ee2eab2cc633e720f21b06acba495b6876f05805e946caa811c
|
data/Gemfile.lock
CHANGED
data/lib/nubank_sdk/auth.rb
CHANGED
|
@@ -7,7 +7,7 @@ module NubankSdk
|
|
|
7
7
|
# Auth method to connect with the nubank api
|
|
8
8
|
#
|
|
9
9
|
class Auth
|
|
10
|
-
attr_accessor :refresh_token, :refresh_before, :access_token
|
|
10
|
+
attr_accessor :refresh_token, :refresh_before, :access_token, :encrypted_code, :p_key
|
|
11
11
|
|
|
12
12
|
#
|
|
13
13
|
# Auth method to connect with the nubank api
|
|
@@ -22,6 +22,7 @@ module NubankSdk
|
|
|
22
22
|
@api_routes = api_routes || ApiRoutes.new
|
|
23
23
|
|
|
24
24
|
@connection_adapter = connection_adapter
|
|
25
|
+
@p_key = OpenSSL::PKey::RSA.new 2048
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
#
|
|
@@ -75,7 +76,7 @@ module NubankSdk
|
|
|
75
76
|
response = default_connection.post(@gen_certificate_path, new_payload)
|
|
76
77
|
|
|
77
78
|
response_data = Client.get_body(response)
|
|
78
|
-
certificate.process_decoded(
|
|
79
|
+
certificate.process_decoded(@p_key, response_data[:certificate])
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
private
|
|
@@ -110,7 +111,7 @@ module NubankSdk
|
|
|
110
111
|
{
|
|
111
112
|
login: @cpf,
|
|
112
113
|
password: password,
|
|
113
|
-
public_key:
|
|
114
|
+
public_key: @p_key.public_key.to_pem,
|
|
114
115
|
device_id: @device_id,
|
|
115
116
|
model: "NubankSdk Client (#{@device_id})"
|
|
116
117
|
}
|
|
@@ -132,14 +133,6 @@ module NubankSdk
|
|
|
132
133
|
}
|
|
133
134
|
end
|
|
134
135
|
|
|
135
|
-
# @!visibility private
|
|
136
|
-
# Generates a new key for the certificate communication
|
|
137
|
-
#
|
|
138
|
-
# @return [OpenSSL::PKey::RSA] a new key
|
|
139
|
-
def generate_key
|
|
140
|
-
OpenSSL::PKey::RSA.new 2048
|
|
141
|
-
end
|
|
142
|
-
|
|
143
136
|
# @!visibility private
|
|
144
137
|
# Add the new links to the api routes
|
|
145
138
|
#
|
|
@@ -202,14 +195,6 @@ module NubankSdk
|
|
|
202
195
|
@ssl_connection ||= Client::HTTPS.new(certificate.encoded, @connection_adapter)
|
|
203
196
|
end
|
|
204
197
|
|
|
205
|
-
# @!visibility private
|
|
206
|
-
# return the key of the certificate communication
|
|
207
|
-
#
|
|
208
|
-
# @return [OpenSSL::PKey::RSA] the key of the certificate
|
|
209
|
-
def key
|
|
210
|
-
@key ||= generate_key
|
|
211
|
-
end
|
|
212
|
-
|
|
213
198
|
# @!visibility private
|
|
214
199
|
# Generates a random device id
|
|
215
200
|
#
|
data/lib/nubank_sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nubank_sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Viserion77
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-01-
|
|
11
|
+
date: 2023-01-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|