From ac7eaac523979eb5306554cf115bfe872c43c0f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Ch=C3=A9ron?= Date: Wed, 3 May 2017 20:06:29 +0200 Subject: [PATCH] Simplify Ed25519.generateSecretKey --- Crypto/PubKey/Ed25519.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Crypto/PubKey/Ed25519.hs b/Crypto/PubKey/Ed25519.hs index 094c929..ffb144f 100644 --- a/Crypto/PubKey/Ed25519.hs +++ b/Crypto/PubKey/Ed25519.hs @@ -9,7 +9,6 @@ -- {-# LANGUAGE BangPatterns #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE ScopedTypeVariables #-} module Crypto.PubKey.Ed25519 ( SecretKey , PublicKey @@ -116,9 +115,7 @@ verify public message signatureVal = unsafeDoIO $ -- | Generate a secret key generateSecretKey :: MonadRandom m => m SecretKey -generateSecretKey = do - ba :: ScrubbedBytes <- getRandomBytes secretKeySize - return (SecretKey $ B.copyAndFreeze ba (\_ -> return ())) +generateSecretKey = SecretKey <$> getRandomBytes secretKeySize -- | A public key is 32 bytes publicKeySize :: Int