@feralfile/cli 2.8.0 → 2.10.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/docs/README.md CHANGED
@@ -19,6 +19,19 @@ npm i -g @feralfile/cli
19
19
  ff-cli setup
20
20
  ```
21
21
 
22
+ Unattended provisioning takes the same flags without prompting. Pass an existing signing key with
23
+ `--key-file <path>` rather than `--key`, which puts the key in the process list of a machine nobody is
24
+ watching and in whatever shell or CI log recorded the command:
25
+
26
+ ```bash
27
+ ff-cli setup --non-interactive --key-file /run/secrets/ff-signing.key \
28
+ --role curator --device-host http://192.168.1.50:1111 --device-name studio
29
+ ```
30
+
31
+ `--key` and `--key-file` together is an error, and an empty or unreadable key file is refused rather
32
+ than quietly generating a new identity for the machine. See
33
+ [Where the signing key can come from](./CONFIGURATION.md#where-the-signing-key-can-come-from).
34
+
22
35
  See the full configuration reference here: `./CONFIGURATION.md`.
23
36
 
24
37
  During setup, you can pick FF1 devices to add. Use `ff-cli device add` to add more devices later, and `ff-cli device list` to see what's configured. The first device is the default for `play` commands (override with `-d`).
@@ -97,8 +110,12 @@ Both paths run the same deterministic pipeline: fetch metadata, assemble a DP-1
97
110
  - `validate <file-or-url>` – Validate playlist structure only
98
111
  - `verify <file-or-url>` – Validate structure and verify signatures. On failure, the CLI labels structure issues separately from signature verification. dp1-js uses `--public-key` (or a key derived from `playlist.privateKey` / `PLAYLIST_PRIVATE_KEY` when omitted) **only** for legacy flat `signature` verification; DP-1 v1.1.0 `signatures[]` envelopes are verified without relying on that argument. If deriving or normalizing key material fails, the CLI prints a warning on stderr and continues without it (legacy verification still requires a usable key when the playlist uses a flat `signature`). The derived key is emitted as PEM. Supported key forms: hex with optional `0x`, PEM, or 32-byte raw public key as hex or base64
99
112
  - `sign <file>` – Sign playlist with a DP-1 v1.1.0 multi-signature envelope (private key string is forwarded to **`dp1-js`**; same hex or base64 PKCS#8 DER forms as `playlist.privateKey` in `./CONFIGURATION.md`). The command verifies the final envelope before writing output and refuses to persist tampered or otherwise unverifiable `signatures[]`.
100
- - Options: `-k, --key <privateKey>`, `-r, --role <role>`, `-o, --output <file>`, `--replace-signatures`
113
+ - Options: `-k, --key <privateKey>`, `--key-file <path>`, `-r, --role <role>`, `-o, --output <file>`, `--replace-signatures`, `--force`
114
+ - `--key-file <path>` reads the key from a file instead of the command line, which is where `--key` leaves it in your shell history and in the process list. Same key encodings, same normalization; keep the file private, since the CLI does not check its permissions. `--key` and `--key-file` together is an error, and an empty or unreadable key file is refused rather than falling back to the configured key
115
+ - **It overwrites only a document it has read.** Before writing, the destination is read back and compared with the document being signed; if it holds something else, the run is refused rather than destroying a file the command never inspected. `--force` allows that overwrite, and the report names the file it replaced. A destination holding the *same* document — a copy of the input — is treated as an in-place run, so it is refused only when it would discard a still-valid signature from another key, and `--force` does not override that one. The read and the overwrite are not atomic, so an editor writing in the same instant can still lose its change, as with any in-place tool — a fresh `--output` name is the write that cannot collide. A destination that already exists needs read permission
101
116
  - Signing **appends** by default, so repeated runs accumulate endorsements. That is only correct while the signed content is unchanged: editing a signed playlist moves bytes the earlier signatures cover, and the envelope check then refuses to write the result. `--replace-signatures` discards every existing entry — including a feed's own co-signature — and signs the document as it stands. It is the required step before `publish --replace`
117
+ - **An in-place run refuses when it would discard a still-valid signature from another key**, since only its holder could make that signature again: write the result elsewhere with `-o, --output`, which leaves the original where it is. The refusal is about what cannot be recovered — an in-place run still proceeds when the only entries dropped are your own, or ones that no longer verify
118
+ - `--replace-signatures` names each discarded entry by role and the last 8 characters of its `kid`, and verifies it against the document as it now stands. Your own earlier signature is replaced by the same run. Another key's entry that **still verifies** — which is every entry when the content was not edited, since the signing payload excludes `signatures` — is reported as removed; keep the previous file if you want it back. An entry that does **not** verify is reported as exactly that and no more: the command has only the document as it stands, so it cannot tell an edit from an entry that was never valid, and it does not guess. Roles are carried through as found (`agent`, `institution` and `licensor` are as valid as `curator`), and a flat legacy `signature` is reported as not checkable, since it carries no key or role at all
102
119
  - `play <source>` – Play a playlist file, playlist URL, or media URL on an FF1 device (runs `verify` before sending; only the CLI-synthesized media URL fallback is auto-signed when a signing key is configured; use `--skip-verify` to bypass the gate)
103
120
  - Options: `-d, --device <name>`, `--skip-verify` (skip signature verification; not recommended)
104
121
  - `find <input>` – Resolve a marketplace URL, raw `chain:contract:tokenId`, or wallet address into a playable DP-1 playlist
@@ -110,11 +127,12 @@ Both paths run the same deterministic pipeline: fetch metadata, assemble a DP-1
110
127
  - DP-1 `evm` names a chain family rather than a network, so those items are skipped unless `--assume-ethereum` asserts which one they are. Getting that wrong attaches another artwork's metadata
111
128
  - Options: `-o, --output <file>`, `--force` (replace existing manifests), `--assume-ethereum`, `-v, --verbose`
112
129
  - `publish <file>` – Publish a playlist to a feed server (runs `verify` before upload and rejects unsigned or broken playlists)
113
- - Options: `-s, --server <index>` (server index if multiple configured), `--replace` (replace the playlist already stored under this document id instead of creating a new one)
130
+ - Options: `-s, --server <index>` (server index if multiple configured), `--replace` (replace the playlist already stored under this document id instead of creating a new one), `-k, --key <privateKey>` (signs the replace authorization; `--replace` only), `--key-file <path>` (the same key, read from a file)
131
+ - `--key` and `--key-file` are both refused on a plain `publish`, which signs nothing at request time — it uploads the `signatures[]` envelope the document already carries. Sign the file with `ff-cli sign --key-file` instead
114
132
  - `fetch <id-or-url>` – Save a published playlist from a feed server. Accepts a playlist id, a slug, or a feed URL. The document goes to `-o` when given and to stdout otherwise (status lines always go to stderr, so `ff-cli fetch <id> > playlist.json` works). This is the starting point for `publish --replace`, which requires the stored `id`, `slug`, and `created`
115
- - Options: `-s, --server <index>`, `-o, --output <file>`
116
- - `unpublish <id-or-url>` – Delete a playlist from a feed server. Accepts a playlist id, a slug, or a feed URL. Requires the configured key to be an owner of the stored playlist, and confirms before deleting
117
- - Options: `-s, --server <index>`, `-y, --yes` (skip the confirmation)
133
+ - Options: `-s, --server <index>`, `-o, --output <file>`. There is no `--key`: a fetch is a plain read and signs nothing
134
+ - `unpublish <id-or-url>` – Delete a playlist from a feed server. Accepts a playlist id, a slug, or a feed URL. Requires the signing key to be an owner of the stored playlist, and confirms before deleting
135
+ - Options: `-s, --server <index>`, `-y, --yes` (skip the confirmation), `-k, --key <privateKey>` (signs the delete authorization), `--key-file <path>` (the same key, read from a file)
118
136
  - `ssh <enable|disable>` – Manage SSH access on an FF1 device
119
137
  - Options: `-d, --device <name>`, `--pubkey <path>`, `--ttl <duration>`
120
138
  - `device list` – List all configured FF1 devices
@@ -315,6 +333,13 @@ If you sign with `sign --key <privateKey>`, read that key's identity with
315
333
  and `build` need none of this: they declare the key and sign it as `curator` for you when a signing key
316
334
  is configured. An `apiKey` left over in an existing config is ignored.
317
335
 
336
+ `--key-file <path>` is the same key from a file, on `sign`, `status`, `unpublish`, and
337
+ `publish --replace` alike — so `ff-cli status --key-file signing.key` reports the identity
338
+ `ff-cli sign --key-file signing.key` will assert. Prefer it: `--key` writes your private key into your
339
+ shell history and exposes it in the process list for the length of the run, and a signing key that has
340
+ been disclosed cannot be rotated out of a playlist that already names it. See
341
+ [Where the signing key can come from](./CONFIGURATION.md#where-the-signing-key-can-come-from).
342
+
318
343
  ```json
319
344
  {
320
345
  "feedServers": [
@@ -331,8 +356,11 @@ is configured. An `apiKey` left over in an existing config is ignored.
331
356
  ### Change or remove a published playlist
332
357
 
333
358
  A feed's `PUT` and `DELETE` are owner-bound. Neither takes an API key, and neither is authorized by the
334
- document alone: both carry a short-lived **intent** that ff-cli signs with the configured key in the
335
- `curator` role. Only a key the *stored* playlist names in `curators[]` can authorize either one, which is
359
+ document alone: both carry a short-lived **intent** that ff-cli signs in the `curator` role — with the
360
+ configured `playlist.privateKey` by default, or with whatever `-k, --key` or `--key-file <path>` names
361
+ for that one command (see
362
+ [Where the signing key can come from](./CONFIGURATION.md#where-the-signing-key-can-come-from), which
363
+ explains why the file is the safer of the two). Only a key the *stored* playlist names in `curators[]` can authorize either one, which is
336
364
  why `publish` refuses to create a playlist that carries no owner-role signature — such a document can be
337
365
  neither replaced nor deleted, ever.
338
366
 
@@ -359,6 +387,19 @@ you published — re-running `find` or `build` mints a fresh id, slug, and `crea
359
387
  playlist rather than a replacement. A `publish` without `--replace` is never silently upgraded to a
360
388
  replace; an id the feed already holds fails with a conflict, as before.
361
389
 
390
+ The configured `playlist.privateKey` is only the default. `-k, --key` and `--key-file <path>` override
391
+ it on both commands — for the intent signature and for the local ownership check alike — the way
392
+ `ff-cli sign` and `ff-cli status` already accept them. Passing both is an error rather than a precedence
393
+ rule, since a precedence rule silently ignores one of the two keys you supplied. A `--key` that is
394
+ present but empty (what `--key "$SIGNING_KEY"` becomes when the variable is unset), and a `--key-file`
395
+ that is missing, unreadable, or holds nothing, are all **rejected**, never
396
+ treated as absent: falling back to the configured key would authorize the write under an identity you did
397
+ not choose, and a delete cannot be taken back. `unpublish` derives the identity before it looks the
398
+ playlist up, so a bad credential fails before you are asked to confirm anything, and it prints
399
+ `Signing as:` so the identity is visible in the record either way. The configured key is one identity;
400
+ the key that owns a given playlist may be another, and editing `config.json` to delete something you own
401
+ is not a workflow.
402
+
362
403
  Both verbs prove ownership locally before signing anything. A key counts as an owner only when the
363
404
  **stored** playlist names it in `curators[]` **and** carries its valid `curator`-role signature — being
364
405
  named is a claim, signing in the owner role is the proof. A playlist that declares a curator but was
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feralfile/cli",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "description": "CLI for building, signing, and playing DP-1 playlists of digital art on Feral File devices",
5
5
  "repository": {
6
6
  "type": "git",