Skip to content

Commit

Permalink
Fix the type of signatures in metadata
Browse files Browse the repository at this point in the history
Signatures are actually complex objects. We could use `Value` here since
it's unlikely that any consumers care about this, but it's cheap enough
to just define a structure for the signature objects.

In practice this isn't an issue because it seems like this field is
never populated in Hackage, but it can be populated if you build a
custom Hackage it can happen.

Fixes #573.
  • Loading branch information
michaelpj authored and sternenseemann committed Oct 10, 2022
1 parent b3ae6f9 commit 4262a32
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hackage-db/src/Distribution/Hackage/DB/MetaData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ parseMetaData :: ByteString -> MetaData
parseMetaData = either (throw . InvalidMetaFile) id . eitherDecode

data MetaData = MetaData { signed :: SignedMetaData
, signatures :: [String]
, signatures :: [Signature]
}
deriving (Show, Generic)

Expand All @@ -56,3 +56,10 @@ data TargetData = TargetData { length :: Int
deriving (Show, Generic)

instance FromJSON TargetData

data Signature = Signature { keyid :: String
, method :: String
, sig :: String }
deriving (Show, Generic)

instance FromJSON Signature

0 comments on commit 4262a32

Please sign in to comment.