Sha256: 840234b72dcb1b24e5d7a633c0c2c041f9f80b75d4c01f4935a3486184c9dd9f

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

module Yoti
  # Handles all the publicly accesible Yoti methods for
  # geting data using an encrypted connect token
  module Client
    # Performs all the steps required to get the decrypted profile from an API request
    # @param encrypted_connect_token [String] token provided as a base 64 string
    # @return [Object] an ActivityDetails instance encapsulating the user profile
    def self.get_activity_details(encrypted_connect_token)
      receipt = Yoti::ProfileRequest.new(encrypted_connect_token).receipt
      encrypted_data = Protobuf.current_user(receipt)

      return ActivityDetails.new(receipt) if encrypted_data.nil?

      unwrapped_key = Yoti::SSL.decrypt_token(receipt['wrapped_receipt_key'])
      decrypted_data = Yoti::SSL.decipher(unwrapped_key, encrypted_data.iv, encrypted_data.cipher_text)
      decrypted_profile = Protobuf.attribute_list(decrypted_data)
      ActivityDetails.new(receipt, decrypted_profile)
    end

    def self.aml_check(aml_profile)
      Yoti::AmlCheckRequest.new(aml_profile).response
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yoti-1.4.0 lib/yoti/client.rb
yoti-1.3.1 lib/yoti/client.rb
yoti-1.3.0 lib/yoti/client.rb
yoti-1.2.1 lib/yoti/client.rb
yoti-1.2.0 lib/yoti/client.rb