Add runnable node, HTTP API, all-devices revocation and reconnect sync

- cmd/node: init (recovery phrase onboarding), run, recover
- api: public reads of canonical signed records, token-protected writes
- identity: RevokeAll voids every device certified before a cutoff, so
  recovery works with only the phrase; store purges by certificate age
- p2p: redial bootstrap peers, sync on every new connection (in-flight
  guard only), validate bootstrap addresses up front
- docs: API, recovery semantics, peer-ID change on recovery

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 18:03:46 +01:00
co-authored by Claude Sonnet 5.5
parent d3efe5a3a7
commit 918e16ed37
18 changed files with 1550 additions and 82 deletions
+33
View File
@@ -121,3 +121,36 @@ func TestDeviceSaveLoad(t *testing.T) {
t.Fatal("Save must not overwrite an existing device key")
}
}
func TestRevokeAll(t *testing.T) {
root, _, _ := NewRoot()
oldDev, _ := Enroll(root, testNow.Add(-time.Hour), 24*time.Hour)
newDev, _ := Enroll(root, testNow, 24*time.Hour) // enrolled at the cutoff
other, _, _ := NewRoot()
foreign, _ := Enroll(other, testNow.Add(-time.Hour), 24*time.Hour)
r, err := RevokeAll(root, testNow, 8)
if err != nil {
t.Fatal(err)
}
if err := r.Check(8); err != nil {
t.Fatal(err)
}
if !r.AllDevices() {
t.Fatal("expected an all-devices revocation")
}
if !r.Covers(oldDev.Cert) {
t.Fatal("older device must be covered")
}
if r.Covers(newDev.Cert) {
t.Fatal("device enrolled at the cutoff must stay valid")
}
if r.Covers(foreign.Cert) {
t.Fatal("another identity's device must not be covered")
}
// It must outlive every certificate it covers.
if r.CertExpiresAt < oldDev.Cert.ExpiresAt {
t.Fatal("revocation would be dropped before the covered certificates expire")
}
}