spacemeshos / smcli

Spacemesh command-line tool
https://spacemesh.io/
MIT License
8 stars 9 forks source link

Clean up error handling in WalletKeyOpt functional options #29

Open lrettig opened 1 year ago

lrettig commented 1 year ago
          Exiting the program in case the functional options have been defined in the wrong order is a bit extrem imo

I would prefer one of the following:

  1. WithPdkdf2Password also takes a salt and the user must not also call WithSalt
  2. WalletKey has a verify method that is called after applying all functional options that verifies a correct state and returns an error if something is missing (e.g. no salt provided)

_Originally posted by @fasmat in https://github.com/spacemeshos/smcli/pull/20#discussion_r1153727168_