/// <reference types="node" />
import { Point, Scalar } from "@dedis/kyber";
import { Message, Properties } from "protobufjs/light";
import { Instruction } from "../byzcoin";
import ByzCoinRPC from "../byzcoin/byzcoin-rpc";
import CoinInstance, { Coin } from "../byzcoin/contracts/coin-instance";
import Instance, { InstanceID } from "../byzcoin/instance";
import Signer from "../darc/signer";
import { OnChainSecretRPC } from "./calypso-rpc";
export declare class OnChainSecretInstance extends Instance {
    private rpc;
    static readonly contractID = "longTermSecret";
    /**
     * Spawn a longTermSecret instance
     *
     * @param bc        The RPC to use
     * @param darcID    The darc instance ID
     * @param signers   The list of signers for the transaction
     * @param write The write structure containing the encrypted secret
     * @returns a promise that resolves with the new instance
     */
    static spawn(bc: ByzCoinRPC, darcID: InstanceID, signers: Signer[]): Promise<OnChainSecretInstance>;
    /**
     * Initializes using an existing coinInstance from ByzCoin
     * @param bc    The RPC to use
     * @param iid   The instance ID
     * @param waitMatch how many times to wait for a match - useful if its called just after an addTransactionAndWait.
     * @param interval how long to wait between two attempts in waitMatch.
     * @returns a promise that resolves with the OnChainSecret instance
     */
    static fromByzcoin(bc: ByzCoinRPC, iid: InstanceID, waitMatch?: number, interval?: number): Promise<OnChainSecretInstance>;
    write: Write;
    constructor(rpc: ByzCoinRPC, inst: Instance);
}
export declare class CalypsoWriteInstance extends Instance {
    private rpc;
    static readonly contractID = "calypsoWrite";
    static readonly commandUpdate = "update";
    static readonly argumentWrite = "write";
    static readonly argumentDarcID = "darcID";
    static readonly argumentPreID = "preID";
    static readonly argumentData = "data";
    static readonly argumentExtraData = "extraData";
    /**
     * Spawn a calypsoWrite instance
     *
     * @param bc        The RPC to use
     * @param darcID    The darc instance ID
     * @param write The write structure containing the encrypted secret
     * @param signers   The list of signers for the transaction
     * @param preID used to calculate the ID of the write instance
     * @returns a promise that resolves with the new instance
     */
    static spawn(bc: ByzCoinRPC, darcID: InstanceID, write: Write, signers: Signer[], preID?: Buffer): Promise<CalypsoWriteInstance>;
    /**
     * Initializes using an existing coinInstance from ByzCoin
     * @param bc    The RPC to use
     * @param iid   The instance ID
     * @returns a promise that resolves with the coin instance
     */
    static fromByzcoin(bc: ByzCoinRPC, iid: InstanceID, waitMatch?: number, interval?: number): Promise<CalypsoWriteInstance>;
    /**
     * Returns the instanceID given a preID.
     * @param preID
     */
    static preToInstID(preID: Buffer): InstanceID;
    write: Write;
    constructor(rpc: ByzCoinRPC, inst: Instance);
    spawnRead(pub: Point, signers: Signer[], coin?: CoinInstance, coinSigners?: Signer[], preID?: Buffer): Promise<CalypsoReadInstance>;
    /**
     * Update sends an update command to an existing CalypsoWriteInstance and changes the data and/or the extraData
     * field of the Write structure. If neither data, nor extraData is given, it returns without sending a
     * transaction to byzcoin.
     * @param u a structure holding the data and/or extraData to be updated.
     */
    update(u: {
        data?: Buffer;
        extraData?: Buffer;
    }): Promise<import("../byzcoin/proto/requests").AddTxResponse>;
}
export declare class CalypsoReadInstance extends Instance {
    private rpc;
    static readonly contractID = "calypsoRead";
    static readonly argumentRead = "read";
    static readonly argumentPreID = "preID";
    static spawn(bc: ByzCoinRPC, writeId: InstanceID, pub: Point, signers: Signer[], pay?: Instruction, preID?: Buffer): Promise<CalypsoReadInstance>;
    /**
     * Initializes using an existing CalypsoReadInstance from ByzCoin
     * @param bc    The RPC to use
     * @param iid   The instance ID
     * @returns a promise that resolves with the coin instance
     */
    static fromByzcoin(bc: ByzCoinRPC, iid: InstanceID, waitMatch?: number, interval?: number): Promise<CalypsoReadInstance>;
    /**
     * Returns the instanceID given a preID.
     * @param preID
     */
    static preToInstID(preID: Buffer): InstanceID;
    read: Read;
    constructor(rpc: ByzCoinRPC, inst: Instance);
    decrypt(ocs: OnChainSecretRPC, priv: Scalar): Promise<Buffer>;
}
export declare class Write extends Message<Write> {
    /**
     * @see README#Message classes
     */
    static register(): void;
    /**
     * createWrite returns a new write structure that contains a proof for the read-request
     * with regard to the LTS-ID and the write-Darc.
     *
     * @param ltsid the long-term-secret ID that can re-encrypt the key
     * @param writeDarc allowed to ask for a re-encryption
     * @param X the aggregate public key under which the symmetric key will be encrypted
     * @param key the symmetric key to be encrypted
     */
    static createWrite(ltsid: InstanceID, writeDarc: InstanceID, X: Point, key: Buffer, rand?: (length: number) => Buffer): Write;
    data: Buffer;
    u: Buffer;
    ubar: Buffer;
    e: Buffer;
    f: Buffer;
    c: Buffer;
    extradata: Buffer;
    ltsid: InstanceID;
    cost: Coin;
    constructor(props?: Properties<Write>);
    toBytes(): Buffer;
}
export declare class Read extends Message<Read> {
    /**
     * @see README#Message classes
     */
    static register(): void;
    write: Buffer;
    xc: Buffer;
    constructor(props?: Properties<Read>);
    toBytes(): Buffer;
}
export declare function DecodeKey(X: Point, C: Point, XhatEnc: Point, priv: Scalar): Promise<Buffer>;
