Skip to content

feat: add base64 Pubkeys from cli#17639

Merged
julienrbrt merged 7 commits into
cosmos:mainfrom
Zondax:feat/add-b64-pubkey
Sep 7, 2023
Merged

feat: add base64 Pubkeys from cli#17639
julienrbrt merged 7 commits into
cosmos:mainfrom
Zondax:feat/add-b64-pubkey

Conversation

@JulianToledano
Copy link
Copy Markdown
Contributor

Description

Closes:
#10388


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@JulianToledano JulianToledano requested a review from a team September 6, 2023 10:00
@github-actions github-actions Bot added C:CLI C:Keys Keybase, KMS and HSMs labels Sep 6, 2023
@ghost ghost requested review from a team, alexanderbez and samricotta and removed request for a team September 6, 2023 10:14
@julienrbrt julienrbrt linked an issue Sep 6, 2023 that may be closed by this pull request
4 tasks
Comment thread client/keys/add.go
Comment thread client/keys/add.go Outdated
if err != nil {
return err
}
jsonPub := fmt.Sprintf(`{"@type":"%s","key":"%s"}`, tempAny.TypeUrl, b64)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to avoid manual JSON templating?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is susceptible to some sneak attacks, we can invoke this

jsonPubB, err := json.Marshal(struct{
     Type string `json:"@type,omitempty"`
     Key string `json:"key,omitempty"`
}{tempAny.TypeURL, b64})
if err != nil {
    return fmt.Errorf("failed to JSON marshal typeURL and base64 key: %w", err)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch guys!! Resolved in last commit!

Copy link
Copy Markdown
Contributor

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this change @JulianToledano! I've added some code reviews, please take a look.

Comment thread client/keys/add.go Outdated
if err != nil {
return err
}
jsonPub := fmt.Sprintf(`{"@type":"%s","key":"%s"}`, tempAny.TypeUrl, b64)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is susceptible to some sneak attacks, we can invoke this

jsonPubB, err := json.Marshal(struct{
     Type string `json:"@type,omitempty"`
     Key string `json:"key,omitempty"`
}{tempAny.TypeURL, b64})
if err != nil {
    return fmt.Errorf("failed to JSON marshal typeURL and base64 key: %w", err)
}

Comment thread client/keys/add.go Outdated
Comment thread CHANGELOG.md Outdated
JulianToledano and others added 2 commits September 6, 2023 19:24
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Comment thread CHANGELOG.md Outdated
Copy link
Copy Markdown
Contributor

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thank you @JulianToledano! LGTM with some tweaks.

Copy link
Copy Markdown
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@julienrbrt
Copy link
Copy Markdown
Contributor

lgtm

@julienrbrt julienrbrt added this pull request to the merge queue Sep 7, 2023
Merged via the queue into cosmos:main with commit 933d042 Sep 7, 2023
@JulianToledano JulianToledano deleted the feat/add-b64-pubkey branch September 8, 2023 09:04
@julienrbrt
Copy link
Copy Markdown
Contributor

@Mergifyio backport release/v0.50.x

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Nov 10, 2023

backport release/v0.50.x

✅ Backports have been created

Details

mergify Bot pushed a commit that referenced this pull request Nov 10, 2023
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
(cherry picked from commit 933d042)

# Conflicts:
#	CHANGELOG.md
julienrbrt added a commit that referenced this pull request Nov 10, 2023
Co-authored-by: Julián Toledano <JulianToledano@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
@faddat faddat mentioned this pull request Nov 8, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C:CLI C:Keys Keybase, KMS and HSMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better UX for specifying a pubkey when adding keys with the CLI

5 participants