Skip to main content

Module code_fields

Module code_fields 

Source
Expand description

The fields of a code’s storage part (D13). coven-storage decides what they mean; this module packs them with the format’s own primitives (D2), so a storage part has one encoding and a reader refuses a truncated or malformed one. Every owned buffer erases on drop.

Structs§

FieldReader
Reads one storage part’s fields in the order they were packed. Every length is checked against what remains before it is allocated, and FieldReader::finish refuses trailing bytes.
FieldWriter
Writes one storage part’s fields in order. pack runs the same fields twice: once to count their bytes, then into a buffer of exactly that size, so no secret is left behind in a grown allocation.

Constants§

MAX_STORAGE
The largest storage part a restore or invite code carries.

Functions§

pack
Pack the fields put writes into one buffer erased on drop and allocated once. put must write the same fields both times it runs.