You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phase 0/1/2 are landed (SWARM_SPEC, node identity, Ed25519 signature service). Phase 3 starts implementing the wire format defined in docs/SWARM_SPEC.md. This issue is the type-and-canonicalization foundation that every later wire-touching piece reuses.
Background — read this BEFORE starting
mcp__vector-memory__prime_context with task_description "implement TypeScript wire types and JCS canonicalization for mycelium swarm"
Read docs/SWARM_SPEC.md §2 (JCS) and §3 (Wire types) carefully — the field tables are the source of truth
Why
Phase 0/1/2 are landed (SWARM_SPEC, node identity, Ed25519 signature service). Phase 3 starts implementing the wire format defined in docs/SWARM_SPEC.md. This issue is the type-and-canonicalization foundation that every later wire-touching piece reuses.
Background — read this BEFORE starting
mcp__vector-memory__prime_contextwith task_description "implement TypeScript wire types and JCS canonicalization for mycelium swarm"docs/SWARM_SPEC.md§2 (JCS) and §3 (Wire types) carefully — the field tables are the source of truthsrc/services/signature.ts(PR feat(swarm): signature service — Ed25519 sign/verify over JCS (#77) #82) — it already imports a JCS canonicalizer; reuse the same libraryWhat this issue delivers
A new file
src/services/wire-types.tscontaining:Lesson(§3.1)HubAnchor(§3.2)NodeAdvertisement(§3.3)TrustEdge(§3.4) — local-only, but the type still belongs hereWIRE_SPEC_VERSION = "1.0"(matches §1)canonicalizeForSigning<T extends { signature?: string }>(record: T): Uint8Arraythat:signatureif presentsignature.tsuseskindOf(record: unknown): "lesson" | "hub_anchor" | "node_advertisement" | "trust_edge" | null— best-effort discriminator using required-field presencePlus tests in
tests/services/wire-types.test.ts:satisfies)canonicalizeForSigningis deterministic (call twice, byte-equal)canonicalizeForSigningstripssignature(record with vs. withoutsignatureproduces same bytes)kindOfcorrectly classifies each example and returnsnullon garbageAcceptance criteria
src/services/wire-types.tsexists and exports the four interfaces,WIRE_SPEC_VERSION,canonicalizeForSigning,kindOftests/services/wire-types.test.tsruns green (at least 6 assertions)signature.tsalready pulled it inHard constraints
Out of scope