virgil-sdk 4.2.5 → 4.2.6
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/README.md +1 -1
- data/lib/virgil/sdk/client/card.rb +3 -3
- data/lib/virgil/sdk/client/card_validator.rb +16 -13
- data/lib/virgil/sdk/client/http/cards_service_connection.rb +1 -1
- data/lib/virgil/sdk/client/virgil_client.rb +1 -1
- data/lib/virgil/sdk/high_level/virgil_context.rb +2 -2
- data/lib/virgil/sdk/high_level/virgil_identity.rb +1 -1
- data/lib/virgil/sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16acb388b3bf946a6c34865ae853cc522ce7b272
|
4
|
+
data.tar.gz: 421df1a63fd56ef79abd928b4cb51df4fbf088b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4be3c89279093ae449bdd3cbb98894c61d617821f7b4552544f6ff86abb243f50575dc6eea0f1ea8c7feb0c01650063b7dbee7553bacbe7f2eeaee7776861957
|
7
|
+
data.tar.gz: e89ca01b97a3af8f310efc30fd2098106ceec3ec5e964ea7709c275b8ecb7496471ae12d19e5b66369b3c98e5a70beb1cc29e8b833bbc0f4c90b97962e321035
|
data/README.md
CHANGED
@@ -134,9 +134,9 @@ module Virgil
|
|
134
134
|
|
135
135
|
|
136
136
|
|
137
|
-
Card::SERVICE_URL =
|
138
|
-
Card::READ_ONLY_SERVICE_URL =
|
139
|
-
Card::RA_SERVICE_URL =
|
137
|
+
Card::SERVICE_URL = "https://cards.virgilsecurity.com"
|
138
|
+
Card::READ_ONLY_SERVICE_URL = "https://cards-ro.virgilsecurity.com"
|
139
|
+
Card::RA_SERVICE_URL = "https://ra.virgilsecurity.com"
|
140
140
|
Card::VRA_VERSION = "v1" # version of service, which creates and deletes local and global cards
|
141
141
|
Card::VC_VERSION = "v4" # version of service, which gets, searchs card
|
142
142
|
end
|
@@ -33,18 +33,15 @@
|
|
33
33
|
# POSSIBILITY OF SUCH DAMAGE.
|
34
34
|
|
35
35
|
|
36
|
-
|
37
36
|
module Virgil
|
38
37
|
module SDK
|
39
38
|
module Client
|
40
39
|
# Class used for cards signatures validation.
|
41
40
|
class CardValidator
|
42
|
-
SERVICE_CARD_ID =
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
'a1YxdFVuZTJ1T2RrdzRrRXJSUmJKcmMyU3lhejVWMWZ1RytyVnM9Ci0tLS0tRU5E'\
|
47
|
-
'IFBVQkxJQyBLRVktLS0tLQo='
|
41
|
+
SERVICE_CARD_ID = '3e29d43373348cfb373b7eae189214dc01d7237765e572db685839b64adca853'
|
42
|
+
SERVICE_PUBLIC_KEY = 'LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUNvd0JRWURLMlZ3QXlFQVlSNTAx'\
|
43
|
+
'a1YxdFVuZTJ1T2RrdzRrRXJSUmJKcmMyU3lhejVWMWZ1RytyVnM9Ci0tLS0tRU5E'\
|
44
|
+
'IFBVQkxJQyBLRVktLS0tLQo='
|
48
45
|
|
49
46
|
attr_reader :crypto, :verifiers
|
50
47
|
|
@@ -53,7 +50,7 @@ module Virgil
|
|
53
50
|
@public_key_bytes = Crypto::Bytes.from_base64(SERVICE_PUBLIC_KEY)
|
54
51
|
@public_key = crypto.import_public_key(@public_key_bytes)
|
55
52
|
@verifiers = {
|
56
|
-
|
53
|
+
SERVICE_CARD_ID => @public_key
|
57
54
|
}
|
58
55
|
end
|
59
56
|
|
@@ -74,10 +71,15 @@ module Virgil
|
|
74
71
|
# True if card signatures are valid, false otherwise.
|
75
72
|
def is_valid?(card)
|
76
73
|
|
77
|
-
return true if (card.version == '
|
74
|
+
return true if (card.version == '3.0')
|
75
|
+
|
76
|
+
if (card.nil? || !card.is_a?(Card) || card.snapshot.nil? || (card.signatures.nil? || card.signatures.empty?))
|
77
|
+
return false
|
78
|
+
end
|
78
79
|
|
80
|
+
# add self signature verifier
|
79
81
|
fingerprint = self.crypto.calculate_fingerprint(
|
80
|
-
|
82
|
+
Crypto::Bytes.from_string(card.snapshot)
|
81
83
|
)
|
82
84
|
fingerprint_hex = fingerprint.to_hex
|
83
85
|
return false if fingerprint_hex != card.id
|
@@ -85,14 +87,15 @@ module Virgil
|
|
85
87
|
verifiers = self.verifiers.clone
|
86
88
|
card_public_key = self.crypto.import_public_key(card.public_key)
|
87
89
|
verifiers[fingerprint_hex] = card_public_key
|
90
|
+
|
88
91
|
verifiers.each do |id, key|
|
89
92
|
unless card.signatures.has_key?(id)
|
90
93
|
return false
|
91
94
|
end
|
92
95
|
is_valid = self.crypto.verify(
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
+
fingerprint.value,
|
97
|
+
Crypto::Bytes.from_base64(card.signatures[id]),
|
98
|
+
key
|
96
99
|
)
|
97
100
|
return false unless is_valid
|
98
101
|
end
|
@@ -41,7 +41,7 @@ module Virgil
|
|
41
41
|
# Contains cards service specific errors dictionary.
|
42
42
|
class CardsServiceConnection < BaseConnection
|
43
43
|
ERRORS = {
|
44
|
-
10000 => "Internal application error
|
44
|
+
10000 => "Internal application error",
|
45
45
|
20300 => "The Virgil access token was not specified or is invalid",
|
46
46
|
20301 => "The Virgil authenticator service responded with an error",
|
47
47
|
20302 => "The Virgil access token validation has failed on the Virgil Authenticator service",
|
@@ -60,7 +60,7 @@ module Virgil
|
|
60
60
|
access_token=nil,
|
61
61
|
cards_service_url=Card::SERVICE_URL,
|
62
62
|
cards_read_only_service_url=Card::READ_ONLY_SERVICE_URL,
|
63
|
-
identity_service_url=Virgil::SDK::VirgilIdentity::IDENTITY_SERVICE_URL,
|
63
|
+
identity_service_url=Virgil::SDK::HighLevel::VirgilIdentity::IDENTITY_SERVICE_URL,
|
64
64
|
ra_service_url=Card::RA_SERVICE_URL
|
65
65
|
)
|
66
66
|
self.access_token = access_token
|
@@ -53,9 +53,9 @@ module Virgil
|
|
53
53
|
@credentials = credentials
|
54
54
|
@key_storage = Cryptography::Keys::KeyStorage.new(key_storage_path)
|
55
55
|
|
56
|
-
|
56
|
+
@client.card_validator = Client::CardValidator.new(@crypto)
|
57
57
|
|
58
|
-
|
58
|
+
if card_verifiers.any?
|
59
59
|
|
60
60
|
card_verifiers.each do |card_verifier|
|
61
61
|
raise ArgumentError.new("card_verifiers is not valid") unless card_verifier.is_a? VirgilCardVerifierInfo
|
@@ -7,7 +7,7 @@ module Virgil
|
|
7
7
|
autoload :ValidationToken, 'virgil/sdk/high_level/virgil_identity/validation_token'
|
8
8
|
autoload :EmailConfirmation, 'virgil/sdk/high_level/virgil_identity/email_confirmation'
|
9
9
|
|
10
|
-
IDENTITY_SERVICE_URL =
|
10
|
+
IDENTITY_SERVICE_URL = "https://identity.virgilsecurity.com"
|
11
11
|
|
12
12
|
EMAIL = "email"
|
13
13
|
USERNAME = "username"
|
data/lib/virgil/sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virgil-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Dudkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virgil-crypto
|