feat(storage-key): add StorageKeyR to routes; minor Handler refactor

This commit is contained in:
Sarah Vaupel 2020-01-28 12:06:52 +01:00 committed by Gregor Kleen
parent 059efe5085
commit 2d1d58f78f
2 changed files with 3 additions and 2 deletions

3
routes
View File

@ -73,6 +73,7 @@
/user/set-display-email SetDisplayEmailR GET POST !free
/user/csv-options CsvOptionsR GET POST !free
/user/lang LangR POST !free
/user/storage-key StorageKeyR POST !free
/exam-office ExamOfficeR !exam-office:
/ EOExamsR GET
@ -221,4 +222,4 @@
!/#UUID CryptoUUIDDispatchR GET !free -- just redirect
-- !/*{CI FilePath} CryptoFileNameDispatchR GET !free -- Disabled until preliminary check for valid cID exists
!/*WellKnownFileName WellKnownR GET !free
!/*WellKnownFileName WellKnownR GET !free

View File

@ -70,7 +70,7 @@ postStorageKeyR = do
ikm = (toStrict . Aeson.encode) (skReqType, uid, sbKey)
key = HKDF.expand (HKDF.extract salt ikm :: HKDF.PRK SHA3_256) (toStrict $ Binary.encode (timestamp,skReqLength)) skReqLength
sendResponseStatus ok200 $ toJSON StorageKeyResponse
return $ toJSON StorageKeyResponse
{ skResKey = (decodeUtf8 . Base64.encode) key
, skResTimestamp = timestamp
, skResSalt = (decodeUtf8 . Base64.encode) salt