go-sidecar

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0

README

go-sidecar

The Go side of Vouch Protocol. It holds three things:

  • cmd/vouch-sidecar: the signing sidecar, the one sidecar every language uses.
  • signer/: the Go signer and verifier (credentials, Data Integrity proofs, delegation, status lists, did:webvh, authority state, identity chains).
  • robotics/: the robotics profile in Go, byte-compatible with the Python, TypeScript and Rust implementations through the shared vectors in test-vectors/robotics/.

attenuation/ holds the narrowing rules for delegation, and internal/policy reads the policy file with the same checks and the same messages as the Python and TypeScript readers.

The signing sidecar

The sidecar holds the agent's signing key in its own process, so the model that asks for signatures never has the key. The agent asks it over HTTP on localhost, and the sidecar signs only what the policy's rules allow for its own DID.

Get the binary with one of:

go install github.com/vouch-protocol/vouch/go-sidecar/cmd/vouch-sidecar@latest
docker run ghcr.io/vouch-protocol/sidecar:latest        # the container image

or build it from this folder (go build ./cmd/vouch-sidecar). vouch sidecar (Python) and vouch-sidecar-ts (the TypeScript SDK) are launchers: they find this binary and run it with the flags you give. They look at VOUCH_SIDECAR_BIN first, then vouch-sidecar on the PATH, then where go install puts it.

Run it

The sidecar will not start without a policy file. vouch policy init writes a starter, and vouch policy check lists the problems in one.

vouch init -y                                  # an identity in ~/.vouch/keys
vouch policy init                              # then add rules for the DID `vouch whoami` prints
vouch-sidecar --policy vouch-policy.json       # listens on 127.0.0.1:8877

A policy that lets the sidecar sign one action:

{
  "version": 1,
  "target": "payments",
  "trust": { "issuers": ["did:key:z6Mk..."] },
  "rules": [
    { "did": "did:key:z6Mk...", "allow": [{ "action": "transfer", "resource": "**" }] }
  ]
}

The sidecar refuses to start when the rules have nothing for its own DID, unless the policy sets signing.allowAnyAction.

Policy section What the sidecar reads from it
rules What it may sign for its own DID. checks.requireResource refuses a credential with no resource
signing defaultValidity (5 minutes if unset), maxValidity (1 hour if unset, 12 hours at most), hybrid (the post-quantum proof set), consent (never, first-use, always), allowAnyAction, allowGrants (sign an intent that names a delegatee; off by default, and the consent question then reads "Grant authority to")
network allowedOrigins (browser origins that may call it), allowedHosts (the Host names it answers)
Flags and settings
Flag Setting Meaning
--policy VOUCH_POLICY The policy file (else ./vouch-policy.json)
--key VOUCH_KEY Where the key is: a Multikey key file, keyring:<did>, kms:aws:<key>, kms:gcp:<key version>, the key itself, or ephemeral[:<domain>]. --key wins
--did VOUCH_DID The identity to sign as, when the keystore holds more than one
--host VOUCH_SIDECAR_HOST Address to listen on (default 127.0.0.1)
--port VOUCH_SIDECAR_PORT Port (default 8877)
VOUCH_SIDECAR_TOKEN The bearer token callers send. Required on any address but loopback
VOUCH_KEY_PASSPHRASE Opens a passphrase-locked identity
--kms, --dev Shorthands for --key kms:... and --key ephemeral
--otel-endpoint An OpenTelemetry collector for traces
--verbose Log every request

With no key the sidecar does not start, and it never makes up a lasting one. A removed setting that is still set (VOUCH_PRIVATE_KEY, VOUCH_ED25519_SEED, VOUCH_KEYSTORE, VOUCH_SIDECAR_KMS and the others) stops the start, by name, with what replaces it. Flags that moved into the policy (--allowlist, --default-validity, --max-validity, --hybrid, --consent, --allow-origin) are no longer flags.

--key reads only the Multikey key file. Convert an older key once with vouch keys convert <file> --out <new file>.

Endpoints
Endpoint What it returns
POST /sign A credential for the intent, with an eddsa-jcs-2022 proof
POST /sign/hybrid The same, with the post-quantum proof set
POST /sign/content A signature over page content, for the browser extension (only with signing.consent on)
GET /health Readiness, the DID, the key source, the validity settings, the last signature time
GET /did The DID and its verification method
GET /pubkey The public keys as Multikeys
GET /.well-known/did.json The DID document for the signing key
curl -s http://127.0.0.1:8877/sign -H 'Content-Type: application/json' \
  -d '{"intent": {"action": "transfer", "target": "payments", "resource": "invoice/42"}, "validSeconds": 120}'

A request carries intent, and may add validSeconds (a whole number above zero; leave it out for the default), reputationScore, credentialStatus and parentCredential. A field the sidecar does not know is a 400 that names it.

To sign under a grant, send the grant (or the grant chain, root first) as parentCredential. The sidecar checks the intent against it with the same rules the SDKs apply when they sign, builds the delegation links itself, and refuses anything outside the grant with the SDK's reason. It never signs links sent to it.

Desktop use

With network.allowedOrigins set, a request with any other Origin header is a 403 before anything runs, and every browser request needs the token (the sidecar makes one in ~/.vouch/sidecar-token when none is set). With signing.consent on, the sidecar asks the person before it signs content for a page. first-use asks once per caller, and the question names the origin the browser sent. The dialog is osascript on macOS, a message box on Windows, and zenity or kdialog on Linux, with the terminal as the fallback and a refusal when there is nothing to ask with.

Container

The image holds one static binary and runs as a non-root user. Mount the identity folder and the policy read-only:

docker run --rm -p 127.0.0.1:8877:8877 \
  --user "$(id -u):$(id -g)" -e HOME=/home/vouch \
  -e VOUCH_SIDECAR_TOKEN -e VOUCH_POLICY=/home/vouch/vouch-policy.json \
  -v "$HOME/.vouch/keys:/home/vouch/.vouch/keys:ro" \
  -v "$PWD/vouch-policy.json:/home/vouch/vouch-policy.json:ro" \
  ghcr.io/vouch-protocol/sidecar:latest --host 0.0.0.0

Inside a container the sidecar listens on all addresses for the port mapping to reach it, so it needs VOUCH_SIDECAR_TOKEN. In a Kubernetes pod, where the agent shares localhost with the sidecar, leave --host and the token out.

Test

go vet ./...
go test ./...

The Python and TypeScript tests that start the real sidecar build it first and set VOUCH_SIDECAR_BIN.

Directories

Path Synopsis
Package attenuation implements the v1.7 capability-attenuation rule: the non-expansion check over the six delegation dimensions, verifier cost budgets, and chain-cascade revocation (Specification 9.3-9.6).
Package attenuation implements the v1.7 capability-attenuation rule: the non-expansion check over the six delegation dimensions, verifier cost budgets, and chain-cascade revocation (Specification 9.3-9.6).
cmd
vouch-sidecar command
Command vouch-sidecar runs the Vouch Protocol signing sidecar as an HTTP server.
Command vouch-sidecar runs the Vouch Protocol signing sidecar as an HTTP server.
examples
robotics-evidence-pack command
Command robotics-evidence-pack assembles a regulatory evidence pack for a robot from Vouch robotics credentials (Go).
Command robotics-evidence-pack assembles a regulatory evidence pack for a robot from Vouch robotics credentials (Go).
robotics-vla-accountability-loop command
Command robotics-vla-accountability-loop runs a VLA control loop with provenance on load, a pre-actuation scope gate, and a tamper-evident black box (Go).
Command robotics-vla-accountability-loop runs a VLA control loop with provenance on load, a pre-actuation scope gate, and a tamper-evident black box (Go).
internal
jcs
policy
Package policy reads vouch-policy.json, the one policy file every Vouch Protocol component reads, with the same checks and the same error strings as the Python reference (vouch/policy) and the TypeScript SDK (packages/sdk-ts/src/policy).
Package policy reads vouch-policy.json, the one policy file every Vouch Protocol component reads, with the same checks and the same error strings as the Python reference (vouch/policy) and the TypeScript SDK (packages/sdk-ts/src/policy).
pyjson
Package pyjson reads JSON text by the rules of the Python reference, which parses with json.loads: NaN and Infinity refused, numbers checked as they are read, repeated member names found when their object closes, and the first problem met in document order decides the answer.
Package pyjson reads JSON text by the rules of the Python reference, which parses with json.loads: NaN and Infinity refused, numbers checked as they are read, repeated member names found when their object closes, and the first problem met in document order decides the answer.
timefmt
Package timefmt reads every protocol time in the Go port with one strict grammar, the same in every Vouch Protocol implementation:
Package timefmt reads every protocol time in the Go port with one strict grammar, the same in every Vouch Protocol implementation:
Robot-to-infrastructure bounded trust: authenticate a robot to physical resources, Go.
Robot-to-infrastructure bounded trust: authenticate a robot to physical resources, Go.
did:webvh v1.0 resolution (DIF did:webvh v1.0, identity.foundation/didwebvh/v1.0).
did:webvh v1.0 resolution (DIF did:webvh v1.0, identity.foundation/didwebvh/v1.0).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL