/// <reference types="node" />
import { IDeSer } from './deser';
/**
 * Defines a generic envelope that can have a child envelope (which can also have a
 * child envelope, and so on).
 */
export interface IEnvelope {
    child?: IEnvelope | Buffer;
}
/**
 * Extracts the child envelope from a parent envelope.
 * @param deser The (de)serializer to use for deserialization (when required)
 * @param parent The envelope from which to extract the child.
 * @returns The deserialized child container as IEnvelope instance.
 */
export declare function extractEnvelopeChild<Child extends IEnvelope>(deser: IDeSer, parent: IEnvelope): Child | undefined;
/**
 * Serializes a given envelope and its child envelopes (recursively).
 * @param deser The (de)serializer to use for serialization (when required)
 * @param envelope The envelope that needs to be serialized
 * @returns A buffer that contains the serialized envelope
 */
export declare function serializeEnvelope(deser: IDeSer, envelope: IEnvelope | Buffer): Buffer;
