summaryrefslogtreecommitdiff
path: root/src/PubKey.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2019-10-11 22:19:15 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2019-10-11 22:19:15 +0200
commit61b04eb5fda0d1e94f673ad1c11f328a318bb09d (patch)
treef9dc3edde8de7f50e17bcd0bcc3873f8cda6c89c /src/PubKey.hs
parent681c68ef5843c13df1a8e5da3540b2b00ba2eb03 (diff)
Identity merging and verification
Diffstat (limited to 'src/PubKey.hs')
-rw-r--r--src/PubKey.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/PubKey.hs b/src/PubKey.hs
index 6dc8080..d7134c8 100644
--- a/src/PubKey.hs
+++ b/src/PubKey.hs
@@ -2,7 +2,7 @@ module PubKey (
PublicKey, SecretKey,
KeyPair(generateKeys), loadKey,
Signature(sigKey), Signed, signedData, signedSignature,
- sign, signAdd,
+ sign, signAdd, isSignedBy,
PublicKexKey, SecretKexKey,
dhSecret,
@@ -103,6 +103,9 @@ signAdd (SecretKey secret spublic) (Signed val sigs) = do
ssig <- wrappedStore (storedStorage val) $ Signature spublic sig
return $ Signed val (ssig : sigs)
+isSignedBy :: Signed a -> Stored PublicKey -> Bool
+isSignedBy sig key = key `elem` map (sigKey . fromStored) (signedSignature sig)
+
data PublicKexKey = PublicKexKey CX.PublicKey
deriving (Show)