Skip to content
Snippets Groups Projects
Commit f8bff00f authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Take `ristretto` out of the IO monad

None of the FFI values escape from `ristretto` so all of the FFI IO should be
safe to do with `unsafePerformIO`.
parent 17c89f16
Branches
No related tags found
1 merge request!22Ristretto-flavored PrivacyPass
......@@ -65,7 +65,7 @@ ristrettoIssue
:: SigningKey -- ^ The key to provide to the PrivacyPass signer.
-> Issuer -- ^ An issuer using the given key.
ristrettoIssue signingKey tokens = do
issuance <- ristretto signingKey tokens
let issuance = ristretto signingKey tokens
case issuance of
Right (publicKey, tokens, proof) -> return . Just $ ChallengeBypass publicKey tokens proof
Left err -> do
......
......@@ -11,6 +11,9 @@ import Control.Exception
( bracket
, assert
)
import System.IO.Unsafe
( unsafePerformIO
)
import Data.Text
( Text
, unpack
......@@ -85,7 +88,7 @@ data RistrettoFailure
ristretto
:: Text -- ^ The base64 encoded signing key.
-> [Text] -- ^ A list of the base64 blinded tokens.
-> IO (Either RistrettoFailure Issuance) -- ^ Left for an error, otherwise
-> (Either RistrettoFailure Issuance) -- ^ Left for an error, otherwise
-- Right with the ristretto results
ristretto textSigningKey textTokens =
let
......@@ -116,7 +119,7 @@ ristretto textSigningKey textTokens =
True -> return $ Left PublicKeyLookup
False -> return $ Right (signingKey, publicKey)
in
do
unsafePerformIO $ do
keys <- extractKeyMaterial stringSigningKey
case keys of
Left err -> return $ Left err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment