summaryrefslogtreecommitdiff
path: root/src/PubKey.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-08-27 18:33:16 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-08-30 20:53:55 +0200
commitc27b3c23ecdd53acdbfece747b9bbdb39bf4dae9 (patch)
tree52a4be70840e2691195ec54149f5ac14ec112606 /src/PubKey.hs
parentdfddb65ad1abf5ba4171be42d303850ebbc363ee (diff)
Replace storedStorage usage with MonadHead
Diffstat (limited to 'src/PubKey.hs')
-rw-r--r--src/PubKey.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/PubKey.hs b/src/PubKey.hs
index 483a94b..f69d739 100644
--- a/src/PubKey.hs
+++ b/src/PubKey.hs
@@ -1,6 +1,6 @@
module PubKey (
PublicKey, SecretKey,
- KeyPair(generateKeys), loadKey,
+ KeyPair(generateKeys), loadKey, loadKeyMb,
Signature(sigKey), Signed, signedData, signedSignature,
sign, signAdd, isSignedBy,
@@ -97,14 +97,14 @@ instance Storable a => Storable (Signed a) where
throwError "signature verification failed"
return $ Signed sdata sigs
-sign :: SecretKey -> Stored a -> IO (Signed a)
+sign :: MonadStorage m => SecretKey -> Stored a -> m (Signed a)
sign secret val = signAdd secret $ Signed val []
-signAdd :: SecretKey -> Signed a -> IO (Signed a)
+signAdd :: MonadStorage m => SecretKey -> Signed a -> m (Signed a)
signAdd (SecretKey secret spublic) (Signed val sigs) = do
let PublicKey public = fromStored spublic
sig = ED.sign secret public $ storedRef val
- ssig <- wrappedStore (storedStorage val) $ Signature spublic sig
+ ssig <- mstore $ Signature spublic sig
return $ Signed val (ssig : sigs)
isSignedBy :: Signed a -> Stored PublicKey -> Bool