smile-identity-core 0.2.2 → 0.2.3
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/.gitignore +1 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -5
- data/lib/smile-identity-core/signature.rb +6 -6
- data/lib/smile-identity-core/version.rb +1 -1
- 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: 21c2a5a3b5e5f424a1c496debe16bab3a3950123b734c1a35e43035da2f7c622
|
4
|
+
data.tar.gz: a8cebcd27f35a24ae3bdcd61c692dae4523d8cf80e2f7adaf2e021dfe150a30e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f30735bd2481bd6baecad7b0c37c4aa6ca239e3c00ef61e96aa4f4346b732a2641fc2bcf34898e68de766835ec94aa759d481e014350936a4a6d40b2086b46a5
|
7
|
+
data.tar.gz: fd8bfef72649e53477633ed2bcd3d2235295b06b78ee418fecdfbe06466da244c1b0afd19ed5e79b9fb526bef191ce90b272e7fb658f48c22bdc214d53ddc015
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -24,3 +24,11 @@ Fix the loss of optional_callback
|
|
24
24
|
Ensure that we allow nil inputs or empty hashes for options and id_info
|
25
25
|
Confirm the signature when querying the job status
|
26
26
|
Add a Utilities class with get_job_status that we use internally to expose a public get_job_status method on WebApi
|
27
|
+
|
28
|
+
## [0.2.2] - 2019-09-17
|
29
|
+
### Updated
|
30
|
+
Add the language to the package information
|
31
|
+
|
32
|
+
## [0.2.3] - 2019-09-17
|
33
|
+
### Updated
|
34
|
+
Lenient Decoding of the api key
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SmileIdentityCore
|
2
2
|
|
3
|
-
The official Smile Identity gem exposes
|
3
|
+
The official Smile Identity gem exposes three classes namely, the Web API and Signature class.
|
4
4
|
|
5
5
|
The **Web API Class** allows you as the Partner to validate a user’s identity against the relevant Identity Authorities/Third Party databases that Smile Identity has access to using ID information provided by your customer/user (including photo for compare). It has the following public methods:
|
6
6
|
- submit_job
|
@@ -10,8 +10,8 @@ The **Signature Class** allows you as the Partner to generate a sec key to inter
|
|
10
10
|
- generate_sec_key
|
11
11
|
- confirm_sec_key
|
12
12
|
|
13
|
-
|
14
|
-
- get_job_status
|
13
|
+
The **Utilities Class** allows you as the Partner to have access to our general Utility functions to gain access to your data. It has the following public methods:
|
14
|
+
- get_job_status
|
15
15
|
|
16
16
|
## Documentation
|
17
17
|
|
@@ -150,7 +150,7 @@ $ connection = SmileIdentityCore::Signature.new(partner_id, api_key)
|
|
150
150
|
$ sec_key = connection.confirm_sec_key(sec_key, timestamp)
|
151
151
|
```
|
152
152
|
|
153
|
-
|
153
|
+
#### Utilities Class
|
154
154
|
|
155
155
|
You may want to receive more information about a job. This is built into Web Api if you choose to set return_job_status as true in the options hash. However, you also have the option to build the functionality yourself by using the Utilities class. Please note that if you are querying a job immediately after submitting it, you will need to poll it for the duration of the job.
|
156
156
|
|
@@ -161,7 +161,7 @@ utilities_connection = SmileIdentityCore::Utilities.new('partner_id', 'api_key'
|
|
161
161
|
|
162
162
|
utilities_connection.get_job_status('user_id', 'job_id', options)
|
163
163
|
where options is {return_history: true | false, return_image_links: true | false}
|
164
|
-
```
|
164
|
+
```
|
165
165
|
|
166
166
|
## Development
|
167
167
|
|
@@ -10,9 +10,9 @@ module SmileIdentityCore
|
|
10
10
|
begin
|
11
11
|
@timestamp = timestamp
|
12
12
|
|
13
|
-
hash_signature = Digest::SHA256.hexdigest([@partner_id, @timestamp].join(":"))
|
14
|
-
public_key = OpenSSL::PKey::RSA.new(Base64.
|
15
|
-
@sec_key = [Base64.
|
13
|
+
hash_signature = Digest::SHA256.hexdigest([@partner_id.to_i, @timestamp].join(":"))
|
14
|
+
public_key = OpenSSL::PKey::RSA.new(Base64.decode64(@api_key))
|
15
|
+
@sec_key = [Base64.encode64(public_key.public_encrypt(hash_signature)), hash_signature].join('|')
|
16
16
|
|
17
17
|
return {
|
18
18
|
sec_key: @sec_key,
|
@@ -25,11 +25,11 @@ module SmileIdentityCore
|
|
25
25
|
|
26
26
|
def confirm_sec_key(timestamp, sec_key)
|
27
27
|
begin
|
28
|
-
hash_signature = Digest::SHA256.hexdigest([@partner_id, timestamp].join(":"))
|
28
|
+
hash_signature = Digest::SHA256.hexdigest([@partner_id.to_i, timestamp].join(":"))
|
29
29
|
encrypted = sec_key.split('|')[0]
|
30
30
|
|
31
|
-
public_key = OpenSSL::PKey::RSA.new(Base64.
|
32
|
-
decrypted = public_key.public_decrypt(Base64.
|
31
|
+
public_key = OpenSSL::PKey::RSA.new(Base64.decode64(@api_key))
|
32
|
+
decrypted = public_key.public_decrypt(Base64.decode64(encrypted))
|
33
33
|
|
34
34
|
return decrypted == hash_signature
|
35
35
|
rescue => e
|