Files
lodestar/packages/api/keymanager_server.js
Lion - dapplion c5997e07d6 Implement standard keymanager API (#3522)
* Add keymanager backend

* Add keymanager server

* Add private local signer

* Fix comment typo

* Update test types

* Update package.json and license

* Hooking up the keymanager server - still manually registering a dummy api that returns static data

* Revert "Hooking up the keymanager server - still manually registering a dummy api that returns static data"

This reverts commit c3c220e4cf9455387cc665ef8dba5e319dbc2d95.

* using 9657 as default port for key manager server. Also not overriding defaults with undefined

* starting keymanager server also in dev

* First stab at implementing deleting keys from persistant storage

* updating parsing of slashing data to make POST request work

* leaving some todo

* switching deleting file to async. Still need to take care of logging in case deleting fails

* first dash at persisting keys for later restarts

* Adding (local signer for now) and removing of signer in ValidatorStore.

* deleting and adding working again with remote signer merged in

* fix lint errors

* fix lint errors

* fix lint errors - finally

* temp

* Moving keymanager to its own package to make the validator package nodejs agnostic

* track test file

* removing some outdated TODOs

* adding the generic server test for keymanager api

* removing an unused function and two empty test files

* keeping inline with existing pattern of using _config when config is not used

* Added first test for KeymanagerApi#listKeys

* Added test for KeymanagerApi#importKeystores

* Added test for KeymanagerApi#deleteKeystores

* move lock file to utils

* making sure keystore are added and deleted in all scenarios

* temp making some assertion less strict

* adding back matchers in the test

* removing e2e test in script since none yet

* On delete remove key from internal list of keys known my the keymanager

* first shot at adding bearer authentication for keymanager server

* Using async pattern again so as to fix test that only fails on ci

* log location of keymanager's bearer token on startup

* Undoing the addition of lockfile to lodestar-util as it is a package that should be filesystem/nodejs agnostic

* importing lockfile in test

* Stubbing out the keystore. All tests should now pass on CI

* remove duplicated start of validator

* When using dev command, make it actually possible to not run a validator with a beacon node

* Passing in the directory where the keymanager's bearer token will be stored

* Properly setting the path to keystore file to be deleted

* adding methods to remove signer from various duties, exposing and calling in keymanager.

* Added tests for BlockDutiesService#remove

* fix linting errors

* Added tests for AttestationDutiesService#remove

* Added tests for SyncCommitteeDutiesService#remove

* Added test to directly test IndicesService

* update test to confirm unremoved pubkey is not affected by the remove call

* Added the scaffolding to run e2e test that makes use of the keymanager

* shut down node and validators in keymanager e2e test

* Making sure by default bearer authentication is used for keymanager api

* Adding e2e for keymanager api

* adding some eslint ignore comments

* Fix linting errors

* Processing some todos

* Process left TODOs

* log a warning if kemanager started without auth

* fix compilation error when running sim:singleThread test

* import all modules from same package in same line

* fix compilation error due to import

* Added logger to KeymanagerApi

* Fixed compilation error in key managers e2e test due to changes that added logger to KeymanagerApi

* removing TODO after deciding to action needed

* removing download-spec-tests from keymanager-server script

* test request is denied if no auth for keymanager

* trying closing keymanager before beacon node

* setting port right

* Some improvement to the keymanager e2e test

* Added signing to e2e test for key manager

* Added support for interactions with remote signer validators. Removed some unit tests in place of e2e

* optimise imports

* optimize some tests assertion

* minor correction to capitalisation

* register callback to delete locks in same loop that adds to signers

* fix compilation error

* adding lockfile as dependency following alphabetical order

* Improving the registering of shutdown callbacks

* moving keymanager options out of beacon node options

* having back default value for startValidators flag

* Removed unnecessary comment

* removed the parse-numbers setting

* Switching to making imported keystore path deterministic by pubkey

* Using Array constructor with length is more efficient

* Move some keystore test utility function to a seperate file

* Removed some more suppress comments

* Removed unnecessary dependency

* using 5062 as default port for keymanager

* Improve keymanager and keymanager e2e tests

* Removed unnecessary test utility function

* Removed the use of mapvalues

* Not exposing duties

* Minor comment improvement

* Have slashing protection be part of validator and use that in the key manager

* Remove getSignerLocal

* switch use of forEach for for-of

* revert changes to local.md

* optimise import order

* Moved typing info for lockfile to devDependencies

* Some renaming

* replace join with path.join for clarity

* setting derivation path

* Introduced a utility for keystore file, that is used both in importing and deleting keys

* having duties service classes back to private

* re-adding test:unit

* switching to using path.join

* Introduced a more robust cleanup for lightclient.test.ts

* import optimisation

* putting all closing of nodes/validators into afterEach call

* temp skip keymanager e2e test

* switching node port back to 9596. It should not be any problem as long as all tests shuts down node properly

* switch test port to 19596 see if this fixes tests

* Immediately register clean up for servers

* Temp skip a failing test

* Using tmp dir for keeping bearer token for test cases where keymanager needs bearer token

* move the lockfile to keymanager

* Added tests to cover bearer token authentication flow

* Setting derivationPath back to empty string. Implementing getting derivationPath would be done later

* Fix type error

Co-authored-by: Cayman <caymannava@gmail.com>
Co-authored-by: Dadepo Aderemi <dadepo@gmail.com>
2022-04-01 19:35:40 +05:30

3 lines
119 B
JavaScript

// eslint-disable-next-line @typescript-eslint/no-require-imports
module.exports = require("./lib/keymanager/server");