mldsa-0.1.0.0: tests/KeyGen.hs
-- |
-- Module : KeyGen
-- License : BSD-3-Clause
-- Copyright : (c) 2025 Olivier Chéron
--
-- Types that are specific to key-generation test vectors
--
{-# LANGUAGE OverloadedStrings #-}
module KeyGen
( TestGroup(..), Test(..)
) where
import Data.Aeson
import Data.ByteString (ByteString)
import Util
data TestGroup = TestGroup
{ tgId :: Int
, testType :: String
, parameterSet :: String
, tests :: [Test]
} deriving Show
instance FromJSON TestGroup where
parseJSON = withObject "TestGroup" $ \o -> TestGroup
<$> o .: "tgId"
<*> o .: "testType"
<*> o .: "parameterSet"
<*> o .: "tests"
data Test = Test
{ tcId :: Int
, deferred :: Bool
, seed :: ByteString
, pk :: ByteString
, sk :: ByteString
} deriving Show
instance FromJSON Test where
parseJSON = withObject "Test" $ \o -> Test
<$> o .: "tcId"
<*> o .: "deferred"
<*> o .:: "seed"
<*> o .:: "pk"
<*> o .:: "sk"