xpkt-cli 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # xpkt CLI
2
+
3
+ A command-line interface for the [Packet Protocol](https://packet.chat) — send encrypted messages, manage inboxes, upload content to Irys, and interact with Solana wallets directly from your terminal.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g xpkt-cli
9
+ ```
10
+
11
+ Then run `packet --help` for a full list of commands and options.
12
+
13
+ Or run without installing:
14
+
15
+ ```bash
16
+ npx xpkt-cli --help
17
+ ```
18
+
19
+ Requires Node.js 20+.
20
+
21
+ ## Quick Start
22
+
23
+ **1. Configure your wallet and RPC:**
24
+
25
+ ```bash
26
+ # Import a private key
27
+ packet init config --rpc https://your-rpc-url --private-key <base58-key>
28
+
29
+ # Or point to an existing Solana CLI keypair
30
+ packet init config --rpc https://your-rpc-url --keypair ~/.config/solana/id.json
31
+ ```
32
+
33
+ **2. Create an inbox:**
34
+
35
+ ```bash
36
+ packet message create-inbox --inbox 0
37
+ ```
38
+
39
+ **3. Send a message:**
40
+
41
+ ```bash
42
+ packet message new-thread --to <recipient-pubkey> --content "Hello!"
43
+ ```
44
+
45
+ **4. Read your inbox:**
46
+
47
+ ```bash
48
+ packet message inbox 0
49
+ ```
50
+
51
+ ## Command Groups
52
+
53
+ | Group | Description |
54
+ |---|---|
55
+ | `init config` | Configure RPC endpoint and wallet |
56
+ | `message` | Send, read, and manage threads, inboxes, and escrow |
57
+ | `crypto` | Standalone encrypt/decrypt operations |
58
+ | `upload` | Upload files or raw content to Irys |
59
+
60
+ ## Commands
61
+
62
+ ### `init config`
63
+
64
+ Set up your RPC and wallet. Must be run before any other command.
65
+
66
+ ```bash
67
+ packet init config --rpc <url> --private-key <base58>
68
+ packet init config --rpc <url> --keypair ~/.config/solana/id.json
69
+ ```
70
+
71
+ Config is stored at:
72
+ - Linux: `~/.config/xpkt/config.toml`
73
+ - macOS: `~/Library/Preferences/xpkt/config.toml`
74
+ - Windows: `%APPDATA%\xpkt\Config\config.toml`
75
+
76
+ Private keys imported via `--private-key` are written to `wallet.json` with mode `0600`.
77
+
78
+ ### `message`
79
+
80
+ ```bash
81
+ # Send a new thread
82
+ packet message new-thread --to <pubkey> --content "Hello!"
83
+
84
+ # Send encrypted
85
+ packet message new-thread --to <pubkey> --content "Secret" --encrypt
86
+
87
+ # Upload a file and send the Irys CID
88
+ packet message new-thread --to <pubkey> --file ./doc.txt --upload --encrypt
89
+
90
+ # Reply to an existing thread
91
+ packet message new --thread <id> --content "Reply"
92
+
93
+ # List your inboxes
94
+ packet message inboxes
95
+
96
+ # Browse an inbox
97
+ packet message inbox 0
98
+
99
+ # View activity (all threads sent/received)
100
+ packet message activity
101
+
102
+ # Load messages from a thread
103
+ packet message messages --thread <id>
104
+
105
+ # Escrow
106
+ packet message escrow approve --thread <id>
107
+ packet message escrow withdraw --thread <id>
108
+
109
+ # Create inbox with payment wall
110
+ packet message create-inbox --inbox 0 --payment-sol 0.05 --escrow
111
+ ```
112
+
113
+ ### `crypto`
114
+
115
+ Encrypt or decrypt content outside of a message send.
116
+
117
+ ```bash
118
+ # Encrypt for a recipient
119
+ packet crypto encrypt --to <pubkey> --content "Secret"
120
+
121
+ # Encrypt a file and save output
122
+ packet crypto encrypt --to <pubkey> --file ./doc.txt --out ./doc.enc.json
123
+
124
+ # Encrypt and upload to Irys
125
+ packet crypto encrypt --to <pubkey> --content "Secret" --upload
126
+
127
+ # Decrypt from a file
128
+ packet crypto decrypt --file ./doc.enc.json
129
+
130
+ # Decrypt from a URL
131
+ packet crypto decrypt --url https://gateway.irys.xyz/<cid>
132
+ ```
133
+
134
+ ### `upload`
135
+
136
+ Upload content to Irys (free tier for small payloads).
137
+
138
+ ```bash
139
+ # Upload raw string
140
+ packet upload raw --content "hello world"
141
+
142
+ # Upload a file
143
+ packet upload file ./report.pdf
144
+ ```
145
+
146
+ ## Encryption
147
+
148
+ The CLI uses **wallet-derived X25519** encryption by default: your Ed25519 signing key is deterministically converted to an X25519 key. No separate key registration step is required.
149
+
150
+ If a recipient has registered a Key account on-chain, the SDK picks it up automatically. The sender is included as a reader by default so you can decrypt your own sent messages.
151
+
152
+ ## License
153
+
154
+ MIT