1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-29 00:24:51 +09:00

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
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,) $