class SmartId::Api::Authentication::Base
Attributes
authentication_hash[R]
Public Class Methods
authenticate(**opts)
click to toggle source
# File lib/smart_id/api/authentication/base.rb, line 11 def self.authenticate(**opts) new(**opts).call end
new(**opts)
click to toggle source
# File lib/smart_id/api/authentication/base.rb, line 15 def initialize(**opts) @authentication_hash = opts[:authentication_hash] @display_text = opts[:display_text] @certificate_level = opts[:certificate_level] @multiple_choice = opts[:multiple_choice] end
Public Instance Methods
call()
click to toggle source
# File lib/smart_id/api/authentication/base.rb, line 23 def call response = SmartId::Api::Request.execute(method: :post, uri: api_uri, params: request_params) SmartId::Api::Response.new(JSON.parse(response.body), authentication_hash) end
Private Instance Methods
api_uri()
click to toggle source
# File lib/smart_id/api/authentication/base.rb, line 50 def api_uri raise NotImplementedError end
request_params()
click to toggle source
# File lib/smart_id/api/authentication/base.rb, line 30 def request_params params = { relyingPartyUUID: SmartId.relying_party_uuid, relyingPartyName: SmartId.relying_party_name, certificateLevel: @certificate_level || SmartId.default_certificate_level, hash: authentication_hash.calculate_base64_digest, hashType: "SHA256" } if @display_text params.merge!(displayText: @display_text) end if @multiple_choice params.merge!(requestProperties: { vcChoice: @multiple_choice }) end params end