verifySignature :: MonadIO m =>
                   PSState
                -> Xmpp.Jid
                -> BS.ByteString
                -> BS.ByteString
                -> BS.ByteString
                -> m (Maybe BS.ByteString)
verifySignature st _peer pk sig pt = runPSM st $ do
    ids <- importIdent pk
    case ids of
        [id] -> do
            verified <- liftIO $ verifyGPG id sig pt
            logDebug $ "Signature is: "  ++ show verified
            return $ if verified then (Just id) else Nothing
        _ -> do
            logDebug "import resulted in more than one key"
            return Nothing
verifySignature :: MonadIO m =>
                   PSState
                -> Xmpp.Jid
                -> BS.ByteString
                -> BS.ByteString
                -> BS.ByteString
                -> m (Maybe BS.ByteString)
verifySignature st _peer pk sig pt = runPSM st $ do
    ids <- importIdent pk
    case ids of
        [id] -> do
            verified <- liftIO $ verifyGPG id sig pt
            logDebug $ "Signature is: "  ++ show verified
            return $ if verified then (Just id) else Nothing
        _ -> do
            logDebug "import resulted in more than one key"
            return Nothing
verifySignature st _peer pk sig pt = runPSM st $ do
    ids <- importIdent pk
    case ids of
        [id] -> do
            verified <- liftIO $ verifyGPG id sig pt
            logDebug $ "Signature is: "  ++ show verified
            return $ if verified then (Just id) else Nothing
        _ -> do
            logDebug "import resulted in more than one key"
            return Nothing