glifio / glif

Apache License 2.0
8 stars 4 forks source link

Add support for encrypting keys in wallet using passphrase #112

Closed jimpick closed 1 year ago

jimpick commented 1 year ago

When creating new keys with glif wallet new, the user will be prompted for a passphrase for the owner key.

By default, the operator key is created with an empty passphrase, but it can be changed using glif wallet change-passphrase <address>.

Whenever a signature is needed, and a passphrase is required, the user will be prompted.

If a passphrase is set to empty, then the passphrase prompt is skipped.

For automation, the environment variables GLIF_OWNER_PASSPHRASE and GLIF_OPERATOR_PASSPHRASE can be set to provide values instead of using the interactive prompts.

Legacy private keys for the owner and operator in keys.toml will be automatically migrated to the new go-ethereum based keystore.

TODO: User facing documention needs updating.

Ledger support will come in a separate PR.

Schwartz10 commented 1 year ago

Notes from call:

Flow for migration:

  1. User attempts to take an action (like borrow) that requires the new keystore
  2. If keystore does not exist, block the action, force a migration
  3. Once the user migrates, do not touch or move keys.toml (this is scary). Coach them into doing that on their own after saving their backup encrypted files
  4. If the user still has keys.toml when initiating a write command that requires the keystore after having already completed the migration, then show a warning saying "You should safely backup and delete your keys.toml"

Other notes:

Bug:

Testing:

jimpick commented 1 year ago

I merged in the autopilot with pull funds code, and converted it to use the new wallet code. Tested and it is working.