> For the complete documentation index, see [llms.txt](https://www.conserver.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.conserver.io/vcon-c-library.md).

# vCon-C Library

The C implementation of vCon (libvcon), a peer to the Python and JavaScript libraries for native, embedded, and systems code.

`libvcon` is the C implementation of the vCon specification, a peer to the [Python `vcon` library](/vcon-library.md) and [`vcon-js`](/vcon-js-library.md). All three target [`draft-ietf-vcon-vcon-core`](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/) (syntax `"0.4.0"`) and produce byte-compatible vCons: build with one, verify or consume with another.

> **Version:** `libvcon` **0.1.0** · Single header `vcon.h` · Requires OpenSSL 3; libcurl and ffmpeg optional · [GitHub: vcon-dev/vcon-c](https://github.com/vcon-dev/vcon-c).

## When to use vcon-c

* **vcon-c** for C/C++ services, embedded targets, telephony/media daemons, or any native code that reads or writes vCons where a libc + OpenSSL is the only safe dependency. It is the natural fit alongside the C components of the conserver ecosystem (for example the vfun transcription daemon).
* **Python `vcon`** for conserver links, data pipelines, and ML preprocessing.
* **vcon-js** for Node, edge functions, and browser code.

## Parity with the Python library

`libvcon` 0.1.0 is built for behavioral parity with `vcon-lib` 0.9.6, proven by golden fixtures generated from the Python library and checked into the C repo. Coverage:

* ✅ Core tree, JSON I/O, `property_handling` (default/strict/meta)
* ✅ Validation with the same error strings as Python `is_valid`
* ✅ uuid8 (domain + time), strict RFC 3339, base64url
* ✅ Builders: party, dialog (incl. transfer/incomplete + inline data), attachment, analysis, tags, extension/critical lists
* ✅ Content hashing (sha512/sha256 + legacy), OpenSSL-backed
* ✅ JWS RS256 sign/verify, cross-verified with Python both directions
* ✅ Extensions: lawful\_basis and wtf transcription
* ✅ Optional HTTP (libcurl) and media metadata (ffprobe + header parsing)

### Deliberate divergences

`libvcon` matches Python's observable behavior except where Python is demonstrably wrong:

* **`created_at` is preserved verbatim** on parse (Python reformats via dateutil, turning `Z` into `+00:00` non-idempotently).
* **The lawful-basis permission check works.** Python's `check_lawful_basis_permission` returns `False` for every input; `vcon_check_lawful_basis_permission` evaluates the grant per `draft-howe-vcon-lawful-basis`.
* **Strict RFC 3339** timestamps rather than lenient dateutil parsing.

## Quickstart

```c
#include <vcon.h>

vcon_t *v = vcon_new(NULL);              /* uuid8 + created_at filled in */

cJSON *alice = cJSON_CreateObject();
cJSON_AddStringToObject(alice, "name", "Alice");
vcon_add_party(v, alice);                /* takes ownership */

int parties[] = {0};
cJSON *d = vcon_dialog_new("text", "2026-01-15T10:30:00Z", parties, 1);
cJSON_AddStringToObject(d, "mediatype", "text/plain");
cJSON_AddStringToObject(d, "body", "Hello");
vcon_add_dialog(v, d);

char *json = vcon_to_json(v);            /* caller frees */
printf("%s\n", json);
free(json);
vcon_free(v);
```

For a full walkthrough — parties, a recording dialog with inline audio and a content hash, transcript + summary analysis, tags, a lawful-basis consent record, validation, a permission check, JWS signing and verification, and serialization — see [`examples/call_recording.c`](https://github.com/vcon-dev/vcon-c/blob/main/examples/call_recording.c), which the default build compiles to `./build/call_recording`.

Build and install:

```bash
cmake -S . -B build && cmake --build build
ctest --test-dir build --output-on-failure
sudo cmake --install build              # libvcon.a, vcon.h, libvcon.pc
```

Options: `-DVCON_WITH_CURL=OFF` drops HTTP; `-DVCON_WITH_MEDIA=ON` adds image/PDF/ffprobe metadata.

## See also

* [Python vCon Library](/vcon-library.md) — the reference implementation
* [vCon-JS Library](/vcon-js-library.md) — the TypeScript peer
* [Extensions](/extensions.md) — shapes for lawful\_basis, wtf, and others


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.conserver.io/vcon-c-library.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
