Why is MnemonicSecretManager needed?
Closed this issue · 4 comments
Description
In the example generate_addresses you use
let secret_manager = SecretManager::Mnemonic(MnemonicSecretManager::try_from_mnemonic(
&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap(),
)?);
to generate a new secret manager. But what is MnemonicSecretManager
needed for?
It would be easier to use something like:
let secret_manager = SecretManager::Mnemonic(
&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap()
);
Motivation
Having another MnemonicSecretManager just seems to complicate things
Are you planning to do it yourself in a pull request?
No.
SecretManager::Mnemonic
contains a Seed
, not at String
so that wouldn't work. Without MnemonicSecretManager
, you would need something like
let secret_manager = SecretManager::Mnemonic(
Client::mnemonic_to_seed(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?
);
which is not necessarily better IMO
But surely we could add a method SecretManager:: try_from_mnemonic(&str)
SecretManager::Mnemonic contains a Seed
Right, I locked that up but forgot to give Feedback.
Isn't the word mnemonic
only related to the 24 words? I wouldn't call a Seed a mnemonic 🤔
So in my opinion it would make sense to change the whole syntax to accept a string only.
If you still want to use a hex encoded Seed or something I would use a totally different function.
SecretManager
ist just a wrapper so we can use the same API with different secret managers, but you can also use MnemonicSecretManager
directly