Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ tag is placed.
| asio | [genesis](libraries/asio/openspec/changes/genesis) | asio: Boost.Asio across native, browsers and WASI | wrapper | implementing | | 2026-10-11 | [code](https://github.com/webcpporg/asio) |
| beast | [genesis](libraries/beast/openspec/changes/genesis) | beast: existing Boost.Beast applications on WASIp2, WASIp3 and Emscripten | wrapper | implementing | | 2026-11-06 | [code](https://github.com/webcpporg/beast) |
| cobalt | [genesis](libraries/cobalt/openspec/changes/genesis) | cobalt: existing Boost.Cobalt applications on native, browsers and WASIp2/P3 | wrapper | implementing | | 2026-11-06 | [code](https://github.com/webcpporg/cobalt) |
| codecs | [genesis](libraries/codecs/openspec/changes/genesis) | codecs: one contract for turning bytes and values into text and back, one header per format, tokens like Boost.URL | own | implementing | | 2026-11-24 | [code](https://github.com/webcpporg/codecs) |
| config | [genesis](libraries/config/openspec/changes/archive/2026-10-09-genesis) | config: webcpp's configuration, the target, exceptions and version every library includes first | own | implemented | 0.1.0 | 2026-10-09 | [code](https://github.com/webcpporg/config/tree/2fad162) |
| crypto | [genesis](libraries/crypto/openspec/changes/genesis) | crypto: authenticated encryption, randomness and secp256k1 over C backends | wrapper | implementing | | 2026-10-11 | [code](https://github.com/webcpporg/crypto) |
| crypto | [foundation](libraries/crypto/openspec/changes/foundation) | crypto: the cryptographic foundation, every backend in full, one default per family and a browser backend | wrapper | accepted | | 2026-11-14 | |
Expand Down
11 changes: 11 additions & 0 deletions libraries/codecs/openspec/changes/genesis/.openspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
schema: spec-driven
created: 2026-11-24
webcpp:
library: codecs
title: "codecs: one contract for turning bytes and values into text and back, one header per format, tokens like Boost.URL"
kind: own
port_of: null
status: implementing
release: null
implementation: https://github.com/webcpporg/codecs
decided: 2026-11-24
1,722 changes: 1,722 additions & 0 deletions libraries/codecs/openspec/changes/genesis/design.md

Large diffs are not rendered by default.

202 changes: 202 additions & 0 deletions libraries/codecs/openspec/changes/genesis/proposal.md

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions libraries/codecs/openspec/changes/genesis/reference/STATUS.md

Large diffs are not rendered by default.

2,079 changes: 2,079 additions & 0 deletions libraries/codecs/openspec/changes/genesis/reference/plan.md

Large diffs are not rendered by default.

370 changes: 370 additions & 0 deletions libraries/codecs/openspec/changes/genesis/specs/codecs/spec.md

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions libraries/codecs/openspec/changes/genesis/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Tasks

Each task writes its tests first; the library builds and its tests pass on every local lane at the
end of every task. The plan with code is `reference/plan.md` (its task numbers follow in brackets;
the plan folds 2.7, 2.9, 2.13 and 3.8 into the tasks whose forms they test, ruling R13). The
owner's gates come first: the repository `webcpporg/codecs` and the submodule `libs/codecs`
(chapter 10's checklist, items 1 and 2); until then the library is a local repository at
`libs/codecs`. webcpp::secure (`libraries/secure/openspec/changes/genesis/`) is merged first:
codecs uses its guard, erase, secret and constant-time blocks (owner decision 14). The owner's
decisions of 2026-11-25 (15 to 23: the conversion contract, streams, allocators) are folded into
the core's tasks 2.4 to 2.13 and the formats' tasks below; the one-shot API is built first and is
unchanged by them. When an allocator fails (owner decision 24, closing O7), its exception
propagates unchanged in a build with exceptions, the allocating functions are not `noexcept`, and
tokens stay untouched and secrets wiped on the way out; tasks 2.4 to 2.7 and 2.11 test it.

## 1. The library's skeleton

- [x] 1.1 The repository's files (chapter 10's checklist, items 3 to 7): `meta/libraries.json` with `"port-of": null`, `build.jam` with `codecs` and `percent` (D1), `LICENSE_1_0.txt`, `README.md`, `AGENTS.md`, `.gitattributes`, `.gitignore`, `.github/workflows/ci.yml`, `test/Jamfile`, `example/Jamfile`, `doc/Jamfile` and `doc/changelog.adoc`; the index page's entry (plan task 1 and its preflight)
- [x] 1.2 `config.hpp` and its test three ways (exceptions, `WEBCPP_NO_EXCEPTIONS`, `WEBCPP_CODECS_NO_EXCEPTIONS`); `CODING-GUIDELINES.md` chapter 17's entry, with the convenience header's recorded departure (D1) (plan task 1; chapter 17's entry in plan task 23)
- [x] 1.3 `codecs::error`, its category `webcpp.codecs` and each message's test (D14) (plan task 1)

## 2. The core

- [x] 2.1 `codec` and `value_codec` declared, the concepts, `static_input_size_v`, the compile-time refusal and its compile-fail tests, over a format of the test's own (D3, D4, D5, D7) (plan task 2)
- [x] 2.2 `encoded_size`, `max_decoded_size` and the buffer forms (D6) (plan task 2)
- [x] 2.3 `text<N>` and `bytes<N>`, the default results, the typed decode into the fixed byte types and `fixed_byte_storage` (D9) (plan task 3)
- [x] 2.4 The token contract and `codecs::tokens`, with `append_to` and `assign_to` over any `std::basic_string` and `std::vector<std::uint8_t>` allocator, and `return_string` and `secret` callable with an allocator; Boost.URL's three tokens in a test that names `/webcpp//boost_url`; `std::pmr::string` tokens over a recording arena (D8, D22) (plan task 4)
- [x] 2.5 Secrecy: `is_secret` and `fixed_byte_storage` with their specializations for `secure::secret<N>`, `secret_text<N>`, `secret_bytes<N>`, `basic_secret_string<Allocator>` and `basic_secret_byte_vector<Allocator>` with their `std::allocator` and `codecs::pmr` aliases (wiped before `deallocate`, the old buffer on growth included, proven by a wipe-checking counting allocator), the typed decode with a trailing allocator, every wipe by `secure::erase_secret`, the wipe tests' seam, and `secure::timing_guard` engaged for secret operations, with its seam test (D10, D12) (plan tasks 5 and 6)
- [x] 2.6 `over<Outer, Inner, Allocator>` with its deduction guides (with and without an allocator), the in-place and heap intermediates, the secret chain (D11, D22) (plan task 7)
- [x] 2.7 The allocation test over the core with the test's own format; the allocator tests (an arena resource receives every allocation of every allocating form, propagation by `std::allocator_traits`, the approved spellings unchanged; an allocator throwing on its Nth allocation leaves tokens untouched and every secret buffer wiped, the `noexcept` of every non-allocating function checked by `static_assert`, and the `_no_exceptions` twins compiling every allocating form) (D15, D22, owner decision 24) (plan tasks 2 to 7, 10 and 19)
- [x] 2.8 The transformer contract: `one_shot_transformer`, `stream_transformer`, `detail::transformer_types`, `is_constant_time_v`, `flow`, `step`, `capacity<N>`, `secret_operation`; the protocol's states over a stream transformer of the test's own (D17, D18) (plan task 8)
- [x] 2.9 The toy non-byte transformers (`packet`, `frame`, `image`: a stateful packet-to-frame stream holding one frame back, frame-to-bytes and frame-to-image one-shots), their concept checks, and the compile-fail test of a wrong `pipe` (D15, D17) (plan tasks 8, 10 and 13)
- [x] 2.10 `pipe` and `drain`, in place, their refusals' messages (incompatible types, a one-shot argument), secrecy and wiping (D19, D21) (plan task 9)
- [x] 2.11 `each` (per item; in place, requiring a constant `max_output_size` and `N >= max_output_size(1)` with its `static_assert`, and with an allocator growing as `buffered` does; a short span delivered over several receives; `completed_items()`; item errors) and `buffered` (accumulating; in place and with an allocator; `input_too_long`), over the toy frames and over the test's own format (D19, D22) (plan task 10)
- [x] 2.12 `stream_codec`, `stream_options`, `encoder(format)` and `decoder(format)` as one-shot transformers always and stream transformers over `stream_codec`; `encoder(over{...})` and `decoder(over{...})` as `format_encoder` and `format_decoder`, streaming through an inner `pipe` when both links stream natively; a call that reports a data error writes nothing; configuration faults checked first, in both forms (B23, B43, B44); the refusals for value codecs and for `capacity<N>` on a format that does not hold; a streaming format of the test's own equal to its one-shot form for every chunking (D20) (plan task 11)
- [x] 2.13 The streams' allocation and wiping tests over the core: no allocation after construction, pending state, intermediates and buffers wiped on `reset`, destruction and move, every secret link run with DIT set, the guards nesting and their count back to zero after each call (D15, D21) (plan task 12)

## 3. The formats

- [x] 3.1 `hex.hpp`, constant time, RFC 4648 section 10's base16 vectors; its `stream_codec`, equal to the one-shot form for every chunking (D13, D12, D20) (plan task 13)
- [x] 3.2 `base64.hpp`, `base64` and `base64url`, constant time, RFC 4648 section 10's vectors and the canonical refusals; their `stream_codec` (D13, D12, D20) (plan task 16)
- [x] 3.3 `bech32.hpp`: `basic_bech32<Variant, MaximumLength = 90, Data = bech32_bytes>` with `bech32_variant`, the tags `bech32_bytes` and `bech32_words` and `.words()`, `formats::bech32` and `formats::bech32m` of 90 characters, a `static_assert` on a maximum length below 8, `bech32_parts<Data, MaximumLength>`, `append_words_from_bytes` and `bytes_from_words`, everything in place; constant time; BIP-173's and BIP-350's lists, their segwit addresses in words mode, the version-as-a-byte pitfall, BOLT 11's example invoice through `basic_bech32<bech32_variant::bech32, 2048>`; their `stream_codec`, the encoder streaming and the decoder holding raw characters until `flush` (a default hold of `MaximumLength` characters, `capacity<N>` in characters, `human_readable_part()`) (D13, D12, D20, owner decision 27) (plan task 17)
- [x] 3.4 `base32.hpp`, `base32` and `base32hex`, constant time, RFC 4648 section 10's vectors; their `stream_codec` (D13, D12, D20) (plan task 18)
- [x] 3.5 `base58.hpp`: `basic_base58<MaximumBytes, Alphabet, Checksum = no_checksum>`, the concepts `base58_alphabet` and `base58_checksum`, `no_checksum`, the alphabet types `bitcoin_alphabet`, `ripple_alphabet` and `flickr_alphabet` (a `static_assert` on 58 distinct characters), the instances `base58_bitcoin`, `base58_ripple` and `base58_flickr` of 100 bytes, `formats::base58` being `base58_bitcoin`; `maximum_characters` derived from the bound and the checksum's size; `input_too_long` past either bound before any read, and for a decoded payload past `maximum_bytes`; the scratch in place, sized by the template; the checksum appended on encode, split, recomputed and compared with `secure::constant_time_equal` on decode (`checksum_mismatch`, `invalid_length`); the secret constant-time conversion beside Bitcoin Core's, Bitcoin Core's vectors through both, its 256-byte input through `basic_base58<256, bitcoin_alphabet>`; a 101-byte input refused by the default and accepted by `basic_base58<1024, bitcoin_alphabet>`; an alphabet of the tests' own; no `stream_codec`, streamed through `buffered` in the tests (D13, D12, D20, owner decisions 25 and 26) (plan task 19)
- [x] 3.6 `percent.hpp` over Boost.URL, Boost.URL's functions as the oracle, for the one-shot form and for its `stream_codec` on every chunking (D13, D20) (plan task 20)
- [x] 3.7 `armor.hpp`, constant time over its base64 payload (its structure and label public), `armor_parts`, RFC 7468's examples, OpenSSL's PEM as the oracle natively, `over<armor, ...>`; its `stream_codec` and `label()` (D13, D12, D20) (plan task 21)
- [x] 3.8 The allocation test over every format, one-shot and stream; the interoperation test of a format registered outside codecs (`basic_base58` with a 4-byte checksum type of the tests' own as its third parameter, the form of hash's `base58_with_checksum`) (plan tasks 13, 16 to 21; the interoperation test in plan task 19)

## 4. The own lanes

- [x] 4.1 The lane `constant-time` (`WEBCPP_SECURE_CT_VALGRIND`, `WEBCPP_SECURE_CT_MSAN`, the marks and the seam recorder in codecs' own `test/support/`, as secure keeps its own, until webcpp::core lands; O5): memcheck with the secret undefined, MemorySanitizer where crypto runs it, dudect with its A/A control, the planted table-indexed hex that must fail, over hex, base32, base64, bech32, armor and base58's secret operations, one-shot and stream at fixed chunk sizes (D12, D15, D21) (plan task 14, and each format of plan tasks 16 to 21)
- [x] 4.2 The lane `fuzz`: one target per decoder and one for `over`, the round-trip and no-heap assertions, the stream form split where the fuzzer chooses equal to the one-shot form, the vectors as corpus, a bounded time (D15) (plan task 15, and each format of plan tasks 16 to 21)

## 5. The documentation and the delivery

- [x] 5.1 The page: one section per format, tokens, results, secrecy, composition, streams (the protocol, the borrowed input, `pipe`, `drain`, `each`, `buffered`), allocators and `codecs::pmr`, writing a format, writing a transformer of other data, the changelog; every example built and run (D16) (plan task 22)
- [ ] 5.2 Full local verification on every lane (native clang and gcc 15, MSVC 14.3 and 14.5, wasip2, wasip3, Emscripten, the own lanes, the Linux lint), exceptions on and off; the review; pull requests the owner merges; one CI at the end (plan tasks 23 and 24). Done 2026-11-30 but for the last part: every local lane green on the final heads (codecs `9e1baee`, superproject `c703e6e`; `reference/STATUS.md`), the review closed; the pull requests and the one CI follow
11 changes: 11 additions & 0 deletions libraries/codecs/openspec/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
schema: spec-driven

context: |
This repository holds the OpenSpec proposals of webcpp (github.com/webcpporg),
a superproject of header-only C++20 libraries for native, WASI (wasip2,
wasip3) and Emscripten targets, each library a repository of its own under
libs/<name>, licensed BSL-1.0, "Copyright (c) 2026 WebCpp.org".
The superproject's CODING-GUIDELINES.md holds the rules every library follows
and the decisions of webcpp's design; its AGENTS.md says how to work in the tree.
Everything is written in English; never the em dash, use a plain dash.
This root holds the proposals of the library webcpp::codecs: its genesis and its changes.
Loading