[CLI Feature] List public keys

GPG has the command gpg --list-secret-keys that will provide you details of the keys for which you have the corresponding private keys. Let’s say you have a load of keypairs in your keys/ directory, there’s no way to view them all currently without essentially cat `ing the contents. I imagine a coda client list-secret-keys or similar to list those public keys with corresponding secret keys that are known to the client.

Note, this probably isn’t the best idea not least as it would rely on storing the keys in a predetermined location, albeit this may be customisable with a flag.

I’ve been playing with the GraphQL API and there is a method there ownedWallet (Wallets for which the daemon knows the private key) that would be a great addition to the CLI which covers the above and more. I created a couple and the output of this is really helpful not least as it lists the balance of all known wallets (though maybe I am not understanding “wallets” correctly)

{
    "data": {
        "ownedWallets": [
            {
                "publicKey": "tNciDhKWNmKpoQ4jHvP4oqt7gnuQYaUYz8pMSE1wewiXjaozksHVL5YpkC4bSx3hqaZHH6cgxwLicrXAdddGyHx8eh3WJBZN6XzpAZdfYM861t53khP9v74Kj3CBxHCbfVPisD8ikNaBGE",
                "balance": {
                    "total": "0",
                    "unknown": "0"
                },
                "nonce": null,
                "receiptChainHash": null,
                "delegate": null,
                "votingFor": null,
                "stakingActive": false,
                "privateKeyPath": "/home/gareth/.coda-config/wallets/store/tNciDhKWNmKpoQ4jHvP4oqt7gnuQYaUYz8pMSE1wewiXjaozksHVL5YpkC4bSx3hqaZHH6cgxwLicrXAdddGyHx8eh3WJBZN6XzpAZdfYM861t53khP9v74Kj3CBxHCbfVPisD8ikNaBGE"
            },
            {
                "publicKey": "tNciddBDdHdrgvwjowJTZnwMGxxuDW1pEvEXJRsmQaaivnUq9sJ41xEJvEzr1mAdyhrsxcDH5gUgQBjHLpSFx3Sqic5LXJ8aqKaY6pjrzrFpJKsZdFewTMZQvoMezJu2YxAsWZCm55AdNG",
                "balance": {
                    "total": "0",
                    "unknown": "0"
                },
                "nonce": null,
                "receiptChainHash": null,
                "delegate": null,
                "votingFor": null,
                "stakingActive": false,
                "privateKeyPath": "/home/gareth/.coda-config/wallets/store/tNciddBDdHdrgvwjowJTZnwMGxxuDW1pEvEXJRsmQaaivnUq9sJ41xEJvEzr1mAdyhrsxcDH5gUgQBjHLpSFx3Sqic5LXJ8aqKaY6pjrzrFpJKsZdFewTMZQvoMezJu2YxAsWZCm55AdNG"
            }
        ]
    }
}

I started some work along these lines the other day in case you’re interested, it will just require some reworking of the other cli commands to let them know about these accounts before we can release it so it’s turned off for now.

1 Like