envelope

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package envelope assembles and reads the stored log-entry bytes: the DSSE-signed receipt envelope whose complete bytes the log's Merkle leaf covers (receipt-schema-v1.md §2).

It was lifted out of internal/tlog in Week 3 so the MCP proxy can build the envelope it signs and spools without linking the appender. That is not just binary weight: one appender process per log is an architectural constraint (Q57), and a capture surface that cannot import the appender cannot accidentally become one. internal/tlog re-exports this package's API unchanged.

Index

Constants

View Source
const Version = "behalf.sh/envelope/v1"

Version is the version string stamped on every stored envelope.

Variables

This section is empty.

Functions

func Build

func Build(payloadType string, payload []byte, keyid string, sig []byte) []byte

Build assembles the stored log-entry bytes, with the payload spliced verbatim (the span rule, docs/export-format-v1.md §1.2 — the signed bytes are the stored bytes). Assembly is byte concatenation, never re-marshaling of a structure containing the payload.

{"v":"behalf.sh/envelope/v1","payloadType":<t>,"payload":<verbatim>,"sig":{"keyid":<jkt>,"sig":"<b64std>"}}

Types

type Envelope

type Envelope struct {
	PayloadType string
	Payload     []byte // exact byte span, aliases the envelope bytes
	KeyID       string
	Sig         []byte
}

Envelope is the parsed view of a stored envelope. Payload aliases the original envelope bytes — it is the exact signed span, never re-serialized.

func Parse

func Parse(env []byte) (*Envelope, error)

Parse extracts the payloadType, the exact payload byte span, and the signature from stored envelope bytes using a span scanner — it never parse-and-reserializes the payload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL