Export class interfaces too

This commit is contained in:
dapplion 2020-11-30 11:43:47 +00:00
parent 0a3f6f5659
commit 9b7e5f5f95
1 changed files with 30 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import {IBls} from "./interface";
import {IBls, IPrivateKey, IPublicKey, ISignature} from "./interface";
import {bls as blsHerumi} from "./herumi";
export type Implementation = "herumi" | "blst-native";
@ -7,6 +7,7 @@ export * from "./interface";
// TODO: Use a Proxy for example to throw an error if it's not initialized yet
export const bls: IBls = {} as IBls;
export default bls;
async function getImplementation(impl: Implementation = "herumi"): Promise<IBls> {
switch (impl) {
@ -43,8 +44,32 @@ export declare let aggregatePubkeys: IBls["aggregatePubkeys"];
export declare let verify: IBls["verify"];
export declare let verifyAggregate: IBls["verifyAggregate"];
export declare let verifyMultiple: IBls["verifyMultiple"];
export declare let PrivateKey: IBls["PrivateKey"];
export declare let PublicKey: IBls["PublicKey"];
export declare let Signature: IBls["Signature"];
export default bls;
export declare class PrivateKey implements IPrivateKey {
static fromBytes(bytes: Uint8Array): PrivateKey;
static fromHex(hex: string): PrivateKey;
static fromKeygen(entropy?: Uint8Array): PrivateKey;
sign(message: Uint8Array): Signature;
toPublicKey(): PublicKey;
toBytes(): Uint8Array;
toHex(): string;
}
export declare class PublicKey implements IPublicKey {
static fromBytes(bytes: Uint8Array): PublicKey;
static fromHex(hex: string): PublicKey;
static aggregate(pubkeys: PublicKey[]): PublicKey;
toBytes(): Uint8Array;
toHex(): string;
}
export declare class Signature implements ISignature {
static fromBytes(bytes: Uint8Array): Signature;
static fromHex(hex: string): Signature;
static aggregate(signatures: Signature[]): Signature;
verify(publicKey: PublicKey, message: Uint8Array): boolean;
verifyAggregate(publicKeys: PublicKey[], message: Uint8Array): boolean;
verifyMultiple(publicKeys: PublicKey[], messages: Uint8Array[]): boolean;
toBytes(): Uint8Array;
toHex(): string;
}