import type { BuiltLayer, OciImageConfig, OciManifest } from './types';
/** Compute `sha256:<hex>` for a buffer. */
export declare function digest(data: Uint8Array | Buffer): string;
/** The hex portion of a `sha256:<hex>` digest. */
export declare function digestHex(d: string): string;
/**
 * Create a deterministic, uncompressed tar of a rootfs directory. Uses the
 * system `tar` (always present on the platforms pantry targets) — the same
 * approach the package installer uses for extraction. Numeric owner + sorted
 * names keep the output stable across machines.
 */
export declare function tarDirectory(rootfsDir: string): Buffer;
/**
 * Build a single OCI layer from a rootfs directory: produce the uncompressed
 * tar (→ diffId), gzip it (→ digest), and write the gzipped blob to `blobDir`.
 * Also writes the uncompressed tar next to it (needed for docker-archive).
 */
export declare function buildLayerFromRootfs(rootfsDir: string, blobDir: string): BuiltLayer & { tarPath: string };
/** Serialize an image config to canonical JSON bytes + its digest. */
export declare function serializeConfig(config: OciImageConfig): { bytes: Buffer, digest: string };
/** Build an OCI image manifest referencing the config + layers. */
export declare function buildManifest(configDigest: string, configSize: number, layers: BuiltLayer[]): { manifest: OciManifest, bytes: Buffer, digest: string };
/**
 * Write an OCI image layout directory:
 *   <dir>/oci-layout
 *   <dir>/index.json
 *   <dir>/blobs/sha256/<hex>   (config, layers, manifest)
 */
export declare function writeOciLayout(dir: string, manifestBytes: Buffer, manifestDigest: string, configBytes: Buffer, configDigest: string, layers: BuiltLayer[], tags: string[]): void;
/**
 * Write a docker-archive tarball (the `docker save` format) at `outPath`:
 *   manifest.json            → [{ Config, RepoTags, Layers }]
 *   <configHex>.json         → image config
 *   <diffIdHex>/layer.tar    → uncompressed layer tar (one per layer)
 *
 * `docker load` and OCI runtimes (podman/containerd) accept this format.
 */
export declare function writeDockerArchive(outPath: string, configBytes: Buffer, configDigest: string, layers: Array<BuiltLayer & { tarPath: string }>, tags: string[]): void;
/** Normalize an `os/arch` platform string into config fields. */
export declare function platformFields(platform?: string): { os: string, architecture: string };
