Support more variations of ActivityPub keyId in signature (#4630)
- Tries to avoid performing HTTP request if the keyId is an actor URI - Likewise if the URI is a fragment URI on top of actor URI - Resolves public key, returns owner if the owner links back to the key
This commit is contained in:
parent
f391a4673a
commit
72bb3e03fd
8 changed files with 60 additions and 7 deletions
|
@ -9,6 +9,10 @@ module JsonLdHelper
|
|||
value.is_a?(Array) ? value.first : value
|
||||
end
|
||||
|
||||
def value_or_id(value)
|
||||
value.is_a?(String) ? value : value['id']
|
||||
end
|
||||
|
||||
def supported_context?(json)
|
||||
equals_or_includes?(json['@context'], ActivityPub::TagManager::CONTEXT)
|
||||
end
|
||||
|
@ -20,7 +24,7 @@ module JsonLdHelper
|
|||
end
|
||||
|
||||
def body_to_json(body)
|
||||
body.nil? ? nil : Oj.load(body, mode: :strict)
|
||||
body.is_a?(String) ? Oj.load(body, mode: :strict) : body
|
||||
rescue Oj::ParseError
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue