aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/event.rs
Commit message (Collapse)AuthorAgeFilesLines
* continuum-party: signing through an ssh-agentslopulus80 min.1-5/+17
| | | | | | | | | | | | | | A key held in hardware is never a file: only an ssh-agent signs with it. Given a public key as `--key` (a `.pub` file, `ssh-ed25519` or `ecdsa-sha2-nistp256`), the client asks the agent at `SSH_AUTH_SOCK` to sign what SSHSIG signs (a sign request with the key's blob, no flags) and writes the blob around the agent's signature as `ssh-keygen -Y sign` does. An ECDSA signature the agent gives with a high `s` is made low, the other of its two spellings, which the federation takes. What it makes is checked before it is used. A private key file signs as it did. A test starts `ssh-agent`, adds an ECDSA and an Ed25519 key to it and deletes their files, signs through it, and has both continuum and `ssh-keygen -Y verify` check each signature, one of an agent's high-S answers among them. Without OpenSSH it asks nothing.
* keys: a party's key may be ecdsa-sha2-nistp256, its signature low-S onlyslopulus80 min.1-2/+1
| | | | | | | | | | | | | | | | | | | | A party's keys may be held where no file has them, in a Secure Enclave or a phone, and those are ECDSA keys on NIST P-256. Everywhere a party's key counts (a version's keys, a key set, the key an event is signed with) such a key is taken beside an Ed25519 one, spelled as `ssh-keygen` writes it, without a comment: `ecdsa-sha2-nistp256`, a space, and the base64 of its SSH encoding, its point uncompressed and on the curve. Its signature is SSHSIG as an Ed25519 one is, hashed with `sha512`, its inner signature over SHA-256 as SSH signs with such a key. ECDSA signatures are malleable: of `s` and the curve's order less `s`, both check. So the federation takes one spelling alone: `s` low, at most half the order, `r` and `s` each SSH's shortest mpint, and the blob reading back to itself as an Ed25519 one does. What anyone makes of a party's signature is then none, as before. The vectors are a key `ssh-keygen -t ecdsa -b 256` made, a first version naming it, and a write and a key set `ssh-keygen -Y sign` signed with it, each taken; the signature's high-S twin, which checks as ECDSA, and its `r` spelled longer are none. Ed25519 keys and signatures are spelled and checked as they were.
* federation: events made, as a party's client makes themtv23 hours1-0/+79
| | | | | | | What makes a signed event (`event::signed`) and what each does (`write`, `keys`, `nodes`, `proposal`, `vote`), and a version event (`event::version_event`), move from the tests' harness into `federation::event`, for a party's client to make them as the tests do: the harness makes its events through them.
* federation: the federation as the store's foldtv27 hours1-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Federation` is the store's fold for `docs/federation.md`. The state judging reads is the state of an event's history, which the store builds from the checkpoint and that history alone; so the version current there is the state's, the highest-numbered one written, and a history holding two versions of one number is refused. * A signed event's party is a party of the version current at its history. A write is signed by a key among its party's (those of its key set that counts, else those its version names) where a rule gives its party the place; a key set, node list, proposal or vote by a key its version names. * A vote is on the version current at its history, for a proposal proposed on it; a `true` only where every other proposal its party backs on that version is dead. Passing and dead go by the parties voting each way, a party with both counting for both. * A version event writes a proposal on the version current at its history, passed there, which is a version changing that one; one naming a checkpoint names heads after the current checkpoint at which it is current too, none in another's history, the version event above them. A node keeps a version event only where it changes the version it reads, or writes one it took. * What counts is read by the current version: of each party's writes at a place it may write, signed by a key among its party's, and of its key sets and node lists written under a version at least their `since`, the latest, then the lowest ID. A checkpoint keeps what counts at its heads and the proposals and votes on the version current there; a fork's root what counts at its heads by its version; the members are the nodes each party's node list names. Tests take a federation through writes, a key set, a proposal passing, one yes at a time, two versions changing one, a checkpoint and a node starting from it, and a fork. Events are read with their signature checked once, where they are judged.
* federation: events and checkpoints as bytes, and a harness that signs themtv27 hours1-0/+316
`Event::read` reads an event and says what makes one none (`docs/federation.md`, Events): bytes that aren't the JCS of the JSON they read as, larger than 256 KiB, with no dependency or more than 64, not ascending, or a field missing or more; and of a signed event, a party that is no party's name, a key or signature that doesn't read back to itself or doesn't hold, a path, key set, node list or vote spelled otherwise. A proposal is taken whatever it holds, named by its hash; a version event names a hash. `Checkpoint` reads and writes `{"at", "keeps", "version"}`, a root among them, which is no event. The tests' harness (`docs/federation-tests.md`, The harness) makes parties with keys from seeds, signs each kind of event as the design says, and spells versions out.