Class: ZATCA::UBL::Signing::SignedInfo

Inherits:
BaseComponent show all
Defined in:
lib/zatca/ubl/signing/signed_info.rb

Constant Summary

Constants inherited from BaseComponent

BaseComponent::ArrayOfBaseComponentOrNil

Instance Attribute Summary

Attributes inherited from BaseComponent

#attributes, #index, #value

Instance Method Summary collapse

Methods inherited from BaseComponent

#[], build, #build_xml, #dig, #find_nested_element_by_path, #generate_xml, #schema, #to_h, #to_xml

Constructor Details

#initialize(invoice_digest:, signed_properties_hash:) ⇒ SignedInfo

Returns a new instance of SignedInfo.



2
3
4
5
6
7
# File 'lib/zatca/ubl/signing/signed_info.rb', line 2

def initialize(invoice_digest:, signed_properties_hash:)
  super()

  @invoice_digest = invoice_digest
  @signed_properties_hash = signed_properties_hash
end

Instance Method Details

#elementsObject



13
14
15
16
17
18
19
20
# File 'lib/zatca/ubl/signing/signed_info.rb', line 13

def elements
  [
    ZATCA::UBL::BaseComponent.new(name: "ds:CanonicalizationMethod", attributes: {"Algorithm" => "http://www.w3.org/2006/12/xml-c14n11"}),
    ZATCA::UBL::BaseComponent.new(name: "ds:SignatureMethod", attributes: {"Algorithm" => "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"}),
    ZATCA::UBL::Signing::InvoiceSignedDataReference.new(digest_value: @invoice_digest),
    ZATCA::UBL::Signing::SignaturePropertiesReference.new(digest_value: @signed_properties_hash)
  ]
end

#nameObject



9
10
11
# File 'lib/zatca/ubl/signing/signed_info.rb', line 9

def name
  "ds:SignedInfo"
end