UNPKG

@runonflux/aa-schnorr-multisig-sdk

Version:

Account Abstraction Schnorr Multi-Signatures SDK

119 lines (118 loc) 3.96 kB
import { Key } from "../types"; import { SchnorrSigner } from "../signers"; import type { SchnorrSignature } from "../types"; import type { Hex } from "../types/misc"; /** * Creates new Schnorr Signer from given private key. * @param privKey private key hexadecimal value * @returns Schnorr Signer */ export declare function createSchnorrSigner(privKey: Hex): SchnorrSigner; /** * Creates the summed signature from all given Schnorr signatures. * @param signatures array of Schnorr signatures * @returns summed signature */ export declare function sumSchnorrSigs(signatures: SchnorrSignature[]): SchnorrSignature; /** * Creates an array of possible combinations. Optionally limited by given X (out of Y). * * @param arr array of any given objects (array length = Y) * @param x minimum combination length for X of Y (default = 1) * @returns all possible combinations limited by given x * * @example * X of Y array defined as [A, B, C] * 3 of 3: [ABC] * 2 of 3: [AB, AC, BC, ABC] * 1 of 3: [A, B, C, AB, AC, BC, ABC] * */ export declare function getAllCombos(arr: any[], x?: number): any[]; /** * Generates combined public address out of all given Schnorr signers' addresses. * * @param signers array of Schnorr signers * @returns combined address */ export declare function getCombinedAddrFromSigners(signers: SchnorrSigner[]): string; /** * Generates combined public address out of all given Schnorr signers' public keys. * * @param pubKeys array of signers' public keys * @returns combined address */ export declare function getCombinedAddrFromKeys(pubKeys: Key[]): Hex; /** * generate single signature data * can be used only if 1 single is defined for Schnorr signature */ /** * Generates a single signature data for single Schnorr signer. * * @param signer Schnorr signer which signs the message * @param msg message to be signed * @returns sigData and msgHash */ export declare function generateSingleSigDataAndHash(signer: SchnorrSigner, msg: string): { sigData: string; msgHash: string; }; /** * Creates an array of possible Schnorr combined addresses from signers. * Optionally limited by given X (out of Y) * * @param signers array of Schnorr signers * @param x minimum combination length for X of Y (default = 1) * @returns * * @example * X of Y array defined as [A, B, C] * 3 of 3: [ABC] * 2 of 3: [AB, AC, BC, ABC] * 1 of 3: [A, B, C, AB, AC, BC, ABC] */ export declare function getAllCombinedAddrFromSigners(signers: SchnorrSigner[], x?: number): string[]; /** * Creates an array of possible Schnorr combined addresses from public keys. * Optionally limited by given X (out of Y). * * @param signers array of Schnorr signers * @param x minimum combination length for X of Y (default = 1) * @returns * * @example * X of Y array defined as [A, B, C] * 3 of 3: [ABC] * 2 of 3: [AB, AC, BC, ABC] * 1 of 3: [A, B, C, AB, AC, BC, ABC] */ export declare function getAllCombinedAddrFromKeys(pubKeys: Key[], x?: number): Hex[]; /** * Creates an array of possible Schnorr combined public keys from signers. * Optionally limited by given X (out of Y). * * @param signers array of Schnorr signers * @param x minimum combination length for X of Y (default = 1) * @returns * * @example * X of Y array defined as [A, B, C] * 3 of 3: [ABC] * 2 of 3: [AB, AC, BC, ABC] * 1 of 3: [A, B, C, AB, AC, BC, ABC] */ export declare function getAllCombinedPubKeysFromSigners(signers: SchnorrSigner[], x?: number): Key[]; /** * Generates a single signature data for multiple Schnorr signer. * * @WARNING FOR TESTING PURPOSE ONLY! * @dev it's not possible to sign msg by every signer at once within single function * @param signer Schnorr signer which signs the message * @param msg message to be signed * @returns sigData and msgHash */ export declare function generateCombinedSigDataAndHash(signers: SchnorrSigner[], msg: string): { sigData: string; msgHash: string; };