/** * kMOSAIC Digital Signatures * * Simple Fiat-Shamir signature scheme compatible with Go implementation. * * Security Properties: * - Fiat-Shamir: Non-interactive via hash-based challenge * - Deterministic: Same message + key produces consistent verification * * Signature Structure: * - Commitment: 32-byte hash of witness + message + binding * - Challenge: 32-byte hash of commitment + message + public key hash * - Response: 64-byte response derived from secret key + challenge + witness */ import { SecurityLevel, type MOSAICParams, type MOSAICPublicKey, type MOSAICSecretKey, type MOSAICKeyPair, type MOSAICSignature } from '../types.js'; /** * Generate kMOSAIC signature key pair * * @param level - Security level (default: MOS_128) * @returns Promise resolving to the generated key pair */ export declare function generateKeyPair(level?: SecurityLevel): Promise; /** * Generate key pair from seed (deterministic) * * @param params - System parameters * @param seed - Master seed (must be at least 32 bytes) * @returns Generated key pair */ export declare function generateKeyPairFromSeed(params: MOSAICParams, seed: Uint8Array): MOSAICKeyPair; /** * Sign a message using kMOSAIC Fiat-Shamir scheme * * Algorithm (matches Go): * 1. Generate random witness * 2. Compute message hash: H(message || binding) * 3. Compute commitment: H(witness || msgHash || binding) * 4. Compute challenge: H_domain(commitment || msgHash || pkHash) * 5. Compute response: SHAKE256(H_domain(skBytes || challenge || witness)) * * @param message - Message to sign * @param secretKey - Secret key * @param publicKey - Public key * @returns Promise resolving to the signature */ export declare function sign(message: Uint8Array, secretKey: MOSAICSecretKey, publicKey: MOSAICPublicKey): Promise; /** * Verify a kMOSAIC signature * * Algorithm (matches Go): * 1. Compute message hash: H(message || binding) * 2. Compute commitment: H(response || challenge || witness) * 3. Verify commitment matches signature commitment * * @param message - Message to verify * @param signature - Signature object * @param publicKey - Public key * @returns Promise resolving to true if valid, false otherwise */ export declare function verify(message: Uint8Array, signature: MOSAICSignature, publicKey: MOSAICPublicKey): Promise; /** * Serialize signature to bytes * * Format: * [commitment (32)] || [challenge (32)] || [response (64)] * * @param sig - Signature object * @returns Serialized bytes */ export declare function serializeSignature(sig: MOSAICSignature): Uint8Array; /** * Deserialize signature from bytes * * Format: [len:4][commitment][len:4][challenge][len:4][response] * * @param data - Serialized signature bytes * @returns Deserialized signature object */ export declare function deserializeSignature(data: Uint8Array): MOSAICSignature; /** * Serialize public key for hashing * * @param pk - Public key * @returns Serialized public key bytes */ export declare function serializePublicKey(pk: MOSAICPublicKey): Uint8Array; //# sourceMappingURL=index.d.ts.map