In this section: Build
Start
Reference code
- obsp (C)
- Conformance runner (reference service)
- obsp (Go)
- Plugfests (non-normative groundwork)
- Python reference pipelines (draft profiles, synthetic data)
- obsp-eo
- obsp-model-run (draft OIP-0012, MODEL-OBSERVER)
- obsp-sensing (draft OIP-0011, NETWORK-SENSING, provisional)
- obsp-space
- Rust reference workspace
- Performance bench (WP-RI-11)
- The 0.2 candidate (DRAFT)
- obsp-core (Rust reference library)
- obsp-federation
- obsp-node-embedded
- Node agent (obsp-node)
- Evidence verifier (obsp-verify)
- obsp-sdk (TypeScript / ES modules)
Tools
API reference
- All APIs
- Observatory Protocol service administration (production services)
- Observatory Protocol CloudEvents (draft OIP-0024 binding)
- Observatory Protocol correction subscriptions
- Observatory Protocol credential status (reference service)
- Observatory Protocol discovery (reference service)
- Observatory Protocol exchange API (reference)
- Observatory Protocol federation sync (draft OIP-0004)
- Observatory Protocol Field Topic Contract (MQTT 5 and Sparkplug B)
- Observatory Protocol participant gateway
- gRPC services
- Observatory Protocol implementations and conformance registry (reference service)
- Observatory Protocol transparency log (reference service)
- Observatory Protocol WIS 2.0 notifications (draft OIP-0009 binding)
Public services
Bindings and crosswalks
obsp (C)
| Field | Value |
|---|---|
| Status | Reference code written against draft proposals (DRAFT); accepts no proposal; no conformance claim |
| Language | C99, standard library only |
A portable C99 SDK for constrained devices, written against the C standard library only. The core allocates nothing: every function works in buffers the caller provides. It is a reference for reading and testing, not a product. This library makes no conformance claim.
What it covers
| File | What it does |
|---|---|
src/sha2.c |
SHA-256 and SHA-512 (RFC 6234), incremental and one-shot |
src/text.c |
hex, base64url without padding, the Digest form sha256:<64 hex> (format and parse), a strict UTF-8 check |
src/ed25519.c |
Ed25519 (RFC 8032 section 5.1) key derivation, signing and strict verification (refuses S of L or more, a public key that is not a canonical point, and an R that does not re-encode to the signed bytes) |
src/cbor.c |
deterministic CBOR (RFC 8949 section 4.2.1): a writer that counts or writes into the caller’s buffer, a strict reader and a whole-buffer validator (shortest integers and lengths, preferred floats, sorted unique map keys, definite lengths, UTF-8 text, depth limit 16) |
src/compact.c |
the draft OIP-0027 compact observation (keys 1 to 10: context, property index or id, value, unit, phenomenon and result time, result state, uncertainty, origin, subject class) and the evidence batch (key table, entry digests, batch digest, signed payload, declared times, references, tagged COSE_Sign1 under key 9) |
src/cose.c |
the draft OIP-0008 COSE_Sign1 pieces for Ed25519: protected header {1: -19, 4: kid}, Sig_structure, sign, verify, the tagged envelope with a detached payload |
include/obsp.h |
the whole public interface |
Decoded views point into the buffer that was decoded; keep it alive. Strings are not NUL-terminated.
What it does not cover
- Compact observation keys 11 to 28 (the other result forms and the record’s remaining fields): they are recognised
and refused with
OBSP_E_UNSUPPORTED. Uncertainty values other than a number are refused the same way. There is no compact TimeQuality or CompactContext codec, no expansion of a device message into an ObservationRecord, no JSON or JCS handling, no SenML mapping and no schema validation. - Algorithms other than Ed25519, key records, key resolution, revoked or deprecated key checks and object-class
rules (OIP-0008
OBS-SIG-0003andOBS-SIG-0006): the SDK has no key store. Header and signature faults are reported asOBSP_E_HEADERandOBSP_E_SIG. - OSCORE and EDHOC (the constrained link), radio and transport code, clocks and time sources, persistent storage.
- Resistance to timing, power or fault attacks beyond branch-free handling of secret scalars in the ladder. No claim of any kind is made about side channels.
- Any claim that an implementation is conformant, certified or secure. Levels stop at SELF_TESTED.
OIP-0008 and OIP-0027 are DRAFT proposals; this code follows the proposals, not the live specification, which defines
no signature and no compact encoding. Where the reference codec in sdk/python is lenient this one is stricter in two
places: the batch’s declared-time list must be in ascending entry order, and a signed batch carries a detached
COSE_Sign1 only.
Third-party code
None is vendored. SHA-2 and Ed25519 were written from RFC 6234 and RFC 8032 for this repository (see NOTICE.md); the
Ed25519 field arithmetic uses radix-2^16 limbs in the manner of compact NaCl-style implementations, and its curve
constants were computed from the RFC’s definitions. Licence: Apache-2.0 (REUSE.toml).
Tests
make c from the repository root (or make check here). Needs a C99 compiler, ar, nm and size; the root target
skips itself when there is no compiler.
- build with
-std=c99 -Wall -Wextra -Werror -pedantic; the test program runs plain (-O2) and, when the compiler has them, under-fsanitize=address,undefinedwith undefined-behaviour reports fatal; - SHA-256 and SHA-512 against RFC 6234 values (including the million-
amessages), incremental against one-shot; - Ed25519 against RFC 8032 section 7.1 tests 1 to 3 (key derivation, signature, verification), a changed signature or
message,
S + L, and a non-canonical public key; - CBOR against the RFC 8949 Appendix A values the profile uses (integers, floats in preferred form, strings, containers, tags, simple values) and 23 inputs the validator must refuse (non-shortest forms, non-preferred floats, unsorted or repeated keys, indefinite lengths, invalid UTF-8, truncation, trailing bytes, deep nesting);
- every OIP-0027 compact message vector (
testdata/oip-0027/messages.json, copied from the draft): the four device messages and the worst case are built from typed fields and compared byte for byte with the published hex, their digests and size budget (at most 40 bytes) checked, and each decodes and re-encodes to itself; - the OIP-0027 batch vector (
testdata/oip-0027/batch.json): entry digests, batch digest, signed payload, protected header, Sig_structure, Ed25519 signature, tagged COSE_Sign1 and the compact batch (498 bytes) reproduced byte for byte from the published test key; the published bytes decode and check; the vector’s invalid cases (wrong count, tampered batch digest, tampered entry, wrong key, changed declared time, wrong header) fail with the matching code; - every OIP-0008 Ed25519 vector (
testdata/oip-0008/, copied from the draft, test keys only): both valid vectors are reproduced by signing (Sig_structure and COSE_Sign1 bytes, payload digest, base64url forms) and the seven invalid vectors are refused for the reason they state, exceptOBS-SIG-0003andOBS-SIG-0006, which need a key store and a verifier policy this SDK does not have; - a seeded pseudo-random run: 30 000 observations and 300 signed batches round-trip field by field and byte by byte; every mutated or random input is decoded without a crash, and a mutant that is accepted re-encodes to its own bytes (a mutated signed batch never checks); 60 random Ed25519 sign and verify cases;
- the static library references no allocator (
nm -u); - a code-size report of the
-Osstatic library.
Code size
make size prints size -t of build/libobsp.a built with -Os. On x86-64 with GCC, the whole library is 25 840 bytes
of code and read-only data (SHA-2 3 857, Ed25519 5 976, CBOR 3 020, text forms 1 762, COSE 2 533, compact observation
and batch 8 692); a device links only what it calls. Stack use and the size on a small microcontroller target are not
measured.