This document describes the wire behavior a second implementation can interop with today. Anything the node does not ship yet is explicitly marked planned; nothing below is aspirational unless it says so.
- Key type: Ed25519.
- Method (alpha):
did:keyonly. Resolution is deterministic public-key extraction from the multicodec prefix (z6Mk…, multicodec0xed01). - Signed requests presenting any other DID method are rejected; the node's
auth layer answers with a hint that only
did:keyis supported in alpha. - Planned:
did:webanddid:gitlawbresolution. Clients MUST NOT assume either is accepted anywhere yet.
- Transport: production deployments should run the node behind TLS (typically a reverse proxy). The node itself has no scheme check: it verifies RFC 9421 headers on whatever transport the request arrives over, so nothing at the signature layer refuses a cleartext request.
- HTTP signatures:
Signature-Inputcovers@method,@path, andcontent-digest:sig1=("@method" "@path" "content-digest");keyid="did:key:…";alg="ed25519";created=<unix>All three components are mandatory: aSignature-Inputmissing one is rejected asincomplete_signature. @pathvalue: the node binds@pathto the path and query string of the request, not to the path-only value RFC 9421 defines for@path. A second implementation must sign the request exactly as it goes on the wire, e.g.GET /zOwner/myrepo.git/info/refs?service=git-upload-packincluding the?service=…part (see §5 for the owner and.gitnormalization).- Signer identity:
keyidis the actor DID (did:keyonly, see §1). - Integrity:
Content-Digestis SHA-256 over the request body and is verified against it. Every signed request MUST send the header: a signed request without it is refused400 missing_content_digestbefore routing. On a body-less request the header still carries the SHA-256 digest of the empty body (sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:), it is never omitted.
- Mode: controlled by
ICAPTCHA_MODE=off|shadow|enforce, defaultoff. A node with the gate off never demands proof. - Scope: the gate applies to a small set of write endpoints (agent registration and repo create/fork), not to all writes.
- Wire shape: the client-supplied header is
x-icaptcha-proof— that is the only iCaptcha header a node reads from a request. When the gate isenforceand a verifier public key is loaded, a missing or invalid proof answers403 icaptcha_proof_requiredand setsx-icaptcha-urlandx-icaptcha-levelon the response (also mirrored as JSON fields) so the client can go solve a challenge and retry. Fail-safe:enforcewith no public key loaded (unset and unfetchable) stays inert and admits the request rather than rejecting every request.
Planned: the gitlawb/ref-update/v1 schema below is defined in code, but no
shipped endpoint serves or verifies these certificates today; nothing in
sections 2-3 produces one on the wire. It is documented here so a second
implementation shares the type vocabulary ahead of the wire surface.
The hash fields reserve 64 hex characters for the SHA-256 object format; the repositories the node serves are sha1 with 40-hex OIDs (see §5), so the field width is a forward reservation, not what a current push produces.
Two distinct certificate-shaped payloads exist; this section documents the
core signing schema, which is what gitlawb/ref-update/v1 names:
- Type string:
gitlawb/ref-update/v1. - Body (canonical JSON, the signed bytes):
type,repo(the repository DID),ref_name,from(previous hash, 64 hex chars, all-zeros for a new ref),to(target hash, 64 hex chars),seq(monotonically increasing, replay prevention),timestamp(RFC 3339),nonce. - Signatures: a list of
{signer: did:key, sig: base64url-unpadded Ed25519}entries appended outside the signed body; thresholds are counted over distinct signers that verify.
The node's REST API separately serves push receipts — a different,
node-issued JSON payload attesting that a push was processed. Receipts are
not gitlawb/ref-update/v1 documents and are not interchangeable with them;
they are documented with the node's HTTP API, not here.
- Object format: bare repositories are created with
--object-format=sha1; production OIDs are 40 hex chars. Planned: SHA-256 object format. - Path normalization:
{repo}may carry one trailing.gitsuffix, stripped before lookup (somyrepo.gitresolves tomyrepo; a repo literally namedfoo.gitaddresses asfoo.git.git).{owner}may be the fulldid:key:…string or the bare multibase segment thedid:key:prefix implies; both resolve to the same owner. None of this changes@path: sign the request path and query exactly as sent. - Smart-HTTP endpoints:
GET /{owner}/{repo}/info/refs?service=git-upload-pack— fetch advertisement.GET /{owner}/{repo}/info/refs?service=git-receive-pack— push advertisement. The?service=parameter is mandatory and takes exactly those two values; a missing parameter is a400, not an omitted-service default.POST /{owner}/{repo}/git-upload-pack— clone/fetch. Request and response bodies are pkt-line framed; the result content type isapplication/x-git-upload-pack-result.POST /{owner}/{repo}/git-receive-pack— push. Authentication is mandatory: an unsigned push is refused with401. Same pkt-line framing; the result content type isapplication/x-git-receive-pack-result. Signed requests on this path follow the RFC 9421 header rules in §2. §2's transport note applies here too: the verifier has no scheme check, so nothing at the signature layer requires this push to arrive over TLS.
- Fetch vs push auth split: fetch-side requests against a withheld or
private repo answer
404(existence is not confirmed to unauthorized callers), while the push path answers401for missing/invalid signatures. A second implementation must not treat the two symmetrically. - Content addressing: the node records IPFS CID metadata per branch and
serves it over REST (the repo
refsendpoint maps branch heads to CIDs). Planned: IPNS-backed branch pointers; IPNS is not part of the shipped wire contract.
Encrypted-blob recovery uses a permanent index that maps git object ids to the CIDs of encrypted envelopes. Version 2 is the only schema a current client may use as recovery authority. Version 1 manifests may still exist in permanent storage, but they are unsigned and current clients MUST NOT fetch or interpret their bodies as authority.
A v2 artifact is one compact JSON object with exactly these fields:
{"schema":"gitlawb/encrypted-manifest/v2","payload":"<payload-json-string>","signature":"<base64url-ed25519>"}The payload value is a JSON string, not a nested object. The exact UTF-8
bytes of that string are the signed bytes. When parsed as JSON, the payload has
exactly these fields:
schema: exactlygitlawb/encrypted-manifest/v2.repo: the canonical repository slug described below.owner_did: the repository owner DID.node_did: the signing node's canonical Ed25519did:key.timestamp: an RFC 3339 timestamp.blobs: an array of objects with exactlyoidandcid.
The signing input is the ASCII bytes gitlawb-encrypted-manifest-sig/v2\n
followed by the exact payload-string bytes. The signature is base64url without
padding over a 64-byte Ed25519 signature. Unknown or missing fields, a schema
mismatch, malformed base64url, a wrong signature length, or a signature that
does not verify are all rejection conditions.
The canonical owner key strips a leading did:key: only when the remainder
contains no further colon. Other DID spellings remain whole. The canonical
repository slug is <canonical-owner-key>/<repo-name>. The signed owner_did
must canonicalize to the owner portion of the signed repo. Object ids are 40
or 64 lowercase or uppercase hexadecimal characters and must not repeat within
one manifest. Blob CIDs must parse as CIDv1; any CIDv1 codec is valid because
large envelopes may sit behind a chunked root.
A verifier accepts at most 256 KiB of outer artifact bytes and at most 1024 blob entries. Current writers produce complete disjoint shards of at most 256 entries and at most 96 KiB of outer bytes each. No shard index exists because the entries are disjoint and recovery is their union. A shard that cannot be made valid must not be published.
Discovery tags are hints, never authority. Current discovery uses:
App-Name:twigpineorgitlawbSchema:gitlawb/encrypted-manifest/v2Repo-Digest: base64url-unpadded SHA-256 over the exact UTF-8 bytes of the canonical repository slug
The human-readable Repo tag is diagnostic only. It may be truncated by the
uploader's tag rules and is not a v2 discovery key. Legacy v1 probing uses the
old truncated Repo tag only as a metadata-only presence check; v1 bodies are
never recovery input.
A client requests Arweave transaction bodies from /raw/<transaction-id>, not
from the manifest-resolving /<transaction-id> endpoint. Transaction ids are
exactly 43 base64url characters before they may appear in a request URL. The
CLI discovery query asks for sort: HEIGHT_DESC and reads at most 8 pages or
exactly at most 512 transaction ids. Pagination uses the cursor on the final
edge; Arweave pageInfo supplies hasNextPage, not endCursor. Each GraphQL
page response is capped at 256 KiB.
Discovery plus manifest fetch and verification has a 120 second wall-clock
budget. Hitting a count or time budget means recovery is incomplete and must
produce a warning.
The signer DID is anchored outside the artifact. twigpine clone --expect-node <did> supplies the pin explicitly. Without it, the CLI reads the effective
clone node's root metadata once, accepts its did field only when it is a
canonical Ed25519 did:key, and uses that as the implicit anchor. The implicit
anchor is not independent verification: clone already trusts the selected node
for the base repository and primary recovery. It exists so the ordinary clone
path can use B3. A caller cloning through a replica who needs the origin
node's anchors should pin that origin DID with --expect-node; the pin is not
required to equal the replica's self-reported DID. If no valid implicit anchor
can be derived, only Arweave recovery is skipped.
The artifact's node_did may be compared with the externally anchored DID,
but it must never supply that anchor. The signed repo must equal the canonical
slug of the repository being cloned. Wrong signer, wrong repository, unsigned
v1 data, malformed identity or timestamp fields, malformed object ids or CIDs,
repeated object ids, and schema drift are all rejected before merge. Clone
passes the effective node to git subprocesses as both TWIGPINE_NODE and
GITLAWB_NODE, so the git transport and recovery API use the same node.
Authentication happens before merge. Entries naming object ids absent from the cloned tree are discarded before merge retention, local object checks, or gateway fetches. Surviving entries for the same object rank by:
- the signed timestamp compared as an RFC 3339 instant;
- block-height rank as the equal-timestamp tie-break: a pending anchor is newest, otherwise larger height wins;
- the lexicographically larger CID as the final deterministic tie-break.
The signed timestamp must outrank inclusion height because anyone can republish exact old public manifest bytes into a new transaction. Height is gateway- reported availability metadata only. It is never evidence of authenticity.
Discovery tags remain permissionless hints. A publisher can spam matching tag queries and crowd honest transactions out of the fixed page, transaction, or time budgets. The caps bound that abuse and require an incomplete-recovery warning; they do not prove discovery completeness. Closing that censorship hole requires owner-bound upload ownership or another issuer-bound discovery mechanism.
Public-gateway envelope bodies are capped at 32 MiB of object bytes plus 64
KiB of envelope allowance. A body exactly at the cap is valid; a larger body,
a mid-body read failure, or a cross-origin redirect cannot become recovery
input. Redirects are followed only within the same origin, only when path and
query are unchanged, never on a downgrade from https, and only within the
shared ten-hop bound. The default IPFS gateway is path-style https://ipfs.io.
Subdomain-only gateways such as dweb.link redirect path requests to another
origin and are incompatible with that policy.
Gateway-controlled terminal output is sanitized. At most 20 detailed B3 warning lines are emitted, followed by one aggregate suppression count.