Bump CryptoID
This commit is contained in:
parent
0cba4ca023
commit
11895f6709
@ -39,7 +39,6 @@ import qualified Data.Text.Lazy.Encoding as Lazy.Text
|
||||
import qualified Data.CaseInsensitive as CI
|
||||
|
||||
import qualified Data.ByteString.Lazy as Lazy (ByteString)
|
||||
import qualified Data.ByteString.Lazy as Lazy.ByteString
|
||||
|
||||
import Text.Read (readEither)
|
||||
|
||||
@ -82,7 +81,7 @@ getRating submissionId = runMaybeT $ do
|
||||
Sheet{ sheetCourseId, sheetName = ratingSheetName } <- MaybeT $ get submissionSheetId
|
||||
Course{ courseName = ratingCourseName } <- MaybeT $ get sheetCourseId
|
||||
cIDKey <- getsYesod appCryptoIDKey
|
||||
ratingSubmissionId <- Poly.encrypt base32 cIDKey submissionId
|
||||
ratingSubmissionId <- Poly.encrypt Nothing base32 cIDKey submissionId
|
||||
return Rating{..}
|
||||
where
|
||||
base32 = return . CI.foldCase . Text.unpack . Text.dropWhileEnd (== '=') . Text.decodeUtf8 . Base32.encode
|
||||
@ -157,12 +156,12 @@ isRatingFile fName
|
||||
(Just <$> Poly.decrypt unbase32 cIDKey cID) `catch` decryptErrors
|
||||
| otherwise = return Nothing
|
||||
where
|
||||
unbase32 = either (const $ throwM CiphertextConversionFailed) return . Base32.decode . Text.encodeUtf8 . Text.pack . toUpper . (<> "===")
|
||||
unbase32 = (\bs -> either (const . throwM $ CiphertextConversionFailed bs) return $ Base32.decode bs) . Text.encodeUtf8 . Text.pack . toUpper . (<> "===")
|
||||
|
||||
decryptErrors CiphertextConversionFailed = return Nothing
|
||||
decryptErrors InvalidNamespaceDetected = return Nothing
|
||||
decryptErrors (DeserializationError _) = return Nothing
|
||||
decryptErrors err = throwM err
|
||||
decryptErrors (CiphertextConversionFailed _) = return Nothing
|
||||
decryptErrors InvalidNamespaceDetected = return Nothing
|
||||
decryptErrors DeserializationError = return Nothing
|
||||
decryptErrors err = throwM err
|
||||
|
||||
isRatingFile' :: FilePath -> Maybe (CryptoIDSubmission String)
|
||||
isRatingFile' (takeFileName -> fName)
|
||||
|
||||
@ -10,7 +10,7 @@ extra-deps:
|
||||
- colonnade-1.1.1
|
||||
- yesod-colonnade-1.1.0
|
||||
- zip-stream-0.1.0.1
|
||||
- uuid-crypto-1.1.1.0
|
||||
- cryptoids-0.2.0.0
|
||||
- uuid-crypto-1.2.0.0
|
||||
- cryptoids-0.3.0.0
|
||||
- cryptoids-types-0.0.0
|
||||
resolver: lts-9.3
|
||||
|
||||
Loading…
Reference in New Issue
Block a user