pub fn encode(
envelope: &Envelope,
app_key: &str,
encrypt: bool,
) -> Result<String>Expand description
Encode an envelope to the wire form (base64-URL-no-pad of JSON).
When the encoded JSON exceeds GZ_MIN_SIZE and encrypt = false,
the encoder switches to a gzip-compressed payload prefixed with gz:.
The decoder detects the prefix automatically. Encryption mode (enc:)
is not combined with gzip — enc: already encodes through AES-GCM
which doesn’t benefit meaningfully from compression and would leak
length-based side channels (CRIME-style).