cardano-crypto-class-2.1.1.0: 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 #

Associated Types

data VerKeyVRF v :: Type #

data SignKeyVRF v :: Type #

data CertVRF v :: Type #

type ContextVRF v :: Type #

Context required to run the VRF algorithm

Unit by default (no context required)

type ContextVRF v = ()

type Signable v :: Type -> Constraint #

type Signable c = Empty

Instances

Instances details
VRFAlgorithm MockVRF # 
Instance details

Defined in Cardano.Crypto.VRF.Mock

VRFAlgorithm NeverVRF # 
Instance details

Defined in Cardano.Crypto.VRF.NeverUsed

VRFAlgorithm SimpleVRF # 
Instance details

Defined in Cardano.Crypto.VRF.Simple

VRF output

newtype OutputVRF v #

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) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

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

Defined in Cardano.Crypto.VRF.Class

Typeable v => ToCBOR (OutputVRF v) # 
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) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

rnf :: OutputVRF v -> () Source #

Eq (OutputVRF v) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Ord (OutputVRF v) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

NoThunks (OutputVRF v) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

getOutputVRFNatural :: OutputVRF v -> Natural #

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 #

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 #

Constructors

CertifiedVRF 

Instances

Instances details
Generic (CertifiedVRF v a) # 
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) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

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

Defined in Cardano.Crypto.VRF.Class

(VRFAlgorithm v, Typeable a) => ToCBOR (CertifiedVRF v a) # 
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) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

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

Defined in Cardano.Crypto.VRF.Class

type Rep (CertifiedVRF v a) # 
Instance details

Defined in Cardano.Crypto.VRF.Class

type Rep (CertifiedVRF v a) = D1 ('MetaData "CertifiedVRF" "Cardano.Crypto.VRF.Class" "cardano-crypto-class-2.1.1.0-inplace" '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

decodeVerKeyVRF :: forall v s. VRFAlgorithm v => Decoder s (VerKeyVRF v) #

decodeCertVRF :: forall v s. VRFAlgorithm v => Decoder s (CertVRF v) #

Encoded Size expressions

encodedVerKeyVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy (VerKeyVRF v) -> Size #

Size expression for VerKeyVRF which is using sizeVerKeyVRF encoded as Size.

encodedSignKeyVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy (SignKeyVRF v) -> Size #

Size expression for SignKeyVRF which is using sizeSignKeyVRF encoded as Size

encodedCertVRFSizeExpr :: forall v. VRFAlgorithm v => Proxy (CertVRF v) -> Size #

Size expression for CertVRF which is using sizeCertVRF encoded as Size.