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
- certSizeVRF :: Int
- signKeySizeVRF :: Int
- verKeySizeVRF :: Int
- vrfKeySizeVRF :: Int
- data Seed
- genSeed :: IO Seed
- keypairFromSeed :: Seed -> ( VerKey , SignKey )
- outputBytes :: Output -> ByteString
- proofBytes :: Proof -> ByteString
- skBytes :: SignKey -> ByteString
- vkBytes :: VerKey -> ByteString
- skToVerKey :: SignKey -> VerKey
- skToSeed :: SignKey -> Seed
- proofFromBytes :: MonadFail m => ByteString -> m Proof
- skFromBytes :: MonadFail m => ByteString -> m SignKey
- vkFromBytes :: MonadFail m => ByteString -> m VerKey
- prove :: SignKey -> ByteString -> Maybe Proof
- verify :: VerKey -> Proof -> ByteString -> Maybe Output
- data family SignKeyVRF v
- data family VerKeyVRF v
- data family CertVRF v
- data Proof
- data SignKey
- data VerKey
- data Output
VRFAlgorithm API
Instances
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
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.
proofFromBytes :: MonadFail m => ByteString -> m Proof Source #
skFromBytes :: MonadFail m => ByteString -> m SignKey Source #
vkFromBytes :: MonadFail m => ByteString -> m VerKey Source #
Core VRF operations
data family SignKeyVRF v Source #
Instances
data family VerKeyVRF v Source #
Instances
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 # | |
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
type
Rep
(
CertVRF
PraosVRF
) =
D1
('
MetaData
"CertVRF" "Cardano.Crypto.VRF.Praos" "cardano-crypto-praos-2.1.0.0-8RyEQjtDErEBX6y5WsfiKH" '
True
) (
C1
('
MetaCons
"CertPraosVRF" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
Proof
)))
|
Internal types
A proof, as constructed by the
prove
function.
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.
Verification key.