superhero-com / superhero-wallet

Superhero Wallet – More than just a way to receive, store & send tokens on the æternity blockchain
https://wallet.superhero.com
ISC License
39 stars 38 forks source link

Ability to import/export Private Key (backup) #3188

Open smaroudasunicorn opened 1 month ago

smaroudasunicorn commented 1 month ago

STORY:

User has to be able to export wallet private keys encrypted. User has to be able to restore wallet accounts with the encrypted key(s) and the password.

DESIGN:

1. Import with Seed phrase VS Import with Private key(s) and password:

Import wallet accounts with Private Key:

Image

Image

Image

Image

Image

Image

Image

Import wallet accounts with Seed phrase:

Image

Image

Image

Image

Image

Image

..................................................................................... 2. Export private key(s):

!! See Figma comments (follow the reference link below)

Image

Image

Image

Image

Image

Image

Image

..................................................................................... FIGMA REFERENCE: https://www.figma.com/design/3oGLWzSH0oJljo4RETZtur/Superhero-Wallet-UI-(%E2%9C%94%EF%B8%8FUpdated)?node-id=33646-210502&t=yNhx5Cr7FQ1SiG9h-0

nikita-fuchs commented 1 month ago

Hey, so awesome to see this moving !

I. image

  1. Improve phrasing: " ..export your private key in plain text format or as a .json or .csv file" (is that correct? or will plain text also be a file?)
  2. What is meant by "current wallet password" - will there be a protection accessing SH wallet, like in metamask? If so, maybe adapt the wording to "current SUperhero Wallewt password" so (less technical) people don't mix it with the private key of one account.

II. Right now, all accounts except the main one are derived from the main seed phrase. In order to get them back after restoring the SH wallet, one has to 'magically summon' all of them back by 'creating' new accounts, and via the derivation path you get them all back again.

How is that handled in the future, when derived and imported (via PK import) accounts mix ? Are all PKs for the derived accounts stored somewhere, so that technically all accounts (derived and PK-imported) can be treated equally in terms of exporting, e.g. I am responsible / have the possibility to export/import all PKs of all accounts?

Thank you for putting work in this, this is a huge improvement for the ecosystem.

CedrikNikita commented 1 month ago

will there be a protection accessing SH wallet, like in metamask?

Yes. https://github.com/superhero-com/superhero-wallet/issues/3189, https://github.com/superhero-com/superhero-wallet/pull/3231

How is that handled in the future, when derived and imported (via PK import) accounts mix ?

The idea is to allow a user to start a wallet with a single private key. If the user wants to add new accounts, they will be prompted to add a mnemonic phrase or import a different private key.

Are all PKs for the derived accounts stored somewhere, so that technically all accounts (derived and PK-imported) can be treated equally in terms of exporting, e.g. I am responsible / have the possibility to export/import all PKs of all accounts?

Yes, they will be stored "somewhere", and can be exported equally. We should think about having option "export all the accounts".

nikita-fuchs commented 1 month ago

Alright, awesome. Then basically the role of importing an account with a mnemonic will be limited to deriving a keypair at index 0 only, right ? As a bonus feature, you could ask users which index they want to derive the account from, for the case that some people rely on this feature.

CedrikNikita commented 3 weeks ago

Alright, awesome. Then basically the role of importing an account with a mnemonic will be limited to deriving a keypair at index 0 only, right ?

No. It will remain the same. You just would be able to import a private key in addition to existing functionality.

As a bonus feature, you could ask users which index they want to derive the account from, for the case that some people rely on this feature.

We have a separate ticket for this feature.

onvisions commented 2 weeks ago

UPDATED DESIGN MVP @CedrikNikita @smaroudasunicorn

ACCEPTANCE CRITERIA:

For MVP version there are only 2 basic flows: - Export private key: The user is able to get the current account private key (PK) shown and to copy it. - Import private key: The user is able to import any account with its private key from the Dashboard/Add account card/Add account modal.

Naming of PK added accounts: PK + blockchain + account + number.

Order: PK imported account is added after existing accounts in the switcher. It becomes the current active account.

Wording update:

Text update of the modal sub-title of Add account modal: it is changed to just "Please select blockchain." (See mockups below; options displayed in the modal include not only adding new account to the blockchain but also importing already existing accounts into the wallet so the previous text was not exactly correct)

.............................................................................................

DESIGN

1. Export Private Key (Show & Copy PK):

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Prototype REC (Exporting):

https://github.com/user-attachments/assets/c252303b-8d4a-4c5d-b076-c822b66f95a4

.............................................................................................

2. Import private key from Add account modal:

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Prototype REC (Importing):

https://github.com/user-attachments/assets/eda9cc4b-a37f-49e0-9bed-9b7027682fe5

.............................................................................................

Figma Reference:

https://www.figma.com/design/3oGLWzSH0oJljo4RETZtur/Superhero-Wallet-UI-(%E2%9C%94%EF%B8%8FUpdated)?node-id=33899-223886&t=QgX8ogcJglXGgf13-0

nikita-fuchs commented 2 weeks ago

good job @onvisions !