/**
 * OTA private-key vault envelope (customer-side encryption).
 *
 * The Capgo OTA private key (`.capgo_key_v2`, RSA PKCS#1 or PKCS#8 PEM) is encrypted on the
 * customer's machine before it is sent to Capgo. The encryption key is derived from a vault
 * secret that only the customer holds (generated `capgo-vault-...` secret or a long passphrase),
 * so Capgo stores ciphertext it cannot open. Any client holding the vault secret and an API
 * key that can read the envelope (CLI, local MCP, CI, the console) decrypts it locally.
 *
 * - KDF: PBKDF2-HMAC-SHA256, random 16-byte salt, >= 600,000 iterations.
 * - Cipher: AES-256-GCM, random 96-bit IV.
 * - AAD binds the format version, app ID, public-key fingerprint and KDF/IV parameters, so an
 *   envelope copied to another app, or edited server-side, fails to open.
 * - After decryption the public key is re-derived from the private key and must match the
 *   stored fingerprint.
 *
 * Pure WebCrypto: runs in Node >= 20, Deno and browsers. Also imported by the console.
 */
export declare const OTA_KEY_VAULT_FORMAT = "capgo-ota-key-vault";
export declare const OTA_KEY_VAULT_VERSION = 1;
export declare const OTA_KEY_VAULT_DEFAULT_ITERATIONS = 600000;
export declare const OTA_KEY_VAULT_MIN_ITERATIONS = 600000;
export declare const OTA_KEY_VAULT_MAX_ITERATIONS = 10000000;
export declare const OTA_KEY_VAULT_SECRET_PREFIX = "capgo-vault-";
export declare const OTA_KEY_VAULT_MIN_SECRET_LENGTH = 16;
export declare const OTA_KEY_VAULT_SECRET_ENV = "CAPGO_KEY_VAULT_SECRET";
/** Ciphertext cap: a 4096-bit RSA PEM is ~3.3 KB; leave room for 8192-bit keys. */
export declare const OTA_KEY_VAULT_MAX_CIPHERTEXT_BYTES: number;
export interface OtaKeyVaultEnvelope {
    format: typeof OTA_KEY_VAULT_FORMAT;
    version: typeof OTA_KEY_VAULT_VERSION;
    kdf: {
        name: 'PBKDF2-SHA256';
        iterations: number;
        salt: string;
    };
    cipher: {
        name: 'AES-256-GCM';
        iv: string;
    };
    ciphertext: string;
    public_key_sha256: string;
}
export declare class OtaKeyVaultError extends Error {
    constructor(message: string);
}
export declare function bytesToBase64(bytes: Uint8Array): string;
export declare function base64ToBytes(value: string): Uint8Array;
/** A new 256-bit vault secret, e.g. `capgo-vault-3q2-...`. Show it once; Capgo never sees it. */
export declare function generateVaultSecret(): string;
export declare function assertVaultSecret(secret: string | undefined | null): string;
/** PKCS#1 RSAPublicKey DER (SEQUENCE { modulus, publicExponent }) derived from a private key PEM. */
export declare function rsaPublicKeyDerFromPrivateKey(privateKeyPem: string): Uint8Array;
export declare function rsaPublicKeyPemFromPrivateKey(privateKeyPem: string): string;
/** SHA-256 (hex) of the PKCS#1 DER of an `RSA PUBLIC KEY` PEM, the format in capacitor.config. */
export declare function rsaPublicKeyFingerprint(publicKeyPem: string): Promise<string>;
export declare function rsaPrivateKeyFingerprint(privateKeyPem: string): Promise<string>;
/** Structural validation shared by every client (the backend has an equivalent check). */
export declare function parseOtaKeyVaultEnvelope(value: unknown): OtaKeyVaultEnvelope;
export interface SealedOtaPrivateKey {
    envelope: OtaKeyVaultEnvelope;
    publicKeyPem: string;
    publicKeySha256: string;
}
/** Encrypts the OTA private key locally. Only the returned envelope and public key leave the machine. */
export declare function sealOtaPrivateKey(input: {
    appId: string;
    privateKeyPem: string;
    secret: string;
    iterations?: number;
}): Promise<SealedOtaPrivateKey>;
/** Decrypts locally and checks that the private key still matches the stored public-key fingerprint. */
export declare function openOtaPrivateKey(input: {
    appId: string;
    envelope: unknown;
    secret: string;
}): Promise<string>;
