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

feat: add unsafe (unencrypted) private key import / export functionality #537

Merged
merged 5 commits into from
Mar 1, 2023

Conversation

zivkovicmilos
Copy link
Member

@zivkovicmilos zivkovicmilos commented Feb 23, 2023

Description

Based on discussions with the Onbloc team, this PR introduces unsafe (unencrypted) private key export and import functionality to gnokey.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist (for contributors)

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

  • Manually tested the import / export commands with the --unsafe flag.
  • Added unit tests that cover this functionality.

Additional comments

cc @r3v4-onbloc

@zivkovicmilos zivkovicmilos added the 🌱 feature New update to Gno label Feb 23, 2023
@zivkovicmilos zivkovicmilos requested a review from a team as a code owner February 23, 2023 14:34
@zivkovicmilos zivkovicmilos self-assigned this Feb 23, 2023
@moul moul merged commit ae34d7f into gnolang:master Mar 1, 2023
@zivkovicmilos zivkovicmilos deleted the feature/unsafe-import-export branch March 1, 2023 11:22
harry-hov pushed a commit to harry-hov/gno that referenced this pull request Mar 6, 2023
harry-hov pushed a commit to harry-hov/gno that referenced this pull request Mar 7, 2023
@r3v4s
Copy link
Contributor

r3v4s commented Aug 9, 2023

Hello @zivkovicmilos, currently adena supports private key import functionality if key is unarmored and formatted in hex.

Thanks to this pr, I think unsafe=true flag does satisfy unarmored

However we(adena) still need hex format, so can you add unarmored-hex flag too??

@zivkovicmilos
Copy link
Member Author

Hey @r3v4s,

The import command with the unsafe flag expects unencrypted armor, and the export command with the unsafe flag exports unencrypted armor. Can't you do the hexing client side?

@r3v4s
Copy link
Contributor

r3v4s commented Aug 10, 2023

Hey @zivkovicmilos Adena needs raw byte value to handle hex encoding, which means user need to upload file(or idk.. somehow pass raw value), i.e user can't just copy & paste result from gnokey export -unsafe=true <- I think this isn't really good process for UX

@zivkovicmilos
Copy link
Member Author

Got it - just to understand, you would like to hex the private key armor as well? (not just the raw private key bytes)

@r3v4s
Copy link
Contributor

r3v4s commented Aug 11, 2023

@zivkovicmilos nah unarmored hex is enough :D

@zivkovicmilos
Copy link
Member Author

@r3v4s
Understood, so you just need the raw private key data, makes sense given the API we use around (even gnokey unarmors / armors when working with private key data).

I'll look into opening up a PR this week and tagging you to make sure we got the API right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 feature New update to Gno
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants