/** * PGP Key Export * * Export PKCS8 private keys to OpenPGP armored format. * Compatible with GPG and GitHub. * * This module converts existing PKCS8 key material to OpenPGP format, * preserving the original cryptographic material rather than generating * new keys. * * Issue #1374 */ /** * Options for exporting a PGP key */ export interface ExportPGPKeyOptions { /** Optional passphrase to encrypt the exported key */ passphrase?: string; /** User IDs to associate with the key */ userIds?: Array<{ name?: string; email?: string; }>; /** Key creation date (defaults to current time) */ date?: Date; } /** * Result of exporting a PGP key */ export interface ExportedPGPKey { /** Armored private key in OpenPGP format */ armoredPrivateKey: string; /** Armored public key in OpenPGP format */ armoredPublicKey: string; /** Whether the exported private key is encrypted */ isEncrypted: boolean; /** Key fingerprint (SHA-256 of SPKI bytes, first 40 hex chars) */ fingerprint: string; } /** * Error thrown when key export fails */ export declare class PGPKeyExportError extends Error { readonly code: string; constructor(message: string, code: string); } /** * Export a PKCS8 private key to OpenPGP armored format * * This function converts existing PKCS8 RSA key material to OpenPGP format, * preserving the original cryptographic material. The exported key can be * used with GPG, GitHub, and other OpenPGP-compatible tools. * * @param privateKeyBytes - PKCS8 encoded private key bytes * @param options - Export options (passphrase, userIds, date) * @returns Armored private and public keys with fingerprint * @throws PGPKeyExportError if export fails */ export declare function exportPGPKeyToArmored(privateKeyBytes: Uint8Array, options?: ExportPGPKeyOptions): Promise;