IF Commons GitHub

Keys and rosters of signed merges

0007Active

0007-anyfs-cli-keys · owner if · domain commons

Requirements

FR-001checkpassing

keygen --replica ID --key FILE MUST write the key of the replica to FILE readable by its owner only, MUST print the entry for the roster and never the private key, MUST NOT write over a file that is there, and MUST accept --not-before and --not-after (milliseconds) as the window of the key. It replaces the script tools/keygen.ts of 0005-anyfs-cli-merge-signing FR-005 (the script stays and does the same).

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/keys.test.ts

Proved by: anyfs-cli/suite/keys.test.ts

Written in: anyfs-cli/src/physical/verbs/keys.ts

Tests: passed: suite/keys.test.ts keygen writes the key for its owner only, prints the entry and not the private key, never

Cited by: AnyFS command line, physical/verbs/keys

FR-002checkpassing

The verbs that make or change keys and rosters (keygen, roster add, roster publish, roster fetch, roster rotate) MUST come through the command line only, never through the tool server; roster show only reads.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/keys.test.ts

Proved by: anyfs-cli/suite/keys.test.ts

Written in: anyfs-cli/src/physical/verbs/keys.ts

Tests: passed: suite/keys.test.ts keygen writes the key for its owner only, prints the entry and not the private key, never

FR-003checkpassing

roster show ROSTER MUST say each key with its replica, its id and whether it is active, expired or future at --at (now by default); roster add ROSTER SOURCE... MUST add the public keys of rosters, entries and signing keys (never reading out the private part), MUST be idempotent, and MUST refuse a key id that is there with another public key.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/keys.test.ts

Proved by: anyfs-cli/suite/keys.test.ts

Written in: anyfs-cli/src/logical/roster.ts, anyfs-cli/src/physical/verbs/keys.ts

Tests: passed: suite/keys.test.ts roster add takes the public keys of keys and entries, idempotently, and roster show says w

Cited by: AnyFS command line, logical/roster

FR-004checkpassing

roster publish ROSTER LOCATION MUST write the roster, public keys only, to a file of a store.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/keys.test.ts

Proved by: anyfs-cli/suite/keys.test.ts

Written in: anyfs-cli/src/logical/roster.ts, anyfs-cli/src/physical/verbs/keys.ts

Tests: passed: suite/keys.test.ts a roster is published to a store and fetched from it, and a new key is taken in only where

FR-005checkpassing

roster fetch ROSTER LOCATION MUST add a key that is new only where its id is named in --accept, and MUST otherwise show it as pending with the command that accepts it; a key that is there MUST be kept as it is (a fetched roster never widens a window), and a key id that is there with another public key MUST be refused.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/keys.test.ts

Proved by: anyfs-cli/suite/keys.test.ts

Written in: anyfs-cli/src/logical/roster.ts, anyfs-cli/src/physical/verbs/keys.ts

Tests: passed: suite/keys.test.ts a roster is published to a store and fetched from it, and a new key is taken in only where

FR-006checkpassing

roster rotate ROSTER KEYID --key FILE [--at MS] MUST make a new key for the replica of KEYID, end the old key at the instant (never later than it ended), start the new key at the next millisecond, write the new key as FILE readable by its owner only without writing over a file, and so that a delta signed with the old key before the instant still holds and one signed with it after does not.

Enforced (check): .github: cd commons/anyfs-cli && bun run verify — suite/keys.test.ts

Proved by: anyfs-cli/suite/keys.test.ts

Written in: anyfs-cli/src/logical/roster.ts, anyfs-cli/src/physical/verbs/keys.ts

Tests: passed: suite/keys.test.ts rotate ends the old key and starts a new one so that what the old key signed before the in

Cited by: AnyFS command line, logical/roster, physical/verbs/keys

Acceptance scenarios

  1. Given two replicas that sign, When one rotates its key and signs a delta with the new key, Then merge --trust signed with the rotated roster takes it, per FR-006.

Out of scope

  • Revocation of a key before its window ends, a roster that is itself signed, and the check of a key with its owner (that is the person's, by --accept).

Edge cases

  • A roster file that is not there is made by roster add and roster fetch; roster show and roster rotate need it, per FR-003 and FR-006.

Assumptions

  • The id of a key (the digest of its public key) is told to the person who accepts it by another way than the store that carries the roster.

Open questions

  • None.

Key entities

  • Roster - the JSON list of the entries of public keys, with their windows.

Success criteria

SC-001success criterion

A fleet can add a replica, move a roster between computers and replace a key without a script and without a secret on a command line or in a store.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No implementation language beyond what the requirement needs
  • [x] Out of scope is stated

Cited by

AnyFS command line, logical/roster, physical/verbs/keys, Trust and keys in merge and sync-medium

Titles, headings, exports, tables, columns and requirements. Esc closes.