Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Commit 0f10bca

Browse files
authored
Merge pull request #2 from getyoti/updates
[SDK-145]: Add base64_selfie_uri
2 parents b98fde1 + f035b99 commit 0f10bca

File tree

6 files changed

+42
-25
lines changed

6 files changed

+42
-25
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 1.1.3 - 2017-11-01
8+
9+
### Added
10+
- `base64_selfie_uri` value
11+
712
## 1.1.2 - 2017-10-18
813

914
## 1.1.1 - 2017-09-13
@@ -16,7 +21,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1621
- `simplecov` `~> 0.15`
1722
- `webmock` `~> 3.0`
1823

19-
2024
## 1.1.0 - 2017-04-11
2125
Updates dependencies to the latest versions and aligns extra fields naming conventions with the Yoti attributes.
2226

@@ -36,7 +40,6 @@ Updates dependencies to the latest versions and aligns extra fields naming conve
3640
- `simplecov` `~> 0.14`
3741
- `webmock` `~> 2.3`
3842

39-
4043
## 1.0.1 - 2016-11-28
4144
### Added
4245
- Yoti proprietary license

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,24 @@ A call to `/auth/yoti/callback` will open the Yoti authentication page, and afte
6060

6161
```ruby
6262
{
63-
"provider" => "yoti",
64-
"uid" => "mHvpV4...",
65-
"info" => {
66-
"name" => "mHvpV4Mm+yMb..."
67-
},
68-
"credentials" => {},
69-
"extra" => {
70-
"selfie" => "data:image/jpeg;base64,/9j/2wCEAAMCAg...",
71-
"given_names" => "Given Name",
72-
"family_name" => "Family Name",
73-
"phone_number" => "07474747474",
74-
"email_address" => "[email protected]",
75-
"date_of_birth" => nil,
76-
"postal_address" => nil,
77-
"gender" => 'MALE',
78-
"nationality" => nil
79-
}
63+
"provider" => "yoti",
64+
"uid" => "mHvpV4...",
65+
"info" => {
66+
"name" => "mHvpV4Mm+yMb...",
67+
"base64_selfie_uri" => "data:image/jpeg;base64,/9j/2wCEAAMCAg..."
68+
},
69+
"credentials" => {},
70+
"extra" => {
71+
"selfie" => "jpeg image file",
72+
"given_names" => "Given Name",
73+
"family_name" => "Family Name",
74+
"phone_number" => "07474747474",
75+
"email_address" => "[email protected]",
76+
"date_of_birth" => nil,
77+
"postal_address" => nil,
78+
"gender" => 'MALE',
79+
"nationality" => nil
80+
}
8081
}
8182

8283
```

lib/omniauth/strategies/yoti.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ def request_phase
1313
end
1414

1515
uid { yoti_user_id }
16-
info { { name: yoti_user_id } }
16+
info {{
17+
name: yoti_user_id,
18+
base64_selfie_uri: base64_selfie_uri
19+
}}
1720

1821
def extra
1922
@raw_info ||= {
@@ -46,11 +49,16 @@ def yoti_user_id
4649
yoti_activity_details.user_id
4750
end
4851

52+
def base64_selfie_uri
53+
yoti_activity_details.base64_selfie_uri
54+
end
55+
4956
def configure_yoti_client!
5057
::Yoti.configure do |config|
5158
config.client_sdk_id = options.client_options[:client_sdk_id]
5259
config.key_file_path = options.client_options[:key_file_path]
5360
config.key = options.client_options[:key]
61+
config.sdk_identifier = 'OmniAuth'
5462
end
5563
end
5664

lib/omniauth/yoti/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Omniauth
22
module Yoti
3-
VERSION = '1.1.2'.freeze
3+
VERSION = '1.1.3'.freeze
44
end
55
end

omniauth-yoti.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
2222
spec.required_ruby_version = '>= 2.1.9'
2323

2424
spec.add_dependency 'omniauth', '~> 1.6'
25-
spec.add_dependency 'yoti', '~> 1.0'
25+
spec.add_dependency 'yoti', '~> 1.1.0'
2626

2727
spec.add_development_dependency 'bundler', '~> 1.13'
2828
spec.add_development_dependency 'rake', '~> 12.1'

spec/omniauth/strategies/yoti_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,21 @@
4646
end
4747

4848
describe '#info' do
49-
it 'returns an info array' do
50-
expect(subject.info).to eql(name: 'Hig2yAT79cWvseSuXcIuCLa5lNkAPy70rxetUaeHlTJGmiwc/g1MWdYWYrexWvPU')
49+
it 'returns the name value' do
50+
expect(subject.info[:name]).to eql('Hig2yAT79cWvseSuXcIuCLa5lNkAPy70rxetUaeHlTJGmiwc/g1MWdYWYrexWvPU')
51+
end
52+
53+
it 'returns the base64_selfie_uri value' do
54+
selfie = File.read('spec/fixtures/selfie.txt', encoding: 'utf-8')
55+
expect(subject.info[:base64_selfie_uri]).to eql(selfie)
5156
end
5257
end
5358

5459
describe '#extra' do
5560
context 'when using a mock request' do
5661
it 'has the correct selfie' do
5762
selfie = File.read('spec/fixtures/selfie.txt', encoding: 'utf-8')
58-
expect(subject.extra[:selfie]).to eql(selfie)
63+
expect('data:image/jpeg;base64,'.concat(Base64.strict_encode64(subject.extra[:selfie]))).to eql(selfie)
5964
end
6065

6166
it 'has the correct phone number' do

0 commit comments

Comments
 (0)