@drop2p/cli 0.1.0

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,94 @@
1
+ # @drop2p/cli
2
+
3
+ A terminal-native Drop2p peer: `drop2p send <file>` / `drop2p receive <code>`.
4
+
5
+ It is a **real Drop2p peer** — the same DSTP/1 protocol as the browser (code-bound
6
+ SPAKE2 → HKDF → per-frame AES-256-GCM, over WebRTC with TURN fallback), via the
7
+ shared [`@drop2p/transfer-core`](../../packages/transfer-core) engine and
8
+ [`node-datachannel`](https://github.com/murat-dogan/node-datachannel) for WebRTC
9
+ outside the browser. **Zero-storage holds:** bytes only ever move peer-to-peer;
10
+ there is no upload/download-URL API. Both peers must be online at the same time.
11
+
12
+ > Status: built and **packaged** (a `pnpm pack` tarball installs and runs
13
+ > standalone); **not yet published to npm**. Once published: `npm i -g @drop2p/cli`.
14
+ > Single binaries (Node SEA) + a Homebrew tap are still to come.
15
+
16
+ ## Run it
17
+
18
+ **From the monorepo (dev):**
19
+ ```bash
20
+ pnpm install
21
+ apps/cli/node_modules/.bin/tsx apps/cli/src/cli.ts send ./bigfile.zip
22
+ apps/cli/node_modules/.bin/tsx apps/cli/src/cli.ts receive 8QVY-Q9MZ4P --out ~/Downloads
23
+ ```
24
+
25
+ **As an installed package (what users get):**
26
+ ```bash
27
+ pnpm --filter @drop2p/cli build # bundle → apps/cli/dist (also runs on pack)
28
+ pnpm --filter @drop2p/cli pack # → drop2p-cli-<version>.tgz
29
+ npm i -g ./apps/cli/drop2p-cli-*.tgz # installs node-datachannel's prebuilt binary too
30
+ drop2p send ./bigfile.zip
31
+ ```
32
+
33
+ To target production (or any deployment), set `DROP2P_SIGNALING_URL` /
34
+ `DROP2P_API_URL` (see [Environment](#environment)).
35
+
36
+ ## Commands
37
+
38
+ ```
39
+ drop2p send <file> [--password X] [--out-code-only] [--json]
40
+ drop2p receive <code> [--out DIR] [--password X] [--json]
41
+ drop2p login [--key d2p_…] | [--email you@example.com --password ••••]
42
+ drop2p whoami [--json]
43
+ drop2p logout
44
+ drop2p keys (create <name> | list | revoke <id>) [--json]
45
+ drop2p history [--limit N] [--json]
46
+ ```
47
+
48
+ - **send** — connects, prints a share code, waits for the peer, then streams the
49
+ file. Blocks until the receiver confirms receipt.
50
+ - **receive** — connects with the code, runs the PAKE, decrypts, and writes the
51
+ file to `--out` (default: current directory), streamed to disk (no memory cap).
52
+ - **`--password` / `DROP2P_PASSWORD`** — adds the Ultimate **double-encryption**
53
+ layer (Argon2id). The receiver must supply the same password.
54
+ - **login** — paste an API key (`--key`, or interactive), *or* sign in with
55
+ email/password. Saved to `~/.config/drop2p/config.json` (owner-only).
56
+ - An **API key** authenticates transfers + read-only calls (CI-friendly).
57
+ - **Key management** (`keys create/revoke`) needs an email/password login — a
58
+ key can't mint or revoke keys. Issuing keys requires an **Ultimate** plan.
59
+ - **keys / whoami / history** — manage keys, show the account, list transfer
60
+ history (Pro/Ultimate, metadata only).
61
+
62
+ ## Authentication & tiers
63
+
64
+ - Anonymous send/receive works under **free-tier** limits (no login needed).
65
+ - With an API key (or a logged-in account), the account's plan applies — size,
66
+ concurrency, and monthly-quota limits, plus transfer history.
67
+ - Get an API key from the **account page** (Account → API keys, Ultimate) or
68
+ `drop2p keys create <name>` after an email/password login.
69
+
70
+ ## Scripting / CI
71
+
72
+ - `--json` emits machine-readable NDJSON events on stdout
73
+ (`code`, `connected`, `progress`, `done`, `error`).
74
+ - Exit codes: `0` success · `1` transfer/auth failure · `2` usage error.
75
+ - Fully stateless via env — no `login` needed:
76
+
77
+ ```bash
78
+ DROP2P_API_KEY=d2p_… \
79
+ DROP2P_SIGNALING_URL=wss://signal.drop2p.com/ws \
80
+ DROP2P_API_URL=https://api.drop2p.com \
81
+ drop2p send ./build.tar.gz --json
82
+ ```
83
+
84
+ ## Environment
85
+
86
+ | Var | Purpose | Default |
87
+ |---|---|---|
88
+ | `DROP2P_API_KEY` | API key for transfers + read-only calls | — |
89
+ | `DROP2P_PASSWORD` | Double-encryption passphrase (alt to `--password`) | — |
90
+ | `DROP2P_SIGNALING_URL` | Signalling WebSocket URL | `ws://localhost:34110/ws` |
91
+ | `DROP2P_API_URL` | REST API base URL | `http://localhost:34140` |
92
+ | `DROP2P_FORCE_RELAY` | Force TURN-only ICE (test strict-NAT) | off |
93
+
94
+ Env vars override `~/.config/drop2p/config.json`.