Safe Haskell | None |
---|---|
Language | Haskell2010 |
Verifiable Random Function (VRF) implemented as FFI wrappers around the implementation in https://github.com/input-output-hk/libsodium
Synopsis
- data PraosBatchCompatVRF
- crypto_vrf_ietfdraft13_bytes_batchcompat ∷ CSize
- crypto_vrf_ietfdraft13_publickeybytes ∷ CSize
- crypto_vrf_ietfdraft13_secretkeybytes ∷ CSize
- crypto_vrf_ietfdraft13_seedbytes ∷ CSize
- crypto_vrf_ietfdraft13_outputbytes ∷ CSize
- io_crypto_vrf_ietfdraft13_publickeybytes ∷ IO CSize
- io_crypto_vrf_ietfdraft13_secretkeybytes ∷ IO 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
data PraosBatchCompatVRF Source #
Instances
Low-level size specifiers
Key sizes
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
data family CertVRF v Source #