Skip to main content

Module code_envelope

Module code_envelope 

Source
Expand description

Shared wire format for pasted coven codes: prefix + base64url(json).

Restore, device-pairing, and membership-operation codes are JSON payloads wrapped the same way — a recognizable prefix, then the payload base64url-encoded — so they share one implementation of those mechanics.

Enums§

EnvelopeError
An envelope-level decode failure. Each caller maps this to its own user-facing error type.
FixedHexError

Constants§

PREFIX
Prefix on a pasted coven code, so a string from an unrelated format is rejected immediately with a clear “missing prefix” error rather than failing confusingly at base64 or JSON decode.

Functions§

decode_code
Decode {prefix}{base64url(json)} back into T. Trims surrounding whitespace first, so a pasted code with stray leading/trailing newlines still decodes.
decode_fixed_hex
Decode fixed-length hex material carried inside a pasted code.
encode_code
Encode code as {prefix}{base64url(json)}.