|
4 | 4 |
|
5 | 5 | PayID CLI for creating, fetching, signing and verifying PayIDs. Based on the Typescript PayID Utils library. |
6 | 6 |
|
| 7 | +## Prerequisites |
7 | 8 |
|
| 9 | +In order to use the CLI, both [node](https://nodejs.org/en/download/) and |
| 10 | +[npm](https://docs.npmjs.com/downloading-and-installing-packages-locally) must be installed first. |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +To install the PayID CLI, run the command |
| 15 | +``` |
| 16 | +npm install -g @payid-org/payid-cli |
| 17 | +``` |
| 18 | + |
| 19 | +## Interactive vs single command mode |
| 20 | + |
| 21 | +CLI can be run in interactive mode or as a single command mode. |
| 22 | +In interactive mode, a prompt is shown where multiple commands can be run until the exit command is run. |
| 23 | + |
| 24 | +In single command mode, a single command is run and then the CLI exits. No prompt is shown in this mode. |
| 25 | +This mode is useful for running commands from a script, or from a shell where multiple commands can be |
| 26 | +chained together or to pipe output to another application. |
| 27 | + |
| 28 | +To run the CLI in interactive mode, run ```payid```. |
| 29 | + |
| 30 | +To run the CLI in single command mode, run ```payid <command> <arguments>```. Example: |
| 31 | +``` |
| 32 | +payid load 'nhartner$xpring.money' |
| 33 | +``` |
| 34 | +_note: when passing a PayID as an argument in single command mode, the PayID needs to be quoted |
| 35 | +if run in a Linux shell (to avoid the '$' being interpolated as a variable by the Linux shell). |
| 36 | + |
| 37 | +## Commands |
| 38 | + |
| 39 | +A list of available commands can be found run running the `help` command. |
| 40 | + |
| 41 | +## Use Cases |
| 42 | + |
| 43 | +### Loading a PayID |
| 44 | +The following command can be used to load an existing PayID from a remote server: |
| 45 | +``` |
| 46 | +load nhartner$xpring |
| 47 | +``` |
| 48 | +This will fetch all the PayID address mappings for the given PayID from the remote |
| 49 | +server and displays the resulting JSON. |
| 50 | + |
| 51 | +### Creating a new PayID |
| 52 | + |
| 53 | +The following set of commands demonstrates how to create a new PayID, attach multiple |
| 54 | +address mappings and save the result to a JSON file. |
| 55 | + |
| 56 | +``` |
| 57 | +init example$mypayid.com |
| 58 | +crypto-address add xrpl mainnet rP3t3JStqWPYd8H88WfBYh3v84qqYzbHQ6 12345 |
| 59 | +crypto-address add btc mainnet 3M2CH71P6uZTra1PsjiEhNFB7kCENShCgt |
| 60 | +save |
| 61 | +``` |
| 62 | +The end result should be a PayID json representation being saved to the local filesystem as |
| 63 | +example.json. |
| 64 | + |
| 65 | +### Identity Keys |
| 66 | + |
| 67 | +The PayID protocol supports signing address mappings using one or more cryptographic keys. |
| 68 | +The CLI provides several commands for generating and loading keys. Once a key is generated |
| 69 | +or loaded by the CLI, it is retained in the CLI's local storage for use in signing your PayID. |
| 70 | +Multiple identity keys can be generated or loaded using the `keys generate` and `keys load` commands. |
| 71 | +To remove all loaded keys from the CLI's local storage, use the `keys clear` command. |
| 72 | +The `keys list` command will show you all keys currently loaded into the CLI. |
| 73 | + |
| 74 | +To generate new key run: |
| 75 | +``` |
| 76 | +keys generate |
| 77 | +``` |
| 78 | +This will generate a new key and save it to a file named `identity-key.pem`. To load a previously |
| 79 | +created identity key, run `keys load </path/to/pem/file>`. |
| 80 | + |
| 81 | +### Signing a PayID |
| 82 | + |
| 83 | +In order to sign an PayID, it must either be loaded using the `load` command or created using the |
| 84 | +`init` command (as well as executing commands to add 1 or more addresses). Once a PayID has been |
| 85 | +initialized or loaded, it can be signed using an identity key (refer to the above section). |
| 86 | + |
| 87 | +Once your PayID has been loaded or initialized, and your identity key has been generated or loaded, |
| 88 | +you can sign the PayID using the command `sign`. This command will signed each of your PayID address |
| 89 | +mappings using the loaded identity keys and out the resulting PayID with verifiedAddress. The `save` |
| 90 | +command can be used to save your PayID, with signed addresses, to file. |
| 91 | + |
| 92 | +### Inspecting a Verified PayID |
| 93 | + |
| 94 | +Two commands are available to verify a PayID's verified addresses. |
| 95 | + |
| 96 | +- ```verify``` - checks if all the verified addresses have valid signatures |
| 97 | +- ```insepct``` - displays details information about each verified address and signatures. |
0 commit comments