Skip to content

Commit

Permalink
The remote Keymanager API was not using the URLs indicated in the spec
Browse files Browse the repository at this point in the history
  • Loading branch information
zah committed Mar 3, 2022
1 parent 3ffab01 commit 4c01b77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions beacon_chain/rpc/rest_key_management_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ proc installKeymanagerHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonResponsePlain(response)

# https://ethereum.github.io/keymanager-APIs/#/Remote%20Key%20Manager/ListRemoteKeys
router.api(MethodGet, "/api/eth/v1/remotekey") do () -> RestApiResponse:
router.api(MethodGet, "/api/eth/v1/remotekeys") do () -> RestApiResponse:
let authStatus = checkAuthorization(request, node)
if authStatus.isErr():
return RestApiResponse.jsonError(Http401, InvalidAuthorization,
Expand All @@ -197,7 +197,7 @@ proc installKeymanagerHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonResponsePlain(response)

# https://ethereum.github.io/keymanager-APIs/#/Remote%20Key%20Manager/ImportRemoteKeys
router.api(MethodPost, "/api/eth/v1/remotekey") do (
router.api(MethodPost, "/api/eth/v1/remotekeys") do (
contentBody: Option[ContentBody]) -> RestApiResponse:
let authStatus = checkAuthorization(request, node)
if authStatus.isErr():
Expand Down Expand Up @@ -239,7 +239,7 @@ proc installKeymanagerHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonResponsePlain(response)

# https://ethereum.github.io/keymanager-APIs/#/Remote%20Key%20Manager/DeleteRemoteKeys
router.api(MethodDelete, "/api/eth/v1/remotekey") do (
router.api(MethodDelete, "/api/eth/v1/remotekeys") do (
contentBody: Option[ContentBody]) -> RestApiResponse:
let authStatus = checkAuthorization(request, node)
if authStatus.isErr():
Expand Down Expand Up @@ -294,15 +294,15 @@ proc installKeymanagerHandlers*(router: var RestRouter, node: BeaconNode) =

router.redirect(
MethodGet,
"/eth/v1/remotekey",
"/api/eth/v1/remotekey")
"/eth/v1/remotekeys",
"/api/eth/v1/remotekeys")

router.redirect(
MethodPost,
"/eth/v1/remotekey",
"/api/eth/v1/remotekey")
"/eth/v1/remotekeys",
"/api/eth/v1/remotekeys")

router.redirect(
MethodDelete,
"/eth/v1/remotekey",
"/api/eth/v1/remotekey")
"/eth/v1/remotekeys",
"/api/eth/v1/remotekeys")
6 changes: 3 additions & 3 deletions beacon_chain/spec/eth2_apis/rest_keymanager_calls.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ proc listKeys*(client: RestClientRef,
raiseUnknownStatusError(resp)

proc listRemoteKeysPlain*(): RestPlainResponse {.
rest, endpoint: "/eth/v1/remotekey",
rest, endpoint: "/eth/v1/remotekeys",
meth: MethodGet.}
## https://ethereum.github.io/keymanager-APIs/#/Remote%20Key%20Manager/ListRemoteKeys

proc importRemoteKeysPlain*(body: ImportRemoteKeystoresBody
): RestPlainResponse {.
rest, endpoint: "/eth/v1/remotekey",
rest, endpoint: "/eth/v1/remotekeys",
meth: MethodPost.}
## https://ethereum.github.io/keymanager-APIs/#/Remote%20Key%20Manager/ImportRemoteKeys

proc deleteRemoteKeysPlain*(body: DeleteKeystoresBody): RestPlainResponse {.
rest, endpoint: "/eth/v1/remotekey",
rest, endpoint: "/eth/v1/remotekeys",
meth: MethodDelete.}
## https://ethereum.github.io/keymanager-APIs/#/Remote%20Key%20Manager/DeleteRemoteKeys

Expand Down

0 comments on commit 4c01b77

Please sign in to comment.