lib/yoti/protobuf/main.rb in yoti-1.5.0 vs lib/yoti/protobuf/main.rb in yoti-1.6.0

- old
+ new

@@ -4,10 +4,13 @@ require 'json' require_relative 'attrpubapi/List_pb.rb' require_relative 'compubapi/EncryptedData_pb.rb' require_relative 'compubapi/SignedTimestamp_pb.rb' +require_relative 'sharepubapi/ExtraData_pb.rb' +require_relative 'sharepubapi/IssuingAttributes_pb.rb' +require_relative 'sharepubapi/ThirdPartyAttribute_pb.rb' module Yoti module Protobuf class << self CT_UNDEFINED = :UNDEFINED # should not be seen, and is used as an error placeholder @@ -38,15 +41,23 @@ return nil unless valid_receipt?(receipt) decipher_profile(receipt['profile_content'], receipt['wrapped_receipt_key']) end + def extra_data(receipt) + return nil unless valid_receipt?(receipt) + + decipher_profile(receipt['extra_data'], receipt['wrapped_receipt_key']) if receipt['extra_data'] + end + def attribute_list(data) Yoti::Protobuf::Attrpubapi::AttributeList.decode(data) end def value_based_on_attribute_name(value, attr_name) case attr_name + when Yoti::Attribute::DOCUMENT_DETAILS + Yoti::DocumentDetails.new(value) when Yoti::Attribute::DOCUMENT_IMAGES raise(TypeError, 'Document Images could not be decoded') unless value.is_a?(Yoti::MultiValue) value.allow_type(Yoti::Image).items else