a slight change to match master auth.Data

This commit is contained in:
terrill 2018-07-27 11:20:02 +08:00
parent a8a6422d50
commit 9c36971b11

View file

@ -35,30 +35,30 @@ func Setup(
encryptionDB *storage.Database,
deviceDB *devices.Database,
) {
dataDB := auth.DeviceDatabase(deviceDB)
authData := auth.Data{nil, deviceDB, nil}
unstablemux := apiMux.PathPrefix(pathPrefixUnstable).Subrouter()
unstablemux.Handle("/keys/upload/{deviceID}",
common.MakeAuthAPI("upload keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
common.MakeAuthAPI("upload keys", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return UploadPKeys(req, encryptionDB, device.UserID, device.ID)
}),
).Methods(http.MethodPost, http.MethodOptions)
unstablemux.Handle("/keys/upload",
common.MakeAuthAPI("upload keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
common.MakeAuthAPI("upload keys", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return UploadPKeys(req, encryptionDB, device.UserID, device.ID)
}),
).Methods(http.MethodPost, http.MethodOptions)
unstablemux.Handle("/keys/query",
common.MakeAuthAPI("query keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
common.MakeAuthAPI("query keys", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
//vars := mux.Vars(req)
return QueryPKeys(req, encryptionDB, device.ID, deviceDB)
}),
).Methods(http.MethodPost, http.MethodOptions)
unstablemux.Handle("/keys/claim",
common.MakeAuthAPI("claim keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
common.MakeAuthAPI("claim keys", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return ClaimOneTimeKeys(req, encryptionDB)
}),
).Methods(http.MethodPost, http.MethodOptions)