Documentation
¶
Overview ¶
Package envelope is the relay record: a type byte and opaque bytes (plan decision 7). A record is either the inviter's plaintext card (detached Ed25519 signature + card bytes) or a Signal ciphertext — a PreKeySignalMessage or a normal SignalMessage, which the library's own wire bytes do not tell apart.
The relay is untrusted and go.mau.fi/libsignal panics on some malformed input (ecc.DecodePoint indexes an empty slice) and accepts short or low-order keys. Check validates a record before any library call; Safe turns a panic that still escapes into an error.
Index ¶
Constants ¶
const MaxBody = 1 << 20
MaxBody is the cap on a record's decoded bytes (1 MiB).
const SigSize = ed25519.SignatureSize
SigSize is the length of the card's detached signature.
Variables ¶
var ( ErrType = errors.New("envelope: unknown type") ErrEmpty = errors.New("envelope: empty body") ErrTooLarge = errors.New("envelope: body over 1 MiB") ErrBase64 = errors.New("envelope: body is not standard base64") ErrMalformed = errors.New("envelope: malformed") ErrPanic = errors.New("envelope: library panic") )
Functions ¶
func CheckKey ¶
CheckKey requires the serialized public-key form libsignal reads with ecc.DecodePoint: exactly 33 bytes, type 0x05, not a low-order point.
func CheckPreKeyMessage ¶
CheckPreKeyMessage validates a PreKeySignalMessage and its inner message.
func CheckSignalMessage ¶
CheckSignalMessage validates a normal Signal message.
func Safe ¶
Safe runs fn and returns a panic inside it as an error wrapping ErrPanic. Wrap every libsignal deserialize and decrypt call that sees relay bytes.
func UnpackCard ¶
UnpackCard splits a Card body into card bytes and signature. It does not verify the signature; the card package does, before parsing the bytes.
Types ¶
type Envelope ¶
Envelope is one relay record.
func (Envelope) Check ¶
Check validates the envelope against its type; a nil result means the bytes are safe to hand to the card verifier or to libsignal's deserializers.
func (Envelope) MarshalBinary ¶
MarshalBinary packs the envelope as its type byte followed by the body, the form for local storage (an outbox entry).
func (*Envelope) UnmarshalBinary ¶
UnmarshalBinary reverses MarshalBinary and checks the result.