You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
480 B
26 lines
480 B
# frozen_string_literal: true |
|
|
|
class VerifySalmonService < BaseService |
|
include AuthorExtractor |
|
|
|
def call(payload) |
|
body = salmon.unpack(payload) |
|
|
|
xml = Nokogiri::XML(body) |
|
xml.encoding = 'utf-8' |
|
|
|
account = author_from_xml(xml.at_xpath('/xmlns:entry', xmlns: OStatus::TagManager::XMLNS)) |
|
|
|
if account.nil? |
|
false |
|
else |
|
salmon.verify(payload, account.keypair) |
|
end |
|
end |
|
|
|
private |
|
|
|
def salmon |
|
@salmon ||= OStatus2::Salmon.new |
|
end |
|
end
|
|
|