import { type PackedSkillBundle } from "./skill-bundle.js"; /** Environment variable holding the HMAC signing key. Never logged, never printed. */ export declare const SKILLS_SIGNING_KEY_ENV = "SKILLS_SIGNING_KEY"; /** Environment variable naming the source commit the bundle was built from. */ export declare const SKILLS_SOURCE_COMMIT_ENV = "SKILLS_SOURCE_COMMIT"; /** Prefix of the signature string. The remainder is lowercase hex. */ export declare const SIGNATURE_PREFIX = "hmac-sha256:"; export interface SkillBundleManifest { name: string; version: string; source_commit: string; /** Canonical sha256 of the bundle bytes (the skill's content address). */ content_hash: string; /** `hmac-sha256:` over the bundle bytes. Omitted when no key is available. */ signature?: string; published_at: string; } export interface BuildSkillBundleOptions { name: string; /** The skill directory to pack. */ dir: string; version: string; /** Source commit the skill came from. `unknown` when the provenance is unavailable. */ sourceCommit: string; /** Signing key. Defaults to reading process.env[SKILLS_SIGNING_KEY_ENV]. */ signingKey?: string; /** Explicit published_at. Defaults to now. Tests only. */ publishedAt?: string; } export interface BuiltSkillBundle { bundle: PackedSkillBundle; manifest: SkillBundleManifest; } /** * Resolve the signing key from the environment. Returns null when unset, and the * caller decides how to behave (omit the signature, warn, or refuse) — this function * never touches stdout, so nothing about the key can leak through it. */ export declare function resolveSigningKey(env?: Record): string | null; /** Sign canonical bundle bytes with an HMAC key. Returns `hmac-sha256:`. */ export declare function signBundleBytes(bytes: Uint8Array, key: string): string; /** * Verify a signature string against bundle bytes and a key. Returns true only for a * well-formed `hmac-sha256:` signature computed over exactly these bytes. * timingSafeEqual keeps the comparison from leaking a byte-at-a-time signal; the * length check is a format check (a hex digest is a fixed length), not a leak. */ export declare function verifyBundleSignature(bytes: Uint8Array, signature: string, key: string): boolean; /** * Pack a skill directory and build its signed manifest in one call — the unit the CI * bundle script, push, and pull all share, so a bundle built by CI and one pushed by * a machine agree on the canonical content_hash by construction. */ export declare function buildSkillBundle(options: BuildSkillBundleOptions): BuiltSkillBundle;