Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tooling] Update CLI to support key management #489

Closed
9 tasks
Olshansk opened this issue Feb 3, 2023 · 0 comments · Fixed by #524
Closed
9 tasks

[Tooling] Update CLI to support key management #489

Olshansk opened this issue Feb 3, 2023 · 0 comments · Fixed by #524
Assignees
Labels
community Open to or owned by a non-core team member core Core infrastructure - protocol related tooling tooling to support development, testing et al

Comments

@Olshansk
Copy link
Member

Olshansk commented Feb 3, 2023

Objective

Allow the user to manage keys via the CLI.

Origin Document

This is a follow-up ticket #484. Specifically, the following deliverable:

Documentation on what the default keys in the keybase are (until the CLI is added to support this)

Goals

  • Allow users to manage keys (create, delete, import, export, etc...) via the CLI
  • Support all the necessary functions defined by the Keybase interface in app/client/keybase/keybase.go via the CLI

Deliverable

  • Update the CLI (seen in the screenshot below) to have a p1 Keys namespace
  • The p1 Keys namespace should have options to create, import, export, delete, etc commands
  • Add the ability to have a default key in the keybase

Screenshot 2023-02-03 at 12 02 10 PM

Non-goals / Non-deliverables

  • Changes in any of the core node business logic

General issue deliverables

  • Update the appropriate CHANGELOG(s)
  • Update any relevant local/global README(s)
  • Update relevant source code tree explanations
  • Add or update any relevant or supporting mermaid diagrams

Testing Methodology

  • All tests: make test_all
  • LocalNet: verify a LocalNet is still functioning correctly by following the instructions at docs/development/README.md

Creator: @Olshansk
Co-Owners: @jessicadaugherty

@Olshansk Olshansk added core Core infrastructure - protocol related community Open to or owned by a non-core team member tooling tooling to support development, testing et al labels Feb 3, 2023
@Olshansk Olshansk moved this to Backlog in V1 Dashboard Feb 3, 2023
h5law added a commit that referenced this issue Feb 14, 2023
## Description

This PR addresses the `#150` comments throughout the `app/client/cli`
directory and integrates the keybase to be used in place of reading keys
from files locally.

The new method has been added to the `debug/keystore.go` file
`InitialiseDebugKeybase()` which reads the 999 validator private keys
from the `build/localnet/manifests/private-keys.yaml` file and stores
them in the keybase. This is only run when there are less than 999 keys
in the keybase. To speed this up `BadgerDB`'s `WriteBatch()` function is
being used - however due to the encryption/JSON encoding and then Gob
encoding steps of adding private keys to the keybase this takes a few
seconds when ran for the first time.

This PR does not add any endpoints to interact with the keybase from the
CLI this is instead tracked in the issue #489

## Issue

Fixes #484 

## Type of change

Please mark the relevant option(s):

- [x] New feature, functionality or library
- [ ] Bug fix
- [x] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Add logic to initialise keybase with 999 validator keys
- Update `app/client/cli` to use the keybase


## Testing

- [x] `make develop_test`
- [x]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
w/ all of the steps outlined in the `README`


[localnet_with_integration.webm](https://user-images.githubusercontent.com/53987565/217543043-21c35c3e-8389-44a5-968a-d3afb6cb8dd9.webm)

## Required Checklist

- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have tested my changes using the available tooling
- [x] I have updated the corresponding CHANGELOG

### If Applicable Checklist

- [ ] I have updated the corresponding README(s); local and/or global
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)
h5law added a commit that referenced this issue Feb 23, 2023
## Description

This PR adds the `Keys` endpoint to the CLI and adds the relevant
subcommands to interact with the keybase from the users' perspective.

The new `Keys` namespace allows for CRUD operations on keys and gives
users access to creating, importing and exporting keys (as a raw string
or JSON encoded string), deleting keys, listing all keys and getting
specific keys as well as signing and verifying hex-encoded byte
messages.


![image](https://user-images.githubusercontent.com/53987565/219619590-1a802307-2653-4b07-984a-9f1b277f6824.png)


![image](https://user-images.githubusercontent.com/53987565/219866188-efb62b0d-aaa1-47cb-b2cc-ccb918eb8a0d.png)


## Issue

Fixes #489 

## Type of change

Please mark the relevant option(s):

- [x] New feature, functionality or library
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Add Keys CLI namespace
- Add keybase-related subcommands
- Return keypair when importing or creating a new key
- Reformat tests
- Remove `Exists()` function from keybase interface

## Testing

- [x] `make develop_test`
- [x]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
w/ all of the steps outlined in the `README`

## Required Checklist

- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have tested my changes using the available tooling
- [x] I have updated the corresponding CHANGELOG

### If Applicable Checklist

- [ ] I have updated the corresponding README(s); local and/or global
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)
@github-project-automation github-project-automation bot moved this from Backlog to Done in V1 Dashboard Feb 23, 2023
bryanchriswhite added a commit that referenced this issue Feb 23, 2023
…_reporting' into chore/libp2p-1

* pokt/issue/improve_test_failure_reporting:
  feat(tooling): return failed tests full output
  [Tooling] Update CLI to support key management (Issue #489) (#524)
bryanchriswhite added a commit that referenced this issue Feb 24, 2023
* pokt/main:
  [Tooling] Returning failed tests full output (#542)
  [Tooling] Update CLI to support key management (Issue #489) (#524)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Open to or owned by a non-core team member core Core infrastructure - protocol related tooling tooling to support development, testing et al
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants