feat: add api key and admin API #7
Open
+2,024
−45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why this API change
Problem
Multiple AVS can use single Cerberus instance to sign with their key by sending the public key in the request. This creates a problem with a malicious AVS can ask keys from other AVS to sign. We need a way to make sure AVS1 can only sign with keys registered from them. Following are some potential ways we can solve this problem
Solution
Every new BLS key pair which is either created or imported will return a new API Key. This will be a unique identifier (uuid) for authorizing the key to sign. In Cerberus we will persist the mapping of hash of API Key and public key (with some other metadata). All the signing requests should come with API Key and if that API key doesn’t match with the public key it is mapped with, Cerberus will reject the request.
Sample Go Client code
Sample cerberus validation code