| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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
- data PraosVRF
- crypto_vrf_proofbytes :: CSize
- crypto_vrf_publickeybytes :: CSize
- crypto_vrf_secretkeybytes :: CSize
- crypto_vrf_seedbytes :: CSize
- crypto_vrf_outputbytes :: CSize
- certSizeVRF :: Int
- signKeySizeVRF :: Int
- verKeySizeVRF :: Int
- vrfKeySizeVRF :: Int
- data Seed
- genSeed :: IO Seed
- keypairFromSeed :: Seed -> (VerKey, SignKey)
- unsafeRawSeed :: Seed -> IO ByteString
- outputBytes :: Output -> ByteString
- proofBytes :: Proof -> ByteString
- skBytes :: SignKey -> ByteString
- vkBytes :: VerKey -> ByteString
- skToVerKey :: SignKey -> VerKey
- skToSeed :: SignKey -> Seed
- prove :: SignKey -> ByteString -> Maybe Proof
- verify :: VerKey -> Proof -> ByteString -> Maybe Output
- data family SignKeyVRF v
- data family VerKeyVRF v
- data family CertVRF v
VRFAlgorithm API
Instances
Low-level size specifiers
Key sizes
certSizeVRF :: Int Source #
signKeySizeVRF :: Int Source #
verKeySizeVRF :: Int Source #
vrfKeySizeVRF :: Int Source #
Seed and key generation
A random seed, used to derive a key pair.
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.
keypairFromSeed :: Seed -> (VerKey, SignKey) Source #
Derive a key pair (Sign + Verify) from a seed.
Conversions
unsafeRawSeed :: Seed -> IO ByteString Source #
Convert an opaque Seed into a ByteString that we can inspect.
Note that this will copy the seed into RTS-managed memory; this is not
currently a problem, but if at any point we decide that we want to make
sure the seed is properly mlocked, then this function will leak such a
secured seed into non-locked (swappable) memory.
outputBytes :: Output -> ByteString Source #
Convert a proof verification output hash into a ByteString that we can
inspect.
proofBytes :: Proof -> ByteString Source #
Convert a proof into a ByteString that we can inspect.
skBytes :: SignKey -> ByteString Source #
Convert a signing key into a ByteString that we can inspect.
vkBytes :: VerKey -> ByteString Source #
Convert a verification key into a ByteString that we can inspect.
skToVerKey :: SignKey -> VerKey Source #
Derive a Verification Key from a Signing Key.
Core VRF operations
prove :: SignKey -> ByteString -> Maybe Proof Source #
verify :: VerKey -> Proof -> ByteString -> Maybe Output Source #
data family SignKeyVRF v Source #
Instances
data family VerKeyVRF v Source #
Instances
| Eq (VerKeyVRF PraosVRF) Source # | |
| (TypeError ('Text "Ord not supported for verification keys, use the hash instead") :: Constraint, Eq (VerKeyVRF v)) => Ord (VerKeyVRF v) | |
Defined in Cardano.Crypto.VRF.Class | |
| Show (VerKeyVRF PraosVRF) Source # | |
| Generic (VerKeyVRF PraosVRF) Source # | |
| ToCBOR (VerKeyVRF PraosVRF) Source # | |
Defined in Cardano.Crypto.VRF.Praos | |
| FromCBOR (VerKeyVRF PraosVRF) Source # | |
| NFData (VerKeyVRF PraosVRF) Source # | |
Defined in Cardano.Crypto.VRF.Praos | |
| NoThunks (VerKeyVRF PraosVRF) Source # | |
| newtype VerKeyVRF PraosVRF Source # | |
Defined in Cardano.Crypto.VRF.Praos | |
| type Rep (VerKeyVRF PraosVRF) Source # | |
Defined in Cardano.Crypto.VRF.Praos | |
data family CertVRF v Source #
Instances
| Eq (CertVRF PraosVRF) Source # | |
| Show (CertVRF PraosVRF) Source # | |
| Generic (CertVRF PraosVRF) Source # | |
| ToCBOR (CertVRF PraosVRF) Source # | |
Defined in Cardano.Crypto.VRF.Praos | |
| FromCBOR (CertVRF PraosVRF) Source # | |
| NFData (CertVRF PraosVRF) Source # | |
Defined in Cardano.Crypto.VRF.Praos | |
| NoThunks (CertVRF PraosVRF) Source # | |
| newtype CertVRF PraosVRF Source # | |
Defined in Cardano.Crypto.VRF.Praos | |
| type Rep (CertVRF PraosVRF) Source # | |
Defined in Cardano.Crypto.VRF.Praos | |