Remove Keypair class

This commit is contained in:
dapplion 2020-11-25 10:45:19 +00:00
parent 4da10180d9
commit 84c95ba069
4 changed files with 2 additions and 66 deletions

View File

@ -1,4 +1,3 @@
import {Keypair} from "./keypair";
import {PrivateKey} from "./privateKey";
import {PublicKey} from "./publicKey";
import {Signature} from "./signature";
@ -6,7 +5,7 @@ import {IBls} from "../interface";
export * from "../constants";
import {functionalInterfaceFactory} from "../functional";
export {Keypair, PrivateKey, PublicKey, Signature};
export {PrivateKey, PublicKey, Signature};
export async function initBLS(): Promise<void> {
// Native bindings require no init() call
@ -16,7 +15,6 @@ export function destroy(): void {
}
export const bls: IBls = {
// Keypair,
PrivateKey,
PublicKey,
Signature,

View File

@ -1,30 +0,0 @@
import {PublicKey} from "./publicKey";
import {PrivateKey} from "./privateKey";
import {IKeypair} from "../interface";
export class Keypair implements IKeypair {
private readonly _publicKey: PublicKey;
private readonly _privateKey: PrivateKey;
public constructor(privateKey: PrivateKey, publicKey?: PublicKey) {
this._privateKey = privateKey;
if (!publicKey) {
this._publicKey = privateKey.toPublicKey();
} else {
this._publicKey = publicKey;
}
}
public get publicKey(): PublicKey {
return this._publicKey;
}
public get privateKey(): PrivateKey {
return this._privateKey;
}
public static generate(): Keypair {
return new Keypair(PrivateKey.fromKeygen());
}
}

View File

@ -1,4 +1,3 @@
import {Keypair} from "./keypair";
import {PrivateKey} from "./privateKey";
import {PublicKey} from "./publicKey";
import {Signature} from "./signature";
@ -6,10 +5,9 @@ import {initBLS, destroy} from "./context";
import {IBls} from "../interface";
import {functionalInterfaceFactory} from "../functional";
export {Keypair, PrivateKey, PublicKey, Signature, initBLS, destroy};
export {PrivateKey, PublicKey, Signature, initBLS, destroy};
const bls: IBls = {
// Keypair,
PrivateKey,
PublicKey,
Signature,

View File

@ -1,30 +0,0 @@
import {PublicKey} from "./publicKey";
import {PrivateKey} from "./privateKey";
import {IKeypair} from "../interface";
export class Keypair implements IKeypair {
private readonly _publicKey: PublicKey;
private readonly _privateKey: PrivateKey;
public constructor(privateKey: PrivateKey, publicKey?: PublicKey) {
this._privateKey = privateKey;
if (!publicKey) {
this._publicKey = privateKey.toPublicKey();
} else {
this._publicKey = publicKey;
}
}
public get publicKey(): PublicKey {
return this._publicKey;
}
public get privateKey(): PrivateKey {
return this._privateKey;
}
public static generate(): Keypair {
return new Keypair(PrivateKey.fromKeygen());
}
}