import { VorionError } from '../../common/errors.js';
import { type Commitment, type MerkleProof, type PedersenCommitment, CommitmentScheme } from './types.js';
/**
 * Commitment-related errors
 */
export declare class CommitmentError extends VorionError {
    readonly scheme?: CommitmentScheme;
    code: string;
    statusCode: number;
    constructor(message: string, scheme?: CommitmentScheme, details?: Record<string, unknown>);
}
/**
 * Pedersen Commitment Service
 *
 * Implements Pedersen commitments which are:
 * - Perfectly hiding (computationally binding)
 * - Additively homomorphic: C(v1) * C(v2) = C(v1 + v2)
 *
 * Commitment: C = g^v * h^r
 * where:
 * - g, h are generators of a prime-order group
 * - v is the value being committed
 * - r is a random blinding factor
 *
 * Note: This implementation uses SHA-256 hash-based simulation.
 * For production, use elliptic curve implementations (e.g., ristretto255).
 *
 * @example
 * ```typescript
 * const pedersen = new PedersenCommitmentService();
 *
 * // Create a commitment
 * const { commitment, opening } = await pedersen.commit(BigInt(42));
 *
 * // Verify the commitment
 * const valid = await pedersen.verify(commitment, BigInt(42), opening);
 * ```
 */
export declare class PedersenCommitmentService {
    private generatorG;
    private generatorH;
    constructor();
    /**
     * Create a commitment to a value
     *
     * @param value - The value to commit to (as bigint for large numbers)
     * @param blindingFactor - Optional blinding factor (random if not provided)
     * @returns Commitment and opening information
     */
    commit(value: bigint | number, blindingFactor?: string): Promise<{
        commitment: PedersenCommitment;
        opening: PedersenOpening;
    }>;
    /**
     * Verify a commitment opening
     *
     * @param commitment - The commitment to verify
     * @param value - The claimed value
     * @param blindingFactor - The blinding factor used
     * @returns Whether the opening is valid
     */
    verify(commitment: PedersenCommitment, value: bigint | number, blindingFactor: string): Promise<boolean>;
    /**
     * Add two commitments (homomorphic addition)
     *
     * C(v1, r1) + C(v2, r2) = C(v1 + v2, r1 + r2)
     */
    add(c1: PedersenCommitment, c2: PedersenCommitment): Promise<PedersenCommitment>;
    /**
     * Create a commitment to zero for zero-knowledge proofs
     */
    commitToZero(): Promise<{
        commitment: PedersenCommitment;
        blindingFactor: string;
    }>;
    /**
     * Generate a random scalar for blinding
     */
    generateRandomScalar(): Promise<string>;
    private hashToPoint;
    private combinePoints;
}
/**
 * Opening information for a Pedersen commitment
 */
export interface PedersenOpening {
    /** The committed value */
    value: string;
    /** The blinding factor */
    blindingFactor: string;
}
/**
 * Merkle Tree Commitment Service
 *
 * Implements Merkle tree commitments for set membership proofs.
 * The root of the tree commits to all elements in the set.
 *
 * Features:
 * - Efficient O(log n) membership proofs
 * - Dynamic tree updates (add/remove elements)
 * - Sparse tree support for large sets
 *
 * @example
 * ```typescript
 * const merkle = new MerkleTreeService();
 *
 * // Build tree from elements
 * const { root, tree } = await merkle.buildTree(['alice', 'bob', 'charlie']);
 *
 * // Generate membership proof
 * const proof = merkle.generateProof(tree, 'bob');
 *
 * // Verify proof
 * const valid = await merkle.verifyProof(root, 'bob', proof);
 * ```
 */
export declare class MerkleTreeService {
    private readonly hashPrefix;
    constructor();
    /**
     * Build a Merkle tree from elements
     */
    buildTree(elements: string[]): Promise<{
        root: string;
        tree: MerkleTree;
        proofs: Map<string, MerkleProof>;
    }>;
    /**
     * Generate a membership proof for an element
     */
    generateProof(tree: MerkleTree, element: string): MerkleProof;
    /**
     * Verify a membership proof
     */
    verifyProof(root: string, element: string, proof: MerkleProof): Promise<boolean>;
    /**
     * Update a leaf in the tree
     */
    updateLeaf(tree: MerkleTree, oldElement: string, newElement: string): Promise<{
        newRoot: string;
        newTree: MerkleTree;
    }>;
    /**
     * Add an element to the tree
     */
    addElement(tree: MerkleTree, element: string): Promise<{
        newRoot: string;
        newTree: MerkleTree;
    }>;
    /**
     * Create a sparse Merkle tree with a default empty value
     */
    createSparseTree(depth: number): Promise<{
        root: string;
        emptyRoots: string[];
    }>;
    private generateProofInternal;
    private hashLeaf;
    private hashNode;
}
/**
 * Merkle tree structure
 */
export interface MerkleTree {
    /** Tree root */
    root: string;
    /** All levels of the tree */
    levels: string[][];
    /** Elements (padded) */
    elements: string[];
    /** Tree depth */
    depth: number;
}
/**
 * Cryptographic Accumulator Service
 *
 * Implements accumulator commitments for dynamic set membership.
 * Unlike Merkle trees, accumulators have constant-size proofs.
 *
 * Features:
 * - Constant-size membership proofs
 * - Efficient batch updates
 * - Non-membership proofs
 *
 * Note: This implementation uses hash-based simulation.
 * For production, use RSA or bilinear accumulator implementations.
 *
 * @example
 * ```typescript
 * const accumulator = new AccumulatorService();
 *
 * // Add elements
 * let state = await accumulator.initialize();
 * state = await accumulator.add(state, 'element1');
 *
 * // Generate witness
 * const witness = await accumulator.createWitness(state, 'element1');
 *
 * // Verify
 * const valid = await accumulator.verify(state.value, 'element1', witness);
 * ```
 */
export declare class AccumulatorService {
    private readonly accumulatorSeed;
    constructor();
    /**
     * Initialize a new accumulator
     */
    initialize(): Promise<AccumulatorState>;
    /**
     * Add an element to the accumulator
     */
    add(state: AccumulatorState, element: string): Promise<AccumulatorState>;
    /**
     * Remove an element from the accumulator
     */
    remove(state: AccumulatorState, element: string): Promise<AccumulatorState>;
    /**
     * Create a membership witness for an element
     */
    createWitness(state: AccumulatorState, element: string): Promise<AccumulatorWitness>;
    /**
     * Verify a membership witness
     */
    verify(accumulatorValue: string, element: string, witness: AccumulatorWitness): Promise<boolean>;
    /**
     * Batch add multiple elements
     */
    batchAdd(state: AccumulatorState, elements: string[]): Promise<AccumulatorState>;
    /**
     * Update a witness after accumulator changes
     */
    updateWitness(oldWitness: AccumulatorWitness, newState: AccumulatorState, addedElements: string[], removedElements: string[]): Promise<AccumulatorWitness>;
    private hash;
}
/**
 * Accumulator state
 */
export interface AccumulatorState {
    /** Current accumulator value */
    value: string;
    /** Elements in the accumulator */
    elements: Set<string>;
    /** Version number for updates */
    version: number;
}
/**
 * Accumulator membership witness
 */
export interface AccumulatorWitness {
    /** Element being proven */
    element: string;
    /** Witness value */
    witness: string;
    /** Accumulator value at time of witness creation */
    accumulatorValue: string;
    /** Version number */
    version: number;
}
/**
 * Simple Hash Commitment Service
 *
 * Implements basic hash-based commitments.
 * Computationally binding but not perfectly hiding.
 *
 * Commitment: C = H(value || nonce)
 *
 * @example
 * ```typescript
 * const hash = new HashCommitmentService();
 *
 * // Create commitment
 * const { commitment, nonce } = await hash.commit('secret');
 *
 * // Verify
 * const valid = await hash.verify(commitment, 'secret', nonce);
 * ```
 */
export declare class HashCommitmentService {
    constructor();
    /**
     * Create a hash commitment
     */
    commit(value: string): Promise<{
        commitment: Commitment;
        nonce: string;
    }>;
    /**
     * Verify a hash commitment opening
     */
    verify(commitment: Commitment, value: string, nonce: string): Promise<boolean>;
    /**
     * Create a time-locked commitment
     */
    commitWithExpiry(value: string, expiresAt: Date): Promise<{
        commitment: Commitment;
        nonce: string;
    }>;
    private hash;
    private generateNonce;
}
/**
 * Create commitment service for the specified scheme
 */
export declare function createCommitmentService(scheme: CommitmentScheme): PedersenCommitmentService | MerkleTreeService | AccumulatorService | HashCommitmentService;
//# sourceMappingURL=commitment.d.ts.map