/// <reference types="node" />
/// <reference types="node" />
import * as crypto from '@shardeum-foundation/lib-crypto-utils';
import { ChildProcess, Serializable } from 'child_process';
import Log4js from 'log4js';
import Logger from '../logger';
import * as Shardus from '../shardus/shardus-types';
import Storage from '../storage';
export type HashableObject = (object | string) & {
    sign?: Shardus.Sign;
};
interface Keypair {
    publicKey?: crypto.publicKey;
    secretKey?: crypto.secretKey;
}
interface Crypto {
    baseDir: string;
    config: Shardus.StrictServerConfiguration;
    mainLogger: Log4js.Logger;
    storage: Storage;
    keypair: Keypair;
    curveKeypair: {
        publicKey?: crypto.curvePublicKey;
        secretKey?: crypto.curveSecretKey;
    };
    powGenerators: {
        [name: string]: ChildProcess;
    };
    sharedKeys: {
        [name: string]: Buffer;
    };
}
declare class Crypto {
    constructor(baseDir: string, config: Shardus.StrictServerConfiguration, logger: Logger, storage: Storage);
    init(): Promise<void>;
    setCurveKeyPair(keypair: Keypair): void;
    getKeyPairFile(): string;
    writeKeypairToFile(keypair: Keypair): void;
    readKeypairFromFile(): crypto.Keypair;
    _generateKeypair(): crypto.Keypair;
    convertPublicKeyToCurve(pk: crypto.publicKey): string;
    getPublicKey(): string;
    getCurvePublicKey(): string;
    getSharedKey(curvePk: crypto.curvePublicKey): Buffer;
    tag<T>(obj: T, recipientCurvePk: crypto.curvePublicKey): T & crypto.TaggedObject;
    /**
     * Measure the message size when we are making the object copy (because it is pretty much free)
     * then add msgSize to the object
     * relies on node honesty.. better (but more work) to implement at shardus_net level
     *    to implement at shardus_net level we need to have it send us an extra argument to show
     *    the message size
     * @param obj
     * @param recipientCurvePk
     * @returns
     */
    tagWithSize<T>(obj: T, recipientCurvePk: crypto.curvePublicKey): T & {
        msgSize: number;
    } & crypto.TaggedObject;
    signWithSize<T>(obj: T): T & crypto.SignedObject;
    authenticate(obj: crypto.TaggedObject, senderCurvePk: crypto.curvePublicKey): boolean;
    sign<T>(obj: T): T & crypto.SignedObject;
    verify(obj: crypto.SignedObject, expectedPk?: string): boolean;
    hash(obj: HashableObject): string;
    isGreaterHash(hash1: string | number, hash2: string | number): boolean;
    getComputeProofOfWork(seed: unknown, difficulty: number): Promise<Serializable>;
    stopAllGenerators(): void;
    _runProofOfWorkGenerator(generator: string, seed: unknown, difficulty: number): Promise<Serializable>;
    _stopProofOfWorkGenerator(generator: string): Promise<number | string>;
}
export default Crypto;
