Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Crypto.VRF.Class
Description
Abstract Verifiable Random Functions.
Synopsis
-
class
(
Typeable
v,
Show
(
VerKeyVRF
v),
Eq
(
VerKeyVRF
v),
Show
(
SignKeyVRF
v),
Show
(
CertVRF
v),
Eq
(
CertVRF
v),
NoThunks
(
CertVRF
v),
NoThunks
(
VerKeyVRF
v),
NoThunks
(
SignKeyVRF
v)) =>
VRFAlgorithm
v
where
- data VerKeyVRF v :: Type
- data SignKeyVRF v :: Type
- data CertVRF v :: Type
- type ContextVRF v :: Type
- type Signable v :: Type -> Constraint
- algorithmNameVRF :: proxy v -> String
- deriveVerKeyVRF :: SignKeyVRF v -> VerKeyVRF v
- hashVerKeyVRF :: HashAlgorithm h => VerKeyVRF v -> Hash h ( VerKeyVRF v)
- evalVRF :: ( HasCallStack , Signable v a) => ContextVRF v -> a -> SignKeyVRF v -> ( OutputVRF v, CertVRF v)
- verifyVRF :: ( HasCallStack , Signable v a) => ContextVRF v -> VerKeyVRF v -> a -> ( OutputVRF v, CertVRF v) -> Bool
- genKeyVRF :: Seed -> SignKeyVRF v
- genKeyPairVRF :: Seed -> ( SignKeyVRF v, VerKeyVRF v)
- seedSizeVRF :: proxy v -> Word
- sizeVerKeyVRF :: proxy v -> Word
- sizeSignKeyVRF :: proxy v -> Word
- sizeCertVRF :: proxy v -> Word
- sizeOutputVRF :: proxy v -> Word
- rawSerialiseVerKeyVRF :: VerKeyVRF v -> ByteString
- rawSerialiseSignKeyVRF :: SignKeyVRF v -> ByteString
- rawSerialiseCertVRF :: CertVRF v -> ByteString
- rawDeserialiseVerKeyVRF :: ByteString -> Maybe ( VerKeyVRF v)
- rawDeserialiseSignKeyVRF :: ByteString -> Maybe ( SignKeyVRF v)
- rawDeserialiseCertVRF :: ByteString -> Maybe ( CertVRF v)
- newtype OutputVRF v = OutputVRF { }
- getOutputVRFNatural :: OutputVRF v -> Natural
- mkTestOutputVRF :: forall v. VRFAlgorithm v => Natural -> OutputVRF v
-
data
CertifiedVRF
v a =
CertifiedVRF
{
- certifiedOutput :: !( OutputVRF v)
- certifiedProof :: !( CertVRF v)
- evalCertified :: ( VRFAlgorithm v, Signable v a) => ContextVRF v -> a -> SignKeyVRF v -> CertifiedVRF v a
- verifyCertified :: ( VRFAlgorithm v, Signable v a) => ContextVRF v -> VerKeyVRF v -> a -> CertifiedVRF v a -> Bool
- encodeVerKeyVRF :: VRFAlgorithm v => VerKeyVRF v -> Encoding
- decodeVerKeyVRF :: forall v s. VRFAlgorithm v => Decoder s ( VerKeyVRF v)
- encodeSignKeyVRF :: VRFAlgorithm v => SignKeyVRF v -> Encoding
- decodeSignKeyVRF :: forall v s. VRFAlgorithm v => Decoder s ( SignKeyVRF v)
- encodeCertVRF :: VRFAlgorithm v => CertVRF v -> Encoding
- decodeCertVRF :: forall v s. VRFAlgorithm v => Decoder s ( CertVRF v)
- encodedVerKeyVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy ( VerKeyVRF v) -> Size
- encodedSignKeyVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy ( SignKeyVRF v) -> Size
- encodedCertVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy ( CertVRF v) -> Size
VRF algorithm class
class ( Typeable v, Show ( VerKeyVRF v), Eq ( VerKeyVRF v), Show ( SignKeyVRF v), Show ( CertVRF v), Eq ( CertVRF v), NoThunks ( CertVRF v), NoThunks ( VerKeyVRF v), NoThunks ( SignKeyVRF v)) => VRFAlgorithm v where Source #
Minimal complete definition
algorithmNameVRF , deriveVerKeyVRF , evalVRF , verifyVRF , seedSizeVRF , ( genKeyVRF | genKeyPairVRF ), rawSerialiseVerKeyVRF , rawSerialiseSignKeyVRF , rawSerialiseCertVRF , rawDeserialiseVerKeyVRF , rawDeserialiseSignKeyVRF , rawDeserialiseCertVRF , sizeVerKeyVRF , sizeSignKeyVRF , sizeCertVRF , sizeOutputVRF
Associated Types
data VerKeyVRF v :: Type Source #
data SignKeyVRF v :: Type Source #
data CertVRF v :: Type Source #
type ContextVRF v :: Type Source #
Context required to run the VRF algorithm
Unit by default (no context required)
type ContextVRF v = ()
type Signable v :: Type -> Constraint Source #
Methods
algorithmNameVRF :: proxy v -> String Source #
deriveVerKeyVRF :: SignKeyVRF v -> VerKeyVRF v Source #
hashVerKeyVRF :: HashAlgorithm h => VerKeyVRF v -> Hash h ( VerKeyVRF v) Source #
evalVRF :: ( HasCallStack , Signable v a) => ContextVRF v -> a -> SignKeyVRF v -> ( OutputVRF v, CertVRF v) Source #
verifyVRF :: ( HasCallStack , Signable v a) => ContextVRF v -> VerKeyVRF v -> a -> ( OutputVRF v, CertVRF v) -> Bool Source #
genKeyVRF :: Seed -> SignKeyVRF v Source #
genKeyPairVRF :: Seed -> ( SignKeyVRF v, VerKeyVRF v) Source #
seedSizeVRF :: proxy v -> Word Source #
sizeVerKeyVRF :: proxy v -> Word Source #
sizeSignKeyVRF :: proxy v -> Word Source #
sizeCertVRF :: proxy v -> Word Source #
sizeOutputVRF :: proxy v -> Word Source #
rawSerialiseVerKeyVRF :: VerKeyVRF v -> ByteString Source #
rawSerialiseSignKeyVRF :: SignKeyVRF v -> ByteString Source #
rawSerialiseCertVRF :: CertVRF v -> ByteString Source #
rawDeserialiseVerKeyVRF :: ByteString -> Maybe ( VerKeyVRF v) Source #
rawDeserialiseSignKeyVRF :: ByteString -> Maybe ( SignKeyVRF v) Source #
rawDeserialiseCertVRF :: ByteString -> Maybe ( CertVRF v) Source #
Instances
VRF output
The output bytes of the VRF.
The output size is a fixed number of bytes and is given by
sizeOutputVRF
.
Constructors
OutputVRF | |
Fields |
Instances
Eq ( OutputVRF v) Source # | |
Ord ( OutputVRF v) Source # | |
Defined in Cardano.Crypto.VRF.Class Methods compare :: OutputVRF v -> OutputVRF v -> Ordering Source # (<) :: OutputVRF v -> OutputVRF v -> Bool Source # (<=) :: OutputVRF v -> OutputVRF v -> Bool Source # (>) :: OutputVRF v -> OutputVRF v -> Bool Source # (>=) :: OutputVRF v -> OutputVRF v -> Bool Source # |
|
Show ( OutputVRF v) Source # | |
Typeable v => ToCBOR ( OutputVRF v) Source # | |
Typeable v => FromCBOR ( OutputVRF v) Source # | |
NFData ( OutputVRF v) Source # | |
Defined in Cardano.Crypto.VRF.Class |
|
NoThunks ( OutputVRF v) Source # | |
getOutputVRFNatural :: OutputVRF v -> Natural Source #
The output bytes of the VRF interpreted as a big endian natural number.
The range of this number is determined by the size of the VRF output bytes.
It is thus in the range
0 .. 2 ^ (8 * sizeOutputVRF proxy) - 1
.
mkTestOutputVRF :: forall v. VRFAlgorithm v => Natural -> OutputVRF v Source #
For testing purposes, make an
OutputVRF
from a
Natural
.
The
OutputVRF
will be of the appropriate size for the
VRFAlgorithm
.
CertifiedVRF
wrapper
data CertifiedVRF v a Source #
Constructors
CertifiedVRF | |
Fields
|
Instances
evalCertified :: ( VRFAlgorithm v, Signable v a) => ContextVRF v -> a -> SignKeyVRF v -> CertifiedVRF v a Source #
verifyCertified :: ( VRFAlgorithm v, Signable v a) => ContextVRF v -> VerKeyVRF v -> a -> CertifiedVRF v a -> Bool Source #
CBOR encoding and decoding
encodeVerKeyVRF :: VRFAlgorithm v => VerKeyVRF v -> Encoding Source #
decodeVerKeyVRF :: forall v s. VRFAlgorithm v => Decoder s ( VerKeyVRF v) Source #
encodeSignKeyVRF :: VRFAlgorithm v => SignKeyVRF v -> Encoding Source #
decodeSignKeyVRF :: forall v s. VRFAlgorithm v => Decoder s ( SignKeyVRF v) Source #
encodeCertVRF :: VRFAlgorithm v => CertVRF v -> Encoding Source #
decodeCertVRF :: forall v s. VRFAlgorithm v => Decoder s ( CertVRF v) Source #
Encoded
Size
expressions
encodedVerKeyVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy ( VerKeyVRF v) -> Size Source #
Size
expression for
VerKeyVRF
which is using
sizeVerKeyVRF
encoded as
Size
.
encodedSignKeyVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy ( SignKeyVRF v) -> Size Source #
Size
expression for
SignKeyVRF
which is using
sizeSignKeyVRF
encoded
as
Size
encodedCertVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy ( CertVRF v) -> Size Source #
Size
expression for
CertVRF
which is using
sizeCertVRF
encoded as
Size
.