onflow / flowkit

Apache License 2.0
6 stars 10 forks source link

[IMPROVEMENT] Allow for private key to be created in a target directory #47

Closed chasefleming closed 3 months ago

chasefleming commented 3 months ago

Issue to be solved

You can save the state to a path, but the private key creation only happens at the root level. This means your config and key can be in different locations after saving.

Suggest A Solution

We need a way to give the target directory to the private key creation so it occurs in the same place as the config is created.

What are you currently working on that this is blocking?

No response

jribbink commented 3 months ago

The other workaround is potentially to just make the default account/emulator account an argument instead of the target driectory. This could potentially provide more control to the end user while also solving this issue. (i.e. right now everyone is forced to use file keys for emulator account, maybe they don't want to do this, etc.)

chasefleming commented 3 months ago

@bjartek any thoughts on this? It could be something like flowkit.Init(readerWriter, NewEmulatorAccount(...))

Or, separately creating the account could be an additional step like:

state, err := flowkit.Init(readerWriter)
state.AddAccount(...)

That being said if you prefer what was on the PR that would work as well, which was flowkit.Init(readerWriter, crypto.ECDSA_P256, crypto.SHA3_256, "")

bjartek commented 3 months ago

I dont really use keys in files. I find it easier to use env var substitution to keep things secure.