Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copy to .env and fill in. .env is gitignored.

# --- CLI runtime -------------------------------------------------------------
# Gateway API key used by `unicity-timestamp stamp`. Get one at https://sphere.unicity.network/
# Gateway API key used by `unicity-proof stamp`. Get one at https://sphere.unicity.network/
UNICITY_API_KEY=sk_your_gateway_key
# mainnet | testnet2
UNICITY_NETWORK=mainnet
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ name: Release
# restriction rather than anything written in this file.
# * The package exists on the registry and names this workflow as its trusted
# publisher (npmjs.com > the package > Settings > Trusted Publisher;
# repository `unicitynetwork/timestamp-cli`, workflow `npm.yml`, environment
# repository `unicitynetwork/proof-cli`, workflow `npm.yml`, environment
# `npm-publish`). npm will not accept a trusted publisher for a package that
# has never been published, so the first release is published by hand and
# every release after it runs from here.
# * That configuration permits direct publishing under "Allowed actions".
# Configurations created after 3 September 2026 allow only
# `npm stage publish` by default, and the publish step below runs
# `npm publish`, so a default configuration refuses it.
on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -157,8 +161,8 @@ jobs:
- name: Refuse a version that is already published
run: |
version='${{ steps.version.outputs.version }}'
if npm view "@unicitylabs/timestamp-cli@${version}" version >/dev/null 2>&1; then
echo "@unicitylabs/timestamp-cli@${version} is already on the registry." >&2
if npm view "@unicitylabs/proof-cli@${version}" version >/dev/null 2>&1; then
echo "@unicitylabs/proof-cli@${version} is already on the registry." >&2
exit 1
fi

Expand Down Expand Up @@ -192,5 +196,5 @@ jobs:
fi
gh release create "v${version}" \
--title "v${version}" \
--notes "https://www.npmjs.com/package/@unicitylabs/timestamp-cli/v/${version}" \
--notes "https://www.npmjs.com/package/@unicitylabs/proof-cli/v/${version}" \
--verify-tag $prerelease
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unicity Timestamp CLI
# Unicity Proof CLI

Timestamping service on Unicity network. Tokens are standard Unicity tokens produced with the [state transition SDK](https://github.com/unicitynetwork/state-transition-sdk-js).
Proof-of-existence service on the Unicity network. Tokens are standard Unicity tokens produced with the [state transition SDK](https://github.com/unicitynetwork/state-transition-sdk-js).

## Requirements

Expand All @@ -10,23 +10,23 @@ Timestamping service on Unicity network. Tokens are standard Unicity tokens prod
## Installation

```bash
npm install -g @unicitylabs/timestamp-cli
unicity-timestamp --help
npm install -g @unicitylabs/proof-cli
unicity-proof --help
```

Or run it without installing:

```bash
npx @unicitylabs/timestamp-cli --help
npx @unicitylabs/proof-cli --help
```

To work from a checkout instead:

```bash
git clone https://github.com/unicitynetwork/timestamp-cli.git
cd timestamp-cli
git clone https://github.com/unicitynetwork/proof-cli.git
cd proof-cli
npm install # builds through the prepare script
npm link # optional: puts `unicity-timestamp` on your PATH
npm link # optional: puts `unicity-proof` on your PATH
```

## Configuration
Expand Down Expand Up @@ -59,12 +59,12 @@ as the table says.
### Stamp

```bash
unicity-timestamp stamp <sha256-hex> # hash supplied
unicity-timestamp stamp --file <path> # hash computed locally
unicity-timestamp stamp --file document.pdf --out document.cbor
unicity-timestamp stamp --file document.pdf --network testnet2
unicity-timestamp stamp --file document.pdf --timeout 120
unicity-timestamp stamp --file document.pdf --json > stamp.json
unicity-proof stamp <sha256-hex> # hash supplied
unicity-proof stamp --file <path> # hash computed locally
unicity-proof stamp --file document.pdf --out document.cbor
unicity-proof stamp --file document.pdf --network testnet2
unicity-proof stamp --file document.pdf --timeout 120
unicity-proof stamp --file document.pdf --json > stamp.json
```

A stamp prints a summary and writes the token to `--out`, by default `token_<first 16 hex characters of the digest>.cbor` in the current directory. The token file is the receipt; keep it with the document.
Expand Down Expand Up @@ -96,8 +96,8 @@ that text recovers the stamp in full; there is no need to stamp again.
By default a stamp proves only that the hash existed. To also prove that *you* stamped it, sign with a key:

```bash
unicity-timestamp keygen --out my.key # once; mode 0600, 64 hex characters
unicity-timestamp stamp --file document.pdf --key-file my.key
unicity-proof keygen --out my.key # once; mode 0600, 64 hex characters
unicity-proof stamp --file document.pdf --key-file my.key
```

`keygen --out -` prints the private key to stdout instead of writing a file, as
Expand All @@ -115,10 +115,10 @@ The signer's compressed public key is printed on every `stamp` and `verify`, as
### Verify

```bash
unicity-timestamp verify document.cbor # is this a valid Unicity timestamp?
unicity-timestamp verify document.cbor --file document.pdf # ...and is it for this file?
unicity-timestamp verify document.cbor --hash 2cf24dba…9824 # ...or for this digest?
cat document.cbor | unicity-timestamp verify - # from stdin; binary or hex
unicity-proof verify document.cbor # is this a valid Unicity timestamp?
unicity-proof verify document.cbor --file document.pdf # ...and is it for this file?
unicity-proof verify document.cbor --hash 2cf24dba…9824 # ...or for this digest?
cat document.cbor | unicity-proof verify - # from stdin; binary or hex
```

```
Expand All @@ -140,7 +140,7 @@ The `Trust base` line says which root of trust produced that verdict — `bundle
### Inspect

```bash
unicity-timestamp inspect document.cbor
unicity-proof inspect document.cbor
```

Prints the same fields as `verify` without checking anything, under an `UNVERIFIED` banner. Useful for looking at tokens from other networks or other token types.
Expand All @@ -150,7 +150,7 @@ Prints the same fields as `verify` without checking anything, under an `UNVERIFI
Every command accepts `--json` and prints one JSON object on stdout; everything else goes to stderr. Large integers are decimal strings. `referenceTimeIso` is null when the token carries a reference time no date can represent; `referenceTime` always holds the raw value.

```bash
unicity-timestamp verify document.cbor --file document.pdf --json | jq -r .referenceTimeIso
unicity-proof verify document.cbor --file document.pdf --json | jq -r .referenceTimeIso
```

| Exit code | Meaning |
Expand All @@ -164,9 +164,9 @@ unicity-timestamp verify document.cbor --file document.pdf --json | jq -r .refer
### Testnet and custom gateways

```bash
unicity-timestamp stamp --file document.pdf --network testnet2 --api-key sk_ddc3cfcc001e4a28ac3fad7407f99590
unicity-timestamp stamp --file document.pdf --gateway https://gateway.example --trust-base ./bft-trustbase.json
unicity-timestamp stamp --file document.pdf --gateway http://localhost:3000 --allow-insecure # local aggregator only
unicity-proof stamp --file document.pdf --network testnet2 --api-key sk_ddc3cfcc001e4a28ac3fad7407f99590
unicity-proof stamp --file document.pdf --gateway https://gateway.example --trust-base ./bft-trustbase.json
unicity-proof stamp --file document.pdf --gateway http://localhost:3000 --allow-insecure # local aggregator only
```

The testnet2 key above is the shared public demo key published in the [sphere-sdk README](https://github.com/unicity-sphere/sphere-sdk/blob/main/README.md#api-key), where it is documented as public rather than secret; capacity is shared, so get your own key for sustained use. Trust bases for mainnet and testnet2 ship inside the package. The CLI never downloads a trust base at run time.
Expand Down
103 changes: 80 additions & 23 deletions docs/plans/2026-10-14-rename-to-proof-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
**Files:**

- Modify: `package.json` (name, bin, description, keywords, repository, homepage, bugs)
- Modify: `package-lock.json` (name at the root and in the `""` package entry)
- Modify: `package-lock.json` (name at the root and in the `""` package entry, and the `bin` map inside that entry)
- Modify: `src/lib/constants.ts:6-12` (the comment on `TIMESTAMP_TAG`)

**Interfaces:**
Expand Down Expand Up @@ -127,10 +127,27 @@ git commit -m "Rename the package to @unicitylabs/proof-cli"
In `tests/e2e/CliOfflineTest.ts`, add to the existing `prints help and version` test, after the `-v, --version` assertion:

```ts
// The installed command name and the name the help prints have to agree,
// or the help tells the reader to run something not on their PATH.
expect(help.stdout).toContain('unicity-proof');
expect(help.stdout).not.toContain('unicity-timestamp');
// The installed command name and the name the help prints have to agree, or
// the help tells the reader to run something that is not on their PATH. The
// whole usage line is asserted rather than a substring, so a stale name cannot
// hide in it — and the old name is deliberately absent from this file, because
// Task 4 and Task 5 grep the tree for it.
expect(help.stdout.split('\n')[0]).toEqual('Usage: unicity-proof [options] [command]');
```

The `--out` default is a separate string in a different help screen, so it gets
its own assertion. Add this test next to the one above:

```ts
it(
'names the default key file in the keygen help',
async () => {
const keygenHelp = await runCli(['keygen', '--help'], { cwd });
expect(keygenHelp.code).toBe(0);
expect(keygenHelp.stdout).toContain('unicity-proof.key');
},
TIMEOUT,
);
```

- [ ] **Step 2: Write the failing test for the default key file**
Expand Down Expand Up @@ -163,7 +180,7 @@ expect(sink.stderr()).toContain('`unicity-proof verify` accepts hex text');
- [ ] **Step 4: Run the three tests to verify they fail**

Run: `npm run build && npx jest tests/e2e/CliOfflineTest.ts -t 'prints help and version'`
Expected: FAIL — `Expected substring: "unicity-proof"`
Expected: FAIL — equality mismatch: received `Usage: unicity-timestamp [options] [command]`

Run: `npx jest tests/e2e/CliOfflineTest.ts -t 'names the default key file'`
Expected: FAIL — received `["unicity-timestamp.key"]`
Expand Down Expand Up @@ -272,9 +289,19 @@ Expected: the digest from Step 1. If the line numbers moved, the appendix was ed

- [ ] **Step 5: Verify no stale brand references remain outside the appendix**

Run: `head -214 README.md | grep -n 'unicity-timestamp\|timestamp-cli'`
Run: `head -214 README.md | grep -nI 'unicity-timestamp\|timestamp-cli\|Timestamp CLI\|Unicity Timestamp'`
Expected: no output.

The last two patterns matter: the H1 title reads `# Unicity Timestamp CLI`,
which is Title Case and space-separated, so Step 2's substitutions do not touch
it and a check using only their patterns cannot see it. Change the title to
`# Unicity Proof CLI` as part of Step 2.

Do **not** broaden this to a case-insensitive search for `timestamp`. The README
uses the English word legitimately throughout — "round timestamp", "A timestamp
is an attestation", "classic timestamp authority" — and all of it stays. Only
the product name is being renamed.

- [ ] **Step 6: Commit**

```bash
Expand Down Expand Up @@ -338,14 +365,17 @@ Run: `python3 -c "import yaml,sys; yaml.safe_load(open('.github/workflows/npm.ym
Expected: `yaml ok`

Run: `grep -rnI 'timestamp-cli\|unicity-timestamp' .github .env.example scripts tests`
Expected: no output. `-I` skips `tests/fixtures/*.cbor`, which carry the tag in
their burn reason by design; without it grep reports them as binary matches and
the check looks failed when it passed.
Expected: no output. Two things make that achievable: `-I` skips
`tests/fixtures/*.cbor`, which carry the tag in their burn reason by design and
would otherwise be reported as binary matches; and Task 2's assertions were
written without the old name in them, so no test file contains it. If this grep
returns a hit inside `tests/`, a test embedded the literal — fix the test
rather than loosening this check.

- [ ] **Step 5: Run the suite and lint**

Run: `npm run lint && CI= npm test`
Expected: PASS, same test count as before the rename plus the one new keygen test.
Expected: PASS, same test count as before the rename plus the two new keygen tests.

- [ ] **Step 6: Commit**

Expand Down Expand Up @@ -384,7 +414,7 @@ Expected: `OK` twice. These tokens were certified before the rename; this is the

- [ ] **Step 3: Confirm the old name survives only where it must**

Run: `grep -rlnI 'unicity-timestamp' src tests README.md | sort`
Run: `grep -rlI 'unicity-timestamp\|Timestamp CLI\|Unicity Timestamp' src tests README.md | sort`
Expected exactly these three files:

```
Expand All @@ -396,7 +426,8 @@ src/lib/constants.ts
Any other file is a missed rename. `-I` is required: the two
`tests/fixtures/*.cbor` files contain the tag in their burn reason — which is
the whole point of keeping them — and `grep -l` reports binary matches rather
than skipping them, so without `-I` this check can never pass.
than skipping them, so without `-I` this check can never pass. `-l` also
suppresses line numbers, so `-n` is not used here.

- [ ] **Step 4: Confirm the package would publish correctly**

Expand Down Expand Up @@ -468,13 +499,39 @@ gh pr create --title "Rename the CLI to @unicitylabs/proof-cli" --body-file ../p

---

## Operator steps after merge

These need registry or organisation credentials and are not part of the code change. They are migration steps 2 through 8 of the spec, in order:

1. `npm version 0.2.0-rc1 --no-git-tag-version`, then `npm publish --access public --tag next`. Discard the local bump. **`--tag next` is required** — npm points `latest` at whatever it publishes, prerelease or not.
2. Configure the new package's trusted publisher: repository as currently named, workflow `npm.yml`, environment `npm-publish`.
3. Run the release workflow with `0.2.0` as the explicit version input.
4. `npm deprecate @unicitylabs/timestamp-cli "Renamed to @unicitylabs/proof-cli"`.
5. Optionally `npm dist-tag rm @unicitylabs/proof-cli next`.
6. Rename the repository on GitHub, then re-point the trusted publisher at the new repository name.
## Operator steps

Most of these need registry or organisation credentials; none is part of the
code change. Step 2 is the merge of this branch. **The repository rename comes
first**, because this branch points `repository`, `homepage` and `bugs` at
`unicitynetwork/proof-cli`, and npm requires a package's `repository` to
match, case-sensitively, the repository it publishes from. Publishing from a
repository still named `timestamp-cli` with those URLs in the manifest fails.

1. Rename the repository on GitHub to `proof-cli`. Organisation admin. Update
the remote in any working copy.
2. Merge this branch.
3. `npm version 0.2.0-rc1 --no-git-tag-version`, then
`npm publish --access public --tag next`. Discard the local bump.
**`--tag next` is required** — npm points `latest` at whatever it publishes,
prerelease or not.
4. Configure the new package's trusted publisher: repository
`unicitynetwork/proof-cli`, workflow `npm.yml`, environment `npm-publish`,
and under "Allowed actions" permit direct publishing with `npm publish`.
Configurations created after 3 September 2026 default to `npm stage publish`
only, and this workflow publishes directly.
5. Run the release workflow with `0.2.0` as the explicit version input.
**Within two days of step 4.** A new trusted-publisher configuration has to
complete its first successful publish inside that window; after it, the
configuration expires and can no longer be used or edited, and has to be
recreated. Do not configure the publisher until ready to release.
6. `npm deprecate @unicitylabs/timestamp-cli "Renamed to @unicitylabs/proof-cli"`.
7. Optionally `npm dist-tag rm @unicitylabs/proof-cli next`.
8. Optionally restrict token publishing on the new package — npm Settings,
Publishing access, "Require two-factor authentication and disallow tokens".
Configuring a trusted publisher does not do this on its own, and the
bootstrap token from step 3 keeps working until it is done.

Step 4's binding is to the repository's immutable identity, not its name. npm
does not document what a later rename requires of it; under this ordering the
repository is not renamed again afterwards, so the question is moot.
Loading
Loading