cardano-crypto-class-2.2.2.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 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

Associated Types

data VerKeyVRF MockVRF Source #

data SignKeyVRF MockVRF Source #

data CertVRF MockVRF Source #

type ContextVRF MockVRF Source #

type Signable MockVRF ∷ Type → Constraint Source #

VRFAlgorithm NeverVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.NeverUsed

Associated Types

data VerKeyVRF NeverVRF Source #

data SignKeyVRF NeverVRF Source #

data CertVRF NeverVRF Source #

type ContextVRF NeverVRF Source #

type Signable NeverVRF ∷ Type → Constraint Source #

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

Methods

showsPrecIntOutputVRF v → ShowS #

showOutputVRF v → String #

showList ∷ [OutputVRF v] → ShowS #

Typeable v ⇒ FromCBOR (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

fromCBORDecoder s (OutputVRF v) Source #

label ∷ Proxy (OutputVRF v) → Text Source #

Typeable v ⇒ ToCBOR (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

toCBOROutputVRF v → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (OutputVRF v) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [OutputVRF v] → Size Source #

NFData (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

rnfOutputVRF v → ()

Eq (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

(==)OutputVRF v → OutputVRF v → Bool #

(/=)OutputVRF v → OutputVRF v → Bool #

Ord (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

compareOutputVRF v → OutputVRF v → Ordering #

(<)OutputVRF v → OutputVRF v → Bool #

(<=)OutputVRF v → OutputVRF v → Bool #

(>)OutputVRF v → OutputVRF v → Bool #

(>=)OutputVRF v → OutputVRF v → Bool #

maxOutputVRF v → OutputVRF v → OutputVRF v #

minOutputVRF v → OutputVRF v → OutputVRF v #

NoThunks (OutputVRF v) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

noThunksContextOutputVRF v → IO (Maybe ThunkInfo) Source #

wNoThunksContextOutputVRF v → IO (Maybe ThunkInfo) Source #

showTypeOf ∷ Proxy (OutputVRF v) → String Source #

getOutputVRFNaturalOutputVRF 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 ∷ ∀ v. VRFAlgorithm v ⇒ NaturalOutputVRF 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

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

Defined in Cardano.Crypto.VRF.Class

Associated Types

type Rep (CertifiedVRF v a) ∷ Type → Type #

Methods

fromCertifiedVRF v a → Rep (CertifiedVRF v a) x #

toRep (CertifiedVRF v a) x → CertifiedVRF v a #

VRFAlgorithm v ⇒ Show (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

showsPrecIntCertifiedVRF v a → ShowS #

showCertifiedVRF v a → String #

showList ∷ [CertifiedVRF v a] → ShowS #

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

Defined in Cardano.Crypto.VRF.Class

Methods

fromCBORDecoder s (CertifiedVRF v a) Source #

label ∷ Proxy (CertifiedVRF v a) → Text Source #

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

Defined in Cardano.Crypto.VRF.Class

Methods

toCBORCertifiedVRF v a → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (CertifiedVRF v a) → Size Source #

encodedListSizeExpr ∷ (∀ 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

Methods

(==)CertifiedVRF v a → CertifiedVRF v a → Bool #

(/=)CertifiedVRF v a → CertifiedVRF v a → Bool #

VRFAlgorithm v ⇒ NoThunks (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Class

Methods

noThunksContextCertifiedVRF v a → IO (Maybe ThunkInfo) Source #

wNoThunksContextCertifiedVRF v a → IO (Maybe ThunkInfo) Source #

showTypeOf ∷ Proxy (CertifiedVRF v a) → String Source #

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.2.2.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

Encoded Size expressions

encodedVerKeyVRFSizeExpr ∷ ∀ v. VRFAlgorithm v ⇒ Proxy (VerKeyVRF v) → Size Source #

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

encodedSignKeyVRFSizeExpr ∷ ∀ v. VRFAlgorithm v ⇒ Proxy (SignKeyVRF v) → Size Source #

Size expression for SignKeyVRF which is using sizeSignKeyVRF encoded as Size

encodedCertVRFSizeExpr ∷ ∀ v. VRFAlgorithm v ⇒ Proxy (CertVRF v) → Size Source #

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