lib/xml/kit/document.rb in xml-kit-0.2.0 vs lib/xml/kit/document.rb in xml-kit-0.3.0

- old
+ new

@@ -1,10 +1,10 @@ # frozen_string_literal: true module Xml module Kit - # {include:file:spec/saml/xml_spec.rb} + # {include:file:spec/xml/kit/document_spec.rb} class Document include ActiveModel::Validations NAMESPACES = { "ds": ::Xml::Kit::Namespaces::XMLDSIG }.freeze validate :validate_signatures @@ -45,12 +45,13 @@ invalid_signatures.flat_map(&:errors).uniq.each do |error| errors.add(error, 'is invalid') end end - def invalid_signatures - signed_document = Xmldsig::SignedDocument.new(document, id_attr: 'ID=$uri or @Id') - signed_document.signatures.find_all do |signature| + def invalid_signatures(id_attr: 'ID=$uri or @Id') + Xmldsig::SignedDocument + .new(document, id_attr: id_attr) + .signatures.find_all do |signature| x509_certificates.all? do |certificate| !signature.valid?(certificate) end end end