cardano-crypto-class-2.0.0.0.0.0.0.2: Type classes abstracting over cryptography primitives for Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Crypto.VRF.Class

Description

Abstract Verifiable Random Functions.

Synopsis

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 #

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 #

type Signable c = Empty

Instances

Instances details
VRFAlgorithm MockVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Mock

VRFAlgorithm NeverVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.NeverUsed

VRFAlgorithm SimpleVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Simple

VRF output

newtype OutputVRF v Source #

The output bytes of the VRF.

The output size is a fixed number of bytes and is given by sizeOutputVRF.

Constructors

OutputVRF 

Instances

Instances details
Show (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Typeable v => FromCBOR (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Typeable v => ToCBOR (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

toCBOR :: OutputVRF v -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (OutputVRF v) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [OutputVRF v] -> Size Source #

NFData (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

rnf :: OutputVRF v -> () Source #

Eq (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Ord (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

NoThunks (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

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 

Instances

Instances details
Generic (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Associated Types

type Rep (CertifiedVRF v a) :: Type -> Type Source #

Methods

from :: CertifiedVRF v a -> Rep (CertifiedVRF v a) x Source #

to :: Rep (CertifiedVRF v a) x -> CertifiedVRF v a Source #

VRFAlgorithm v => Show (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

(VRFAlgorithm v, Typeable a) => FromCBOR (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

(VRFAlgorithm v, Typeable a) => ToCBOR (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

toCBOR :: CertifiedVRF v a -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (CertifiedVRF v a) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [CertifiedVRF v a] -> Size Source #

VRFAlgorithm v => Eq (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

VRFAlgorithm v => NoThunks (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

type Rep (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

type Rep (CertifiedVRF v a) = D1 ('MetaData "CertifiedVRF" "Cardano.Crypto.VRF.Class" "cardano-crypto-class-2.0.0.0.0.0.0.2-DK6Ti6yI0b4E6vuoX0zDQ9" 'False) (C1 ('MetaCons "CertifiedVRF" 'PrefixI 'True) (S1 ('MetaSel ('Just "certifiedOutput") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (OutputVRF v)) :*: S1 ('MetaSel ('Just "certifiedProof") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (CertVRF v))))

CBOR encoding and decoding

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.