Remove Keypair class
This commit is contained in:
parent
4da10180d9
commit
84c95ba069
|
@ -1,4 +1,3 @@
|
||||||
import {Keypair} from "./keypair";
|
|
||||||
import {PrivateKey} from "./privateKey";
|
import {PrivateKey} from "./privateKey";
|
||||||
import {PublicKey} from "./publicKey";
|
import {PublicKey} from "./publicKey";
|
||||||
import {Signature} from "./signature";
|
import {Signature} from "./signature";
|
||||||
|
@ -6,7 +5,7 @@ import {IBls} from "../interface";
|
||||||
export * from "../constants";
|
export * from "../constants";
|
||||||
import {functionalInterfaceFactory} from "../functional";
|
import {functionalInterfaceFactory} from "../functional";
|
||||||
|
|
||||||
export {Keypair, PrivateKey, PublicKey, Signature};
|
export {PrivateKey, PublicKey, Signature};
|
||||||
|
|
||||||
export async function initBLS(): Promise<void> {
|
export async function initBLS(): Promise<void> {
|
||||||
// Native bindings require no init() call
|
// Native bindings require no init() call
|
||||||
|
@ -16,7 +15,6 @@ export function destroy(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const bls: IBls = {
|
export const bls: IBls = {
|
||||||
// Keypair,
|
|
||||||
PrivateKey,
|
PrivateKey,
|
||||||
PublicKey,
|
PublicKey,
|
||||||
Signature,
|
Signature,
|
||||||
|
|
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {Keypair} from "./keypair";
|
|
||||||
import {PrivateKey} from "./privateKey";
|
import {PrivateKey} from "./privateKey";
|
||||||
import {PublicKey} from "./publicKey";
|
import {PublicKey} from "./publicKey";
|
||||||
import {Signature} from "./signature";
|
import {Signature} from "./signature";
|
||||||
|
@ -6,10 +5,9 @@ import {initBLS, destroy} from "./context";
|
||||||
import {IBls} from "../interface";
|
import {IBls} from "../interface";
|
||||||
import {functionalInterfaceFactory} from "../functional";
|
import {functionalInterfaceFactory} from "../functional";
|
||||||
|
|
||||||
export {Keypair, PrivateKey, PublicKey, Signature, initBLS, destroy};
|
export {PrivateKey, PublicKey, Signature, initBLS, destroy};
|
||||||
|
|
||||||
const bls: IBls = {
|
const bls: IBls = {
|
||||||
// Keypair,
|
|
||||||
PrivateKey,
|
PrivateKey,
|
||||||
PublicKey,
|
PublicKey,
|
||||||
Signature,
|
Signature,
|
||||||
|
|
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue