about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorlogin <login@tilde.team>2022-01-22 13:39:32 +0000
committerlogin <login@tilde.team>2022-01-22 13:39:32 +0000
commit49f8da3cb71d3488660454d27e5118bca31e81c0 (patch)
treec235ff6b8e88ab6c7010c9fde25efe9835389075
parentc0d17610538b41a13401aac6c83f4a6e452f29dd (diff)
downloadtcoin-49f8da3cb71d3488660454d27e5118bca31e81c0.tar.gz
Added 'pcoin name' or 'pcoin -n' to get the name on the account
This is expected to help a pcoin escrow program confirm that a key supplied to it is that of the right pcoin account by checking what the output of 'pcoin name' is. In the future, it may be expected that 'view key', 'spend key' and 'transfer key' would be three different keys that would split power over the pcoin account. And each of the previously mentioned 'keys' could be m-of-n keys. Maybe some kind of social recovery feature could also be added (where other users confirm who you are so you can get your account back, but you nominate them as your 'social recovery circle' beforehand.
-rw-r--r--pcoin.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/pcoin.cpp b/pcoin.cpp
index 3038f8a..f844517 100644
--- a/pcoin.cpp
+++ b/pcoin.cpp
@@ -1570,6 +1570,7 @@ void help()
   std::cout << "\n`" << PCOIN_BIN_PATH_W_SPACE << "send <username> <amount> \"<message>\"` or `" << PCOIN_BIN_PATH_W_SPACE << "-s <username> <amount> \"<message>\"`: optionally, include a message to be sent to <username>";
   std::cout << "\n`" << PCOIN_BIN_PATH_W_SPACE << "silentsend <username> <amount> [\"<message>\"]`, `" << PCOIN_BIN_PATH_W_SPACE << "send -s <username> <amount> [\"<message>\"]` or `" << PCOIN_BIN_PATH_W_SPACE << "-ss <username> <amount> [\"<message>\"]`: send <amount> tildecoins to <username> with an optional (as indicated by [ and ], which should not be included in the actual comment) message included without printing anything";
   std::cout << "\n`" << PCOIN_BIN_PATH_W_SPACE << "refresh_key` or `" << PCOIN_BIN_PATH_W_SPACE << "-rk`: generate a new key for your pcoin account and print it";
+  std::cout << "\n`" << PCOIN_BIN_PATH_W_SPACE << "name` or `" << PCOIN_BIN_PATH_W_SPACE << "-n`: print the name on the account";
   std::cout << "\nIn the commands with `<username> <amount>`, switching the two arguments around (i.e., from `<username> <amount>` to `<amount> <username>`) will also work";
   std::cout << "\n`" << PCOIN_BIN_PATH_W_SPACE << "--help`, `" << PCOIN_BIN_PATH_W_SPACE << "help` or `" << PCOIN_BIN_PATH_W_SPACE << "-h`: print this help text";
   std::cout << "\nSend an email to `login@tilde.town` (tilde.town local email) or `login@tilde.team` (internet-wide email), or `/query login` on IRC to report any errors or request a key for your program.\n\n";
@@ -2196,6 +2197,10 @@ int main(int argc, char *argv[])
     else
       std::cout << new_key << "\n";
   }
+  else if(!strcmp(argv[1], "name") || !strcmp(argv[1], "-n"))
+  {
+    std::cout << get_username() << "\n";
+  }
   else
   {
     std::cout << "\nSorry, an unknown command-line argument was received. `" << PCOIN_BIN_PATH_W_SPACE << "help` will print the help text.\n\n";