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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ tag is placed.
| 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) |
| codecs | [one-verb](libraries/codecs/openspec/changes/one-verb) | codecs: one verb for every library: a value type's formats declared to codecs, the armor's label in its type, over decoding a value in place | own | implementing | | 2026-12-02 | [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) |
| config | [timing-guard](libraries/config/openspec/changes/archive/2026-11-24-timing-guard) | config: one DIT timing guard for every webcpp library, moved from crypto and hash, Windows on ARM64 covered | own | withdrawn | | 2026-11-24 | |
| 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) |
Expand All @@ -58,6 +59,7 @@ tag is placed.
| crypto | [api-gaps](libraries/crypto/openspec/changes/api-gaps) | crypto: the API gaps of version 0.2 closed, and dudect judged on hosted runners | wrapper | implementing | | 2026-11-20 | [code](https://github.com/webcpporg/crypto) |
| crypto | [data-independent-timing](libraries/crypto/openspec/changes/data-independent-timing) | crypto: the library sets arm64's DIT around every cryptographic operation | wrapper | implementing | | 2026-11-20 | [code](https://github.com/webcpporg/crypto) |
| crypto | [formats](libraries/crypto/openspec/changes/formats) | crypto: one encode and one decode for every key and signature format, the format as a value | wrapper | implementing | | 2026-11-22 | [code](https://github.com/webcpporg/crypto) |
| crypto | [one-verb](libraries/crypto/openspec/changes/one-verb) | crypto: codecs' verbs are crypto's: crypto::encode and crypto::decode removed, the check declared to codecs, PEM on a fixed label and decoded in place | wrapper | implementing | | 2026-12-02 | [code](https://github.com/webcpporg/crypto) |
| crypto | [unified-sign](libraries/crypto/openspec/changes/unified-sign) | crypto: one sign and verify on every curve, the scheme always named, the key pair contract and four forms of each operation | wrapper | implementing | | 2026-11-22 | [code](https://github.com/webcpporg/crypto) |
| crypto | [uniform-types](libraries/crypto/openspec/changes/uniform-types) | crypto: typed signatures, typed X25519 keys, and concepts for key pairs, AEADs and boxes | wrapper | implementing | | 2026-11-22 | [code](https://github.com/webcpporg/crypto) |
| document | [genesis](libraries/document/openspec/changes/archive/2026-10-12-genesis) | document: a JSON document for C++20 that behaves as JavaScript does, in one relocatable image | own | implemented | 0.1.0 | 2026-10-12 | [code](https://github.com/webcpporg/document/tree/ac29296) |
Expand Down
11 changes: 11 additions & 0 deletions libraries/codecs/openspec/changes/one-verb/.openspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
schema: spec-driven
created: 2026-11-30
webcpp:
library: codecs
title: "codecs: one verb for every library: a value type's formats declared to codecs, the armor's label in its type, over decoding a value in place"
kind: own
port_of: null
status: implementing
release: null
implementation: https://github.com/webcpporg/codecs
decided: 2026-12-02
779 changes: 779 additions & 0 deletions libraries/codecs/openspec/changes/one-verb/design.md

Large diffs are not rendered by default.

119 changes: 119 additions & 0 deletions libraries/codecs/openspec/changes/one-verb/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
## Why

Two problems of the same kind, met by crypto's `formats` change, which codecs answers once for
every library.

**One verb.** crypto's `formats` gave crypto verbs of its own, `crypto::encode` and
`crypto::decode`, that check the pair against crypto's list and forward to `codecs::encode` and
`codecs::decode<T>` (its R18), only because codecs' refusal of a pair says "this format does not
convert this type" and cannot name the formats a type has, nor say "Ed25519 and BIP340 signatures
have no DER form". Two verbs answer one question, with two diagnostics. On 2026-12-02 the owner
chose one verb ("Vamos com a B", owner decision 31): `codecs::encode` and `codecs::decode` are the
verbs of every library, crypto's are removed with no alias, and codecs gains an extension point
through which a library declares, for its value types, the formats each type has and the pairs'
own refusal reasons, so that codecs' verbs refuse a pair as crypto's D3 does today.

**The PEM label.** crypto's owner decision 1 says a PEM's label comes from the inner format and
"can never be wrong". Today crypto's `pem_t<F>` is `codecs::over<codecs::formats::armor_t, F>`,
whose armor holds its label as a value; crypto's verbs replace a hand-built armor's label, and
`codecs::encode` writes whatever the value holds. With crypto's verbs gone, the label must be right
through codecs' verbs.

**No heap for a PEM.** `codecs::over<Outer, Inner>` holds the bytes between its links in place
only when their bound is known at compile time: the input's type states its size, or, for an
encode, the inner value codec states `max_encoded_size`. A PEM arrives as a `std::string` or a
`std::string_view`, so `codecs::decode<p256::public_key>(pem(spki), text)` puts the DER on the heap
and breaks crypto's owner decision 3 ("no heap"); crypto's `crypto::decode` works around it with
two steps of its own (its R24). On 2026-11-30 the owner approved that codecs' `over` decodes in
place under the inner value codec's decode bound (owner decision 28), the bound enforced by the
core on every path (decision 29) and the in-place intermediate capped at 4096 bytes (decision 30).

This change, first planned as `over-in-place`, carries all three; crypto's change `one-verb`
(`libraries/crypto/openspec/changes/one-verb/`) follows it in the same stream.

## What Changes

- **A value type's formats, declared to codecs (owner decision 31).** `codecs::value_formats<Value>`,
declared and not defined as `value_codec` is, which a library specializes for a value type it
owns (fully, or for a family by a partial specialization constrained by a concept): its
`formats`, a `codecs::format_list<...>`; optionally `has_format<Format>`, for a list that names
a family of formats; optionally `has_reason<Format, Direction>` with `refuse<Format, Direction>()`,
the library's own `static_assert` with its fixed sentence, `Direction` a `codecs::direction`
(`encode`, `decode`). A composition `over<Outer, Inner>` of a declared type converts when its
inner link does, unless a reason refuses it.
- **One refusal.** Every operation that converts a value (`encode` in all its forms, the buffer
forms included, `encoded_size`, the typed `decode<Value>`) and the new
`codecs::check_conversion<Direction, Value, Format>()`, for a library's own entry point, refuse
a pair of a declared type with exactly one error, in this order: the pair's own reason (the
library's sentence); "webcpp::codecs: this type has no such format; the formats it has are the
format_list named in this assertion", the type's list printed in the failed requirement; "this
type lists the format, and no value_codec of the pair encodes (decodes) it". A type with no
declaration keeps the genesis' diagnostic. `codecs::encodable` and `codecs::decodable` follow the
declaration. The typed decode given bytes for a value codec of text, or text for one of bytes,
says so in its own sentence.
- **The armor's label in its type.** `codecs::formats::basic_armor<Label>`: RFC 7468's armor with
the label `Label::value` fixed at compile time (checked against RFC 7468's grammar), no value of
it holding another label; its bound is its label's, so a result over it is exactly as long as
its longest text. crypto's `pem_t<F>` becomes `over<basic_armor<pem_label<F>>, F>` (crypto's
change). `formats::armor_t` and `formats::armor(label)` are unchanged.
- **The decode bound joins codecs' value codec contract, enforced on every path (owner decisions
28 and 29).** `value_codec<Format, Value>` MAY state `static constexpr std::size_t
max_decode_input_size`, the longest encoded input its `decode` accepts, in bytes for a value
codec of bytes and in characters for one of text; codecs adopts crypto's name (crypto's R37).
The core refuses every longer input with `codecs::error::input_too_long` before the value codec
sees it, in the direct `decode<Value>(format, input)` (any input type, public or secret) and
through `over` alike. When a value codec states both bounds, `max_decode_input_size` must not be
below `max_encoded_size`, a check the core makes at compile time.
- **`over` decodes a value in place under that bound (owner decisions 28 and 30).** The
intermediate of `decode<Value>(over{outer, inner}, text)` is held in place, sized by the
smallest bound known at compile time: the outer link's bound on a text of a static size
(unchanged), and the inner value codec's `max_decode_input_size` when it is at most 4096 bytes.
An intermediate whose exact size is past the decode bound is refused with `input_too_long`
before it is made or written, after the outer link's own errors. With the intermediate in place
the decode is `noexcept` when the links' calls are, and allocates nothing.
- **Unchanged:** a value codec with no decode bound; a decode bound above 4096 bytes (the heap,
its allocation never above the bound); the encode side of `over`; `over`'s own value codec,
which states no decode bound; the diagnostic of a type with no declaration; every codec's pair
of bytes.
- **The lanes:** the constant-time lane gains the path of a secret value decoded through
`over{armor, ...}` from a text of a dynamic size; the fuzz lane gains the target `over_value`.
- **The page:** composition's "Where the intermediate lives"; writing a format's value codec
section and a new section "Declaring a value type's formats"; the armor's `basic_armor`; the
examples `over_value.cpp` and `value_formats.cpp`, and a `basic_armor` region in `pem.cpp`; the
changelog's lines.
- **crypto's follow-up, in the same stream:** crypto's change `one-verb` removes `crypto::encode`
and `crypto::decode`, declares its types' formats and reasons to codecs, puts its PEM on
`basic_armor`, drops its two-step PEM decode and migrates every caller; the superproject moves
both gitlinks together.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `codecs`: a value type's formats declared to codecs and the refusal through them; the armor with
its label in its type; the value codec's optional decode bound, and `over`'s decode of a value
in place under it.

## Impact

- **Kind:** webcpp's own (`"port-of": null`), as codecs' genesis.
- **Breaking:** no codecs name is removed. A decode of a value whose value codec states a decode
bound, given an input past that bound, returns `codecs::error::input_too_long` where it returned
the value codec's own error, directly and through `over` (owner decision 29); through `over` such
a decode no longer allocates and becomes `noexcept`. A pair of a declared type that a
declaration does not list is refused even if a value codec exists. The typed decode's message
for an input of the wrong kind changes. crypto's verbs are removed by crypto's change.
- **Implementation:** webcpporg/codecs (`include/webcpp/codecs/detail/core/contract.hpp`,
`operations.hpp`, `sizes.hpp`, `over.hpp`, `secrecy.hpp`, `size_maximum.hpp`, `tokens.hpp`,
`include/webcpp/codecs/armor.hpp`; tests, message tests, the constant-time and fuzz lanes, the
page, two examples, the changelog's lines), webcpporg/crypto through its change `one-verb`, the
superproject (both gitlinks). The plan is `reference/plan.md`.
- **Status:** the decode bound and `over` in place approved by the owner on 2026-11-30 (crypto
`formats`' question Q1; owner decisions 28 to 30); one verb decided by the owner on 2026-12-02
(owner decision 31); accepted with `reference/plan.md`; the public names approved by the owner
as designed on 2026-12-02 ("Quanto aos nomes, podem ficar assim"). Built on 2026-12-03
(`implementing`): `reference/STATUS.md` holds the heads, the verification and the rulings.
Loading
Loading