Account storage support: authentication, revocation
- https://askubuntu.com/a/14536 - Storage per currency, per account name - `$XDG_DATA_HOME`|`$HOME/.local/share/silkaj/${currency}` - `${account_name}`: defined by the user, passed via general/specific option `-a/--account` - `revocation.txt` - `authentication_file_${format}.json`: Silkaj would discover which format is it, v1 formats will be dropped at some point ## Implementation ### Account storage * [x] Introduce global `-a/--account` option * [x] Storage class into `silkaj/storage.py` with tests `tests/units/test_storage.py` ### Authentication Read from `--auth-*` method, store into account storage: ```plaintext silkaj --account <account> authentication --auth-* ``` Need special handling of `--auth-*` and `--account` options separately in the authentication selection handling for the `authentication` command. Other commands using the authentication should read only from `--account`. The `authentication` command is kind of a converter command from `--auth-*` methods to account storage. Use `authentication` command as an importer from scattered files to this account storage structure * [x] Move `--auth-*` options as `authentication` specific options? - Con: Would no longer allow easy authentication on other commands - Pro: Would force more secure account storage usage, conversion * [x] Set authentication methods as `MutuallyExclusive` * [x] Implementation in `authentication` command to store in the account storage * [x] Support a better default authentication file format creation in the storage than `seedhex`? * [x] Implement [(E)WIF](https://git.duniter.org/documents/rfcs/-/blob/master/rfc/0013_Duniter_Encrypted_Wallet_Import_Format.md) authfile saving #173 * [ ] Discover which authfile format it is: v1 (seedhex, pubsec), v2 (encrypted json) - `authentication_file_ed25519.txt`, `authentication_file_sr25519.json` * [ ] Write tests ### Revocation ```plaintext # read auth file, write revocation file silkaj --account <account> wot revocation create # read revocation file silkaj --account <account> wot revocation {verify,publish} ``` * [x] `create` read authfile from `--account` and write revocation file into `--account` * [x] `verify`/`publish`: consume file from general `--account` option * [ ] Write tests ### Importer command? - `account import` - import already generated auth and revocation files to an account? ### New Account label - [x] replace `Storage` label ### Documentation - [x] Write documentation how this works (input as general option, output as command-specific option) - [x] Update `README.md§Features` with `Account (storage)` and `Authentication methods`. ### `account` commands - `account list` command ```py def list(self): for root, dirnames, filenames in self.path.parent.walk(): print(root, dirnames, filenames) ``` - list available accounts per currencies: there contents, auth file, revocation file - following implementations can all be done with Unix commands. To be done in a follow-up ticket? - instead of a copy to the right place? - `account remove $account`: remove complete account, remove only authentication or revocation file? - `account rename $old_name $new_name`
issue