mobile_id 0.0.14 → 0.0.15
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/CHANGELOG.md +3 -0
- data/lib/mobile_id/auth.rb +8 -10
- data/lib/mobile_id/cert.rb +23 -23
- data/lib/mobile_id/railtie.rb +0 -2
- 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: 471b24920bcc581ae61b62629bf81b1bb9d7714b5a8fb56c35be92da0b1f813f
|
4
|
+
data.tar.gz: 4bc0e35fd965c21485113fef8f40cb3607a01c4b5f2ad01d09ef7a934d580e7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7137ef520eddcacc1855dc6dbf4a2e18dddbc35c389d0ff95eac8e4d8832a1fa775db99650ff7ac350044ceef5c09bb789a802610f5c86c7f27cac000768f668
|
7
|
+
data.tar.gz: 3f5daa9b2b7fdc2fd97080af483c3a9ab20f5b43222087a8e3bbb109b61af2957501b686ed1032e1dee5156b8a4ff9024788f74ad5bb43ecea0a1983022ed4ef
|
data/CHANGELOG.md
CHANGED
data/lib/mobile_id/auth.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module MobileId
|
4
4
|
class Auth
|
5
|
-
|
6
5
|
# API documentation https://github.com/SK-EID/MID
|
7
6
|
LIVE_URL = 'https://mid.sk.ee/mid-api'
|
8
7
|
TEST_URL = 'https://tsp.demo.sk.ee/mid-api'
|
@@ -53,7 +52,7 @@ module MobileId
|
|
53
52
|
nationalIdentityNumber: personal_code.to_s.strip,
|
54
53
|
hash: Base64.strict_encode64(hash),
|
55
54
|
hashType: 'SHA256',
|
56
|
-
language
|
55
|
+
language: language,
|
57
56
|
displayText: display_text,
|
58
57
|
displayTextFormat: 'GSM-7' # or "UCS-2”
|
59
58
|
}.to_json
|
@@ -64,9 +63,9 @@ module MobileId
|
|
64
63
|
|
65
64
|
ActiveSupport::HashWithIndifferentAccess.new(
|
66
65
|
session_id: response['sessionID'],
|
67
|
-
phone
|
68
|
-
phone_calling_code
|
69
|
-
doc:
|
66
|
+
phone: phone,
|
67
|
+
phone_calling_code: phone_calling_code,
|
68
|
+
doc: doc
|
70
69
|
)
|
71
70
|
end
|
72
71
|
|
@@ -74,9 +73,9 @@ module MobileId
|
|
74
73
|
long_poll!(session_id: auth['session_id'], doc: auth['doc'])
|
75
74
|
|
76
75
|
ActiveSupport::HashWithIndifferentAccess.new(
|
77
|
-
personal_code
|
78
|
-
first_name
|
79
|
-
last_name
|
76
|
+
personal_code: personal_code,
|
77
|
+
first_name: first_name,
|
78
|
+
last_name: last_name,
|
80
79
|
phone: auth['phone'],
|
81
80
|
phone_calling_code: auth['phone_calling_code'],
|
82
81
|
auth_provider: 'mobileid' # User::MOBILEID
|
@@ -123,7 +122,7 @@ module MobileId
|
|
123
122
|
raise Error, message
|
124
123
|
end
|
125
124
|
|
126
|
-
@user_cert = MobileId::Cert.new(response['cert'], live:)
|
125
|
+
@user_cert = MobileId::Cert.new(response['cert'], live: live)
|
127
126
|
@user_cert.verify_signature!(response['signature']['value'], doc)
|
128
127
|
self.user_cert = @user_cert
|
129
128
|
end
|
@@ -159,6 +158,5 @@ module MobileId
|
|
159
158
|
user_cert.serial_number
|
160
159
|
end
|
161
160
|
alias personal_code serial_number
|
162
|
-
|
163
161
|
end
|
164
162
|
end
|
data/lib/mobile_id/cert.rb
CHANGED
@@ -2,37 +2,39 @@
|
|
2
2
|
|
3
3
|
module MobileId
|
4
4
|
class Cert
|
5
|
-
|
6
5
|
class << self
|
7
|
-
|
8
6
|
def root_path
|
9
7
|
@root_path ||= File.expand_path('certs', __dir__)
|
10
8
|
end
|
11
9
|
|
12
10
|
def live_store
|
13
11
|
@live_store ||=
|
14
|
-
build_store(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
12
|
+
build_store(
|
13
|
+
[
|
14
|
+
File.join(root_path, 'EE_Certification_Centre_Root_CA.pem.crt'),
|
15
|
+
File.join(root_path, 'EE-GovCA2018.pem.crt'),
|
16
|
+
File.join(root_path, 'EID-SK_2011.pem.crt'),
|
17
|
+
File.join(root_path, 'EID-SK_2016.pem.crt'),
|
18
|
+
File.join(root_path, 'esteid2018.pem.crt'),
|
19
|
+
File.join(root_path, 'ESTEID-SK_2011.pem.crt'),
|
20
|
+
File.join(root_path, 'ESTEID-SK_2015.pem.crt'),
|
21
|
+
File.join(root_path, 'KLASS3-SK_2010_EECCRCA.pem.crt'),
|
22
|
+
File.join(root_path, 'KLASS3-SK_2010_EECCRCA_SHA384.pem.crt'),
|
23
|
+
File.join(root_path, 'KLASS3-SK_2016_EECCRCA_SHA384.pem.crt'),
|
24
|
+
File.join(root_path, 'KLASS3-SK.pem.crt'),
|
25
|
+
File.join(root_path, 'NQ-SK_2016.pem.crt')
|
26
|
+
]
|
27
|
+
)
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_store
|
31
31
|
@test_store ||=
|
32
|
-
build_store(
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
build_store(
|
33
|
+
[
|
34
|
+
File.join(root_path, 'TEST_of_EE_Certification_Centre_Root_CA.pem.crt'),
|
35
|
+
File.join(root_path, 'TEST_of_ESTEID-SK_2015.pem.crt')
|
36
|
+
]
|
37
|
+
)
|
36
38
|
end
|
37
39
|
|
38
40
|
def build_store(paths)
|
@@ -43,14 +45,13 @@ module MobileId
|
|
43
45
|
end
|
44
46
|
store
|
45
47
|
end
|
46
|
-
|
47
48
|
end
|
48
49
|
|
49
50
|
attr_accessor :cert, :subject
|
50
51
|
|
51
52
|
def initialize(base64_cert, live:)
|
52
53
|
self.cert = OpenSSL::X509::Certificate.new(Base64.decode64(base64_cert))
|
53
|
-
verify!(cert, live:)
|
54
|
+
verify!(cert, live: live)
|
54
55
|
build_cert_subject
|
55
56
|
end
|
56
57
|
|
@@ -131,6 +132,5 @@ module MobileId
|
|
131
132
|
result[key] = val
|
132
133
|
end
|
133
134
|
end
|
134
|
-
|
135
135
|
end
|
136
136
|
end
|
data/lib/mobile_id/railtie.rb
CHANGED