Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Build
Start
Reference code
Tools
API reference
Public services
Agents
Bindings and crosswalks

Public reference services

Source services/public-services/README.md

On this page
  1. Production services
  2. Why Python, beside the conformance runner
  3. Shared behaviour
  4. Run
  5. Tests and smoke test

Four services an open protocol needs, as reference code: an implementations and conformance registry, discovery, a credential status publisher and a transparency log. They run locally and in continuous integration only; this repository hosts none of them and holds no credential for doing so. They are drafts built on drafts: each one says which change proposal it follows, and nothing here makes a draft normative.

Service README OpenAPI Threat note Drafts it follows
Implementations and conformance registry README-registry.md obsp-registry registry OIP-0023, OIP-0008
Discovery (/.well-known/obsp, federated index, UNI resolution) README-discovery.md obsp-discovery discovery OIP-0016, OIP-0008
Credential status (Bitstring Status List) README-status.md obsp-credential-status status OIP-0015
Transparency log, with witness cosigning of its tree heads (reference-log feature) README-log.md obsp-transparency-log log OIP-0008 (tree heads); RFC 9162; witnesses: none (no draft)

Production services

reference/rust/obsp-services answers the same routes with the same documents on axum and PostgreSQL, and adds key management, identity and access, an admin API and an audit log. These Python services stay the reference: parity/run_parity.py runs their flows and vectors against both and compares the answers (make rust-services). For that run only, OBSP_TEST_CLOCK=<RFC 3339 time> fixes the services’ clock.

Why Python, beside the conformance runner

The services are Python (standard library http.server, plus jsonschema, PyYAML from requirements.txt) rather than a new Rust crate, for three reasons. They reuse the conformance runner’s code unchanged: its RFC 8032 Ed25519, deterministic CBOR and OIP-0008 envelope (envelope.py) and its RFC 9162 tree hash, audit paths, inclusion check and consistency proofs (tlog.py), so a report the runner signs and a receipt it issues verify here with the same code. They validate with the protocol’s own JSON Schemas through the Python SDK. And they run in make check, which has no Rust toolchain in continuous integration, so the tests and the smoke script gate every push.

Shared behaviour

obsp_public/web.py gives every service the same edges:

  • Errors are RFC 9457 problem documents valid against error-problem; no traceback reaches a caller.
  • Input limits: request target at most 2048 bytes (414), a body size limit per service (413), a Content-Length on every body (411), JSON nested at most 64 levels.
  • Rate limiting: a token bucket per client address (--rate, --burst; writes cost more than reads); 429 with Retry-After and retryAfterSeconds.
  • Operator token for every write except registry submissions (which are authenticated by their signatures): the service reads OBSP_OPERATOR_TOKEN at start-up, keeps only its SHA-256 digest and compares in constant time. Without it the service is read-only.
  • Structured logs: one JSON line per request on standard error (time, service, method, route template, status, duration, sizes, request id). No client address, query string, header or body is logged.
  • GET /healthz and GET /metrics (Prometheus text exposition: requests by route template and status, time spent, rate-limited and rejected requests, service gauges).
  • Binds 127.0.0.1 unless the operator names another host. There is no TLS: put a service behind the operator’s own TLS terminator and access control before exposing it.

Draft contracts are read straight from the proposals’ patches by obsp_public/drafts.py, so nothing is copied and nothing drifts; when a proposal is accepted the live schema is used instead.

Run

export PYTHONPATH=services/public-services:sdk/python/src:services/conformance-runner:.
export OBSP_OPERATOR_TOKEN=...   # optional; enables writes
python3 -m obsp_public log serve --data var/log --key log-key.json [--witnesses policy.json] --port 8101
python3 -m obsp_public registry serve --data var/registry --key-records keys/ --key log-key.json --port 8102
python3 -m obsp_public discovery serve --document authority.json --peers peers.json [--offline] --port 8103
python3 -m obsp_public status serve --state var/status.json --key status-key.json \
    --issuer uni:grid-operator:site001 --list participants --port 8104
python3 -m obsp_public sign --key key.json --in doc.json --out signed.json [--member signature|extensions]
python3 -m obsp_public witness cosign --key witness-key.json --state var/witness.json --log-jwk log.jwk \
    --head sth.json [--proof consistency.json] [--out cosigned.json]
python3 -m obsp_public witness check --log-jwk log.jwk --policy policy.json --head cosigned.json
python3 -m obsp_public witness compare --log-jwk log.jwk --head a.json --head b.json [--proof p.json]

A key file is {"alg": "ed25519", "seed": "<32 bytes, unpadded base64url>", "kid": "uni:key:..."}, as for the runner. Which keys an operator uses, and who holds them, is the operator’s decision.

Tests and smoke test

services/public-services/tests/test_public_*.py, loaded into make test by tests/test_public_services.py: Merkle consistency proofs at every size, the log store and its tamper checks, each registry rule, the discovery rules against the OIP-0016 vectors and negative fixtures, the witness (its checks and persisted state, k-of-n policies, split-view detection, the cosignature routes, the shared vectors also run by obsp-verify), the status lists against the OIP-0015 schema and example, the limits, the route parity with the OpenAPI documents, and smoke.py, which starts every service from its command line on 127.0.0.1 and runs one flow through all four (make services-smoke).