-
Notifications
You must be signed in to change notification settings - Fork 48
Conversation
bd280e7
to
7a63df4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current approach, you can specify the key very simply with "-k first_key" and "-k second_key" which is useful for quickly swapping between different keys. This expand to $HOME/.sawtooth/first_key.priv and $HOME/.sawtooth/second_key.priv.
We should probably keep this behavior.
I think we could additionally support the argument for -k being a filename and a path. We would then have three options for how the argument for -k is to be considered:
a) the short "name" which translates to $HOME/.sawtooth/{K}.priv
b) a filename which translates to $HOME/.sawtooth/{K}
c) a path which translates to just {K}
I think the best way to implement this is to first check for "/" in K; if so, then it is (c). Next, we construct the path for (a) and see if it exists on the filesystem; if it does, use it. If it doesn't, then we construct (b) and look for it on the filesystem; if it does, use it. If none of these work out, then we were unable to load the key because it is not found.
Thoughts?
The use case where user do not prefer to store the keys in So, we definitely need an option to read the keyfile path from the CLI. Most common tools (even the ones in Hyperledger Sawtooth) have used the option What's your take on that? |
Yes, it has assumptions, that sawtooth CLI keys are stored in $HOME/.sawtooth/..., but that is appropriate for this CLI as long as it is part of Sawtooth. We really can't change the behavior without reworking documentation and scripts, which makes this a backward compatibility issue. But we can expand upon it. More generally... Really what we are finding is that we want a separate CLI some_new_prog that is a keygen tool and a place for the keys in $HOME/.some_new_prog/ so it isn't sawtooth agnostic. |
It makes sense to have backward compatibility, I will get to the logic you proposed. Have multiple definition to the use of |
c2f7704
to
49129d1
Compare
Agree, added the logic that follows the explanation you gave to the input parameter. |
@arsulegai Can you rebase this PR to handle merge conflicts. |
Signed-off-by: S m, Aruna <aruna.mohan@walmartlabs.com>
fa3957c
to
b1aedab
Compare
1. Support absolute keyfile read with extension other than `.priv` 2. Support relative keyfile read with any file extension. Signed-off-by: S m, Aruna <aruna.mohan@walmartlabs.com>
Use `dirs` to get the user's home directory, remove currently used deprecated `env`. Signed-off-by: S m, Aruna <aruna.mohan@walmartlabs.com>
1. Support absolute keyfile read with extension other than `.priv` 2. Support relative keyfile read with any file extension. Signed-off-by: S m, Aruna <aruna.mohan@walmartlabs.com>
1. Support absolute keyfile read with extension other than `.priv` 2. Support relative keyfile read with any file extension. Signed-off-by: S m, Aruna <aruna.mohan@walmartlabs.com>
env
withdirs
, to get the user's home directory