Skip to content

Commit

Permalink
Add a mockSigned function to produce mock signatures.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadales committed Nov 12, 2019
1 parent 47b8562 commit 03f7b28
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cardano-crypto-class/src/Cardano/Crypto/DSIGN/Mock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Cardano.Crypto.DSIGN.Mock
, SigDSIGN (..)
, verKeyIdFromSigned
, mockSign
, mockSigned
)
where

Expand Down Expand Up @@ -87,6 +88,9 @@ data VerificationFailure
mockSign :: ToCBOR a => a -> SignKeyDSIGN MockDSIGN -> SigDSIGN MockDSIGN
mockSign a (SignKeyMockDSIGN n) = SigMockDSIGN (getHash $ hash @ShortHash a) n

mockSigned :: ToCBOR a => a -> SignKeyDSIGN MockDSIGN -> SignedDSIGN MockDSIGN a
mockSigned a k = SignedDSIGN (mockSign a k)

instance ToCBOR (SigDSIGN MockDSIGN) where
toCBOR (SigMockDSIGN b i) = encodeListLen 2 <> toCBOR b <> toCBOR i

Expand Down

0 comments on commit 03f7b28

Please sign in to comment.