From 55c87b8a541e2c8c27f6aba69bfffafb7bd20a9b Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 25 May 2020 09:37:15 +0000 Subject: [PATCH] AP: Recognize "CryptographicKey" as a type of http sig keys The examples in the security vocabulary's spec use "Key" but the JSON-LD context doesn't define that term. From now on, just in case, recognizing both "Key" and "CryptographicKey" as indication that the object is a key. zPlus, thanks for finding this bug! --- src/Web/ActivityPub.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Web/ActivityPub.hs b/src/Web/ActivityPub.hs index 3371d0a..a602b8c 100644 --- a/src/Web/ActivityPub.hs +++ b/src/Web/ActivityPub.hs @@ -223,8 +223,8 @@ instance ActivityPub PublicKey where parseObject o = do mtyp <- optional $ o .: "@type" <|> o .: "type" for_ mtyp $ \ t -> - when (t /= ("Key" :: Text)) $ - fail "PublicKey @type isn't Key" + unless (t == ("Key" :: Text) || t == "CryptographicKey") $ + fail "PublicKey @type isn't Key or CryptographicKey" RefURI authority id_ <- o .: "@id" <|> o .: "id" shared <- o .:|? "isShared" .!= False fmap (authority,) $