/** * Ed25519 Signature Operations * * Provides key generation, signing, and verification using Ed25519. * Uses tweetnacl for cryptographic operations. * * @see docs/rfc/proof-bundle-v1.md#5-signature-procedure */ /** * Ed25519 key pair */ export interface KeyPair { publicKey: Uint8Array; secretKey: Uint8Array; } /** * Key storage paths */ export interface KeyPaths { privateKey: string; publicKey: string; } /** * Get default key storage directory */ export declare function getKeyDirectory(): string; /** * Get key file paths */ export declare function getKeyPaths(): KeyPaths; /** * Generate new Ed25519 key pair * * @returns Key pair (public + secret) */ export declare function generateKeys(): KeyPair; /** * Save key pair to disk * * @param keyPair - Key pair to save * @param paths - Optional custom paths (defaults to ~/.qa360/keys/) */ export declare function saveKeys(keyPair: KeyPair, paths?: KeyPaths): Promise; /** * Load key pair from disk * * @param paths - Optional custom paths (defaults to ~/.qa360/keys/) * @returns Key pair * @throws Error if keys don't exist */ export declare function loadKeys(paths?: KeyPaths): Promise; /** * Check if keys exist * * @param paths - Optional custom paths * @returns true if both keys exist */ export declare function keysExist(paths?: KeyPaths): Promise; /** * Initialize keys (generate if they don't exist) * * @param paths - Optional custom paths * @returns Key pair (existing or newly generated) */ export declare function initializeKeys(paths?: KeyPaths): Promise; /** * Ensure proof keys exist (generate if missing) * * @param homeDir - QA360 home directory * @returns Result with creation status, paths, and optional keys */ export declare function ensureProofKeys(homeDir: string): Promise<{ created: boolean; paths: { pub: string; priv: string; }; keys?: KeyPair; }>; /** * Compute SHA-256 hash of data * * @param data - Data to hash (UTF-8 string) * @returns SHA-256 hash as Buffer */ export declare function sha256(data: string): Buffer; /** * Sign data with Ed25519 * * @param data - Data to sign (canonical JSON string) * @param secretKey - Ed25519 secret key (64 bytes) * @returns Base64-encoded signature (88 chars) */ export declare function sign(data: string, secretKey: Uint8Array): string; /** * Verify Ed25519 signature * * @param data - Original data (canonical JSON string) * @param signatureB64 - Base64-encoded signature * @param publicKey - Ed25519 public key (32 bytes) * @returns true if signature is valid */ export declare function verify(data: string, signatureB64: string, publicKey: Uint8Array): boolean; /** * Sign and verify roundtrip test * * @param data - Test data * @param keyPair - Key pair to test * @returns true if roundtrip succeeds */ export declare function testRoundtrip(data: string, keyPair: KeyPair): boolean;