Class: Virgil::SDK::HighLevel::VirgilContext
- Inherits:
-
Object
- Object
- Virgil::SDK::HighLevel::VirgilContext
- Defined in:
- lib/virgil/sdk/high_level/virgil_context.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#cards_read_only_service_url ⇒ Object
readonly
Returns the value of attribute cards_read_only_service_url.
-
#cards_service_url ⇒ Object
readonly
Returns the value of attribute cards_service_url.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#crypto ⇒ Object
readonly
Returns the value of attribute crypto.
-
#identity_service_url ⇒ Object
readonly
Returns the value of attribute identity_service_url.
-
#key_storage ⇒ Object
readonly
Returns the value of attribute key_storage.
-
#ra_service_url ⇒ Object
readonly
Returns the value of attribute ra_service_url.
Instance Method Summary collapse
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: []) ⇒ VirgilContext
Returns a new instance of VirgilContext.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 42 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: [] ) @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) @client.card_validator = Client::CardValidator.new(@crypto) 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 ⇒ Object (readonly)
Returns the value of attribute access_token.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def access_token @access_token end |
#cards_read_only_service_url ⇒ Object (readonly)
Returns the value of attribute cards_read_only_service_url.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def cards_read_only_service_url @cards_read_only_service_url end |
#cards_service_url ⇒ Object (readonly)
Returns the value of attribute cards_service_url.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def cards_service_url @cards_service_url end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def client @client end |
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def credentials @credentials end |
#crypto ⇒ Object (readonly)
Returns the value of attribute crypto.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def crypto @crypto end |
#identity_service_url ⇒ Object (readonly)
Returns the value of attribute identity_service_url.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def identity_service_url @identity_service_url end |
#key_storage ⇒ Object (readonly)
Returns the value of attribute key_storage.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def key_storage @key_storage end |
#ra_service_url ⇒ Object (readonly)
Returns the value of attribute ra_service_url.
38 39 40 |
# File 'lib/virgil/sdk/high_level/virgil_context.rb', line 38 def ra_service_url @ra_service_url end |