/** * PGP Key Import Parser * * Parse and validate armored PGP private keys for import. * Converts to PKCS8 format compatible with Web Crypto API. * * Issue #1374 */ import type { PGPKeyAlgorithm } from "./types"; /** * Result from parsing an armored PGP key */ export interface ParsedPGPKey { /** Private key in PKCS8 format (raw bytes) */ privateKeyBytes: Uint8Array; /** Public key in PEM format (SPKI) */ publicKeyPem: string; /** Key fingerprint (40 hex chars) */ keyId: string; /** Key algorithm */ algorithm: PGPKeyAlgorithm; /** Key size in bits */ keySize: number; /** User IDs associated with the key */ userIds: string[]; /** When the key was created */ createdAt: string; } /** * Validation result for imported key */ export interface KeyValidationResult { /** Whether the key is valid for import */ isValid: boolean; /** Error message if invalid */ error?: string; /** Warning message (e.g., key size < 4096) */ warning?: string; } /** * Error thrown when key import fails */ export declare class PGPKeyImportError extends Error { readonly code: string; constructor(message: string, code: string); } /** * Check if a string looks like an armored PGP key * * @param input - String to check * @returns true if it appears to be armored PGP format */ export declare function isArmoredPGPKey(input: string): boolean; /** * Parse an armored PGP private key * * @param armoredKey - Armored PGP private key string * @param passphrase - Optional passphrase if key is encrypted * @returns Parsed key data * @throws PGPKeyImportError if parsing fails */ export declare function parseArmoredPGPKey(armoredKey: string, passphrase?: string): Promise; /** * Validate an imported key * * @param parsedKey - Parsed key to validate * @returns Validation result with any warnings */ export declare function validateImportedKey(parsedKey: ParsedPGPKey): KeyValidationResult;