2020-07-13 16:02:35 +01:00
|
|
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package inthttp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
2022-09-20 10:32:03 +01:00
|
|
|
|
2020-07-13 16:02:35 +01:00
|
|
|
"github.com/matrix-org/dendrite/internal/httputil"
|
|
|
|
"github.com/matrix-org/dendrite/keyserver/api"
|
|
|
|
)
|
|
|
|
|
2022-12-05 12:53:36 +00:00
|
|
|
func AddRoutes(internalAPIMux *mux.Router, s api.KeyInternalAPI, enableMetrics bool) {
|
2022-08-11 15:29:33 +01:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformClaimKeysPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverPerformClaimKeys", enableMetrics, s.PerformClaimKeys),
|
2020-07-13 16:02:35 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformDeleteKeysPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverPerformDeleteKeys", enableMetrics, s.PerformDeleteKeys),
|
2021-08-18 12:07:09 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformUploadKeysPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverPerformUploadKeys", enableMetrics, s.PerformUploadKeys),
|
2021-08-04 17:56:29 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformUploadDeviceKeysPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverPerformUploadDeviceKeys", enableMetrics, s.PerformUploadDeviceKeys),
|
2021-08-04 17:56:29 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformUploadDeviceSignaturesPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverPerformUploadDeviceSignatures", enableMetrics, s.PerformUploadDeviceSignatures),
|
2020-07-13 16:02:35 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryKeysPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverQueryKeys", enableMetrics, s.QueryKeys),
|
2020-07-13 16:02:35 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryOneTimeKeysPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverQueryOneTimeKeys", enableMetrics, s.QueryOneTimeKeys),
|
2020-08-03 12:29:58 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryDeviceMessagesPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverQueryDeviceMessages", enableMetrics, s.QueryDeviceMessages),
|
2020-08-04 11:32:14 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryKeyChangesPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverQueryKeyChanges", enableMetrics, s.QueryKeyChanges),
|
2020-07-28 18:25:16 +01:00
|
|
|
)
|
2022-08-11 15:29:33 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QuerySignaturesPath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverQuerySignatures", enableMetrics, s.QuerySignatures),
|
2021-08-06 10:13:35 +01:00
|
|
|
)
|
2022-09-20 10:32:03 +01:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformMarkAsStalePath,
|
2022-12-05 12:53:36 +00:00
|
|
|
httputil.MakeInternalRPCAPI("KeyserverMarkAsStale", enableMetrics, s.PerformMarkAsStaleIfNeeded),
|
2022-09-20 10:32:03 +01:00
|
|
|
)
|
2020-07-13 16:02:35 +01:00
|
|
|
}
|