module Cardano.Chain.Update.Proof (
  Proof,
  mkProof,
  recoverProof,
)
where

import Cardano.Chain.Update.Payload (APayload (..), Payload)
import Cardano.Crypto (Hash, hashDecoded, serializeCborHash)
import Cardano.Prelude

-- | Proof that body of update message contains 'Update.Payload'
type Proof = Hash Payload

mkProof :: Payload -> Proof
mkProof :: Payload -> Proof
mkProof = forall a. EncCBOR a => a -> Hash a
serializeCborHash

recoverProof :: APayload ByteString -> Proof
recoverProof :: APayload ByteString -> Proof
recoverProof = forall t. Decoded t => t -> Hash (BaseType t)
hashDecoded