{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
module Cardano.Crypto.KES.NeverUsed
  ( NeverKES
  , VerKeyKES (..)
  , SignKeyKES (..)
  , SigKES (..)
  )
where

import GHC.Generics (Generic)
import NoThunks.Class (NoThunks)

import Cardano.Crypto.KES.Class


-- | KES never used
--
-- The type of keys and signatures is isomorphic to unit, but when actually
-- trying to sign or verify something a runtime exception will be thrown.
data NeverKES

instance KESAlgorithm NeverKES where
  type SeedSizeKES NeverKES = 0

  data VerKeyKES  NeverKES = NeverUsedVerKeyKES
      deriving (Int -> VerKeyKES NeverKES -> ShowS
[VerKeyKES NeverKES] -> ShowS
VerKeyKES NeverKES -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VerKeyKES NeverKES] -> ShowS
$cshowList :: [VerKeyKES NeverKES] -> ShowS
show :: VerKeyKES NeverKES -> String
$cshow :: VerKeyKES NeverKES -> String
showsPrec :: Int -> VerKeyKES NeverKES -> ShowS
$cshowsPrec :: Int -> VerKeyKES NeverKES -> ShowS
Show, VerKeyKES NeverKES -> VerKeyKES NeverKES -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VerKeyKES NeverKES -> VerKeyKES NeverKES -> Bool
$c/= :: VerKeyKES NeverKES -> VerKeyKES NeverKES -> Bool
== :: VerKeyKES NeverKES -> VerKeyKES NeverKES -> Bool
$c== :: VerKeyKES NeverKES -> VerKeyKES NeverKES -> Bool
Eq, forall x. Rep (VerKeyKES NeverKES) x -> VerKeyKES NeverKES
forall x. VerKeyKES NeverKES -> Rep (VerKeyKES NeverKES) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep (VerKeyKES NeverKES) x -> VerKeyKES NeverKES
$cfrom :: forall x. VerKeyKES NeverKES -> Rep (VerKeyKES NeverKES) x
Generic, Context -> VerKeyKES NeverKES -> IO (Maybe ThunkInfo)
Proxy (VerKeyKES NeverKES) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (VerKeyKES NeverKES) -> String
$cshowTypeOf :: Proxy (VerKeyKES NeverKES) -> String
wNoThunks :: Context -> VerKeyKES NeverKES -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> VerKeyKES NeverKES -> IO (Maybe ThunkInfo)
noThunks :: Context -> VerKeyKES NeverKES -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> VerKeyKES NeverKES -> IO (Maybe ThunkInfo)
NoThunks)

  data SignKeyKES NeverKES = NeverUsedSignKeyKES
      deriving (Int -> SignKeyKES NeverKES -> ShowS
[SignKeyKES NeverKES] -> ShowS
SignKeyKES NeverKES -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SignKeyKES NeverKES] -> ShowS
$cshowList :: [SignKeyKES NeverKES] -> ShowS
show :: SignKeyKES NeverKES -> String
$cshow :: SignKeyKES NeverKES -> String
showsPrec :: Int -> SignKeyKES NeverKES -> ShowS
$cshowsPrec :: Int -> SignKeyKES NeverKES -> ShowS
Show, SignKeyKES NeverKES -> SignKeyKES NeverKES -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SignKeyKES NeverKES -> SignKeyKES NeverKES -> Bool
$c/= :: SignKeyKES NeverKES -> SignKeyKES NeverKES -> Bool
== :: SignKeyKES NeverKES -> SignKeyKES NeverKES -> Bool
$c== :: SignKeyKES NeverKES -> SignKeyKES NeverKES -> Bool
Eq, forall x. Rep (SignKeyKES NeverKES) x -> SignKeyKES NeverKES
forall x. SignKeyKES NeverKES -> Rep (SignKeyKES NeverKES) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep (SignKeyKES NeverKES) x -> SignKeyKES NeverKES
$cfrom :: forall x. SignKeyKES NeverKES -> Rep (SignKeyKES NeverKES) x
Generic, Context -> SignKeyKES NeverKES -> IO (Maybe ThunkInfo)
Proxy (SignKeyKES NeverKES) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (SignKeyKES NeverKES) -> String
$cshowTypeOf :: Proxy (SignKeyKES NeverKES) -> String
wNoThunks :: Context -> SignKeyKES NeverKES -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> SignKeyKES NeverKES -> IO (Maybe ThunkInfo)
noThunks :: Context -> SignKeyKES NeverKES -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> SignKeyKES NeverKES -> IO (Maybe ThunkInfo)
NoThunks)

  data SigKES     NeverKES = NeverUsedSigKES
      deriving (Int -> SigKES NeverKES -> ShowS
[SigKES NeverKES] -> ShowS
SigKES NeverKES -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SigKES NeverKES] -> ShowS
$cshowList :: [SigKES NeverKES] -> ShowS
show :: SigKES NeverKES -> String
$cshow :: SigKES NeverKES -> String
showsPrec :: Int -> SigKES NeverKES -> ShowS
$cshowsPrec :: Int -> SigKES NeverKES -> ShowS
Show, SigKES NeverKES -> SigKES NeverKES -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SigKES NeverKES -> SigKES NeverKES -> Bool
$c/= :: SigKES NeverKES -> SigKES NeverKES -> Bool
== :: SigKES NeverKES -> SigKES NeverKES -> Bool
$c== :: SigKES NeverKES -> SigKES NeverKES -> Bool
Eq, forall x. Rep (SigKES NeverKES) x -> SigKES NeverKES
forall x. SigKES NeverKES -> Rep (SigKES NeverKES) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep (SigKES NeverKES) x -> SigKES NeverKES
$cfrom :: forall x. SigKES NeverKES -> Rep (SigKES NeverKES) x
Generic, Context -> SigKES NeverKES -> IO (Maybe ThunkInfo)
Proxy (SigKES NeverKES) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (SigKES NeverKES) -> String
$cshowTypeOf :: Proxy (SigKES NeverKES) -> String
wNoThunks :: Context -> SigKES NeverKES -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> SigKES NeverKES -> IO (Maybe ThunkInfo)
noThunks :: Context -> SigKES NeverKES -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> SigKES NeverKES -> IO (Maybe ThunkInfo)
NoThunks)

  algorithmNameKES :: forall (proxy :: * -> *). proxy NeverKES -> String
algorithmNameKES proxy NeverKES
_ = String
"never"

  deriveVerKeyKES :: SignKeyKES NeverKES -> VerKeyKES NeverKES
deriveVerKeyKES SignKeyKES NeverKES
_ = VerKeyKES NeverKES
NeverUsedVerKeyKES

  signKES :: forall a.
(Signable NeverKES a, HasCallStack) =>
ContextKES NeverKES
-> Period -> a -> SignKeyKES NeverKES -> SigKES NeverKES
signKES   = forall a. HasCallStack => String -> a
error String
"KES not available"
  verifyKES :: forall a.
(Signable NeverKES a, HasCallStack) =>
ContextKES NeverKES
-> VerKeyKES NeverKES
-> Period
-> a
-> SigKES NeverKES
-> Either String ()
verifyKES = forall a. HasCallStack => String -> a
error String
"KES not available"
  updateKES :: HasCallStack =>
ContextKES NeverKES
-> SignKeyKES NeverKES -> Period -> Maybe (SignKeyKES NeverKES)
updateKES = forall a. HasCallStack => String -> a
error String
"KES not available"

  totalPeriodsKES :: forall (proxy :: * -> *). proxy NeverKES -> Period
totalPeriodsKES proxy NeverKES
_ = Period
0

  genKeyKES :: Seed -> SignKeyKES NeverKES
genKeyKES       Seed
_ = SignKeyKES NeverKES
NeverUsedSignKeyKES

  sizeVerKeyKES :: forall (proxy :: * -> *). proxy NeverKES -> Period
sizeVerKeyKES  proxy NeverKES
_ = Period
0
  sizeSignKeyKES :: forall (proxy :: * -> *). proxy NeverKES -> Period
sizeSignKeyKES proxy NeverKES
_ = Period
0
  sizeSigKES :: forall (proxy :: * -> *). proxy NeverKES -> Period
sizeSigKES     proxy NeverKES
_ = Period
0

  rawSerialiseVerKeyKES :: VerKeyKES NeverKES -> ByteString
rawSerialiseVerKeyKES  VerKeyKES NeverKES
_ = forall a. Monoid a => a
mempty
  rawSerialiseSignKeyKES :: SignKeyKES NeverKES -> ByteString
rawSerialiseSignKeyKES SignKeyKES NeverKES
_ = forall a. Monoid a => a
mempty
  rawSerialiseSigKES :: SigKES NeverKES -> ByteString
rawSerialiseSigKES     SigKES NeverKES
_ = forall a. Monoid a => a
mempty

  rawDeserialiseVerKeyKES :: ByteString -> Maybe (VerKeyKES NeverKES)
rawDeserialiseVerKeyKES  ByteString
_ = forall a. a -> Maybe a
Just VerKeyKES NeverKES
NeverUsedVerKeyKES
  rawDeserialiseSignKeyKES :: ByteString -> Maybe (SignKeyKES NeverKES)
rawDeserialiseSignKeyKES ByteString
_ = forall a. a -> Maybe a
Just SignKeyKES NeverKES
NeverUsedSignKeyKES
  rawDeserialiseSigKES :: ByteString -> Maybe (SigKES NeverKES)
rawDeserialiseSigKES     ByteString
_ = forall a. a -> Maybe a
Just SigKES NeverKES
NeverUsedSigKES