logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

verify_salmon_service.rb (480B)


  1. # frozen_string_literal: true
  2. class VerifySalmonService < BaseService
  3. include AuthorExtractor
  4. def call(payload)
  5. body = salmon.unpack(payload)
  6. xml = Nokogiri::XML(body)
  7. xml.encoding = 'utf-8'
  8. account = author_from_xml(xml.at_xpath('/xmlns:entry', xmlns: OStatus::TagManager::XMLNS))
  9. if account.nil?
  10. false
  11. else
  12. salmon.verify(payload, account.keypair)
  13. end
  14. end
  15. private
  16. def salmon
  17. @salmon ||= OStatus2::Salmon.new
  18. end
  19. end