Simplify Ed25519.generateSecretKey
This commit is contained in:
parent
51b36f77b8
commit
ac7eaac523
@ -9,7 +9,6 @@
|
|||||||
--
|
--
|
||||||
{-# LANGUAGE BangPatterns #-}
|
{-# LANGUAGE BangPatterns #-}
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
module Crypto.PubKey.Ed25519
|
module Crypto.PubKey.Ed25519
|
||||||
( SecretKey
|
( SecretKey
|
||||||
, PublicKey
|
, PublicKey
|
||||||
@ -116,9 +115,7 @@ verify public message signatureVal = unsafeDoIO $
|
|||||||
|
|
||||||
-- | Generate a secret key
|
-- | Generate a secret key
|
||||||
generateSecretKey :: MonadRandom m => m SecretKey
|
generateSecretKey :: MonadRandom m => m SecretKey
|
||||||
generateSecretKey = do
|
generateSecretKey = SecretKey <$> getRandomBytes secretKeySize
|
||||||
ba :: ScrubbedBytes <- getRandomBytes secretKeySize
|
|
||||||
return (SecretKey $ B.copyAndFreeze ba (\_ -> return ()))
|
|
||||||
|
|
||||||
-- | A public key is 32 bytes
|
-- | A public key is 32 bytes
|
||||||
publicKeySize :: Int
|
publicKeySize :: Int
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user