Class: Virgil::SDK::HighLevel::VirgilContext
- Inherits:
-
Object
- Object
- Virgil::SDK::HighLevel::VirgilContext
- Defined in:
- lib/virgil/sdk/high_level/virgil_context.rb
Overview
The VirgilContext class manages the VirgilApi dependencies during run time. It also contains a list of properties that uses to configure the high-level components.
Instance Attribute Summary collapse
-
#access_token ⇒ String
readonly
Provides an authenticated secure access to the Virgil Security services.
-
#client ⇒ Client::VirgilClient
readonly
Virgil Security services client.
-
#credentials ⇒ VirgilAppCredentials
readonly
Application authentication credentials.
-
#crypto ⇒ VirgilCrypto
readonly
crypto API that represents a set of methods for dealing with low-level cryptographic primitives and algorithms.
-
#key_storage ⇒ Cryptography::Keys::KeyStorage
readonly
Cryptographic keys storage.
-
#use_built_in_verifiers ⇒ Boolean
readonly
indicates whether the Cards be verified with built in verifiers or not.
Instance Method Summary collapse
-
#initialize(access_token: nil, credentials: nil, key_storage_path: Cryptography::Keys::KeyStorage.default_folder, cards_service_url: Client::Card::SERVICE_URL, cards_read_only_service_url: Client::Card::READ_ONLY_SERVICE_URL, ra_service_url: Client::Card::RA_SERVICE_URL, identity_service_url: VirgilIdentity::IDENTITY_SERVICE_URL, crypto: Cryptography::VirgilCrypto.new, card_verifiers: [], use_built_in_verifiers: true) ⇒ VirgilContext
constructor
Initializes a new instance of the VirgilContext class.
Constructor Details
#initialize(access_token: nil, credentials: nil, key_storage_path: Cryptography::Keys::KeyStorage.default_folder, cards_service_url: Client::Card::SERVICE_URL, cards_read_only_service_url: Client::Card::READ_ONLY_SERVICE_URL, ra_service_url: Client::Card::RA_SERVICE_URL, identity_service_url: VirgilIdentity::IDENTITY_SERVICE_URL, crypto: Cryptography::VirgilCrypto.new, card_verifiers: [], use_built_in_verifiers: true) ⇒ VirgilContext
Initializes a new instance of the Virgil::SDK::HighLevel::VirgilContext class.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 80 def initialize(access_token: nil, credentials: nil, key_storage_path: Cryptography::Keys::KeyStorage.default_folder, cards_service_url: Client::Card::SERVICE_URL, cards_read_only_service_url: Client::Card::READ_ONLY_SERVICE_URL, ra_service_url: Client::Card::RA_SERVICE_URL, identity_service_url: VirgilIdentity::IDENTITY_SERVICE_URL, crypto: Cryptography::VirgilCrypto.new, card_verifiers: [], use_built_in_verifiers: true ) @access_token = access_token @client = Client::VirgilClient.new(access_token, cards_service_url, cards_read_only_service_url, identity_service_url, ra_service_url) @crypto = crypto @credentials = credentials @key_storage = Cryptography::Keys::KeyStorage.new(key_storage_path) @use_built_in_verifiers = use_built_in_verifiers validator = Client::CardValidator.new(@crypto) validator.add_default_verifiers if @use_built_in_verifiers @client.card_validator = validator if card_verifiers.any? card_verifiers.each do |card_verifier| raise ArgumentError.new("card_verifiers is not valid") unless card_verifier.is_a? VirgilCardVerifierInfo @client.card_validator.add_verifier(card_verifier.card_id, @crypto.import_public_key(card_verifier.public_key_value.bytes)) end end end |
Instance Attribute Details
#access_token ⇒ String (readonly)
Provides an authenticated secure access to the Virgil Security services. The access token also allows the API to associate your app requests with your Virgil Security developer’s account.
46 47 48 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 46 def access_token @access_token end |
#client ⇒ Client::VirgilClient (readonly)
Virgil Security services client.
50 51 52 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 50 def client @client end |
#credentials ⇒ VirgilAppCredentials (readonly)
Application authentication credentials.
59 60 61 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 59 def credentials @credentials end |
#crypto ⇒ VirgilCrypto (readonly)
crypto API that represents a set of methods for dealing with low-level cryptographic primitives and algorithms.
55 56 57 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 55 def crypto @crypto end |
#key_storage ⇒ Cryptography::Keys::KeyStorage (readonly)
Cryptographic keys storage.
63 64 65 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 63 def key_storage @key_storage end |
#use_built_in_verifiers ⇒ Boolean (readonly)
indicates whether the Cards be verified with built in verifiers or not.
67 68 69 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 67 def use_built_in_verifiers @use_built_in_verifiers end |