UNPKG

@beraji/wallet-sdk

Version:

Beraji: Distributed Secret Sharing.

41 lines (40 loc) 1.56 kB
import { FiniteField } from './ff'; import { EdCurve } from './edtss'; import { ECCurve } from './ectss'; export type ExtractedShare = { index: Uint8Array; t: Uint8Array; n: Uint8Array; id: Uint8Array; share: Uint8Array; }; export declare class SecretSharing { readonly ff: FiniteField; constructor(ff: FiniteField); static shareLength: number; static extract: (share: Uint8Array) => ExtractedShare; static compress: ({ index, t, n, id, share }: ExtractedShare) => Uint8Array<ArrayBufferLike>; private validateShares; pi: (indice: Uint8Array[], index?: Uint8Array) => Uint8Array[]; yl: (y: Uint8Array, l: Uint8Array) => Uint8Array; ft1: (shares: Uint8Array[]) => Uint8Array; interpolate: (index: Uint8Array, shares: Uint8Array[]) => Uint8Array; construct: (shares: Uint8Array[]) => Uint8Array; share: (key: Uint8Array, t: number, n: number, { indice, id, ec, }?: { indice?: Uint8Array[]; id?: Uint8Array; ec?: typeof EdCurve | typeof ECCurve; }) => { shares: Uint8Array[]; zkp?: Uint8Array[]; }; proactivate: (t: number, n: number, indice: Uint8Array[], { id, ec, }?: { id?: Uint8Array; ec?: typeof EdCurve | typeof ECCurve; }) => { shares: Uint8Array[]; zkp?: Uint8Array[]; }; merge: (prev: Uint8Array, next: Uint8Array) => Uint8Array<ArrayBufferLike>; static verify: (z: Uint8Array, index: Uint8Array, pzkp: Uint8Array[], rzkp: Uint8Array[], ec: typeof EdCurve | typeof ECCurve) => boolean; }