Loading vLEI.wiki
Fetching knowledge base...
Fetching knowledge base...
This comprehensive explanation has been generated from 48 GitHub source documents. All source documents are searchable here.
Last updated: October 7, 2025
This content is meant to be consumed by AI agents via MCP. Click here to get the MCP configuration.
Note: In rare cases it may contain LLM hallucinations.
For authoritative documentation, please consult the official GLEIF vLEI trainings and the ToIP Glossary.
A code table in CESR is a structured mapping of derivation codes to cryptographic primitive types, sizes, and encoding rules, enabling self-framing stream parsing by defining how the first character(s) of a primitive determine its type and length.
A code table in CESR (Composable Event Streaming Representation) is a structured reference that maps derivation codes (prepended character sequences) to specific cryptographic primitive types, their raw sizes, and encoding rules. Code tables enable self-framing by allowing parsers to determine a primitive's type and length by examining only its leading characters, without requiring external delimiters or context.
CESR employs multiple code tables rather than a single universal encoding scheme, optimizing for different primitive characteristics:
Code tables are foundational to CESR's composability property - the ability to convert concatenated primitives between text and binary domains without loss. Each code table is designed around the 24-bit alignment constraint: primitives in the text domain must be integer multiples of 4 Base64 characters (24 bits), and primitives in the binary domain must be integer multiples of 3 bytes (24 bits).
The code table selector - the first character in a CESR stream - determines which code table applies to subsequent primitives. This dual-purpose character both:
Implementations must maintain separate code tables for:
Parsers must:
Code table versioning requires:
Efficient implementations should:
Robust parsers must handle:
For example, the '_' selector is reserved for future opcode tables, while other selectors activate specific primitive encoding tables.
Code tables are versioned through CESR-version count codes that specify which version of all code tables applies to a stream or stream section. The version-code tells parsers "which set of tables to load" and "what version of the table is going to load," enabling protocol evolution while maintaining backward compatibility.
Each code table organizes primitives by their pad size - the number of lead bytes needed for 24-bit alignment:
The pad size calculation ps = (3 - (N mod 3)) mod 3 determines how many lead bytes must be prepended to a raw binary value of N bytes before Base64 conversion.
Code tables enable efficient stream processing and pipelining by supporting:
In KERI key event logs, code tables define how cryptographic primitives are encoded:
These codes appear at the start of each primitive, enabling parsers to extract exactly the right number of characters without ambiguity.