/// import { Hash } from 'crypto'; import { Secp256k1Curve } from '../../curves'; import Shamir from '../../shamir'; import { NShare, PShare, KeyShare, KeyCombined, Signature, SignConvertRT, SignConvert, SignCombine, SignCombineRT, DShare, OShare, SShare, SignShareRT, XShare, YShare } from './types'; /** * ECDSA TSS implementation supporting 2:n Threshold */ export default class Ecdsa { static curve: Secp256k1Curve; static shamir: Shamir; /** * Generate shares for participant at index and split keys `(threshold,numShares)` ways. * @param {number} index participant index * @param {number} threshold Signing threshold * @param {number} numShares Number of shares * @param {Buffer} seed optional seed to use for key generation * @returns {Promise} Returns the private p-share * and n-shares to be distributed to participants at their corresponding index. */ keyShare(index: number, threshold: number, numShares: number, seed?: Buffer): Promise; /** * Combine data shared during the key generation protocol. * @param {KeyShare} participantShares private p-share and * n-shares received from all other participants. * @returns {KeyCombined} Returns the participant private x-share * and y-shares to be used when generating signing shares. */ keyCombine(pShare: PShare, nShares: NShare[]): KeyCombined; /** * Create signing shares. * @param {xShare} xShare Private xShare of current participant signer * @param {YShare} yShare yShare corresponding to the other participant signer * @returns {SignShareRT} Returns the participant private w-share * and k-share to be distributed to other participant signer */ signShare(xShare: XShare, yShare: YShare): SignShareRT; /** * Perform multiplicitive-to-additive (MtA) share conversion with another * signer. * @param {SignConvert} * @returns {SignConvertRT} */ signConvert(shares: SignConvert): SignConvertRT; /** * Combine gamma shares to get the private omicron / delta shares * @param {SignCombine} shares * @returns {SignCombineRT} */ signCombine(shares: SignCombine): SignCombineRT; /** * Sign a message. * @param {Buffer} M Message to be signed * @param {OShare} oShare private omicron share of current participant * @param {DShare} dShare delta share received from the other participant * @param {Hash} hash hashing algorithm implementing Node`s standard crypto hash interface * @returns {SShare} */ sign(M: Buffer, oShare: OShare, dShare: DShare, hash?: Hash): SShare; /** * Construct full signature by combining Sign Shares * @param {SShare[]} shares * @returns {Signature} */ constructSignature(shares: SShare[]): Signature; /** * Verify ecdsa signatures * @param {Buffer} message * @param {Signature } signature * @param {Hash} hash hashing algorithm implementing Node`s standard crypto hash interface * @returns {boolean} True if signature is valid; False otherwise */ verify(message: Buffer, signature: Signature, hash?: Hash): boolean; } //# sourceMappingURL=ecdsa.d.ts.map