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!
This commit is contained in:
fr33domlover 2020-05-25 09:37:15 +00:00
parent 417fcd3e94
commit 55c87b8a54

View file

@ -223,8 +223,8 @@ instance ActivityPub PublicKey where
parseObject o = do parseObject o = do
mtyp <- optional $ o .: "@type" <|> o .: "type" mtyp <- optional $ o .: "@type" <|> o .: "type"
for_ mtyp $ \ t -> for_ mtyp $ \ t ->
when (t /= ("Key" :: Text)) $ unless (t == ("Key" :: Text) || t == "CryptographicKey") $
fail "PublicKey @type isn't Key" fail "PublicKey @type isn't Key or CryptographicKey"
RefURI authority id_ <- o .: "@id" <|> o .: "id" RefURI authority id_ <- o .: "@id" <|> o .: "id"
shared <- o .:|? "isShared" .!= False shared <- o .:|? "isShared" .!= False
fmap (authority,) $ fmap (authority,) $