cardano-crypto-praos-2.2.0.0: Crypto primitives from libsodium
Safe HaskellNone
LanguageHaskell2010

Cardano.Crypto.VRF.Praos

Description

Verifiable Random Function (VRF) implemented as FFI wrappers around the implementation in https://github.com/input-output-hk/libsodium

Synopsis

VRFAlgorithm API

data PraosVRF Source #

Instances

Instances details
VRFAlgorithm PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Generic (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep (CertVRF PraosVRF) ∷ TypeType Source #

Generic (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep (SignKeyVRF PraosVRF) ∷ TypeType Source #

Generic (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep (VerKeyVRF PraosVRF) ∷ TypeType Source #

Show (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Show (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Show (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

ToCBOR (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

toCBORCertVRF PraosVRFEncoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (CertVRF PraosVRF) → Size Source #

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

ToCBOR (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

ToCBOR (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

NFData (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfCertVRF PraosVRF → () Source #

NFData (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfSignKeyVRF PraosVRF → () Source #

NFData (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfVerKeyVRF PraosVRF → () Source #

Eq (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Eq (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Eq (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

NoThunks (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

NoThunks (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

NoThunks (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

newtype CertVRF PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type ContextVRF PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

newtype SignKeyVRF PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Signable PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

newtype VerKeyVRF PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep (CertVRF PraosVRF) = D1 ('MetaData "CertVRF" "Cardano.Crypto.VRF.Praos" "cardano-crypto-praos-2.2.0.0-inplace" 'True) (C1 ('MetaCons "CertPraosVRF" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Proof)))
type Rep (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep (SignKeyVRF PraosVRF) = D1 ('MetaData "SignKeyVRF" "Cardano.Crypto.VRF.Praos" "cardano-crypto-praos-2.2.0.0-inplace" 'True) (C1 ('MetaCons "SignKeyPraosVRF" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SignKey)))
type Rep (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep (VerKeyVRF PraosVRF) = D1 ('MetaData "VerKeyVRF" "Cardano.Crypto.VRF.Praos" "cardano-crypto-praos-2.2.0.0-inplace" 'True) (C1 ('MetaCons "VerKeyPraosVRF" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VerKey)))

Key sizes

Seed and key generation

data Seed Source #

A random seed, used to derive a key pair.

Instances

Instances details
NoThunks Seed Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

genSeedIO Seed Source #

Generate a random seed. Uses randombytes_buf to create random data.

This function provides an alternative way of generating seeds specifically for the PraosVRF algorithm. Unlike the genKeyPairVRF method, which uses a ByteString-based Seed, this seed generation method bypasses the GHC heap, keeping the seed in C-allocated memory instead.

This provides two advantages: 1. It avoids the overhead of unnecessary GHC-side heap allocations. 2. It avoids leaking the seed via the GHC heap; the Seed type itself takes care of zeroing out its memory upon finalization.

keypairFromSeedSeed → (VerKey, SignKey) Source #

Derive a key pair (Sign + Verify) from a seed.

Conversions

outputBytesOutputByteString Source #

Convert a proof verification output hash into a ByteString that we can inspect.

proofBytesProofByteString Source #

Convert a proof into a ByteString that we can inspect.

skBytesSignKeyByteString Source #

Convert a signing key into a ByteString that we can inspect.

vkBytesVerKeyByteString Source #

Convert a verification key into a ByteString that we can inspect.

skToVerKeySignKeyVerKey Source #

Derive a Verification Key from a Signing Key.

skToSeedSignKeySeed Source #

Get the seed used to generate a given Signing Key

vkToBatchCompatVerKeyVRF PraosVRFVerKeyVRF PraosBatchCompatVRF Source #

Construct a BatchCompat vkey from praos, non-batchcompat

skToBatchCompatSignKeyVRF PraosVRFSignKeyVRF PraosBatchCompatVRF Source #

Construct a BatchCompat skey from praos, non-batchcompat

outputToBatchCompatOutputVRF PraosVRFOutputVRF PraosBatchCompatVRF Source #

Construct a BatchCompat output from praos, non-batchcompat

Core VRF operations

proveSignKeyByteStringMaybe Proof Source #

Construct a proof from a Signing Key and a message. Returns Just the proof on success, Nothing if the signing key could not be decoded.

verifyVerKeyProofByteStringMaybe Output Source #

Verify a VRF proof and validate the Verification Key. Returns Just a hash of the verification result on success, Nothing if the verification did not succeed.

For a given verification key and message, there are many possible proofs but only one possible output hash.

data family SignKeyVRF v Source #

Instances

Instances details
Generic (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep (SignKeyVRF PraosVRF) ∷ TypeType Source #

Generic (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

Associated Types

type Rep (SignKeyVRF PraosBatchCompatVRF) ∷ TypeType Source #

Show (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Show (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

FromCBOR (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

ToCBOR (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

ToCBOR (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

NFData (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfSignKeyVRF PraosVRF → () Source #

NFData (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

Eq (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Eq (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

(TypeError ('Text "Ord not supported for signing keys, use the hash instead") ∷ Constraint, Eq (SignKeyVRF v)) ⇒ Ord (SignKeyVRF v) 
Instance details

Defined in Cardano.Crypto.VRF.Class

NoThunks (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

NoThunks (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

newtype SignKeyVRF PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

newtype SignKeyVRF PraosBatchCompatVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

type Rep (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep (SignKeyVRF PraosVRF) = D1 ('MetaData "SignKeyVRF" "Cardano.Crypto.VRF.Praos" "cardano-crypto-praos-2.2.0.0-inplace" 'True) (C1 ('MetaCons "SignKeyPraosVRF" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SignKey)))
type Rep (SignKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

data family VerKeyVRF v Source #

Instances

Instances details
Generic (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep (VerKeyVRF PraosVRF) ∷ TypeType Source #

Generic (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

Associated Types

type Rep (VerKeyVRF PraosBatchCompatVRF) ∷ TypeType Source #

Show (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Show (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

FromCBOR (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

ToCBOR (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

ToCBOR (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

NFData (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfVerKeyVRF PraosVRF → () Source #

NFData (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

Eq (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Eq (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

(TypeError ('Text "Ord not supported for verification keys, use the hash instead") ∷ Constraint, Eq (VerKeyVRF v)) ⇒ Ord (VerKeyVRF v) 
Instance details

Defined in Cardano.Crypto.VRF.Class

NoThunks (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

NoThunks (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

newtype VerKeyVRF PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

newtype VerKeyVRF PraosBatchCompatVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

type Rep (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep (VerKeyVRF PraosVRF) = D1 ('MetaData "VerKeyVRF" "Cardano.Crypto.VRF.Praos" "cardano-crypto-praos-2.2.0.0-inplace" 'True) (C1 ('MetaCons "VerKeyPraosVRF" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VerKey)))
type Rep (VerKeyVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

data family CertVRF v Source #

Instances

Instances details
Generic (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep (CertVRF PraosVRF) ∷ TypeType Source #

Generic (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

Associated Types

type Rep (CertVRF PraosBatchCompatVRF) ∷ TypeType Source #

Show (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Show (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

FromCBOR (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

ToCBOR (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

toCBORCertVRF PraosVRFEncoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (CertVRF PraosVRF) → Size Source #

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

ToCBOR (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

NFData (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfCertVRF PraosVRF → () Source #

NFData (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

Eq (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Eq (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

NoThunks (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

NoThunks (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

newtype CertVRF PraosVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

newtype CertVRF PraosBatchCompatVRF Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

type Rep (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep (CertVRF PraosVRF) = D1 ('MetaData "CertVRF" "Cardano.Crypto.VRF.Praos" "cardano-crypto-praos-2.2.0.0-inplace" 'True) (C1 ('MetaCons "CertPraosVRF" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Proof)))
type Rep (CertVRF PraosBatchCompatVRF) Source # 
Instance details

Defined in Cardano.Crypto.VRF.PraosBatchCompat

Internal types

data Proof Source #

A proof, as constructed by the prove function.

Instances

Instances details
Generic Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep ProofTypeType Source #

Methods

fromProofRep Proof x Source #

toRep Proof x → Proof Source #

Show Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

ToCBOR Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

toCBORProofEncoding Source #

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

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

NFData Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfProof → () Source #

Eq Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

(==)ProofProofBool Source #

(/=)ProofProofBool Source #

NoThunks Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep Proof Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep Proof

data SignKey Source #

Signing key. In this implementation, the signing key is actually a 64-byte value that contains both the 32-byte signing key and the corresponding 32-byte verification key.

Instances

Instances details
Generic SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep SignKeyTypeType Source #

Methods

fromSignKeyRep SignKey x Source #

toRep SignKey x → SignKey Source #

Show SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

ToCBOR SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

toCBORSignKeyEncoding Source #

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

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

NFData SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfSignKey → () Source #

Eq SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

(==)SignKeySignKeyBool Source #

(/=)SignKeySignKeyBool Source #

NoThunks SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep SignKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

data VerKey Source #

Verification key.

Instances

Instances details
Generic VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep VerKeyTypeType Source #

Methods

fromVerKeyRep VerKey x Source #

toRep VerKey x → VerKey Source #

Show VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

FromCBOR VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

ToCBOR VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

toCBORVerKeyEncoding Source #

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

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

NFData VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

rnfVerKey → () Source #

Eq VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Methods

(==)VerKeyVerKeyBool Source #

(/=)VerKeyVerKeyBool Source #

NoThunks VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep VerKey Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep VerKey

data Output Source #

Hashed output of a proof verification, as returned by the verify function.

Instances

Instances details
Generic Output Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

Associated Types

type Rep OutputTypeType Source #

Methods

fromOutputRep Output x Source #

toRep Output x → Output Source #

NoThunks Output Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep Output Source # 
Instance details

Defined in Cardano.Crypto.VRF.Praos

type Rep Output